mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
chore - push workaround and a lint rule for https://github.com/evanw/esbuild/issues/3823 (#220077)
* chore - push workaround and a lint rule for https://github.com/evanw/esbuild/issues/3823 * modernize `tsconfig.monaco`
This commit is contained in:
56
.eslintplugin/code-no-static-self-ref.ts
Normal file
56
.eslintplugin/code-no-static-self-ref.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||
|
||||
/**
|
||||
* WORKAROUND for https://github.com/evanw/esbuild/issues/3823
|
||||
*/
|
||||
export = new class implements eslint.Rule.RuleModule {
|
||||
|
||||
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
|
||||
|
||||
function checkProperty(inNode: any) {
|
||||
|
||||
const classDeclaration = context.getAncestors().find(node => node.type === 'ClassDeclaration');
|
||||
const propertyDefinition = <TSESTree.PropertyDefinition>inNode;
|
||||
|
||||
if (!classDeclaration || !classDeclaration.id?.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!propertyDefinition.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const classCtor = classDeclaration.body.body.find(node => node.type === 'MethodDefinition' && node.kind === 'constructor')
|
||||
|
||||
if (!classCtor) {
|
||||
return;
|
||||
}
|
||||
|
||||
const name = classDeclaration.id.name;
|
||||
const valueText = context.getSourceCode().getText(<any>propertyDefinition.value)
|
||||
|
||||
if (valueText.includes(name + '.')) {
|
||||
|
||||
if (classCtor.value?.type === 'FunctionExpression' && !classCtor.value.params.find((param: any) => param.type === 'TSParameterProperty' && param.decorators?.length > 0)) {
|
||||
return
|
||||
}
|
||||
|
||||
context.report({
|
||||
loc: propertyDefinition.value.loc,
|
||||
message: `Static properties in decorated classes should not reference the class they are defined in. Use 'this' instead. This is a workaround for https://github.com/evanw/esbuild/issues/3823.`
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
'PropertyDefinition[static=true]': checkProperty,
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -141,6 +141,14 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"rules": {
|
||||
"local/code-no-static-self-ref": "warn"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"src/vs/**/*.test.ts"
|
||||
@@ -1090,7 +1098,9 @@
|
||||
"local/code-no-runtime-import": [
|
||||
"error",
|
||||
{
|
||||
"src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts": ["**/*"]
|
||||
"src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts": [
|
||||
"**/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"moduleResolution": "classic",
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"target": "es2018",
|
||||
"target": "ES2022",
|
||||
"sourceMap": false,
|
||||
"declaration": true
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
export class OverviewRulerFeature extends Disposable {
|
||||
private static readonly ONE_OVERVIEW_WIDTH = 15;
|
||||
public static readonly ENTIRE_DIFF_OVERVIEW_WIDTH = OverviewRulerFeature.ONE_OVERVIEW_WIDTH * 2;
|
||||
public static readonly ENTIRE_DIFF_OVERVIEW_WIDTH = this.ONE_OVERVIEW_WIDTH * 2;
|
||||
public readonly width = OverviewRulerFeature.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -35,11 +35,11 @@ export class InlineEditController extends Disposable {
|
||||
static ID = 'editor.contrib.inlineEditController';
|
||||
|
||||
public static readonly inlineEditVisibleKey = 'inlineEditVisible';
|
||||
public static readonly inlineEditVisibleContext = new RawContextKey<boolean>(InlineEditController.inlineEditVisibleKey, false);
|
||||
public static readonly inlineEditVisibleContext = new RawContextKey<boolean>(this.inlineEditVisibleKey, false);
|
||||
private _isVisibleContext = InlineEditController.inlineEditVisibleContext.bindTo(this.contextKeyService);
|
||||
|
||||
public static readonly cursorAtInlineEditKey = 'cursorAtInlineEdit';
|
||||
public static readonly cursorAtInlineEditContext = new RawContextKey<boolean>(InlineEditController.cursorAtInlineEditKey, false);
|
||||
public static readonly cursorAtInlineEditContext = new RawContextKey<boolean>(this.cursorAtInlineEditKey, false);
|
||||
private _isCursorAtInlineEditContext = InlineEditController.cursorAtInlineEditContext.bindTo(this.contextKeyService);
|
||||
|
||||
public static get(editor: ICodeEditor): InlineEditController | null {
|
||||
|
||||
@@ -48,7 +48,7 @@ export abstract class AbstractGotoSymbolQuickAccessProvider extends AbstractEdit
|
||||
|
||||
static PREFIX = '@';
|
||||
static SCOPE_PREFIX = ':';
|
||||
static PREFIX_BY_CATEGORY = `${AbstractGotoSymbolQuickAccessProvider.PREFIX}${AbstractGotoSymbolQuickAccessProvider.SCOPE_PREFIX}`;
|
||||
static PREFIX_BY_CATEGORY = `${this.PREFIX}${this.SCOPE_PREFIX}`;
|
||||
|
||||
protected override readonly options: IGotoSymbolQuickAccessProviderOptions;
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
private static _idPool: number = 0;
|
||||
private static readonly _maxDiagnosticsPerFile: number = 1000;
|
||||
private static readonly _maxDiagnosticsTotal: number = 1.1 * ExtHostDiagnostics._maxDiagnosticsPerFile;
|
||||
private static readonly _maxDiagnosticsTotal: number = 1.1 * this._maxDiagnosticsPerFile;
|
||||
|
||||
private readonly _proxy: MainThreadDiagnosticsShape;
|
||||
private readonly _collections = new Map<string, DiagnosticCollection>();
|
||||
|
||||
@@ -185,7 +185,7 @@ export class WorkspaceTrustRequiredPlaceholderEditor extends EditorPlaceholder {
|
||||
static readonly ID = 'workbench.editors.workspaceTrustRequiredEditor';
|
||||
private static readonly LABEL = localize('trustRequiredEditor', "Workspace Trust Required");
|
||||
|
||||
static readonly DESCRIPTOR = EditorPaneDescriptor.create(WorkspaceTrustRequiredPlaceholderEditor, WorkspaceTrustRequiredPlaceholderEditor.ID, WorkspaceTrustRequiredPlaceholderEditor.LABEL);
|
||||
static readonly DESCRIPTOR = EditorPaneDescriptor.create(WorkspaceTrustRequiredPlaceholderEditor, this.ID, this.LABEL);
|
||||
|
||||
constructor(
|
||||
group: IEditorGroup,
|
||||
@@ -223,7 +223,7 @@ export class ErrorPlaceholderEditor extends EditorPlaceholder {
|
||||
private static readonly ID = 'workbench.editors.errorEditor';
|
||||
private static readonly LABEL = localize('errorEditor', "Error Editor");
|
||||
|
||||
static readonly DESCRIPTOR = EditorPaneDescriptor.create(ErrorPlaceholderEditor, ErrorPlaceholderEditor.ID, ErrorPlaceholderEditor.LABEL);
|
||||
static readonly DESCRIPTOR = EditorPaneDescriptor.create(ErrorPlaceholderEditor, this.ID, this.LABEL);
|
||||
|
||||
constructor(
|
||||
group: IEditorGroup,
|
||||
|
||||
@@ -55,7 +55,7 @@ export class NotificationsToasts extends Themable implements INotificationsToast
|
||||
// Count for the number of notifications over 800ms...
|
||||
interval: 800,
|
||||
// ...and ensure we are not showing more than MAX_NOTIFICATIONS
|
||||
limit: NotificationsToasts.MAX_NOTIFICATIONS
|
||||
limit: this.MAX_NOTIFICATIONS
|
||||
};
|
||||
|
||||
private readonly _onDidChangeVisibility = this._register(new Emitter<void>());
|
||||
|
||||
@@ -56,7 +56,7 @@ export class BulkEditPane extends ViewPane {
|
||||
static readonly ctxGroupByFile = new RawContextKey('refactorPreview.groupByFile', true);
|
||||
static readonly ctxHasCheckedChanges = new RawContextKey('refactorPreview.hasCheckedChanges', true);
|
||||
|
||||
private static readonly _memGroupByFile = `${BulkEditPane.ID}.groupByFile`;
|
||||
private static readonly _memGroupByFile = `${this.ID}.groupByFile`;
|
||||
|
||||
private _tree!: WorkbenchAsyncDataTree<BulkFileOperations, BulkEditElement, FuzzyScore>;
|
||||
private _treeDataSource!: BulkEditDataSource;
|
||||
|
||||
@@ -353,7 +353,7 @@ export class BulkEditPreviewProvider implements ITextModelContentProvider {
|
||||
|
||||
private static readonly Schema = 'vscode-bulkeditpreview-editor';
|
||||
|
||||
static emptyPreview = URI.from({ scheme: BulkEditPreviewProvider.Schema, fragment: 'empty' });
|
||||
static emptyPreview = URI.from({ scheme: this.Schema, fragment: 'empty' });
|
||||
|
||||
|
||||
static fromPreviewUri(uri: URI): URI {
|
||||
|
||||
@@ -70,13 +70,13 @@ export class VoiceChatService extends Disposable implements IVoiceChatService {
|
||||
private static readonly COMMAND_PREFIX = chatSubcommandLeader;
|
||||
|
||||
private static readonly PHRASES_LOWER = {
|
||||
[VoiceChatService.AGENT_PREFIX]: 'at',
|
||||
[VoiceChatService.COMMAND_PREFIX]: 'slash'
|
||||
[this.AGENT_PREFIX]: 'at',
|
||||
[this.COMMAND_PREFIX]: 'slash'
|
||||
};
|
||||
|
||||
private static readonly PHRASES_UPPER = {
|
||||
[VoiceChatService.AGENT_PREFIX]: 'At',
|
||||
[VoiceChatService.COMMAND_PREFIX]: 'Slash'
|
||||
[this.AGENT_PREFIX]: 'At',
|
||||
[this.COMMAND_PREFIX]: 'Slash'
|
||||
};
|
||||
|
||||
private static readonly CHAT_AGENT_ALIAS = new Map<string, string>([['vscode', 'code']]);
|
||||
|
||||
@@ -366,8 +366,8 @@ export class ButtonWithDropdownExtensionActionViewItem extends ActionWithDropdow
|
||||
|
||||
export class InstallAction extends ExtensionAction {
|
||||
|
||||
static readonly CLASS = `${ExtensionAction.LABEL_ACTION_CLASS} prominent install`;
|
||||
private static readonly HIDE = `${InstallAction.CLASS} hide`;
|
||||
static readonly CLASS = `${this.LABEL_ACTION_CLASS} prominent install`;
|
||||
private static readonly HIDE = `${this.CLASS} hide`;
|
||||
|
||||
protected _manifest: IExtensionManifest | null = null;
|
||||
set manifest(manifest: IExtensionManifest | null) {
|
||||
@@ -862,8 +862,8 @@ export class UninstallAction extends ExtensionAction {
|
||||
|
||||
abstract class AbstractUpdateAction extends ExtensionAction {
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} prominent update`;
|
||||
private static readonly DisabledClass = `${AbstractUpdateAction.EnabledClass} disabled`;
|
||||
private static readonly EnabledClass = `${this.LABEL_ACTION_CLASS} prominent update`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
private readonly updateThrottler = new Throttler();
|
||||
|
||||
@@ -940,7 +940,7 @@ export class ToggleAutoUpdateForExtensionAction extends ExtensionAction {
|
||||
static readonly LABEL = localize2('enableAutoUpdateLabel', "Auto Update");
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.EXTENSION_ACTION_CLASS} auto-update`;
|
||||
private static readonly DisabledClass = `${ToggleAutoUpdateForExtensionAction.EnabledClass} hide`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} hide`;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@@ -1023,7 +1023,7 @@ export class ToggleAutoUpdatesForPublisherAction extends ExtensionAction {
|
||||
export class MigrateDeprecatedExtensionAction extends ExtensionAction {
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} migrate`;
|
||||
private static readonly DisabledClass = `${MigrateDeprecatedExtensionAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
private readonly small: boolean,
|
||||
@@ -1213,7 +1213,7 @@ export class ManageExtensionAction extends DropDownExtensionAction {
|
||||
static readonly ID = 'extensions.manage';
|
||||
|
||||
private static readonly Class = `${ExtensionAction.ICON_ACTION_CLASS} manage ` + ThemeIcon.asClassName(manageExtensionIcon);
|
||||
private static readonly HideManageExtensionClass = `${ManageExtensionAction.Class} hide`;
|
||||
private static readonly HideManageExtensionClass = `${this.Class} hide`;
|
||||
|
||||
constructor(
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@@ -1370,7 +1370,7 @@ export class TogglePreReleaseExtensionAction extends ExtensionAction {
|
||||
static readonly LABEL = localize('togglePreRleaseLabel', "Pre-Release");
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} pre-release`;
|
||||
private static readonly DisabledClass = `${TogglePreReleaseExtensionAction.EnabledClass} hide`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} hide`;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@@ -1653,7 +1653,7 @@ export class DisableDropDownAction extends ButtonWithDropDownExtensionAction {
|
||||
export class ExtensionRuntimeStateAction extends ExtensionAction {
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} reload`;
|
||||
private static readonly DisabledClass = `${ExtensionRuntimeStateAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
|
||||
@@ -1767,7 +1767,7 @@ export class SetColorThemeAction extends ExtensionAction {
|
||||
static readonly TITLE = localize2('workbench.extensions.action.setColorTheme', 'Set Color Theme');
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
|
||||
private static readonly DisabledClass = `${SetColorThemeAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@@ -1818,7 +1818,7 @@ export class SetFileIconThemeAction extends ExtensionAction {
|
||||
static readonly TITLE = localize2('workbench.extensions.action.setFileIconTheme', 'Set File Icon Theme');
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
|
||||
private static readonly DisabledClass = `${SetFileIconThemeAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@@ -1868,7 +1868,7 @@ export class SetProductIconThemeAction extends ExtensionAction {
|
||||
static readonly TITLE = localize2('workbench.extensions.action.setProductIconTheme', 'Set Product Icon Theme');
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
|
||||
private static readonly DisabledClass = `${SetProductIconThemeAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@@ -1919,7 +1919,7 @@ export class SetLanguageAction extends ExtensionAction {
|
||||
static readonly TITLE = localize2('workbench.extensions.action.setDisplayLanguage', 'Set Display Language');
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} language`;
|
||||
private static readonly DisabledClass = `${SetLanguageAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@@ -1955,7 +1955,7 @@ export class ClearLanguageAction extends ExtensionAction {
|
||||
static readonly TITLE = localize2('workbench.extensions.action.clearLanguage', 'Clear Display Language');
|
||||
|
||||
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} language`;
|
||||
private static readonly DisabledClass = `${ClearLanguageAction.EnabledClass} disabled`;
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@@ -2267,7 +2267,7 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
|
||||
export class ExtensionStatusLabelAction extends Action implements IExtensionContainer {
|
||||
|
||||
private static readonly ENABLED_CLASS = `${ExtensionAction.TEXT_ACTION_CLASS} extension-status-label`;
|
||||
private static readonly DISABLED_CLASS = `${ExtensionStatusLabelAction.ENABLED_CLASS} hide`;
|
||||
private static readonly DISABLED_CLASS = `${this.ENABLED_CLASS} hide`;
|
||||
|
||||
private initialStatus: ExtensionState | null = null;
|
||||
private status: ExtensionState | null = null;
|
||||
@@ -2370,7 +2370,7 @@ export class ExtensionStatusLabelAction extends Action implements IExtensionCont
|
||||
export class ToggleSyncExtensionAction extends DropDownExtensionAction {
|
||||
|
||||
private static readonly IGNORED_SYNC_CLASS = `${ExtensionAction.ICON_ACTION_CLASS} extension-sync ${ThemeIcon.asClassName(syncIgnoredIcon)}`;
|
||||
private static readonly SYNC_CLASS = `${ToggleSyncExtensionAction.ICON_ACTION_CLASS} extension-sync ${ThemeIcon.asClassName(syncEnabledIcon)}`;
|
||||
private static readonly SYNC_CLASS = `${this.ICON_ACTION_CLASS} extension-sync ${ThemeIcon.asClassName(syncEnabledIcon)}`;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
|
||||
@@ -109,7 +109,7 @@ export class SettingsEditor2 extends EditorPane {
|
||||
private static TOC_RESET_WIDTH: number = 200;
|
||||
private static EDITOR_MIN_WIDTH: number = 500;
|
||||
// Below NARROW_TOTAL_WIDTH, we only render the editor rather than the ToC.
|
||||
private static NARROW_TOTAL_WIDTH: number = SettingsEditor2.TOC_RESET_WIDTH + SettingsEditor2.EDITOR_MIN_WIDTH;
|
||||
private static NARROW_TOTAL_WIDTH: number = this.TOC_RESET_WIDTH + this.EDITOR_MIN_WIDTH;
|
||||
|
||||
private static SUGGESTIONS: string[] = [
|
||||
`@${MODIFIED_SETTING_TAG}`,
|
||||
|
||||
@@ -750,9 +750,9 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
|
||||
abstract get templateId(): string;
|
||||
|
||||
static readonly CONTROL_CLASS = 'setting-control-focus-target';
|
||||
static readonly CONTROL_SELECTOR = '.' + AbstractSettingRenderer.CONTROL_CLASS;
|
||||
static readonly CONTROL_SELECTOR = '.' + this.CONTROL_CLASS;
|
||||
static readonly CONTENTS_CLASS = 'setting-item-contents';
|
||||
static readonly CONTENTS_SELECTOR = '.' + AbstractSettingRenderer.CONTENTS_CLASS;
|
||||
static readonly CONTENTS_SELECTOR = '.' + this.CONTENTS_CLASS;
|
||||
static readonly ALL_ROWS_SELECTOR = '.monaco-list-row';
|
||||
|
||||
static readonly SETTING_KEY_ATTR = 'data-key';
|
||||
|
||||
@@ -70,7 +70,7 @@ export interface IUntitledTextEditorModel extends ITextEditorModel, ILanguageSup
|
||||
export class UntitledTextEditorModel extends BaseTextEditorModel implements IUntitledTextEditorModel {
|
||||
|
||||
private static readonly FIRST_LINE_NAME_MAX_LENGTH = 40;
|
||||
private static readonly FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH = UntitledTextEditorModel.FIRST_LINE_NAME_MAX_LENGTH * 10;
|
||||
private static readonly FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH = this.FIRST_LINE_NAME_MAX_LENGTH * 10;
|
||||
|
||||
// Support the special '${activeEditorLanguage}' language by
|
||||
// looking up the language id from the editor that is active
|
||||
|
||||
Reference in New Issue
Block a user