From c1dd46c2f4e494d74542fbd48aeda5b2b67a7c4d Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 29 Aug 2022 15:49:48 +0200 Subject: [PATCH 01/21] [npm] package.json latest vue version incorrect (#159315) [npm] package.json latest vue version incorrect. FIxes #158850 --- extensions/npm/src/features/packageJSONContribution.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/npm/src/features/packageJSONContribution.ts b/extensions/npm/src/features/packageJSONContribution.ts index a14f157b309..093fea678bc 100644 --- a/extensions/npm/src/features/packageJSONContribution.ts +++ b/extensions/npm/src/features/packageJSONContribution.ts @@ -314,9 +314,10 @@ export class PackageJSONContribution implements IJSONContribution { headers: { agent: USER_AGENT } }); const obj = JSON.parse(success.responseText); + const version = obj['dist-tags']?.latest || Object.keys(obj.versions).pop() || ''; return { description: obj.description || '', - version: Object.keys(obj.versions).pop(), + version, homepage: obj.homepage || '' }; } From e203dad4891ba4ee1ee2b02c193c6e87f81676c4 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 29 Aug 2022 16:15:58 +0200 Subject: [PATCH 02/21] remove permanently removed composites (#159462) --- .../workbench/browser/parts/panel/panelPart.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index 6d2a4e69561..f1a6b89f9ef 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -427,18 +427,20 @@ export abstract class BasePanelPart extends CompositePart impleme private onDidRegisterExtensions(): void { this.extensionsRegistered = true; - this.removeNotExistingComposites(); - this.saveCachedPanels(); - } - - private removeNotExistingComposites(): void { + // hide/remove composites const panels = this.getPaneComposites(); - for (const { id } of this.getCachedPanels()) { // should this value match viewlet (load on ctor) + for (const { id } of this.getCachedPanels()) { if (panels.every(panel => panel.id !== id)) { - this.hideComposite(id); + if (this.viewDescriptorService.isViewContainerRemovedPermanently(id)) { + this.removeComposite(id); + } else { + this.hideComposite(id); + } } } + + this.saveCachedPanels(); } private hideComposite(compositeId: string): void { From c7378f71d1574253059628f2c797db34e2dba3a6 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 29 Aug 2022 17:04:25 +0200 Subject: [PATCH 03/21] remove unused code (#159467) --- .../common/configurationModels.ts | 8 -- .../test/common/configurationModels.test.ts | 98 +------------------ .../browser/configurationService.ts | 5 +- 3 files changed, 2 insertions(+), 109 deletions(-) diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 1df830b7b91..7bac21c1972 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -943,14 +943,6 @@ export class ConfigurationChangeEvent implements IConfigurationChangeEvent { } } -export class AllKeysConfigurationChangeEvent extends ConfigurationChangeEvent { - constructor(configuration: Configuration, workspace: Workspace, source: ConfigurationTarget, sourceConfig: any) { - super({ keys: configuration.allKeys(), overrides: [] }, undefined, configuration, workspace); - this.source = source; - this.sourceConfig = sourceConfig; - } -} - function compare(from: ConfigurationModel | undefined, to: ConfigurationModel | undefined): IConfigurationCompareResult { const { added, removed, updated } = compareConfigurationContents(to, from); const overrides: [string, string[]][] = []; diff --git a/src/vs/platform/configuration/test/common/configurationModels.test.ts b/src/vs/platform/configuration/test/common/configurationModels.test.ts index d1775c8ea6d..cda244e99fa 100644 --- a/src/vs/platform/configuration/test/common/configurationModels.test.ts +++ b/src/vs/platform/configuration/test/common/configurationModels.test.ts @@ -5,8 +5,7 @@ import * as assert from 'assert'; import { join } from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; -import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; -import { AllKeysConfigurationChangeEvent, Configuration, ConfigurationChangeEvent, ConfigurationModel, ConfigurationModelParser, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; +import { Configuration, ConfigurationChangeEvent, ConfigurationModel, ConfigurationModelParser, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { DefaultConfigurationModel } from 'vs/platform/configuration/common/configurations'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -1014,101 +1013,6 @@ suite('ConfigurationChangeEvent', () => { }); -suite('AllKeysConfigurationChangeEvent', () => { - - test('changeEvent', () => { - const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel()); - configuration.updateDefaultConfiguration(toConfigurationModel({ - 'editor.lineNumbers': 'off', - '[markdown]': { - 'editor.wordWrap': 'off' - } - })); - configuration.updateLocalUserConfiguration(toConfigurationModel({ - '[json]': { - 'editor.lineNumbers': 'relative' - } - })); - configuration.updateWorkspaceConfiguration(toConfigurationModel({ 'window.title': 'custom' })); - configuration.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ 'window.zoomLevel': 2, 'window.restoreFullscreen': true })); - configuration.updateFolderConfiguration(URI.file('file2'), toConfigurationModel({ 'workbench.editor.enablePreview': true, 'window.restoreWindows': true })); - const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('file1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('file2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); - const testObject = new AllKeysConfigurationChangeEvent(configuration, workspace, ConfigurationTarget.USER, null); - - assert.deepStrictEqual(testObject.affectedKeys, ['editor.lineNumbers', '[markdown]', '[json]', 'window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); - - assert.ok(testObject.affectsConfiguration('window.title')); - assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window.restoreWindows')); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('file1') })); - - assert.ok(!testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('editor')); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2') })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'json' })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'json' })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); - assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); - - assert.ok(testObject.affectsConfiguration('editor.lineNumbers')); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2') })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'json' })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'json' })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); - assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); - - assert.ok(!testObject.affectsConfiguration('editor.wordWrap')); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'json' })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'json' })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); - assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); - - assert.ok(!testObject.affectsConfiguration('editor.fontSize')); - assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file2') })); - }); -}); - function toConfigurationModel(obj: any): ConfigurationModel { const parser = new ConfigurationModelParser('test'); parser.parse(JSON.stringify(obj)); diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 0b4b4cab851..5c79f8bb507 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -11,7 +11,7 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Queue, Barrier, runWhenIdle, Promises } from 'vs/base/common/async'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import { IWorkspaceContextService, Workspace as BaseWorkspace, WorkbenchState, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, WorkspaceFolder, toWorkspaceFolder, isWorkspaceFolder, IWorkspaceFoldersWillChangeEvent, IEmptyWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceIdentifier, IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace'; -import { ConfigurationModel, ConfigurationChangeEvent, AllKeysConfigurationChangeEvent, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; +import { ConfigurationModel, ConfigurationChangeEvent, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, isConfigurationOverrides, IConfigurationData, IConfigurationValue, IConfigurationChange, ConfigurationTargetToString, IConfigurationUpdateOverrides, isConfigurationUpdateOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IPolicyConfiguration, NullPolicyConfiguration, PolicyConfiguration } from 'vs/platform/configuration/common/configurations'; import { Configuration } from 'vs/workbench/services/configuration/common/configurationModels'; @@ -692,9 +692,6 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat const change = this._configuration.compare(currentConfiguration); this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE); } else { - if (this._onDidChangeConfiguration.hasListeners()) { - this._onDidChangeConfiguration.fire(new AllKeysConfigurationChangeEvent(this._configuration, this.workspace, ConfigurationTarget.WORKSPACE, this.getTargetConfiguration(ConfigurationTarget.WORKSPACE))); - } this.initialized = true; } From 86d5fc5eba247c642ce0530906ef0766a6d6d369 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 29 Aug 2022 08:14:12 -0700 Subject: [PATCH 04/21] perf - avoid `IdleValue` for a feature that is not enabled by default (#159469) --- .../localHistory/browser/localHistory.ts | 33 ++++++++++++------- .../browser/localHistoryCommands.ts | 4 +-- .../browser/localHistoryTimeline.ts | 4 +-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/contrib/localHistory/browser/localHistory.ts b/src/vs/workbench/contrib/localHistory/browser/localHistory.ts index 20bd201237b..254f95041b0 100644 --- a/src/vs/workbench/contrib/localHistory/browser/localHistory.ts +++ b/src/vs/workbench/contrib/localHistory/browser/localHistory.ts @@ -8,22 +8,31 @@ import { Codicon } from 'vs/base/common/codicons'; import { language } from 'vs/base/common/platform'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { registerIcon } from 'vs/platform/theme/common/iconRegistry'; -import { IdleValue } from 'vs/base/common/async'; -export const LOCAL_HISTORY_DATE_FORMATTER: IdleValue<{ format: (timestamp: number) => string }> = new IdleValue(() => { - const options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; +interface ILocalHistoryDateFormatter { + format: (timestamp: number) => string; +} - let formatter: Intl.DateTimeFormat; - try { - formatter = new Intl.DateTimeFormat(language, options); - } catch (error) { - formatter = new Intl.DateTimeFormat(undefined, options); // error can happen when language is invalid (https://github.com/microsoft/vscode/issues/147086) +let localHistoryDateFormatter: ILocalHistoryDateFormatter | undefined = undefined; + +export function getLocalHistoryDateFormatter(): ILocalHistoryDateFormatter { + if (!localHistoryDateFormatter) { + const options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; + + let formatter: Intl.DateTimeFormat; + try { + formatter = new Intl.DateTimeFormat(language, options); + } catch (error) { + formatter = new Intl.DateTimeFormat(undefined, options); // error can happen when language is invalid (https://github.com/microsoft/vscode/issues/147086) + } + + localHistoryDateFormatter = { + format: date => formatter.format(date) + }; } - return { - format: date => formatter.format(date) - }; -}); + return localHistoryDateFormatter; +} export const LOCAL_HISTORY_MENU_CONTEXT_VALUE = 'localHistory:item'; export const LOCAL_HISTORY_MENU_CONTEXT_KEY = ContextKeyExpr.equals('timelineItem', LOCAL_HISTORY_MENU_CONTEXT_VALUE); diff --git a/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.ts b/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.ts index 064b4475a96..641ddffa15f 100644 --- a/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.ts +++ b/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.ts @@ -30,7 +30,7 @@ import { IModelService } from 'vs/editor/common/services/model'; import { ILanguageService } from 'vs/editor/common/languages/language'; import { ILabelService } from 'vs/platform/label/common/label'; import { firstOrDefault } from 'vs/base/common/arrays'; -import { LOCAL_HISTORY_DATE_FORMATTER, LOCAL_HISTORY_ICON_RESTORE, LOCAL_HISTORY_MENU_CONTEXT_KEY } from 'vs/workbench/contrib/localHistory/browser/localHistory'; +import { getLocalHistoryDateFormatter, LOCAL_HISTORY_ICON_RESTORE, LOCAL_HISTORY_MENU_CONTEXT_KEY } from 'vs/workbench/contrib/localHistory/browser/localHistory'; import { IPathService } from 'vs/workbench/services/path/common/pathService'; const LOCAL_HISTORY_CATEGORY = { value: localize('localHistory.category', "Local History"), original: 'Local History' }; @@ -646,7 +646,7 @@ export async function findLocalHistoryEntry(workingCopyHistoryService: IWorkingC const SEP = /\//g; function toLocalHistoryEntryDateLabel(timestamp: number): string { - return `${LOCAL_HISTORY_DATE_FORMATTER.value.format(timestamp).replace(SEP, '-')}`; // preserving `/` will break editor labels, so replace it with a non-path symbol + return `${getLocalHistoryDateFormatter().format(timestamp).replace(SEP, '-')}`; // preserving `/` will break editor labels, so replace it with a non-path symbol } //#endregion diff --git a/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.ts b/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.ts index 2dee3866cbd..417b8fa0570 100644 --- a/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.ts +++ b/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.ts @@ -20,7 +20,7 @@ import { SaveSourceRegistry } from 'vs/workbench/common/editor'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { COMPARE_WITH_FILE_LABEL, toDiffEditorArguments } from 'vs/workbench/contrib/localHistory/browser/localHistoryCommands'; import { MarkdownString } from 'vs/base/common/htmlContent'; -import { LOCAL_HISTORY_DATE_FORMATTER, LOCAL_HISTORY_ICON_ENTRY, LOCAL_HISTORY_MENU_CONTEXT_VALUE } from 'vs/workbench/contrib/localHistory/browser/localHistory'; +import { getLocalHistoryDateFormatter, LOCAL_HISTORY_ICON_ENTRY, LOCAL_HISTORY_MENU_CONTEXT_VALUE } from 'vs/workbench/contrib/localHistory/browser/localHistory'; import { Schemas } from 'vs/base/common/network'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { getVirtualWorkspaceAuthority } from 'vs/platform/workspace/common/virtualWorkspace'; @@ -151,7 +151,7 @@ export class LocalHistoryTimeline extends Disposable implements IWorkbenchContri return { handle: entry.id, label: SaveSourceRegistry.getSourceLabel(entry.source), - tooltip: new MarkdownString(`$(history) ${LOCAL_HISTORY_DATE_FORMATTER.value.format(entry.timestamp)}\n\n${SaveSourceRegistry.getSourceLabel(entry.source)}`, { supportThemeIcons: true }), + tooltip: new MarkdownString(`$(history) ${getLocalHistoryDateFormatter().format(entry.timestamp)}\n\n${SaveSourceRegistry.getSourceLabel(entry.source)}`, { supportThemeIcons: true }), source: LocalHistoryTimeline.ID, timestamp: entry.timestamp, themeIcon: LOCAL_HISTORY_ICON_ENTRY, From 07025f0b0d259db654361b99b68539a742c53c3f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 09:34:57 -0700 Subject: [PATCH 05/21] Remove notebook editor edit api (#158988) Fixes #149181 --- extensions/notebook-renderers/tsconfig.json | 3 +- .../singlefolder-tests/notebook.api.test.ts | 2 +- .../notebook.document.test.ts | 32 ++--- .../notebook.kernel.test.ts | 2 +- .../api/browser/mainThreadNotebookEditors.ts | 34 ++---- .../workbench/api/common/extHost.protocol.ts | 1 - .../api/common/extHostNotebookEditor.ts | 109 +----------------- src/vs/workbench/api/common/extHostTypes.ts | 32 +---- .../common/extensionsApiProposals.ts | 1 - .../vscode.proposed.notebookEditorEdit.d.ts | 56 --------- test/automation/package.json | 4 +- 11 files changed, 38 insertions(+), 238 deletions(-) delete mode 100644 src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts diff --git a/extensions/notebook-renderers/tsconfig.json b/extensions/notebook-renderers/tsconfig.json index 23609811f3a..3472d5bbaa7 100644 --- a/extensions/notebook-renderers/tsconfig.json +++ b/extensions/notebook-renderers/tsconfig.json @@ -8,7 +8,6 @@ }, "include": [ "src/**/*", - "../../src/vscode-dts/vscode.d.ts", - "../../src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts", + "../../src/vscode-dts/vscode.d.ts" ] } diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.api.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.api.test.ts index 233f3ee6177..ee6b24f391a 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.api.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.api.test.ts @@ -294,7 +294,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = { await provideCalled; const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCellMetadata(notebook.uri, 0, { inputCollapsed: true }); + edit.set(notebook.uri, [vscode.NotebookEdit.updateCellMetadata(0, { inputCollapsed: true })]); await vscode.workspace.applyEdit(edit); await provideCalled; }); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.document.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.document.test.ts index 3a28ea9909f..ab11a4ee493 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.document.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.document.test.ts @@ -173,7 +173,7 @@ suite('Notebook Document', function () { // inserting two new cells { const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 0), [{ + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, 0), [{ kind: vscode.NotebookCellKind.Markup, languageId: 'markdown', metadata: undefined, @@ -185,7 +185,7 @@ suite('Notebook Document', function () { metadata: undefined, outputs: [], value: 'new_code' - }]); + }])]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); @@ -198,8 +198,10 @@ suite('Notebook Document', function () { // deleting cell 1 and 3 { const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 1), []); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(2, 3), []); + edit.set(document.uri, [ + vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, 1), []), + vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(2, 3), []) + ]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); } @@ -210,7 +212,7 @@ suite('Notebook Document', function () { // replacing all cells { const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 1), [{ + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, 1), [{ kind: vscode.NotebookCellKind.Markup, languageId: 'markdown', metadata: undefined, @@ -222,7 +224,7 @@ suite('Notebook Document', function () { metadata: undefined, outputs: [], value: 'new2_code' - }]); + }])]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); } @@ -233,7 +235,7 @@ suite('Notebook Document', function () { // remove all cells { const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []); + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, document.cellCount), [])]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); } @@ -246,7 +248,7 @@ suite('Notebook Document', function () { assert.strictEqual(document.cellCount, 1); const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 0), [{ + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, 0), [{ kind: vscode.NotebookCellKind.Markup, languageId: 'markdown', metadata: undefined, @@ -258,7 +260,7 @@ suite('Notebook Document', function () { metadata: undefined, outputs: [], value: 'new_code' - }]); + }])]); const event = utils.asPromise(vscode.workspace.onDidChangeNotebookDocument); @@ -287,7 +289,7 @@ suite('Notebook Document', function () { const document = await vscode.workspace.openNotebookDocument(uri); const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCellMetadata(document.uri, 0, { inputCollapsed: true }); + edit.set(document.uri, [vscode.NotebookEdit.updateCellMetadata(0, { inputCollapsed: true })]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); assert.strictEqual(document.cellAt(0).metadata.inputCollapsed, true); @@ -300,7 +302,7 @@ suite('Notebook Document', function () { const edit = new vscode.WorkspaceEdit(); const event = utils.asPromise(vscode.workspace.onDidChangeNotebookDocument); - edit.replaceNotebookCellMetadata(document.uri, 0, { inputCollapsed: true }); + edit.set(document.uri, [vscode.NotebookEdit.updateCellMetadata(0, { inputCollapsed: true })]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); const data = await event; @@ -338,7 +340,7 @@ suite('Notebook Document', function () { assert.strictEqual(notebook.notebookType, 'notebook.nbdtest'); const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(notebook.uri, new vscode.NotebookRange(0, 0), [{ + edit.set(notebook.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, 0), [{ kind: vscode.NotebookCellKind.Markup, languageId: 'markdown', metadata: undefined, @@ -350,7 +352,7 @@ suite('Notebook Document', function () { metadata: undefined, outputs: [], value: 'new_code' - }]); + }])]); const success = await vscode.workspace.applyEdit(edit); assert.strictEqual(success, true); @@ -399,7 +401,7 @@ suite('Notebook Document', function () { assert.strictEqual(document.isDirty, false); const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []); + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, document.cellCount), [])]); assert.ok(await vscode.workspace.applyEdit(edit)); assert.strictEqual(document.isDirty, true); @@ -414,7 +416,7 @@ suite('Notebook Document', function () { assert.strictEqual(document.isDirty, false); const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []); + edit.set(document.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(0, document.cellCount), [])]); assert.ok(await vscode.workspace.applyEdit(edit)); assert.strictEqual(document.isDirty, true); diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts index 923ee4cfc73..0c4cff5cf4b 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts @@ -406,7 +406,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = { // Delete executing cell const edit = new vscode.WorkspaceEdit(); - edit.replaceNotebookCells(cell!.notebook.uri, new vscode.NotebookRange(cell!.index, cell!.index + 1), []); + edit.set(cell!.notebook.uri, [vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(cell!.index, cell!.index + 1), [])]); await vscode.workspace.applyEdit(edit); assert.strictEqual(executionWasCancelled, true); diff --git a/src/vs/workbench/api/browser/mainThreadNotebookEditors.ts b/src/vs/workbench/api/browser/mainThreadNotebookEditors.ts index d1776c13db5..b45855c6c55 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebookEditors.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebookEditors.ts @@ -4,20 +4,18 @@ *--------------------------------------------------------------------------------------------*/ import { DisposableStore, dispose } from 'vs/base/common/lifecycle'; +import { equals } from 'vs/base/common/objects'; +import { URI, UriComponents } from 'vs/base/common/uri'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; import { getNotebookEditorFromEditorPane, INotebookEditor, INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService'; -import { ExtHostContext, ExtHostNotebookEditorsShape, ICellEditOperationDto, INotebookDocumentShowOptions, INotebookEditorViewColumnInfo, MainThreadNotebookEditorsShape, NotebookEditorRevealType } from '../common/extHost.protocol'; import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange'; -import { ILogService } from 'vs/platform/log/common/log'; -import { URI, UriComponents } from 'vs/base/common/uri'; -import { EditorActivation } from 'vs/platform/editor/common/editor'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { columnToEditorGroup, editorGroupToColumn } from 'vs/workbench/services/editor/common/editorGroupColumn'; -import { equals } from 'vs/base/common/objects'; -import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { ExtHostContext, ExtHostNotebookEditorsShape, INotebookDocumentShowOptions, INotebookEditorViewColumnInfo, MainThreadNotebookEditorsShape, NotebookEditorRevealType } from '../common/extHost.protocol'; class MainThreadNotebook { @@ -43,7 +41,6 @@ export class MainThreadNotebookEditors implements MainThreadNotebookEditorsShape constructor( extHostContext: IExtHostContext, @IEditorService private readonly _editorService: IEditorService, - @ILogService private readonly _logService: ILogService, @INotebookEditorService private readonly _notebookEditorService: INotebookEditorService, @IEditorGroupsService private readonly _editorGroupService: IEditorGroupsService, @IConfigurationService private readonly _configurationService: IConfigurationService @@ -99,23 +96,6 @@ export class MainThreadNotebookEditors implements MainThreadNotebookEditorsShape } } - async $tryApplyEdits(editorId: string, modelVersionId: number, cellEdits: ICellEditOperationDto[]): Promise { - const wrapper = this._mainThreadEditors.get(editorId); - if (!wrapper) { - return false; - } - const { editor } = wrapper; - if (!editor.textModel) { - this._logService.warn('Notebook editor has NO model', editorId); - return false; - } - if (editor.textModel.versionId !== modelVersionId) { - return false; - } - //todo@jrieken use proper selection logic! - return editor.textModel.applyEdits(cellEdits.map(NotebookDto.fromCellEditOperationDto), true, undefined, () => undefined, undefined, true); - } - async $tryShowNotebookDocument(resource: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise { const editorOptions: INotebookEditorOptions = { cellSelections: options.selections, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 10efae0f6dc..f55bd39b99a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -978,7 +978,6 @@ export interface MainThreadNotebookEditorsShape extends IDisposable { $tryShowNotebookDocument(uriComponents: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise; $tryRevealRange(id: string, range: ICellRange, revealType: NotebookEditorRevealType): Promise; $trySetSelections(id: string, range: ICellRange[]): void; - $tryApplyEdits(editorId: string, modelVersionId: number, cellEdits: ICellEditOperationDto[]): Promise; } export interface MainThreadNotebookDocumentsShape extends IDisposable { diff --git a/src/vs/workbench/api/common/extHostNotebookEditor.ts b/src/vs/workbench/api/common/extHostNotebookEditor.ts index ca7037eca64..1a75b1fadb9 100644 --- a/src/vs/workbench/api/common/extHostNotebookEditor.ts +++ b/src/vs/workbench/api/common/extHostNotebookEditor.ts @@ -3,74 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ICellEditOperationDto, MainThreadNotebookEditorsShape } from 'vs/workbench/api/common/extHost.protocol'; -import * as extHostTypes from 'vs/workbench/api/common/extHostTypes'; +import { illegalArgument } from 'vs/base/common/errors'; +import { MainThreadNotebookEditorsShape } from 'vs/workbench/api/common/extHost.protocol'; import * as extHostConverter from 'vs/workbench/api/common/extHostTypeConverters'; -import { CellEditType } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import * as extHostTypes from 'vs/workbench/api/common/extHostTypes'; import * as vscode from 'vscode'; import { ExtHostNotebookDocument } from './extHostNotebookDocument'; -import { illegalArgument } from 'vs/base/common/errors'; - -interface INotebookEditData { - documentVersionId: number; - cellEdits: ICellEditOperationDto[]; -} - -class NotebookEditorCellEditBuilder implements vscode.NotebookEditorEdit { - - private readonly _documentVersionId: number; - - private _finalized: boolean = false; - private _collectedEdits: ICellEditOperationDto[] = []; - - constructor(documentVersionId: number) { - this._documentVersionId = documentVersionId; - } - - finalize(): INotebookEditData { - this._finalized = true; - return { - documentVersionId: this._documentVersionId, - cellEdits: this._collectedEdits - }; - } - - private _throwIfFinalized() { - if (this._finalized) { - throw new Error('Edit is only valid while callback runs'); - } - } - - replaceMetadata(value: { [key: string]: any }): void { - this._throwIfFinalized(); - this._collectedEdits.push({ - editType: CellEditType.DocumentMetadata, - metadata: value - }); - } - - replaceCellMetadata(index: number, metadata: Record): void { - this._throwIfFinalized(); - this._collectedEdits.push({ - editType: CellEditType.PartialMetadata, - index, - metadata - }); - } - - replaceCells(from: number, to: number, cells: vscode.NotebookCellData[]): void { - this._throwIfFinalized(); - if (from === to && cells.length === 0) { - return; - } - this._collectedEdits.push({ - editType: CellEditType.Replace, - index: from, - count: to - from, - cells: cells.map(extHostConverter.NotebookCellData.from) - }); - } -} export class ExtHostNotebookEditor { @@ -136,11 +74,6 @@ export class ExtHostNotebookEditor { get viewColumn() { return that._viewColumn; }, - edit(callback) { - const edit = new NotebookEditorCellEditBuilder(this.document.version); - callback(edit); - return that._applyEdit(edit.finalize()); - }, }; ExtHostNotebookEditor.apiEditorsToExtHost.set(this._editor, this); @@ -171,40 +104,4 @@ export class ExtHostNotebookEditor { _acceptViewColumn(value: vscode.ViewColumn | undefined) { this._viewColumn = value; } - - private _applyEdit(editData: INotebookEditData): Promise { - - // return when there is nothing to do - if (editData.cellEdits.length === 0) { - return Promise.resolve(true); - } - - const compressedEdits: ICellEditOperationDto[] = []; - let compressedEditsIndex = -1; - - for (let i = 0; i < editData.cellEdits.length; i++) { - if (compressedEditsIndex < 0) { - compressedEdits.push(editData.cellEdits[i]); - compressedEditsIndex++; - continue; - } - - const prevIndex = compressedEditsIndex; - const prev = compressedEdits[prevIndex]; - - const edit = editData.cellEdits[i]; - if (prev.editType === CellEditType.Replace && edit.editType === CellEditType.Replace) { - if (prev.index === edit.index) { - prev.cells.push(...(editData.cellEdits[i] as any).cells); - prev.count += (editData.cellEdits[i] as any).count; - continue; - } - } - - compressedEdits.push(editData.cellEdits[i]); - compressedEditsIndex++; - } - - return this._proxy.$tryApplyEdits(this.id, editData.documentVersionId, compressedEdits); - } } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index a35c22c5a04..2ccc9dbde2a 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -737,40 +737,20 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit { // --- notebook - replaceNotebookMetadata(uri: URI, value: Record, metadata?: vscode.WorkspaceEditEntryMetadata): void { + private replaceNotebookMetadata(uri: URI, value: Record, metadata?: vscode.WorkspaceEditEntryMetadata): void { this._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.DocumentMetadata, metadata: value }, notebookMetadata: value }); } - replaceNotebookCells(uri: URI, range: vscode.NotebookRange, cells: vscode.NotebookCellData[], metadata?: vscode.WorkspaceEditEntryMetadata): void; - replaceNotebookCells(uri: URI, start: number, end: number, cells: vscode.NotebookCellData[], metadata?: vscode.WorkspaceEditEntryMetadata): void; - replaceNotebookCells(uri: URI, startOrRange: number | vscode.NotebookRange, endOrCells: number | vscode.NotebookCellData[], cellsOrMetadata?: vscode.NotebookCellData[] | vscode.WorkspaceEditEntryMetadata, metadata?: vscode.WorkspaceEditEntryMetadata): void { - let start: number | undefined; - let end: number | undefined; - let cellData: vscode.NotebookCellData[] = []; - let workspaceEditMetadata: vscode.WorkspaceEditEntryMetadata | undefined; - - if (NotebookRange.isNotebookRange(startOrRange) && NotebookCellData.isNotebookCellDataArray(endOrCells) && !NotebookCellData.isNotebookCellDataArray(cellsOrMetadata)) { - start = startOrRange.start; - end = startOrRange.end; - cellData = endOrCells; - workspaceEditMetadata = cellsOrMetadata; - } else if (typeof startOrRange === 'number' && typeof endOrCells === 'number' && NotebookCellData.isNotebookCellDataArray(cellsOrMetadata)) { - start = startOrRange; - end = endOrCells; - cellData = cellsOrMetadata; - workspaceEditMetadata = metadata; - } - - if (start === undefined || end === undefined) { - throw new Error('Invalid arguments'); - } + private replaceNotebookCells(uri: URI, startOrRange: vscode.NotebookRange, cellData: vscode.NotebookCellData[], metadata?: vscode.WorkspaceEditEntryMetadata): void { + const start = startOrRange.start; + const end = startOrRange.end; if (start !== end || cellData.length > 0) { - this._edits.push({ _type: FileEditType.CellReplace, uri, index: start, count: end - start, cells: cellData, metadata: workspaceEditMetadata }); + this._edits.push({ _type: FileEditType.CellReplace, uri, index: start, count: end - start, cells: cellData, metadata }); } } - replaceNotebookCellMetadata(uri: URI, index: number, cellMetadata: Record, metadata?: vscode.WorkspaceEditEntryMetadata): void { + private replaceNotebookCellMetadata(uri: URI, index: number, cellMetadata: Record, metadata?: vscode.WorkspaceEditEntryMetadata): void { this._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.PartialMetadata, index, metadata: cellMetadata } }); } diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index 85ccd21e919..99bd02c1355 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -43,7 +43,6 @@ export const allApiProposals = Object.freeze({ notebookDebugOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts', notebookDeprecated: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts', notebookEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditor.d.ts', - notebookEditorEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts', notebookKernelSource: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts', notebookLiveShare: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts', notebookMessaging: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts', diff --git a/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts b/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts deleted file mode 100644 index b41878fd319..00000000000 --- a/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/106744 - - export interface WorkspaceEdit { - replaceNotebookMetadata(uri: Uri, value: { [key: string]: any }): void; - - /** - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - */ - replaceNotebookCells(uri: Uri, range: NotebookRange, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void; - - /** - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - */ - replaceNotebookCellMetadata(uri: Uri, index: number, cellMetadata: { [key: string]: any }, metadata?: WorkspaceEditEntryMetadata): void; - } - - export interface NotebookEditorEdit { - /** - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - */ - replaceMetadata(value: { [key: string]: any }): void; - - /** - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - */ - replaceCells(start: number, end: number, cells: NotebookCellData[]): void; - - /** - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - */ - replaceCellMetadata(index: number, metadata: { [key: string]: any }): void; - } - - export interface NotebookEditor { - /** - * Perform an edit on the notebook associated with this notebook editor. - * - * The given callback-function is invoked with an {@link NotebookEditorEdit edit-builder} which must - * be used to make edits. Note that the edit-builder is only valid while the - * callback executes. - * - * @deprecated Please migrate to the new `notebookWorkspaceEdit` proposed API. - * - * @param callback A function which can create edits using an {@link NotebookEditorEdit edit-builder}. - * @return A promise that resolves with a value indicating if the edits could be applied. - */ - edit(callback: (editBuilder: NotebookEditorEdit) => void): Thenable; - } -} diff --git a/test/automation/package.json b/test/automation/package.json index 96397298161..239844d7df5 100644 --- a/test/automation/package.json +++ b/test/automation/package.json @@ -1,6 +1,6 @@ { "name": "vscode-automation", - "version": "1.54.0", + "version": "1.71.0", "description": "VS Code UI automation driver", "author": { "name": "Microsoft Corporation" @@ -33,4 +33,4 @@ "npm-run-all": "^4.1.5", "watch": "^1.0.2" } -} +} \ No newline at end of file From 5b21c7f28b3f945bd9f199b5bfea2c05c8d976f4 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 09:39:09 -0700 Subject: [PATCH 06/21] Run our custom eslint rules using ts-node (#157532) * Run our custom eslint rules using ts-node Use `ts-node` to run our custom eslint rules. This lets us delete the pre-compiled js. It also means you can don't have to compile the rules while editing them As part of this change, I've also switched us to using an eslint plugin instead of a rulesDir. This is now the preferred way to ship custom rules * Fix two more disables * Move ts-node to project root * Enable transpileOnly --- .eslintrc.json | 43 ++-- .vscode/settings.json | 5 - build/eslint.js | 3 +- build/hygiene.js | 3 +- .../code-import-patterns.ts | 2 +- .../code-layering.ts | 0 .../code-no-look-behind-regex.ts | 0 .../code-no-nls-in-standalone-editor.ts | 0 .../code-no-standalone-editor.ts | 0 .../code-no-test-only.ts | 0 .../code-no-unexternalized-strings.ts | 0 .../code-no-unused-expressions.ts | 0 .../code-translation-remind.ts | 0 build/lib/eslint-plugin-vscode/index.js | 12 ++ build/lib/eslint-plugin-vscode/package.json | 6 + .../{eslint => eslint-plugin-vscode}/utils.ts | 0 .../vscode-dts-cancellation.ts | 0 .../vscode-dts-create-func.ts | 0 .../vscode-dts-event-naming.ts | 0 .../vscode-dts-interface-naming.ts | 0 .../vscode-dts-literal-or-types.ts | 0 .../vscode-dts-provider-naming.ts | 0 .../vscode-dts-region-comments.ts | 0 .../vscode-dts-use-thenable.ts | 0 .../vscode-dts-vscode-in-comments.ts | 0 build/lib/eslint/code-import-patterns.js | 199 ------------------ build/lib/eslint/code-layering.js | 68 ------ build/lib/eslint/code-no-look-behind-regex.js | 42 ---- .../code-no-nls-in-standalone-editor.js | 38 ---- build/lib/eslint/code-no-standalone-editor.js | 41 ---- build/lib/eslint/code-no-test-only.js | 17 -- .../eslint/code-no-unexternalized-strings.js | 111 ---------- .../lib/eslint/code-no-unused-expressions.js | 119 ----------- build/lib/eslint/code-translation-remind.js | 57 ----- build/lib/eslint/utils.js | 37 ---- build/lib/eslint/vscode-dts-cancellation.js | 33 --- build/lib/eslint/vscode-dts-create-func.js | 34 --- build/lib/eslint/vscode-dts-event-naming.js | 86 -------- .../lib/eslint/vscode-dts-interface-naming.js | 30 --- .../lib/eslint/vscode-dts-literal-or-types.js | 25 --- .../lib/eslint/vscode-dts-provider-naming.js | 37 ---- .../lib/eslint/vscode-dts-region-comments.js | 35 --- build/lib/eslint/vscode-dts-use-thenable.js | 24 --- .../eslint/vscode-dts-vscode-in-comments.js | 45 ---- build/tsconfig.build.json | 3 + extensions/git/src/git.ts | 2 +- package.json | 2 + .../commandDetectionCapability.ts | 2 +- .../partialCommandDetectionCapability.ts | 2 +- .../common/xterm/shellIntegrationAddon.ts | 2 +- .../colorRegistry.releaseTest.ts | 2 +- .../nativeLocalProcessExtensionHost.ts | 4 +- .../vscode.proposed.customEditorMove.d.ts | 2 +- ...e.proposed.inlineCompletionsAdditions.d.ts | 4 +- .../vscode.proposed.notebookDebugOptions.d.ts | 2 +- src/vscode-dts/vscode.proposed.resolvers.d.ts | 2 +- test/monaco/esm-check/index.js | 2 +- yarn.lock | 93 ++++++++ 58 files changed, 154 insertions(+), 1122 deletions(-) rename build/lib/{eslint => eslint-plugin-vscode}/code-import-patterns.ts (99%) rename build/lib/{eslint => eslint-plugin-vscode}/code-layering.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-look-behind-regex.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-nls-in-standalone-editor.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-standalone-editor.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-test-only.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-unexternalized-strings.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-no-unused-expressions.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/code-translation-remind.ts (100%) create mode 100644 build/lib/eslint-plugin-vscode/index.js create mode 100644 build/lib/eslint-plugin-vscode/package.json rename build/lib/{eslint => eslint-plugin-vscode}/utils.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-cancellation.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-create-func.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-event-naming.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-interface-naming.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-literal-or-types.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-provider-naming.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-region-comments.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-use-thenable.ts (100%) rename build/lib/{eslint => eslint-plugin-vscode}/vscode-dts-vscode-in-comments.ts (100%) delete mode 100644 build/lib/eslint/code-import-patterns.js delete mode 100644 build/lib/eslint/code-layering.js delete mode 100644 build/lib/eslint/code-no-look-behind-regex.js delete mode 100644 build/lib/eslint/code-no-nls-in-standalone-editor.js delete mode 100644 build/lib/eslint/code-no-standalone-editor.js delete mode 100644 build/lib/eslint/code-no-test-only.js delete mode 100644 build/lib/eslint/code-no-unexternalized-strings.js delete mode 100644 build/lib/eslint/code-no-unused-expressions.js delete mode 100644 build/lib/eslint/code-translation-remind.js delete mode 100644 build/lib/eslint/utils.js delete mode 100644 build/lib/eslint/vscode-dts-cancellation.js delete mode 100644 build/lib/eslint/vscode-dts-create-func.js delete mode 100644 build/lib/eslint/vscode-dts-event-naming.js delete mode 100644 build/lib/eslint/vscode-dts-interface-naming.js delete mode 100644 build/lib/eslint/vscode-dts-literal-or-types.js delete mode 100644 build/lib/eslint/vscode-dts-provider-naming.js delete mode 100644 build/lib/eslint/vscode-dts-region-comments.js delete mode 100644 build/lib/eslint/vscode-dts-use-thenable.js delete mode 100644 build/lib/eslint/vscode-dts-vscode-in-comments.js diff --git a/.eslintrc.json b/.eslintrc.json index d86f6103a7d..dab9cca276b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,7 +8,8 @@ "plugins": [ "@typescript-eslint", "jsdoc", - "header" + "header", + "@vscode" ], "rules": { "constructor-super": "warn", @@ -61,17 +62,17 @@ ] } ], - "code-no-unused-expressions": [ + "@vscode/code-no-unused-expressions": [ "warn", { "allowTernary": true } ], - "code-translation-remind": "warn", - "code-no-nls-in-standalone-editor": "warn", - "code-no-standalone-editor": "warn", - "code-no-unexternalized-strings": "warn", - "code-layering": [ + "@vscode/code-translation-remind": "warn", + "@vscode/code-no-nls-in-standalone-editor": "warn", + "@vscode/code-no-standalone-editor": "warn", + "@vscode/code-no-unexternalized-strings": "warn", + "@vscode/code-layering": [ "warn", { "common": [], @@ -122,8 +123,8 @@ "**/*.test.ts" ], "rules": { - "code-no-test-only": "error", - "code-no-unexternalized-strings": "off" + "@vscode/code-no-test-only": "error", + "@vscode/code-no-unexternalized-strings": "off" } }, { @@ -132,14 +133,14 @@ "**/vscode.proposed.*.d.ts" ], "rules": { - "vscode-dts-create-func": "warn", - "vscode-dts-literal-or-types": "warn", - "vscode-dts-interface-naming": "warn", - "vscode-dts-cancellation": "warn", - "vscode-dts-use-thenable": "warn", - "vscode-dts-region-comments": "warn", - "vscode-dts-vscode-in-comments": "warn", - "vscode-dts-provider-naming": [ + "@vscode/vscode-dts-create-func": "warn", + "@vscode/vscode-dts-literal-or-types": "warn", + "@vscode/vscode-dts-interface-naming": "warn", + "@vscode/vscode-dts-cancellation": "warn", + "@vscode/vscode-dts-use-thenable": "warn", + "@vscode/vscode-dts-region-comments": "warn", + "@vscode/vscode-dts-vscode-in-comments": "warn", + "@vscode/vscode-dts-provider-naming": [ "warn", { "allowed": [ @@ -154,7 +155,7 @@ ] } ], - "vscode-dts-event-naming": [ + "@vscode/vscode-dts-event-naming": [ "warn", { "allowed": [ @@ -200,8 +201,8 @@ "src/**/*.ts" ], "rules": { - "code-no-look-behind-regex": "warn", - "code-import-patterns": [ + "@vscode/code-no-look-behind-regex": "warn", + "@vscode/code-import-patterns": [ "warn", { // imports that are allowed in all files of layers: @@ -576,7 +577,7 @@ "test/**/*.ts" ], "rules": { - "code-import-patterns": [ + "@vscode/code-import-patterns": [ "warn", { "target": "test/smoke/**", diff --git a/.vscode/settings.json b/.vscode/settings.json index 71bded80a79..0529bf5aba5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,11 +41,6 @@ } } ], - "eslint.options": { - "rulePaths": [ - "./build/lib/eslint" - ] - }, "typescript.tsdk": "node_modules/typescript/lib", "npm.exclude": "**/extensions/**", "npm.packageManager": "yarn", diff --git a/build/eslint.js b/build/eslint.js index c04f4ef7756..288917b35bf 100644 --- a/build/eslint.js +++ b/build/eslint.js @@ -13,8 +13,7 @@ function eslint() { .src(eslintFilter, { base: '.', follow: true, allowEmpty: true }) .pipe( gulpeslint({ - configFile: '.eslintrc.json', - rulePaths: ['./build/lib/eslint'], + configFile: '.eslintrc.json' }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/hygiene.js b/build/hygiene.js index e18466c8f77..99b757e6d76 100644 --- a/build/hygiene.js +++ b/build/hygiene.js @@ -173,8 +173,7 @@ function hygiene(some, linting = true) { .pipe(filter(eslintFilter)) .pipe( gulpeslint({ - configFile: '.eslintrc.json', - rulePaths: ['./build/lib/eslint'], + configFile: '.eslintrc.json' }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint-plugin-vscode/code-import-patterns.ts similarity index 99% rename from build/lib/eslint/code-import-patterns.ts rename to build/lib/eslint-plugin-vscode/code-import-patterns.ts index 72b63a45b35..259f85fc291 100644 --- a/build/lib/eslint/code-import-patterns.ts +++ b/build/lib/eslint-plugin-vscode/code-import-patterns.ts @@ -6,7 +6,7 @@ import * as eslint from 'eslint'; import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as path from 'path'; -import * as minimatch from 'minimatch'; +import minimatch from 'minimatch'; import { createImportRuleListener } from './utils'; const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); diff --git a/build/lib/eslint/code-layering.ts b/build/lib/eslint-plugin-vscode/code-layering.ts similarity index 100% rename from build/lib/eslint/code-layering.ts rename to build/lib/eslint-plugin-vscode/code-layering.ts diff --git a/build/lib/eslint/code-no-look-behind-regex.ts b/build/lib/eslint-plugin-vscode/code-no-look-behind-regex.ts similarity index 100% rename from build/lib/eslint/code-no-look-behind-regex.ts rename to build/lib/eslint-plugin-vscode/code-no-look-behind-regex.ts diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint-plugin-vscode/code-no-nls-in-standalone-editor.ts similarity index 100% rename from build/lib/eslint/code-no-nls-in-standalone-editor.ts rename to build/lib/eslint-plugin-vscode/code-no-nls-in-standalone-editor.ts diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint-plugin-vscode/code-no-standalone-editor.ts similarity index 100% rename from build/lib/eslint/code-no-standalone-editor.ts rename to build/lib/eslint-plugin-vscode/code-no-standalone-editor.ts diff --git a/build/lib/eslint/code-no-test-only.ts b/build/lib/eslint-plugin-vscode/code-no-test-only.ts similarity index 100% rename from build/lib/eslint/code-no-test-only.ts rename to build/lib/eslint-plugin-vscode/code-no-test-only.ts diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint-plugin-vscode/code-no-unexternalized-strings.ts similarity index 100% rename from build/lib/eslint/code-no-unexternalized-strings.ts rename to build/lib/eslint-plugin-vscode/code-no-unexternalized-strings.ts diff --git a/build/lib/eslint/code-no-unused-expressions.ts b/build/lib/eslint-plugin-vscode/code-no-unused-expressions.ts similarity index 100% rename from build/lib/eslint/code-no-unused-expressions.ts rename to build/lib/eslint-plugin-vscode/code-no-unused-expressions.ts diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint-plugin-vscode/code-translation-remind.ts similarity index 100% rename from build/lib/eslint/code-translation-remind.ts rename to build/lib/eslint-plugin-vscode/code-translation-remind.ts diff --git a/build/lib/eslint-plugin-vscode/index.js b/build/lib/eslint-plugin-vscode/index.js new file mode 100644 index 00000000000..db643095ca9 --- /dev/null +++ b/build/lib/eslint-plugin-vscode/index.js @@ -0,0 +1,12 @@ +const glob = require('glob'); +const path = require('path'); + +require('ts-node').register({ experimentalResolver: true, transpileOnly: true }); + +// Re-export all .ts files as rules +const rules = {}; +glob.sync(`${__dirname}/*.ts`).forEach((file) => { + rules[path.basename(file, '.ts')] = require(file); +}); + +module.exports = { rules }; diff --git a/build/lib/eslint-plugin-vscode/package.json b/build/lib/eslint-plugin-vscode/package.json new file mode 100644 index 00000000000..b8e3adf8c06 --- /dev/null +++ b/build/lib/eslint-plugin-vscode/package.json @@ -0,0 +1,6 @@ +{ + "name": "@vscode/eslint-plugin", + "private": true, + "version": "0.0.0", + "main": "index.js" +} diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint-plugin-vscode/utils.ts similarity index 100% rename from build/lib/eslint/utils.ts rename to build/lib/eslint-plugin-vscode/utils.ts diff --git a/build/lib/eslint/vscode-dts-cancellation.ts b/build/lib/eslint-plugin-vscode/vscode-dts-cancellation.ts similarity index 100% rename from build/lib/eslint/vscode-dts-cancellation.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-cancellation.ts diff --git a/build/lib/eslint/vscode-dts-create-func.ts b/build/lib/eslint-plugin-vscode/vscode-dts-create-func.ts similarity index 100% rename from build/lib/eslint/vscode-dts-create-func.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-create-func.ts diff --git a/build/lib/eslint/vscode-dts-event-naming.ts b/build/lib/eslint-plugin-vscode/vscode-dts-event-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-event-naming.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-event-naming.ts diff --git a/build/lib/eslint/vscode-dts-interface-naming.ts b/build/lib/eslint-plugin-vscode/vscode-dts-interface-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-interface-naming.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-interface-naming.ts diff --git a/build/lib/eslint/vscode-dts-literal-or-types.ts b/build/lib/eslint-plugin-vscode/vscode-dts-literal-or-types.ts similarity index 100% rename from build/lib/eslint/vscode-dts-literal-or-types.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-literal-or-types.ts diff --git a/build/lib/eslint/vscode-dts-provider-naming.ts b/build/lib/eslint-plugin-vscode/vscode-dts-provider-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-provider-naming.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-provider-naming.ts diff --git a/build/lib/eslint/vscode-dts-region-comments.ts b/build/lib/eslint-plugin-vscode/vscode-dts-region-comments.ts similarity index 100% rename from build/lib/eslint/vscode-dts-region-comments.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-region-comments.ts diff --git a/build/lib/eslint/vscode-dts-use-thenable.ts b/build/lib/eslint-plugin-vscode/vscode-dts-use-thenable.ts similarity index 100% rename from build/lib/eslint/vscode-dts-use-thenable.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-use-thenable.ts diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.ts b/build/lib/eslint-plugin-vscode/vscode-dts-vscode-in-comments.ts similarity index 100% rename from build/lib/eslint/vscode-dts-vscode-in-comments.ts rename to build/lib/eslint-plugin-vscode/vscode-dts-vscode-in-comments.ts diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js deleted file mode 100644 index 47cc3063d1c..00000000000 --- a/build/lib/eslint/code-import-patterns.js +++ /dev/null @@ -1,199 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path = require("path"); -const minimatch = require("minimatch"); -const utils_1 = require("./utils"); -const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); -function isLayerAllowRule(option) { - return !!(option.when && option.allow); -} -/** - * Returns the filename relative to the project root and using `/` as separators - */ -function getRelativeFilename(context) { - const filename = path.normalize(context.getFilename()); - return filename.substring(REPO_ROOT.length).replace(/\\/g, '/'); -} -module.exports = new class { - constructor() { - this.meta = { - messages: { - badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization', - badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - this._optionsCache = new WeakMap(); - } - create(context) { - const options = context.options; - const configs = this._processOptions(options); - const relativeFilename = getRelativeFilename(context); - for (const config of configs) { - if (minimatch(relativeFilename, config.target)) { - return (0, utils_1.createImportRuleListener)((node, value) => this._checkImport(context, config, node, value)); - } - } - context.report({ - loc: { line: 1, column: 0 }, - messageId: 'badFilename' - }); - return {}; - } - _processOptions(options) { - if (this._optionsCache.has(options)) { - return this._optionsCache.get(options); - } - function orSegment(variants) { - return (variants.length === 1 ? variants[0] : `{${variants.join(',')}}`); - } - const layerRules = [ - { layer: 'common', deps: orSegment(['common']) }, - { layer: 'worker', deps: orSegment(['common', 'worker']) }, - { layer: 'browser', deps: orSegment(['common', 'browser']), isBrowser: true }, - { layer: 'electron-sandbox', deps: orSegment(['common', 'browser', 'electron-sandbox']), isBrowser: true }, - { layer: 'node', deps: orSegment(['common', 'node']), isNode: true }, - { layer: 'electron-browser', deps: orSegment(['common', 'browser', 'node', 'electron-sandbox', 'electron-browser']), isBrowser: true, isNode: true }, - { layer: 'electron-main', deps: orSegment(['common', 'node', 'electron-main']), isNode: true }, - ]; - let browserAllow = []; - let nodeAllow = []; - let testAllow = []; - for (const option of options) { - if (isLayerAllowRule(option)) { - if (option.when === 'hasBrowser') { - browserAllow = option.allow.slice(0); - } - else if (option.when === 'hasNode') { - nodeAllow = option.allow.slice(0); - } - else if (option.when === 'test') { - testAllow = option.allow.slice(0); - } - } - } - function findLayer(layer) { - for (const layerRule of layerRules) { - if (layerRule.layer === layer) { - return layerRule; - } - } - return null; - } - function generateConfig(layerRule, target, rawRestrictions) { - const restrictions = []; - const testRestrictions = [...testAllow]; - if (layerRule.isBrowser) { - restrictions.push(...browserAllow); - } - if (layerRule.isNode) { - restrictions.push(...nodeAllow); - } - for (const rawRestriction of rawRestrictions) { - let importPattern; - let when = undefined; - if (typeof rawRestriction === 'string') { - importPattern = rawRestriction; - } - else { - importPattern = rawRestriction.pattern; - when = rawRestriction.when; - } - if (typeof when === 'undefined' - || (when === 'hasBrowser' && layerRule.isBrowser) - || (when === 'hasNode' && layerRule.isNode)) { - restrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); - testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); - } - else if (when === 'test') { - testRestrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); - testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); - } - } - testRestrictions.push(...restrictions); - return [ - { - target: target.replace(/\/\~$/, `/${layerRule.layer}/**`), - restrictions: restrictions - }, - { - target: target.replace(/\/\~$/, `/test/${layerRule.layer}/**`), - restrictions: testRestrictions - } - ]; - } - const configs = []; - for (const option of options) { - if (isLayerAllowRule(option)) { - continue; - } - const target = option.target; - const targetIsVS = /^src\/vs\//.test(target); - const restrictions = (typeof option.restrictions === 'string' ? [option.restrictions] : option.restrictions).slice(0); - if (targetIsVS) { - // Always add "vs/nls" - restrictions.push('vs/nls'); - } - if (targetIsVS && option.layer) { - // single layer => simple substitution for /~ - const layerRule = findLayer(option.layer); - if (layerRule) { - const [config, testConfig] = generateConfig(layerRule, target, restrictions); - if (option.test) { - configs.push(testConfig); - } - else { - configs.push(config); - } - } - } - else if (targetIsVS && /\/\~$/.test(target)) { - // generate all layers - for (const layerRule of layerRules) { - const [config, testConfig] = generateConfig(layerRule, target, restrictions); - configs.push(config); - configs.push(testConfig); - } - } - else { - configs.push({ target, restrictions: restrictions.filter(r => typeof r === 'string') }); - } - } - this._optionsCache.set(options, configs); - return configs; - } - _checkImport(context, config, node, importPath) { - // resolve relative paths - if (importPath[0] === '.') { - const relativeFilename = getRelativeFilename(context); - importPath = path.posix.join(path.posix.dirname(relativeFilename), importPath); - if (/^src\/vs\//.test(importPath)) { - // resolve using AMD base url - importPath = importPath.substring('src/'.length); - } - } - const restrictions = config.restrictions; - let matched = false; - for (const pattern of restrictions) { - if (minimatch(importPath, pattern)) { - matched = true; - break; - } - } - if (!matched) { - // None of the restrictions matched - context.report({ - loc: node.loc, - messageId: 'badImport', - data: { - restrictions: restrictions.join(' or ') - } - }); - } - } -}; diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js deleted file mode 100644 index bcb413d9db3..00000000000 --- a/build/lib/eslint/code-layering.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class { - constructor() { - this.meta = { - messages: { - layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - } - create(context) { - const fileDirname = (0, path_1.dirname)(context.getFilename()); - const parts = fileDirname.split(/\\|\//); - const ruleArgs = context.options[0]; - let config; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config.allowed.has(key)) { - config.disallowed.add(key); - } - }); - break; - } - } - if (!config) { - // nothing - return {}; - } - return (0, utils_1.createImportRuleListener)((node, path) => { - if (path[0] === '.') { - path = (0, path_1.join)((0, path_1.dirname)(context.getFilename()), path); - } - const parts = (0, path_1.dirname)(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (config.allowed.has(part)) { - // GOOD - same layer - break; - } - if (config.disallowed.has(part)) { - // BAD - wrong layer - context.report({ - loc: node.loc, - messageId: 'layerbreaker', - data: { - from: part, - allowed: [...config.allowed.keys()].join(', ') - } - }); - break; - } - } - }); - } -}; diff --git a/build/lib/eslint/code-no-look-behind-regex.js b/build/lib/eslint/code-no-look-behind-regex.js deleted file mode 100644 index c7cdf44c181..00000000000 --- a/build/lib/eslint/code-no-look-behind-regex.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -const _positiveLookBehind = /\(\?<=.+/; -const _negativeLookBehind = /\(\? { - const pattern = node.regex?.pattern; - if (_containsLookBehind(pattern)) { - context.report({ - node, - message: 'Look behind assertions are not yet supported in all browsers' - }); - } - }, - // new Regex("...") - ['NewExpression[callee.name="RegExp"] Literal']: (node) => { - if (_containsLookBehind(node.value)) { - context.report({ - node, - message: 'Look behind assertions are not yet supported in all browsers' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js deleted file mode 100644 index 36782a4b5bc..00000000000 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class NoNlsInStandaloneEditorRule { - constructor() { - this.meta = { - messages: { - noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' - } - }; - } - create(context) { - const fileName = context.getFilename(); - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) { - return (0, utils_1.createImportRuleListener)((node, path) => { - // resolve relative paths - if (path[0] === '.') { - path = (0, path_1.join)(context.getFilename(), path); - } - if (/vs(\/|\\)nls/.test(path)) { - context.report({ - loc: node.loc, - messageId: 'noNls' - }); - } - }); - } - return {}; - } -}; diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js deleted file mode 100644 index c57bd560bcf..00000000000 --- a/build/lib/eslint/code-no-standalone-editor.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class NoNlsInStandaloneEditorRule { - constructor() { - this.meta = { - messages: { - badImport: 'Not allowed to import standalone editor modules.' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - } - create(context) { - if (/vs(\/|\\)editor/.test(context.getFilename())) { - // the vs/editor folder is allowed to use the standalone editor - return {}; - } - return (0, utils_1.createImportRuleListener)((node, path) => { - // resolve relative paths - if (path[0] === '.') { - path = (0, path_1.join)(context.getFilename(), path); - } - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { - context.report({ - loc: node.loc, - messageId: 'badImport' - }); - } - }); - } -}; diff --git a/build/lib/eslint/code-no-test-only.js b/build/lib/eslint/code-no-test-only.js deleted file mode 100644 index 46d144bfcaf..00000000000 --- a/build/lib/eslint/code-no-test-only.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class NoTestOnly { - create(context) { - return { - ['MemberExpression[object.name="test"][property.name="only"]']: (node) => { - return context.report({ - node, - message: 'test.only is a dev-time tool and CANNOT be pushed' - }); - } - }; - } -}; diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js deleted file mode 100644 index 48b591f8d3d..00000000000 --- a/build/lib/eslint/code-no-unexternalized-strings.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -function isStringLiteral(node) { - return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; -} -function isDoubleQuoted(node) { - return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; -} -module.exports = new (_a = class NoUnexternalizedStrings { - constructor() { - this.meta = { - messages: { - doubleQuoted: 'Only use double-quoted strings for externalized strings.', - badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', - duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', - badMessage: 'Message argument to \'{{message}}\' must be a string literal.' - } - }; - } - create(context) { - const externalizedStringLiterals = new Map(); - const doubleQuotedStringLiterals = new Set(); - function collectDoubleQuotedStrings(node) { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - } - function visitLocalizeCall(node) { - // localize(key, message) - const [keyNode, messageNode] = node.arguments; - // (1) - // extract key so that it can be checked later - let key; - if (isStringLiteral(keyNode)) { - doubleQuotedStringLiterals.delete(keyNode); - key = keyNode.value; - } - else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { - for (const property of keyNode.properties) { - if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - doubleQuotedStringLiterals.delete(property.value); - key = property.value.value; - break; - } - } - } - } - } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); - } - // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); - } - } - function reportBadStringsAndBadKeys() { - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } - for (const [key, values] of externalizedStringLiterals) { - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (const value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } - } - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } - } - } - } - } - return { - ['Literal']: (node) => collectDoubleQuotedStrings(node), - ['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node), - ['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), - ['Program:exit']: reportBadStringsAndBadKeys, - }; - } - }, - _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, - _a); diff --git a/build/lib/eslint/code-no-unused-expressions.js b/build/lib/eslint/code-no-unused-expressions.js deleted file mode 100644 index 5d9710072e6..00000000000 --- a/build/lib/eslint/code-no-unused-expressions.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -module.exports = { - meta: { - type: 'suggestion', - docs: { - description: 'disallow unused expressions', - category: 'Best Practices', - recommended: false, - url: 'https://eslint.org/docs/rules/no-unused-expressions' - }, - schema: [ - { - type: 'object', - properties: { - allowShortCircuit: { - type: 'boolean', - default: false - }, - allowTernary: { - type: 'boolean', - default: false - }, - allowTaggedTemplates: { - type: 'boolean', - default: false - } - }, - additionalProperties: false - } - ] - }, - create(context) { - const config = context.options[0] || {}, allowShortCircuit = config.allowShortCircuit || false, allowTernary = config.allowTernary || false, allowTaggedTemplates = config.allowTaggedTemplates || false; - // eslint-disable-next-line jsdoc/require-description - /** - * @param node any node - * @returns whether the given node structurally represents a directive - */ - function looksLikeDirective(node) { - return node.type === 'ExpressionStatement' && - node.expression.type === 'Literal' && typeof node.expression.value === 'string'; - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param predicate ([a] -> Boolean) the function used to make the determination - * @param list the input list - * @returns the leading sequence of members in the given list that pass the given predicate - */ - function takeWhile(predicate, list) { - for (let i = 0; i < list.length; ++i) { - if (!predicate(list[i])) { - return list.slice(0, i); - } - } - return list.slice(); - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param node a Program or BlockStatement node - * @returns the leading sequence of directive nodes in the given node's body - */ - function directives(node) { - return takeWhile(looksLikeDirective, node.body); - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param node any node - * @param ancestors the given node's ancestors - * @returns whether the given node is considered a directive in its current position - */ - function isDirective(node, ancestors) { - const parent = ancestors[ancestors.length - 1], grandparent = ancestors[ancestors.length - 2]; - return (parent.type === 'Program' || parent.type === 'BlockStatement' && - (/Function/u.test(grandparent.type))) && - directives(parent).indexOf(node) >= 0; - } - /** - * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. - * @param node any node - * @returns whether the given node is a valid expression - */ - function isValidExpression(node) { - if (allowTernary) { - // Recursive check for ternary and logical expressions - if (node.type === 'ConditionalExpression') { - return isValidExpression(node.consequent) && isValidExpression(node.alternate); - } - } - if (allowShortCircuit) { - if (node.type === 'LogicalExpression') { - return isValidExpression(node.right); - } - } - if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') { - return true; - } - if (node.type === 'ExpressionStatement') { - return isValidExpression(node.expression); - } - return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await|Chain)Expression$/u.test(node.type) || - (node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0); - } - return { - ExpressionStatement(node) { - if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) { - context.report({ node: node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` }); - } - } - }; - } -}; diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js deleted file mode 100644 index 30b63429521..00000000000 --- a/build/lib/eslint/code-translation-remind.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const fs_1 = require("fs"); -const utils_1 = require("./utils"); -module.exports = new (_a = class TranslationRemind { - constructor() { - this.meta = { - messages: { - missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' - } - }; - } - create(context) { - return (0, utils_1.createImportRuleListener)((node, path) => this._checkImport(context, node, path)); - } - _checkImport(context, node, path) { - if (path !== TranslationRemind.NLS_MODULE) { - return; - } - const currentFile = context.getFilename(); - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - const resource = matchService ? matchService[0] : matchPart[0]; - let resourceDefined = false; - let json; - try { - json = (0, fs_1.readFileSync)('./build/lib/i18n.resources.json', 'utf8'); - } - catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - workbenchResources.forEach((existingResource) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - if (!resourceDefined) { - context.report({ - loc: node.loc, - messageId: 'missing', - data: { resource } - }); - } - } - }, - _a.NLS_MODULE = 'vs/nls', - _a); diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js deleted file mode 100644 index c58e4e24be1..00000000000 --- a/build/lib/eslint/utils.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createImportRuleListener = void 0; -function createImportRuleListener(validateImport) { - function _checkImport(node) { - if (node && node.type === 'Literal' && typeof node.value === 'string') { - validateImport(node, node.value); - } - } - return { - // import ??? from 'module' - ImportDeclaration: (node) => { - _checkImport(node.source); - }, - // import('module').then(...) OR await import('module') - ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => { - _checkImport(node); - }, - // import foo = ... - ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => { - _checkImport(node); - }, - // export ?? from 'module' - ExportAllDeclaration: (node) => { - _checkImport(node.source); - }, - // export {foo} from 'module' - ExportNamedDeclaration: (node) => { - _checkImport(node.source); - }, - }; -} -exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint/vscode-dts-cancellation.js b/build/lib/eslint/vscode-dts-cancellation.js deleted file mode 100644 index 65b9e4c1fe1..00000000000 --- a/build/lib/eslint/vscode-dts-cancellation.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new class ApiProviderNaming { - constructor() { - this.meta = { - messages: { - noToken: 'Function lacks a cancellation token, preferable as last argument', - } - }; - } - create(context) { - return { - ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node) => { - let found = false; - for (const param of node.params) { - if (param.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - found = found || param.name === 'token'; - } - } - if (!found) { - context.report({ - node, - messageId: 'noToken' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-create-func.js b/build/lib/eslint/vscode-dts-create-func.js deleted file mode 100644 index e9ec659cef1..00000000000 --- a/build/lib/eslint/vscode-dts-create-func.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new class ApiLiteralOrTypes { - constructor() { - this.meta = { - docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' }, - messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', } - }; - } - create(context) { - return { - ['TSDeclareFunction Identifier[name=/create.*/]']: (node) => { - const decl = node.parent; - if (decl.returnType?.typeAnnotation.type !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) { - return; - } - if (decl.returnType.typeAnnotation.typeName.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) { - return; - } - const ident = decl.returnType.typeAnnotation.typeName.name; - if (ident === 'Promise' || ident === 'Thenable') { - context.report({ - node, - messageId: 'sync' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-event-naming.js b/build/lib/eslint/vscode-dts-event-naming.js deleted file mode 100644 index 747e224b397..00000000000 --- a/build/lib/eslint/vscode-dts-event-naming.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new (_a = class ApiEventNaming { - constructor() { - this.meta = { - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#event-naming' - }, - messages: { - naming: 'Event names must follow this patten: `on[Did|Will]`', - verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration', - subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API', - unknown: 'UNKNOWN event declaration, lint-rule needs tweaking' - } - }; - } - create(context) { - const config = context.options[0]; - const allowed = new Set(config.allowed); - const verbs = new Set(config.verbs); - return { - ['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node) => { - const def = node.parent?.parent?.parent; - const ident = this.getIdent(def); - if (!ident) { - // event on unknown structure... - return context.report({ - node, - message: 'unknown' - }); - } - if (allowed.has(ident.name)) { - // configured exception - return; - } - const match = ApiEventNaming._nameRegExp.exec(ident.name); - if (!match) { - context.report({ - node: ident, - messageId: 'naming' - }); - return; - } - // check that is spelled out (configured) as verb - if (!verbs.has(match[2].toLowerCase())) { - context.report({ - node: ident, - messageId: 'verb', - data: { verb: match[2] } - }); - } - // check that a subject (if present) has occurred - if (match[3]) { - const regex = new RegExp(match[3], 'ig'); - const parts = context.getSourceCode().getText().split(regex); - if (parts.length < 3) { - context.report({ - node: ident, - messageId: 'subject', - data: { subject: match[3] } - }); - } - } - } - }; - } - getIdent(def) { - if (!def) { - return; - } - if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - return def; - } - else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - return def.key; - } - return this.getIdent(def.parent); - } - }, - _a._nameRegExp = /on(Did|Will)([A-Z][a-z]+)([A-Z][a-z]+)?/, - _a); diff --git a/build/lib/eslint/vscode-dts-interface-naming.js b/build/lib/eslint/vscode-dts-interface-naming.js deleted file mode 100644 index 70ca810825b..00000000000 --- a/build/lib/eslint/vscode-dts-interface-naming.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -module.exports = new (_a = class ApiInterfaceNaming { - constructor() { - this.meta = { - messages: { - naming: 'Interfaces must not be prefixed with uppercase `I`', - } - }; - } - create(context) { - return { - ['TSInterfaceDeclaration Identifier']: (node) => { - const name = node.name; - if (ApiInterfaceNaming._nameRegExp.test(name)) { - context.report({ - node, - messageId: 'naming' - }); - } - } - }; - } - }, - _a._nameRegExp = /I[A-Z]/, - _a); diff --git a/build/lib/eslint/vscode-dts-literal-or-types.js b/build/lib/eslint/vscode-dts-literal-or-types.js deleted file mode 100644 index e4c075db91c..00000000000 --- a/build/lib/eslint/vscode-dts-literal-or-types.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiLiteralOrTypes { - constructor() { - this.meta = { - docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' }, - messages: { useEnum: 'Use enums, not literal-or-types', } - }; - } - create(context) { - return { - ['TSTypeAnnotation TSUnionType']: (node) => { - if (node.types.every(value => value.type === 'TSLiteralType')) { - context.report({ - node: node, - messageId: 'useEnum' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-provider-naming.js b/build/lib/eslint/vscode-dts-provider-naming.js deleted file mode 100644 index 44c2ddd5568..00000000000 --- a/build/lib/eslint/vscode-dts-provider-naming.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -module.exports = new (_a = class ApiProviderNaming { - constructor() { - this.meta = { - messages: { - naming: 'A provider should only have functions like provideXYZ or resolveXYZ', - } - }; - } - create(context) { - const config = context.options[0]; - const allowed = new Set(config.allowed); - return { - ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature']: (node) => { - const interfaceName = (node.parent?.parent).id.name; - if (allowed.has(interfaceName)) { - // allowed - return; - } - const methodName = node.key.name; - if (!ApiProviderNaming._providerFunctionNames.test(methodName)) { - context.report({ - node, - messageId: 'naming' - }); - } - } - }; - } - }, - _a._providerFunctionNames = /^(provide|resolve|prepare).+/, - _a); diff --git a/build/lib/eslint/vscode-dts-region-comments.js b/build/lib/eslint/vscode-dts-region-comments.js deleted file mode 100644 index 2dc9487314e..00000000000 --- a/build/lib/eslint/vscode-dts-region-comments.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiEventNaming { - constructor() { - this.meta = { - messages: { - comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/', - } - }; - } - create(context) { - const sourceCode = context.getSourceCode(); - return { - ['Program']: (_node) => { - for (const comment of sourceCode.getAllComments()) { - if (comment.type !== 'Line') { - continue; - } - if (!/^\s*#region /.test(comment.value)) { - continue; - } - if (!/^\s*#region ([a-z]+): (@[a-z]+|https:\/\/github.com\/microsoft\/vscode\/issues\/\d+)/i.test(comment.value)) { - context.report({ - node: comment, - messageId: 'comment', - }); - } - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-use-thenable.js b/build/lib/eslint/vscode-dts-use-thenable.js deleted file mode 100644 index 7e23953cb69..00000000000 --- a/build/lib/eslint/vscode-dts-use-thenable.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiEventNaming { - constructor() { - this.meta = { - messages: { - usage: 'Use the Thenable-type instead of the Promise type', - } - }; - } - create(context) { - return { - ['TSTypeAnnotation TSTypeReference Identifier[name="Promise"]']: (node) => { - context.report({ - node, - messageId: 'usage', - }); - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.js b/build/lib/eslint/vscode-dts-vscode-in-comments.js deleted file mode 100644 index 8f9a13fb01f..00000000000 --- a/build/lib/eslint/vscode-dts-vscode-in-comments.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiVsCodeInComments { - constructor() { - this.meta = { - messages: { - comment: `Don't use the term 'vs code' in comments` - } - }; - } - create(context) { - const sourceCode = context.getSourceCode(); - return { - ['Program']: (_node) => { - for (const comment of sourceCode.getAllComments()) { - if (comment.type !== 'Block') { - continue; - } - if (!comment.range) { - continue; - } - const startIndex = comment.range[0] + '/*'.length; - const re = /vs code/ig; - let match; - while ((match = re.exec(comment.value))) { - // Allow using 'VS Code' in quotes - if (comment.value[match.index - 1] === `'` && comment.value[match.index + match[0].length] === `'`) { - continue; - } - // Types for eslint seem incorrect - const start = sourceCode.getLocFromIndex(startIndex + match.index); - const end = sourceCode.getLocFromIndex(startIndex + match.index + match[0].length); - context.report({ - messageId: 'comment', - loc: { start, end } - }); - } - } - } - }; - } -}; diff --git a/build/tsconfig.build.json b/build/tsconfig.build.json index 0a00f2d0f48..801c7735b06 100644 --- a/build/tsconfig.build.json +++ b/build/tsconfig.build.json @@ -7,5 +7,8 @@ }, "include": [ "**/*.ts" + ], + "exclude": [ + "lib/eslint-plugin-vscode/**/*" ] } diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 392ec661728..d9b8862a885 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -481,7 +481,7 @@ export class Git { const repoUri = Uri.file(repoPath); const pathUri = Uri.file(repositoryPath); if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) { - // eslint-disable-next-line code-no-look-behind-regex + // eslint-disable-next-line @vscode/code-no-look-behind-regex const match = /(?<=^\/?)([a-zA-Z])(?=:\/)/.exec(pathUri.path); if (match !== null) { const [, letter] = match; diff --git a/package.json b/package.json index 43ba684d476..26b09e1612c 100644 --- a/package.json +++ b/package.json @@ -125,6 +125,7 @@ "@types/yazl": "^2.4.2", "@typescript-eslint/eslint-plugin": "^5.10.0", "@typescript-eslint/parser": "^5.10.0", + "@vscode/eslint-plugin": "link:./build/lib/eslint-plugin-vscode", "@vscode/telemetry-extractor": "^1.9.8", "@vscode/test-web": "^0.0.29", "ansi-colors": "^3.2.3", @@ -200,6 +201,7 @@ "source-map-support": "^0.3.2", "style-loader": "^1.3.0", "ts-loader": "^9.2.7", + "ts-node": "^10.9.1", "tsec": "0.1.4", "typescript": "^4.9.0-dev.20220825", "typescript-formatter": "7.1.0", diff --git a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts index f4b242a0c69..6717ac6c813 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts @@ -10,7 +10,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { ICommandDetectionCapability, TerminalCapability, ITerminalCommand, IHandleCommandOptions, ICommandInvalidationRequest, CommandInvalidationReason } from 'vs/platform/terminal/common/capabilities/capabilities'; import { ISerializedCommand, ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line @vscode/code-import-patterns import type { IBuffer, IBufferLine, IDisposable, IMarker, Terminal } from 'xterm-headless'; export interface ICurrentPartialCommand { diff --git a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts index 932413459a3..3fba8a8daea 100644 --- a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts @@ -6,7 +6,7 @@ import { Emitter } from 'vs/base/common/event'; import { IPartialCommandDetectionCapability, TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line @vscode/code-import-patterns import { IMarker, Terminal } from 'xterm-headless'; const enum Constants { diff --git a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts index b824242c7b5..2788f40fec4 100644 --- a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts +++ b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts @@ -12,7 +12,7 @@ import { ICommandDetectionCapability, ICwdDetectionCapability, TerminalCapabilit import { PartialCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/partialCommandDetectionCapability'; import { ILogService } from 'vs/platform/log/common/log'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line @vscode/code-import-patterns import type { ITerminalAddon, Terminal } from 'xterm-headless'; import { ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; diff --git a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts index 4bd0f073a2c..fb7625c54bd 100644 --- a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts +++ b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts @@ -13,7 +13,7 @@ import { getPathFromAmdModule } from 'vs/base/test/node/testUtils'; import { CancellationToken } from 'vs/base/common/cancellation'; import { RequestService } from 'vs/platform/request/node/requestService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line @vscode/code-import-patterns import 'vs/workbench/workbench.desktop.main'; import { NullLogService } from 'vs/platform/log/common/log'; import { mock } from 'vs/base/test/common/mock'; diff --git a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts index 35d0657b669..85ab6db9e1f 100644 --- a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* eslint-disable code-import-patterns */ -/* eslint-disable code-layering */ +/* eslint-disable @vscode/code-import-patterns */ +/* eslint-disable @vscode/code-layering */ import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; diff --git a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts index f988913ea61..dc34afce5d5 100644 --- a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts +++ b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts @@ -23,7 +23,7 @@ declare module 'vscode' { * * @return Thenable indicating that the webview editor has been moved. */ - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line @vscode/vscode-dts-provider-naming moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable; } } diff --git a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts index f1fbb770d8e..8b7a117daa5 100644 --- a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +++ b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts @@ -16,7 +16,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProviderNew { - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line @vscode/vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItemNew): void; } @@ -29,7 +29,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProvider { - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line @vscode/vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItem): void; } diff --git a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts index 80fc9fd9423..02e4b20626d 100644 --- a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts +++ b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts @@ -5,7 +5,7 @@ declare module 'vscode' { - // eslint-disable-next-line vscode-dts-region-comments + // eslint-disable-next-line @vscode/vscode-dts-region-comments // @roblourens: debugUI.simple: https://github.com/microsoft/vscode/issues/147264. Used for Jupyter's Run By Line. // suppressSaveBeforeStart: https://github.com/microsoft/vscode/issues/147263. Used to enable debugging untitled/unsaved notebooks. diff --git a/src/vscode-dts/vscode.proposed.resolvers.d.ts b/src/vscode-dts/vscode.proposed.resolvers.d.ts index 1575fa7c8b9..1e86d0f8be5 100644 --- a/src/vscode-dts/vscode.proposed.resolvers.d.ts +++ b/src/vscode-dts/vscode.proposed.resolvers.d.ts @@ -196,7 +196,7 @@ declare module 'vscode' { export interface ResourceLabelFormatting { label: string; // myLabel:/${path} // For historic reasons we use an or string here. Once we finalize this API we should start using enums instead and adopt it in extensions. - // eslint-disable-next-line vscode-dts-literal-or-types + // eslint-disable-next-line @vscode/vscode-dts-literal-or-types separator: '/' | '\\' | ''; tildify?: boolean; normalizeDriveLetter?: boolean; diff --git a/test/monaco/esm-check/index.js b/test/monaco/esm-check/index.js index 3e585d5bd58..b1c4c3b5e87 100644 --- a/test/monaco/esm-check/index.js +++ b/test/monaco/esm-check/index.js @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// eslint-disable-next-line code-no-standalone-editor +// eslint-disable-next-line @vscode/code-no-standalone-editor import * as monaco from './out/vs/editor/editor.main.js'; monaco.editor.create(document.getElementById('container'), { diff --git a/yarn.lock b/yarn.lock index c408f749974..9176b596279 100644 --- a/yarn.lock +++ b/yarn.lock @@ -303,6 +303,13 @@ "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@discoveryjs/json-ext@^0.5.0": version "0.5.3" resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz#90420f9f9c6d3987f176a19a7d8e764271a2f55d" @@ -418,6 +425,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping@^0.3.9": version "0.3.14" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" @@ -695,6 +710,26 @@ mkdirp "^1.0.4" path-browserify "^1.0.1" +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -1090,6 +1125,10 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== +"@vscode/eslint-plugin@link:./build/lib/eslint-plugin-vscode": + version "0.0.0" + uid "" + "@vscode/iconv-lite-umd@0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48" @@ -1470,6 +1509,11 @@ acorn-jsx@^5.3.1: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + acorn@^6.0.7, acorn@^6.4.1: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" @@ -1698,6 +1742,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2988,6 +3037,11 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3542,6 +3596,11 @@ diff@5.0.0, diff@^5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -6844,6 +6903,11 @@ make-dir@^3.0.2: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -10437,6 +10501,25 @@ ts-morph@^15.1.0: "@ts-morph/common" "~0.16.0" code-block-writer "^11.0.0" +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tsec@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/tsec/-/tsec-0.1.4.tgz#dc8743c28ad01230ea4692e326866e0d54487f3f" @@ -10779,6 +10862,11 @@ uuid@^8.3.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + v8-compile-cache@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" @@ -11573,6 +11661,11 @@ ylru@^1.2.0: resolved "https://registry.yarnpkg.com/ylru/-/ylru-1.2.1.tgz#f576b63341547989c1de7ba288760923b27fe84f" integrity sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ== +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" From 757b4ff1dd4b5460dc190c96046f16ab6ac1fae5 Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Mon, 29 Aug 2022 11:07:17 -0700 Subject: [PATCH 07/21] Open Insiders install link when in Insiders --- src/vs/workbench/browser/window.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/window.ts b/src/vs/workbench/browser/window.ts index 254bdc18153..305709c53da 100644 --- a/src/vs/workbench/browser/window.ts +++ b/src/vs/workbench/browser/window.ts @@ -223,7 +223,11 @@ export class BrowserWindow extends Disposable { if (showResult.choice === 0) { invokeProtocolHandler(); } else if (showResult.choice === 1) { - await this.openerService.open(URI.parse(`http://aka.ms/vscode-install`)); + await this.openerService.open(URI.parse( + this.productService.quality === 'stable' + ? `http://aka.ms/vscode-install` + : `http://aka.ms/vscode-install-insiders` + )); } } } From 43ae67e42ee425e69ccc29eff95fd62a91c352c0 Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Mon, 29 Aug 2022 11:18:49 -0700 Subject: [PATCH 08/21] Keep dialog open after user clicks on install link --- src/vs/workbench/browser/window.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/window.ts b/src/vs/workbench/browser/window.ts index 305709c53da..52dcef61e86 100644 --- a/src/vs/workbench/browser/window.ts +++ b/src/vs/workbench/browser/window.ts @@ -203,9 +203,7 @@ export class BrowserWindow extends Disposable { invokeProtocolHandler(); - // We cannot know whether the protocol handler succeeded. - // Display guidance in case it did not, e.g. the app is not installed locally. - if (matchesScheme(href, this.productService.urlProtocol)) { + const showProtocolUrlOpenedDialog = async () => { const showResult = await this.dialogService.show( Severity.Info, localize('openExternalDialogTitle', "All done. You can close this tab now."), @@ -223,12 +221,22 @@ export class BrowserWindow extends Disposable { if (showResult.choice === 0) { invokeProtocolHandler(); } else if (showResult.choice === 1) { + // Route the user to the appropriate install link await this.openerService.open(URI.parse( this.productService.quality === 'stable' ? `http://aka.ms/vscode-install` : `http://aka.ms/vscode-install-insiders` )); + + // Re-show the dialog so that the user can come back after installing and try again + showProtocolUrlOpenedDialog(); } + }; + + // We cannot know whether the protocol handler succeeded. + // Display guidance in case it did not, e.g. the app is not installed locally. + if (matchesScheme(href, this.productService.urlProtocol)) { + await showProtocolUrlOpenedDialog(); } } From 9e5248072aa783958d41308f515d6d04aa5f3ebe Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 11:51:12 -0700 Subject: [PATCH 09/21] Fix ts-node for eslint (#159483) Bumps the cachesalt to make sure ts-node is installed --- .eslintrc.json | 43 ++-- .vscode/settings.json | 5 + build/eslint.js | 3 +- build/hygiene.js | 3 +- build/lib/eslint-plugin-vscode/index.js | 12 -- build/lib/eslint-plugin-vscode/package.json | 6 - build/lib/eslint/code-import-patterns.js | 199 ++++++++++++++++++ .../code-import-patterns.ts | 2 +- build/lib/eslint/code-layering.js | 68 ++++++ .../code-layering.ts | 0 build/lib/eslint/code-no-look-behind-regex.js | 42 ++++ .../code-no-look-behind-regex.ts | 0 .../code-no-nls-in-standalone-editor.js | 38 ++++ .../code-no-nls-in-standalone-editor.ts | 0 build/lib/eslint/code-no-standalone-editor.js | 41 ++++ .../code-no-standalone-editor.ts | 0 build/lib/eslint/code-no-test-only.js | 17 ++ .../code-no-test-only.ts | 0 .../eslint/code-no-unexternalized-strings.js | 111 ++++++++++ .../code-no-unexternalized-strings.ts | 0 .../lib/eslint/code-no-unused-expressions.js | 119 +++++++++++ .../code-no-unused-expressions.ts | 0 build/lib/eslint/code-translation-remind.js | 57 +++++ .../code-translation-remind.ts | 0 build/lib/eslint/utils.js | 37 ++++ .../{eslint-plugin-vscode => eslint}/utils.ts | 0 build/lib/eslint/vscode-dts-cancellation.js | 33 +++ .../vscode-dts-cancellation.ts | 0 build/lib/eslint/vscode-dts-create-func.js | 34 +++ .../vscode-dts-create-func.ts | 0 build/lib/eslint/vscode-dts-event-naming.js | 86 ++++++++ .../vscode-dts-event-naming.ts | 0 .../lib/eslint/vscode-dts-interface-naming.js | 30 +++ .../vscode-dts-interface-naming.ts | 0 .../lib/eslint/vscode-dts-literal-or-types.js | 25 +++ .../vscode-dts-literal-or-types.ts | 0 .../lib/eslint/vscode-dts-provider-naming.js | 37 ++++ .../vscode-dts-provider-naming.ts | 0 .../lib/eslint/vscode-dts-region-comments.js | 35 +++ .../vscode-dts-region-comments.ts | 0 build/lib/eslint/vscode-dts-use-thenable.js | 24 +++ .../vscode-dts-use-thenable.ts | 0 .../eslint/vscode-dts-vscode-in-comments.js | 45 ++++ .../vscode-dts-vscode-in-comments.ts | 0 build/tsconfig.build.json | 3 - extensions/git/src/git.ts | 2 +- package.json | 2 - .../commandDetectionCapability.ts | 2 +- .../partialCommandDetectionCapability.ts | 2 +- .../common/xterm/shellIntegrationAddon.ts | 2 +- .../colorRegistry.releaseTest.ts | 2 +- .../nativeLocalProcessExtensionHost.ts | 4 +- .../vscode.proposed.customEditorMove.d.ts | 2 +- ...e.proposed.inlineCompletionsAdditions.d.ts | 4 +- .../vscode.proposed.notebookDebugOptions.d.ts | 2 +- src/vscode-dts/vscode.proposed.resolvers.d.ts | 2 +- test/monaco/esm-check/index.js | 2 +- yarn.lock | 93 -------- 58 files changed, 1122 insertions(+), 154 deletions(-) delete mode 100644 build/lib/eslint-plugin-vscode/index.js delete mode 100644 build/lib/eslint-plugin-vscode/package.json create mode 100644 build/lib/eslint/code-import-patterns.js rename build/lib/{eslint-plugin-vscode => eslint}/code-import-patterns.ts (99%) create mode 100644 build/lib/eslint/code-layering.js rename build/lib/{eslint-plugin-vscode => eslint}/code-layering.ts (100%) create mode 100644 build/lib/eslint/code-no-look-behind-regex.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-look-behind-regex.ts (100%) create mode 100644 build/lib/eslint/code-no-nls-in-standalone-editor.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-nls-in-standalone-editor.ts (100%) create mode 100644 build/lib/eslint/code-no-standalone-editor.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-standalone-editor.ts (100%) create mode 100644 build/lib/eslint/code-no-test-only.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-test-only.ts (100%) create mode 100644 build/lib/eslint/code-no-unexternalized-strings.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-unexternalized-strings.ts (100%) create mode 100644 build/lib/eslint/code-no-unused-expressions.js rename build/lib/{eslint-plugin-vscode => eslint}/code-no-unused-expressions.ts (100%) create mode 100644 build/lib/eslint/code-translation-remind.js rename build/lib/{eslint-plugin-vscode => eslint}/code-translation-remind.ts (100%) create mode 100644 build/lib/eslint/utils.js rename build/lib/{eslint-plugin-vscode => eslint}/utils.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-cancellation.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-cancellation.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-create-func.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-create-func.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-event-naming.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-event-naming.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-interface-naming.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-interface-naming.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-literal-or-types.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-literal-or-types.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-provider-naming.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-provider-naming.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-region-comments.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-region-comments.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-use-thenable.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-use-thenable.ts (100%) create mode 100644 build/lib/eslint/vscode-dts-vscode-in-comments.js rename build/lib/{eslint-plugin-vscode => eslint}/vscode-dts-vscode-in-comments.ts (100%) diff --git a/.eslintrc.json b/.eslintrc.json index dab9cca276b..d86f6103a7d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,8 +8,7 @@ "plugins": [ "@typescript-eslint", "jsdoc", - "header", - "@vscode" + "header" ], "rules": { "constructor-super": "warn", @@ -62,17 +61,17 @@ ] } ], - "@vscode/code-no-unused-expressions": [ + "code-no-unused-expressions": [ "warn", { "allowTernary": true } ], - "@vscode/code-translation-remind": "warn", - "@vscode/code-no-nls-in-standalone-editor": "warn", - "@vscode/code-no-standalone-editor": "warn", - "@vscode/code-no-unexternalized-strings": "warn", - "@vscode/code-layering": [ + "code-translation-remind": "warn", + "code-no-nls-in-standalone-editor": "warn", + "code-no-standalone-editor": "warn", + "code-no-unexternalized-strings": "warn", + "code-layering": [ "warn", { "common": [], @@ -123,8 +122,8 @@ "**/*.test.ts" ], "rules": { - "@vscode/code-no-test-only": "error", - "@vscode/code-no-unexternalized-strings": "off" + "code-no-test-only": "error", + "code-no-unexternalized-strings": "off" } }, { @@ -133,14 +132,14 @@ "**/vscode.proposed.*.d.ts" ], "rules": { - "@vscode/vscode-dts-create-func": "warn", - "@vscode/vscode-dts-literal-or-types": "warn", - "@vscode/vscode-dts-interface-naming": "warn", - "@vscode/vscode-dts-cancellation": "warn", - "@vscode/vscode-dts-use-thenable": "warn", - "@vscode/vscode-dts-region-comments": "warn", - "@vscode/vscode-dts-vscode-in-comments": "warn", - "@vscode/vscode-dts-provider-naming": [ + "vscode-dts-create-func": "warn", + "vscode-dts-literal-or-types": "warn", + "vscode-dts-interface-naming": "warn", + "vscode-dts-cancellation": "warn", + "vscode-dts-use-thenable": "warn", + "vscode-dts-region-comments": "warn", + "vscode-dts-vscode-in-comments": "warn", + "vscode-dts-provider-naming": [ "warn", { "allowed": [ @@ -155,7 +154,7 @@ ] } ], - "@vscode/vscode-dts-event-naming": [ + "vscode-dts-event-naming": [ "warn", { "allowed": [ @@ -201,8 +200,8 @@ "src/**/*.ts" ], "rules": { - "@vscode/code-no-look-behind-regex": "warn", - "@vscode/code-import-patterns": [ + "code-no-look-behind-regex": "warn", + "code-import-patterns": [ "warn", { // imports that are allowed in all files of layers: @@ -577,7 +576,7 @@ "test/**/*.ts" ], "rules": { - "@vscode/code-import-patterns": [ + "code-import-patterns": [ "warn", { "target": "test/smoke/**", diff --git a/.vscode/settings.json b/.vscode/settings.json index 0529bf5aba5..71bded80a79 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,6 +41,11 @@ } } ], + "eslint.options": { + "rulePaths": [ + "./build/lib/eslint" + ] + }, "typescript.tsdk": "node_modules/typescript/lib", "npm.exclude": "**/extensions/**", "npm.packageManager": "yarn", diff --git a/build/eslint.js b/build/eslint.js index 288917b35bf..c04f4ef7756 100644 --- a/build/eslint.js +++ b/build/eslint.js @@ -13,7 +13,8 @@ function eslint() { .src(eslintFilter, { base: '.', follow: true, allowEmpty: true }) .pipe( gulpeslint({ - configFile: '.eslintrc.json' + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'], }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/hygiene.js b/build/hygiene.js index 99b757e6d76..e18466c8f77 100644 --- a/build/hygiene.js +++ b/build/hygiene.js @@ -173,7 +173,8 @@ function hygiene(some, linting = true) { .pipe(filter(eslintFilter)) .pipe( gulpeslint({ - configFile: '.eslintrc.json' + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'], }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/lib/eslint-plugin-vscode/index.js b/build/lib/eslint-plugin-vscode/index.js deleted file mode 100644 index db643095ca9..00000000000 --- a/build/lib/eslint-plugin-vscode/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const glob = require('glob'); -const path = require('path'); - -require('ts-node').register({ experimentalResolver: true, transpileOnly: true }); - -// Re-export all .ts files as rules -const rules = {}; -glob.sync(`${__dirname}/*.ts`).forEach((file) => { - rules[path.basename(file, '.ts')] = require(file); -}); - -module.exports = { rules }; diff --git a/build/lib/eslint-plugin-vscode/package.json b/build/lib/eslint-plugin-vscode/package.json deleted file mode 100644 index b8e3adf8c06..00000000000 --- a/build/lib/eslint-plugin-vscode/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "@vscode/eslint-plugin", - "private": true, - "version": "0.0.0", - "main": "index.js" -} diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js new file mode 100644 index 00000000000..47cc3063d1c --- /dev/null +++ b/build/lib/eslint/code-import-patterns.js @@ -0,0 +1,199 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path = require("path"); +const minimatch = require("minimatch"); +const utils_1 = require("./utils"); +const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); +function isLayerAllowRule(option) { + return !!(option.when && option.allow); +} +/** + * Returns the filename relative to the project root and using `/` as separators + */ +function getRelativeFilename(context) { + const filename = path.normalize(context.getFilename()); + return filename.substring(REPO_ROOT.length).replace(/\\/g, '/'); +} +module.exports = new class { + constructor() { + this.meta = { + messages: { + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization', + badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + this._optionsCache = new WeakMap(); + } + create(context) { + const options = context.options; + const configs = this._processOptions(options); + const relativeFilename = getRelativeFilename(context); + for (const config of configs) { + if (minimatch(relativeFilename, config.target)) { + return (0, utils_1.createImportRuleListener)((node, value) => this._checkImport(context, config, node, value)); + } + } + context.report({ + loc: { line: 1, column: 0 }, + messageId: 'badFilename' + }); + return {}; + } + _processOptions(options) { + if (this._optionsCache.has(options)) { + return this._optionsCache.get(options); + } + function orSegment(variants) { + return (variants.length === 1 ? variants[0] : `{${variants.join(',')}}`); + } + const layerRules = [ + { layer: 'common', deps: orSegment(['common']) }, + { layer: 'worker', deps: orSegment(['common', 'worker']) }, + { layer: 'browser', deps: orSegment(['common', 'browser']), isBrowser: true }, + { layer: 'electron-sandbox', deps: orSegment(['common', 'browser', 'electron-sandbox']), isBrowser: true }, + { layer: 'node', deps: orSegment(['common', 'node']), isNode: true }, + { layer: 'electron-browser', deps: orSegment(['common', 'browser', 'node', 'electron-sandbox', 'electron-browser']), isBrowser: true, isNode: true }, + { layer: 'electron-main', deps: orSegment(['common', 'node', 'electron-main']), isNode: true }, + ]; + let browserAllow = []; + let nodeAllow = []; + let testAllow = []; + for (const option of options) { + if (isLayerAllowRule(option)) { + if (option.when === 'hasBrowser') { + browserAllow = option.allow.slice(0); + } + else if (option.when === 'hasNode') { + nodeAllow = option.allow.slice(0); + } + else if (option.when === 'test') { + testAllow = option.allow.slice(0); + } + } + } + function findLayer(layer) { + for (const layerRule of layerRules) { + if (layerRule.layer === layer) { + return layerRule; + } + } + return null; + } + function generateConfig(layerRule, target, rawRestrictions) { + const restrictions = []; + const testRestrictions = [...testAllow]; + if (layerRule.isBrowser) { + restrictions.push(...browserAllow); + } + if (layerRule.isNode) { + restrictions.push(...nodeAllow); + } + for (const rawRestriction of rawRestrictions) { + let importPattern; + let when = undefined; + if (typeof rawRestriction === 'string') { + importPattern = rawRestriction; + } + else { + importPattern = rawRestriction.pattern; + when = rawRestriction.when; + } + if (typeof when === 'undefined' + || (when === 'hasBrowser' && layerRule.isBrowser) + || (when === 'hasNode' && layerRule.isNode)) { + restrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); + testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); + } + else if (when === 'test') { + testRestrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); + testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); + } + } + testRestrictions.push(...restrictions); + return [ + { + target: target.replace(/\/\~$/, `/${layerRule.layer}/**`), + restrictions: restrictions + }, + { + target: target.replace(/\/\~$/, `/test/${layerRule.layer}/**`), + restrictions: testRestrictions + } + ]; + } + const configs = []; + for (const option of options) { + if (isLayerAllowRule(option)) { + continue; + } + const target = option.target; + const targetIsVS = /^src\/vs\//.test(target); + const restrictions = (typeof option.restrictions === 'string' ? [option.restrictions] : option.restrictions).slice(0); + if (targetIsVS) { + // Always add "vs/nls" + restrictions.push('vs/nls'); + } + if (targetIsVS && option.layer) { + // single layer => simple substitution for /~ + const layerRule = findLayer(option.layer); + if (layerRule) { + const [config, testConfig] = generateConfig(layerRule, target, restrictions); + if (option.test) { + configs.push(testConfig); + } + else { + configs.push(config); + } + } + } + else if (targetIsVS && /\/\~$/.test(target)) { + // generate all layers + for (const layerRule of layerRules) { + const [config, testConfig] = generateConfig(layerRule, target, restrictions); + configs.push(config); + configs.push(testConfig); + } + } + else { + configs.push({ target, restrictions: restrictions.filter(r => typeof r === 'string') }); + } + } + this._optionsCache.set(options, configs); + return configs; + } + _checkImport(context, config, node, importPath) { + // resolve relative paths + if (importPath[0] === '.') { + const relativeFilename = getRelativeFilename(context); + importPath = path.posix.join(path.posix.dirname(relativeFilename), importPath); + if (/^src\/vs\//.test(importPath)) { + // resolve using AMD base url + importPath = importPath.substring('src/'.length); + } + } + const restrictions = config.restrictions; + let matched = false; + for (const pattern of restrictions) { + if (minimatch(importPath, pattern)) { + matched = true; + break; + } + } + if (!matched) { + // None of the restrictions matched + context.report({ + loc: node.loc, + messageId: 'badImport', + data: { + restrictions: restrictions.join(' or ') + } + }); + } + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts similarity index 99% rename from build/lib/eslint-plugin-vscode/code-import-patterns.ts rename to build/lib/eslint/code-import-patterns.ts index 259f85fc291..72b63a45b35 100644 --- a/build/lib/eslint-plugin-vscode/code-import-patterns.ts +++ b/build/lib/eslint/code-import-patterns.ts @@ -6,7 +6,7 @@ import * as eslint from 'eslint'; import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as path from 'path'; -import minimatch from 'minimatch'; +import * as minimatch from 'minimatch'; import { createImportRuleListener } from './utils'; const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js new file mode 100644 index 00000000000..bcb413d9db3 --- /dev/null +++ b/build/lib/eslint/code-layering.js @@ -0,0 +1,68 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class { + constructor() { + this.meta = { + messages: { + layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + } + create(context) { + const fileDirname = (0, path_1.dirname)(context.getFilename()); + const parts = fileDirname.split(/\\|\//); + const ruleArgs = context.options[0]; + let config; + for (let i = parts.length - 1; i >= 0; i--) { + if (ruleArgs[parts[i]]) { + config = { + allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), + disallowed: new Set() + }; + Object.keys(ruleArgs).forEach(key => { + if (!config.allowed.has(key)) { + config.disallowed.add(key); + } + }); + break; + } + } + if (!config) { + // nothing + return {}; + } + return (0, utils_1.createImportRuleListener)((node, path) => { + if (path[0] === '.') { + path = (0, path_1.join)((0, path_1.dirname)(context.getFilename()), path); + } + const parts = (0, path_1.dirname)(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + if (config.allowed.has(part)) { + // GOOD - same layer + break; + } + if (config.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + loc: node.loc, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config.allowed.keys()].join(', ') + } + }); + break; + } + } + }); + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-layering.ts b/build/lib/eslint/code-layering.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-layering.ts rename to build/lib/eslint/code-layering.ts diff --git a/build/lib/eslint/code-no-look-behind-regex.js b/build/lib/eslint/code-no-look-behind-regex.js new file mode 100644 index 00000000000..c7cdf44c181 --- /dev/null +++ b/build/lib/eslint/code-no-look-behind-regex.js @@ -0,0 +1,42 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +const _positiveLookBehind = /\(\?<=.+/; +const _negativeLookBehind = /\(\? { + const pattern = node.regex?.pattern; + if (_containsLookBehind(pattern)) { + context.report({ + node, + message: 'Look behind assertions are not yet supported in all browsers' + }); + } + }, + // new Regex("...") + ['NewExpression[callee.name="RegExp"] Literal']: (node) => { + if (_containsLookBehind(node.value)) { + context.report({ + node, + message: 'Look behind assertions are not yet supported in all browsers' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-no-look-behind-regex.ts b/build/lib/eslint/code-no-look-behind-regex.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-look-behind-regex.ts rename to build/lib/eslint/code-no-look-behind-regex.ts diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js new file mode 100644 index 00000000000..36782a4b5bc --- /dev/null +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -0,0 +1,38 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + messages: { + noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' + } + }; + } + create(context) { + const fileName = context.getFilename(); + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) { + return (0, utils_1.createImportRuleListener)((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = (0, path_1.join)(context.getFilename(), path); + } + if (/vs(\/|\\)nls/.test(path)) { + context.report({ + loc: node.loc, + messageId: 'noNls' + }); + } + }); + } + return {}; + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-nls-in-standalone-editor.ts rename to build/lib/eslint/code-no-nls-in-standalone-editor.ts diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js new file mode 100644 index 00000000000..c57bd560bcf --- /dev/null +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -0,0 +1,41 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const utils_1 = require("./utils"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + messages: { + badImport: 'Not allowed to import standalone editor modules.' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + } + }; + } + create(context) { + if (/vs(\/|\\)editor/.test(context.getFilename())) { + // the vs/editor folder is allowed to use the standalone editor + return {}; + } + return (0, utils_1.createImportRuleListener)((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = (0, path_1.join)(context.getFilename(), path); + } + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { + context.report({ + loc: node.loc, + messageId: 'badImport' + }); + } + }); + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-standalone-editor.ts rename to build/lib/eslint/code-no-standalone-editor.ts diff --git a/build/lib/eslint/code-no-test-only.js b/build/lib/eslint/code-no-test-only.js new file mode 100644 index 00000000000..46d144bfcaf --- /dev/null +++ b/build/lib/eslint/code-no-test-only.js @@ -0,0 +1,17 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class NoTestOnly { + create(context) { + return { + ['MemberExpression[object.name="test"][property.name="only"]']: (node) => { + return context.report({ + node, + message: 'test.only is a dev-time tool and CANNOT be pushed' + }); + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-no-test-only.ts b/build/lib/eslint/code-no-test-only.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-test-only.ts rename to build/lib/eslint/code-no-test-only.ts diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js new file mode 100644 index 00000000000..48b591f8d3d --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -0,0 +1,111 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +function isStringLiteral(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} +function isDoubleQuoted(node) { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; +} +module.exports = new (_a = class NoUnexternalizedStrings { + constructor() { + this.meta = { + messages: { + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' + } + }; + } + create(context) { + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + function collectDoubleQuotedStrings(node) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + } + function visitLocalizeCall(node) { + // localize(key, message) + const [keyNode, messageNode] = node.arguments; + // (1) + // extract key so that it can be checked later + let key; + if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); + key = keyNode.value; + } + else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { + for (const property of keyNode.properties) { + if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); + key = property.value.value; + break; + } + } + } + } + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + } + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + for (const [key, values] of externalizedStringLiterals) { + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (const value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } + } + } + return { + ['Literal']: (node) => collectDoubleQuotedStrings(node), + ['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node), + ['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, + }; + } + }, + _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, + _a); diff --git a/build/lib/eslint-plugin-vscode/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-unexternalized-strings.ts rename to build/lib/eslint/code-no-unexternalized-strings.ts diff --git a/build/lib/eslint/code-no-unused-expressions.js b/build/lib/eslint/code-no-unused-expressions.js new file mode 100644 index 00000000000..5d9710072e6 --- /dev/null +++ b/build/lib/eslint/code-no-unused-expressions.js @@ -0,0 +1,119 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +module.exports = { + meta: { + type: 'suggestion', + docs: { + description: 'disallow unused expressions', + category: 'Best Practices', + recommended: false, + url: 'https://eslint.org/docs/rules/no-unused-expressions' + }, + schema: [ + { + type: 'object', + properties: { + allowShortCircuit: { + type: 'boolean', + default: false + }, + allowTernary: { + type: 'boolean', + default: false + }, + allowTaggedTemplates: { + type: 'boolean', + default: false + } + }, + additionalProperties: false + } + ] + }, + create(context) { + const config = context.options[0] || {}, allowShortCircuit = config.allowShortCircuit || false, allowTernary = config.allowTernary || false, allowTaggedTemplates = config.allowTaggedTemplates || false; + // eslint-disable-next-line jsdoc/require-description + /** + * @param node any node + * @returns whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === 'ExpressionStatement' && + node.expression.type === 'Literal' && typeof node.expression.value === 'string'; + } + // eslint-disable-next-line jsdoc/require-description + /** + * @param predicate ([a] -> Boolean) the function used to make the determination + * @param list the input list + * @returns the leading sequence of members in the given list that pass the given predicate + */ + function takeWhile(predicate, list) { + for (let i = 0; i < list.length; ++i) { + if (!predicate(list[i])) { + return list.slice(0, i); + } + } + return list.slice(); + } + // eslint-disable-next-line jsdoc/require-description + /** + * @param node a Program or BlockStatement node + * @returns the leading sequence of directive nodes in the given node's body + */ + function directives(node) { + return takeWhile(looksLikeDirective, node.body); + } + // eslint-disable-next-line jsdoc/require-description + /** + * @param node any node + * @param ancestors the given node's ancestors + * @returns whether the given node is considered a directive in its current position + */ + function isDirective(node, ancestors) { + const parent = ancestors[ancestors.length - 1], grandparent = ancestors[ancestors.length - 2]; + return (parent.type === 'Program' || parent.type === 'BlockStatement' && + (/Function/u.test(grandparent.type))) && + directives(parent).indexOf(node) >= 0; + } + /** + * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. + * @param node any node + * @returns whether the given node is a valid expression + */ + function isValidExpression(node) { + if (allowTernary) { + // Recursive check for ternary and logical expressions + if (node.type === 'ConditionalExpression') { + return isValidExpression(node.consequent) && isValidExpression(node.alternate); + } + } + if (allowShortCircuit) { + if (node.type === 'LogicalExpression') { + return isValidExpression(node.right); + } + } + if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') { + return true; + } + if (node.type === 'ExpressionStatement') { + return isValidExpression(node.expression); + } + return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await|Chain)Expression$/u.test(node.type) || + (node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0); + } + return { + ExpressionStatement(node) { + if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) { + context.report({ node: node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` }); + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/code-no-unused-expressions.ts b/build/lib/eslint/code-no-unused-expressions.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-no-unused-expressions.ts rename to build/lib/eslint/code-no-unused-expressions.ts diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js new file mode 100644 index 00000000000..30b63429521 --- /dev/null +++ b/build/lib/eslint/code-translation-remind.js @@ -0,0 +1,57 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const fs_1 = require("fs"); +const utils_1 = require("./utils"); +module.exports = new (_a = class TranslationRemind { + constructor() { + this.meta = { + messages: { + missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' + } + }; + } + create(context) { + return (0, utils_1.createImportRuleListener)((node, path) => this._checkImport(context, node, path)); + } + _checkImport(context, node, path) { + if (path !== TranslationRemind.NLS_MODULE) { + return; + } + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + const resource = matchService ? matchService[0] : matchPart[0]; + let resourceDefined = false; + let json; + try { + json = (0, fs_1.readFileSync)('./build/lib/i18n.resources.json', 'utf8'); + } + catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + workbenchResources.forEach((existingResource) => { + if (existingResource.name === resource) { + resourceDefined = true; + return; + } + }); + if (!resourceDefined) { + context.report({ + loc: node.loc, + messageId: 'missing', + data: { resource } + }); + } + } + }, + _a.NLS_MODULE = 'vs/nls', + _a); diff --git a/build/lib/eslint-plugin-vscode/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/code-translation-remind.ts rename to build/lib/eslint/code-translation-remind.ts diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js new file mode 100644 index 00000000000..c58e4e24be1 --- /dev/null +++ b/build/lib/eslint/utils.js @@ -0,0 +1,37 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createImportRuleListener = void 0; +function createImportRuleListener(validateImport) { + function _checkImport(node) { + if (node && node.type === 'Literal' && typeof node.value === 'string') { + validateImport(node, node.value); + } + } + return { + // import ??? from 'module' + ImportDeclaration: (node) => { + _checkImport(node.source); + }, + // import('module').then(...) OR await import('module') + ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => { + _checkImport(node); + }, + // import foo = ... + ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => { + _checkImport(node); + }, + // export ?? from 'module' + ExportAllDeclaration: (node) => { + _checkImport(node.source); + }, + // export {foo} from 'module' + ExportNamedDeclaration: (node) => { + _checkImport(node.source); + }, + }; +} +exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint-plugin-vscode/utils.ts b/build/lib/eslint/utils.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/utils.ts rename to build/lib/eslint/utils.ts diff --git a/build/lib/eslint/vscode-dts-cancellation.js b/build/lib/eslint/vscode-dts-cancellation.js new file mode 100644 index 00000000000..65b9e4c1fe1 --- /dev/null +++ b/build/lib/eslint/vscode-dts-cancellation.js @@ -0,0 +1,33 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +module.exports = new class ApiProviderNaming { + constructor() { + this.meta = { + messages: { + noToken: 'Function lacks a cancellation token, preferable as last argument', + } + }; + } + create(context) { + return { + ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node) => { + let found = false; + for (const param of node.params) { + if (param.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { + found = found || param.name === 'token'; + } + } + if (!found) { + context.report({ + node, + messageId: 'noToken' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-cancellation.ts b/build/lib/eslint/vscode-dts-cancellation.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-cancellation.ts rename to build/lib/eslint/vscode-dts-cancellation.ts diff --git a/build/lib/eslint/vscode-dts-create-func.js b/build/lib/eslint/vscode-dts-create-func.js new file mode 100644 index 00000000000..e9ec659cef1 --- /dev/null +++ b/build/lib/eslint/vscode-dts-create-func.js @@ -0,0 +1,34 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +module.exports = new class ApiLiteralOrTypes { + constructor() { + this.meta = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' }, + messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', } + }; + } + create(context) { + return { + ['TSDeclareFunction Identifier[name=/create.*/]']: (node) => { + const decl = node.parent; + if (decl.returnType?.typeAnnotation.type !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) { + return; + } + if (decl.returnType.typeAnnotation.typeName.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) { + return; + } + const ident = decl.returnType.typeAnnotation.typeName.name; + if (ident === 'Promise' || ident === 'Thenable') { + context.report({ + node, + messageId: 'sync' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-create-func.ts b/build/lib/eslint/vscode-dts-create-func.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-create-func.ts rename to build/lib/eslint/vscode-dts-create-func.ts diff --git a/build/lib/eslint/vscode-dts-event-naming.js b/build/lib/eslint/vscode-dts-event-naming.js new file mode 100644 index 00000000000..747e224b397 --- /dev/null +++ b/build/lib/eslint/vscode-dts-event-naming.js @@ -0,0 +1,86 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +module.exports = new (_a = class ApiEventNaming { + constructor() { + this.meta = { + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#event-naming' + }, + messages: { + naming: 'Event names must follow this patten: `on[Did|Will]`', + verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration', + subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API', + unknown: 'UNKNOWN event declaration, lint-rule needs tweaking' + } + }; + } + create(context) { + const config = context.options[0]; + const allowed = new Set(config.allowed); + const verbs = new Set(config.verbs); + return { + ['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node) => { + const def = node.parent?.parent?.parent; + const ident = this.getIdent(def); + if (!ident) { + // event on unknown structure... + return context.report({ + node, + message: 'unknown' + }); + } + if (allowed.has(ident.name)) { + // configured exception + return; + } + const match = ApiEventNaming._nameRegExp.exec(ident.name); + if (!match) { + context.report({ + node: ident, + messageId: 'naming' + }); + return; + } + // check that is spelled out (configured) as verb + if (!verbs.has(match[2].toLowerCase())) { + context.report({ + node: ident, + messageId: 'verb', + data: { verb: match[2] } + }); + } + // check that a subject (if present) has occurred + if (match[3]) { + const regex = new RegExp(match[3], 'ig'); + const parts = context.getSourceCode().getText().split(regex); + if (parts.length < 3) { + context.report({ + node: ident, + messageId: 'subject', + data: { subject: match[3] } + }); + } + } + } + }; + } + getIdent(def) { + if (!def) { + return; + } + if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { + return def; + } + else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { + return def.key; + } + return this.getIdent(def.parent); + } + }, + _a._nameRegExp = /on(Did|Will)([A-Z][a-z]+)([A-Z][a-z]+)?/, + _a); diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-event-naming.ts b/build/lib/eslint/vscode-dts-event-naming.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-event-naming.ts rename to build/lib/eslint/vscode-dts-event-naming.ts diff --git a/build/lib/eslint/vscode-dts-interface-naming.js b/build/lib/eslint/vscode-dts-interface-naming.js new file mode 100644 index 00000000000..70ca810825b --- /dev/null +++ b/build/lib/eslint/vscode-dts-interface-naming.js @@ -0,0 +1,30 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +module.exports = new (_a = class ApiInterfaceNaming { + constructor() { + this.meta = { + messages: { + naming: 'Interfaces must not be prefixed with uppercase `I`', + } + }; + } + create(context) { + return { + ['TSInterfaceDeclaration Identifier']: (node) => { + const name = node.name; + if (ApiInterfaceNaming._nameRegExp.test(name)) { + context.report({ + node, + messageId: 'naming' + }); + } + } + }; + } + }, + _a._nameRegExp = /I[A-Z]/, + _a); diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-interface-naming.ts b/build/lib/eslint/vscode-dts-interface-naming.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-interface-naming.ts rename to build/lib/eslint/vscode-dts-interface-naming.ts diff --git a/build/lib/eslint/vscode-dts-literal-or-types.js b/build/lib/eslint/vscode-dts-literal-or-types.js new file mode 100644 index 00000000000..e4c075db91c --- /dev/null +++ b/build/lib/eslint/vscode-dts-literal-or-types.js @@ -0,0 +1,25 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiLiteralOrTypes { + constructor() { + this.meta = { + docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' }, + messages: { useEnum: 'Use enums, not literal-or-types', } + }; + } + create(context) { + return { + ['TSTypeAnnotation TSUnionType']: (node) => { + if (node.types.every(value => value.type === 'TSLiteralType')) { + context.report({ + node: node, + messageId: 'useEnum' + }); + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-literal-or-types.ts b/build/lib/eslint/vscode-dts-literal-or-types.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-literal-or-types.ts rename to build/lib/eslint/vscode-dts-literal-or-types.ts diff --git a/build/lib/eslint/vscode-dts-provider-naming.js b/build/lib/eslint/vscode-dts-provider-naming.js new file mode 100644 index 00000000000..44c2ddd5568 --- /dev/null +++ b/build/lib/eslint/vscode-dts-provider-naming.js @@ -0,0 +1,37 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +module.exports = new (_a = class ApiProviderNaming { + constructor() { + this.meta = { + messages: { + naming: 'A provider should only have functions like provideXYZ or resolveXYZ', + } + }; + } + create(context) { + const config = context.options[0]; + const allowed = new Set(config.allowed); + return { + ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature']: (node) => { + const interfaceName = (node.parent?.parent).id.name; + if (allowed.has(interfaceName)) { + // allowed + return; + } + const methodName = node.key.name; + if (!ApiProviderNaming._providerFunctionNames.test(methodName)) { + context.report({ + node, + messageId: 'naming' + }); + } + } + }; + } + }, + _a._providerFunctionNames = /^(provide|resolve|prepare).+/, + _a); diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-provider-naming.ts b/build/lib/eslint/vscode-dts-provider-naming.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-provider-naming.ts rename to build/lib/eslint/vscode-dts-provider-naming.ts diff --git a/build/lib/eslint/vscode-dts-region-comments.js b/build/lib/eslint/vscode-dts-region-comments.js new file mode 100644 index 00000000000..2dc9487314e --- /dev/null +++ b/build/lib/eslint/vscode-dts-region-comments.js @@ -0,0 +1,35 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiEventNaming { + constructor() { + this.meta = { + messages: { + comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/', + } + }; + } + create(context) { + const sourceCode = context.getSourceCode(); + return { + ['Program']: (_node) => { + for (const comment of sourceCode.getAllComments()) { + if (comment.type !== 'Line') { + continue; + } + if (!/^\s*#region /.test(comment.value)) { + continue; + } + if (!/^\s*#region ([a-z]+): (@[a-z]+|https:\/\/github.com\/microsoft\/vscode\/issues\/\d+)/i.test(comment.value)) { + context.report({ + node: comment, + messageId: 'comment', + }); + } + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-region-comments.ts b/build/lib/eslint/vscode-dts-region-comments.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-region-comments.ts rename to build/lib/eslint/vscode-dts-region-comments.ts diff --git a/build/lib/eslint/vscode-dts-use-thenable.js b/build/lib/eslint/vscode-dts-use-thenable.js new file mode 100644 index 00000000000..7e23953cb69 --- /dev/null +++ b/build/lib/eslint/vscode-dts-use-thenable.js @@ -0,0 +1,24 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiEventNaming { + constructor() { + this.meta = { + messages: { + usage: 'Use the Thenable-type instead of the Promise type', + } + }; + } + create(context) { + return { + ['TSTypeAnnotation TSTypeReference Identifier[name="Promise"]']: (node) => { + context.report({ + node, + messageId: 'usage', + }); + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-use-thenable.ts b/build/lib/eslint/vscode-dts-use-thenable.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-use-thenable.ts rename to build/lib/eslint/vscode-dts-use-thenable.ts diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.js b/build/lib/eslint/vscode-dts-vscode-in-comments.js new file mode 100644 index 00000000000..8f9a13fb01f --- /dev/null +++ b/build/lib/eslint/vscode-dts-vscode-in-comments.js @@ -0,0 +1,45 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +module.exports = new class ApiVsCodeInComments { + constructor() { + this.meta = { + messages: { + comment: `Don't use the term 'vs code' in comments` + } + }; + } + create(context) { + const sourceCode = context.getSourceCode(); + return { + ['Program']: (_node) => { + for (const comment of sourceCode.getAllComments()) { + if (comment.type !== 'Block') { + continue; + } + if (!comment.range) { + continue; + } + const startIndex = comment.range[0] + '/*'.length; + const re = /vs code/ig; + let match; + while ((match = re.exec(comment.value))) { + // Allow using 'VS Code' in quotes + if (comment.value[match.index - 1] === `'` && comment.value[match.index + match[0].length] === `'`) { + continue; + } + // Types for eslint seem incorrect + const start = sourceCode.getLocFromIndex(startIndex + match.index); + const end = sourceCode.getLocFromIndex(startIndex + match.index + match[0].length); + context.report({ + messageId: 'comment', + loc: { start, end } + }); + } + } + } + }; + } +}; diff --git a/build/lib/eslint-plugin-vscode/vscode-dts-vscode-in-comments.ts b/build/lib/eslint/vscode-dts-vscode-in-comments.ts similarity index 100% rename from build/lib/eslint-plugin-vscode/vscode-dts-vscode-in-comments.ts rename to build/lib/eslint/vscode-dts-vscode-in-comments.ts diff --git a/build/tsconfig.build.json b/build/tsconfig.build.json index 801c7735b06..0a00f2d0f48 100644 --- a/build/tsconfig.build.json +++ b/build/tsconfig.build.json @@ -7,8 +7,5 @@ }, "include": [ "**/*.ts" - ], - "exclude": [ - "lib/eslint-plugin-vscode/**/*" ] } diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index d9b8862a885..392ec661728 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -481,7 +481,7 @@ export class Git { const repoUri = Uri.file(repoPath); const pathUri = Uri.file(repositoryPath); if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) { - // eslint-disable-next-line @vscode/code-no-look-behind-regex + // eslint-disable-next-line code-no-look-behind-regex const match = /(?<=^\/?)([a-zA-Z])(?=:\/)/.exec(pathUri.path); if (match !== null) { const [, letter] = match; diff --git a/package.json b/package.json index 26b09e1612c..43ba684d476 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,6 @@ "@types/yazl": "^2.4.2", "@typescript-eslint/eslint-plugin": "^5.10.0", "@typescript-eslint/parser": "^5.10.0", - "@vscode/eslint-plugin": "link:./build/lib/eslint-plugin-vscode", "@vscode/telemetry-extractor": "^1.9.8", "@vscode/test-web": "^0.0.29", "ansi-colors": "^3.2.3", @@ -201,7 +200,6 @@ "source-map-support": "^0.3.2", "style-loader": "^1.3.0", "ts-loader": "^9.2.7", - "ts-node": "^10.9.1", "tsec": "0.1.4", "typescript": "^4.9.0-dev.20220825", "typescript-formatter": "7.1.0", diff --git a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts index 6717ac6c813..f4b242a0c69 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts @@ -10,7 +10,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { ICommandDetectionCapability, TerminalCapability, ITerminalCommand, IHandleCommandOptions, ICommandInvalidationRequest, CommandInvalidationReason } from 'vs/platform/terminal/common/capabilities/capabilities'; import { ISerializedCommand, ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; // Importing types is safe in any layer -// eslint-disable-next-line @vscode/code-import-patterns +// eslint-disable-next-line code-import-patterns import type { IBuffer, IBufferLine, IDisposable, IMarker, Terminal } from 'xterm-headless'; export interface ICurrentPartialCommand { diff --git a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts index 3fba8a8daea..932413459a3 100644 --- a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts @@ -6,7 +6,7 @@ import { Emitter } from 'vs/base/common/event'; import { IPartialCommandDetectionCapability, TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities'; // Importing types is safe in any layer -// eslint-disable-next-line @vscode/code-import-patterns +// eslint-disable-next-line code-import-patterns import { IMarker, Terminal } from 'xterm-headless'; const enum Constants { diff --git a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts index 2788f40fec4..b824242c7b5 100644 --- a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts +++ b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts @@ -12,7 +12,7 @@ import { ICommandDetectionCapability, ICwdDetectionCapability, TerminalCapabilit import { PartialCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/partialCommandDetectionCapability'; import { ILogService } from 'vs/platform/log/common/log'; // Importing types is safe in any layer -// eslint-disable-next-line @vscode/code-import-patterns +// eslint-disable-next-line code-import-patterns import type { ITerminalAddon, Terminal } from 'xterm-headless'; import { ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; diff --git a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts index fb7625c54bd..4bd0f073a2c 100644 --- a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts +++ b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts @@ -13,7 +13,7 @@ import { getPathFromAmdModule } from 'vs/base/test/node/testUtils'; import { CancellationToken } from 'vs/base/common/cancellation'; import { RequestService } from 'vs/platform/request/node/requestService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; -// eslint-disable-next-line @vscode/code-import-patterns +// eslint-disable-next-line code-import-patterns import 'vs/workbench/workbench.desktop.main'; import { NullLogService } from 'vs/platform/log/common/log'; import { mock } from 'vs/base/test/common/mock'; diff --git a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts index 85ab6db9e1f..35d0657b669 100644 --- a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* eslint-disable @vscode/code-import-patterns */ -/* eslint-disable @vscode/code-layering */ +/* eslint-disable code-import-patterns */ +/* eslint-disable code-layering */ import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; diff --git a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts index dc34afce5d5..f988913ea61 100644 --- a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts +++ b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts @@ -23,7 +23,7 @@ declare module 'vscode' { * * @return Thenable indicating that the webview editor has been moved. */ - // eslint-disable-next-line @vscode/vscode-dts-provider-naming + // eslint-disable-next-line vscode-dts-provider-naming moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable; } } diff --git a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts index 8b7a117daa5..f1fbb770d8e 100644 --- a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +++ b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts @@ -16,7 +16,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProviderNew { - // eslint-disable-next-line @vscode/vscode-dts-provider-naming + // eslint-disable-next-line vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItemNew): void; } @@ -29,7 +29,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProvider { - // eslint-disable-next-line @vscode/vscode-dts-provider-naming + // eslint-disable-next-line vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItem): void; } diff --git a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts index 02e4b20626d..80fc9fd9423 100644 --- a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts +++ b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts @@ -5,7 +5,7 @@ declare module 'vscode' { - // eslint-disable-next-line @vscode/vscode-dts-region-comments + // eslint-disable-next-line vscode-dts-region-comments // @roblourens: debugUI.simple: https://github.com/microsoft/vscode/issues/147264. Used for Jupyter's Run By Line. // suppressSaveBeforeStart: https://github.com/microsoft/vscode/issues/147263. Used to enable debugging untitled/unsaved notebooks. diff --git a/src/vscode-dts/vscode.proposed.resolvers.d.ts b/src/vscode-dts/vscode.proposed.resolvers.d.ts index 1e86d0f8be5..1575fa7c8b9 100644 --- a/src/vscode-dts/vscode.proposed.resolvers.d.ts +++ b/src/vscode-dts/vscode.proposed.resolvers.d.ts @@ -196,7 +196,7 @@ declare module 'vscode' { export interface ResourceLabelFormatting { label: string; // myLabel:/${path} // For historic reasons we use an or string here. Once we finalize this API we should start using enums instead and adopt it in extensions. - // eslint-disable-next-line @vscode/vscode-dts-literal-or-types + // eslint-disable-next-line vscode-dts-literal-or-types separator: '/' | '\\' | ''; tildify?: boolean; normalizeDriveLetter?: boolean; diff --git a/test/monaco/esm-check/index.js b/test/monaco/esm-check/index.js index b1c4c3b5e87..3e585d5bd58 100644 --- a/test/monaco/esm-check/index.js +++ b/test/monaco/esm-check/index.js @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// eslint-disable-next-line @vscode/code-no-standalone-editor +// eslint-disable-next-line code-no-standalone-editor import * as monaco from './out/vs/editor/editor.main.js'; monaco.editor.create(document.getElementById('container'), { diff --git a/yarn.lock b/yarn.lock index 9176b596279..c408f749974 100644 --- a/yarn.lock +++ b/yarn.lock @@ -303,13 +303,6 @@ "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - "@discoveryjs/json-ext@^0.5.0": version "0.5.3" resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz#90420f9f9c6d3987f176a19a7d8e764271a2f55d" @@ -425,14 +418,6 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping@^0.3.9": version "0.3.14" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" @@ -710,26 +695,6 @@ mkdirp "^1.0.4" path-browserify "^1.0.1" -"@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" - integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== - "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -1125,10 +1090,6 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -"@vscode/eslint-plugin@link:./build/lib/eslint-plugin-vscode": - version "0.0.0" - uid "" - "@vscode/iconv-lite-umd@0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48" @@ -1509,11 +1470,6 @@ acorn-jsx@^5.3.1: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== - acorn@^6.0.7, acorn@^6.4.1: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" @@ -1742,11 +1698,6 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -3037,11 +2988,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3596,11 +3542,6 @@ diff@5.0.0, diff@^5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -6903,11 +6844,6 @@ make-dir@^3.0.2: dependencies: semver "^6.0.0" -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -10501,25 +10437,6 @@ ts-morph@^15.1.0: "@ts-morph/common" "~0.16.0" code-block-writer "^11.0.0" -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - tsec@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/tsec/-/tsec-0.1.4.tgz#dc8743c28ad01230ea4692e326866e0d54487f3f" @@ -10862,11 +10779,6 @@ uuid@^8.3.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - v8-compile-cache@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" @@ -11661,11 +11573,6 @@ ylru@^1.2.0: resolved "https://registry.yarnpkg.com/ylru/-/ylru-1.2.1.tgz#f576b63341547989c1de7ba288760923b27fe84f" integrity sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ== -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== - yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" From 4608363029508960a019f8c621cf5e4043f4d860 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 12:10:04 -0700 Subject: [PATCH 10/21] Use AggregateError for errors while disposing (#159477) --- src/vs/base/common/lifecycle.ts | 10 +--------- src/vs/base/test/common/lifecycle.test.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/vs/base/common/lifecycle.ts b/src/vs/base/common/lifecycle.ts index ae43227f6e2..da910eb4e77 100644 --- a/src/vs/base/common/lifecycle.ts +++ b/src/vs/base/common/lifecycle.ts @@ -108,14 +108,6 @@ export function markAsSingleton(singleton: T): T { return singleton; } -export class MultiDisposeError extends Error { - constructor( - public readonly errors: any[] - ) { - super(`Encountered errors while disposing of store. Errors: [${errors.join(', ')}]`); - } -} - export interface IDisposable { dispose(): void; } @@ -146,7 +138,7 @@ export function dispose(arg: T | IterableIterator | un if (errors.length === 1) { throw errors[0]; } else if (errors.length > 1) { - throw new MultiDisposeError(errors); + throw new AggregateError(errors, 'Encountered errors while disposing of store'); } return Array.isArray(arg) ? [] : arg; diff --git a/src/vs/base/test/common/lifecycle.test.ts b/src/vs/base/test/common/lifecycle.test.ts index 07437bf8ef7..b3d97a77a9c 100644 --- a/src/vs/base/test/common/lifecycle.test.ts +++ b/src/vs/base/test/common/lifecycle.test.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; import { Emitter } from 'vs/base/common/event'; -import { DisposableStore, dispose, IDisposable, markAsSingleton, MultiDisposeError, ReferenceCollection, SafeDisposable, toDisposable } from 'vs/base/common/lifecycle'; +import { DisposableStore, dispose, IDisposable, markAsSingleton, ReferenceCollection, SafeDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { ensureNoDisposablesAreLeakedInTestSuite, throwIfDisposablesAreLeaked } from 'vs/base/test/common/utils'; class Disposable implements IDisposable { @@ -88,10 +88,10 @@ suite('Lifecycle', () => { assert.ok(disposedValues.has(1)); assert.ok(disposedValues.has(4)); - assert.ok(thrownError instanceof MultiDisposeError); - assert.strictEqual((thrownError as MultiDisposeError).errors.length, 2); - assert.strictEqual((thrownError as MultiDisposeError).errors[0].message, 'I am error 1'); - assert.strictEqual((thrownError as MultiDisposeError).errors[1].message, 'I am error 2'); + assert.ok(thrownError instanceof AggregateError); + assert.strictEqual((thrownError as AggregateError).errors.length, 2); + assert.strictEqual((thrownError as AggregateError).errors[0].message, 'I am error 1'); + assert.strictEqual((thrownError as AggregateError).errors[1].message, 'I am error 2'); }); test('Action bar has broken accessibility #100273', function () { @@ -167,10 +167,10 @@ suite('DisposableStore', () => { assert.ok(disposedValues.has(1)); assert.ok(disposedValues.has(4)); - assert.ok(thrownError instanceof MultiDisposeError); - assert.strictEqual((thrownError as MultiDisposeError).errors.length, 2); - assert.strictEqual((thrownError as MultiDisposeError).errors[0].message, 'I am error 1'); - assert.strictEqual((thrownError as MultiDisposeError).errors[1].message, 'I am error 2'); + assert.ok(thrownError instanceof AggregateError); + assert.strictEqual((thrownError as AggregateError).errors.length, 2); + assert.strictEqual((thrownError as AggregateError).errors[0].message, 'I am error 1'); + assert.strictEqual((thrownError as AggregateError).errors[1].message, 'I am error 2'); }); }); From b02e85c34032c45eafbdf39eda37605dfed617ec Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 29 Aug 2022 12:11:11 -0700 Subject: [PATCH 11/21] Update xterm.js Fixes #159492 Fixes #159493 Fixes #158868 Fixes #158981 Fixes #157432 --- package.json | 6 +++--- remote/package.json | 6 +++--- remote/web/package.json | 6 +++--- remote/web/yarn.lock | 24 ++++++++++++------------ remote/yarn.lock | 24 ++++++++++++------------ yarn.lock | 24 ++++++++++++------------ 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 43ba684d476..7b1f0b735cb 100644 --- a/package.json +++ b/package.json @@ -86,12 +86,12 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.36", - "xterm-addon-canvas": "0.2.0-beta.17", + "xterm": "5.0.0-beta.44", + "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-serialize": "0.8.0-beta.5", "xterm-addon-unicode11": "0.4.0-beta.5", - "xterm-addon-webgl": "0.13.0-beta.37", + "xterm-addon-webgl": "0.13.0-beta.45", "xterm-headless": "5.0.0-beta.5", "yauzl": "^2.9.2", "yazl": "^2.4.3" diff --git a/remote/package.json b/remote/package.json index bb0ab86c273..60f9e80c27d 100644 --- a/remote/package.json +++ b/remote/package.json @@ -24,12 +24,12 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.36", - "xterm-addon-canvas": "0.2.0-beta.17", + "xterm": "5.0.0-beta.44", + "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-serialize": "0.8.0-beta.5", "xterm-addon-unicode11": "0.4.0-beta.5", - "xterm-addon-webgl": "0.13.0-beta.37", + "xterm-addon-webgl": "0.13.0-beta.45", "xterm-headless": "5.0.0-beta.5", "yauzl": "^2.9.2", "yazl": "^2.4.3" diff --git a/remote/web/package.json b/remote/web/package.json index 46941db4e00..487dd1fb375 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -11,10 +11,10 @@ "tas-client-umd": "0.1.6", "vscode-oniguruma": "1.6.1", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.36", - "xterm-addon-canvas": "0.2.0-beta.17", + "xterm": "5.0.0-beta.44", + "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-unicode11": "0.4.0-beta.5", - "xterm-addon-webgl": "0.13.0-beta.37" + "xterm-addon-webgl": "0.13.0-beta.45" } } diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 80efed13ec3..edc1bbf2e95 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -68,10 +68,10 @@ vscode-textmate@7.0.1: resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-7.0.1.tgz#8118a32b02735dccd14f893b495fa5389ad7de79" integrity sha512-zQ5U/nuXAAMsh691FtV0wPz89nSkHbs+IQV8FDk+wew9BlSDhf4UmWGlWJfTR2Ti6xZv87Tj5fENzKf6Qk7aLw== -xterm-addon-canvas@0.2.0-beta.17: - version "0.2.0-beta.17" - resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.17.tgz#e84a86530b20bd3edcce16b4566f346cd186ab4d" - integrity sha512-2ukPdCA92VTFYQRE56ylzvI3cfaQYDWd/Mc4jlEItI6sV/EA5RnUbbP+2sFIx0JlmHK6nVYXXNY2p6QRB7MRew== +xterm-addon-canvas@0.2.0-beta.21: + version "0.2.0-beta.21" + resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.21.tgz#df79eac3408dcf24b1d42d4979a227efad3e6836" + integrity sha512-d1JjbPLQibDvG31Ii3M4Hz2m6ZINPU43c+O2j73/5ebBVo9zXV6deUFySedqXj+fFxLDgV0Twn09DrIR/j+PZA== xterm-addon-search@0.10.0-beta.5: version "0.10.0-beta.5" @@ -83,12 +83,12 @@ xterm-addon-unicode11@0.4.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.5.tgz#3900e66f10d2e506133b61d7421aab6878d32665" integrity sha512-+g+fuxAd/tkCEJ/jhdnebXKtdPrhsu4VKWNnB/3qM35GbuGQOasmYFYnKL+HYZMpbQ6YqeZcXTVg/wnCTttz0g== -xterm-addon-webgl@0.13.0-beta.37: - version "0.13.0-beta.37" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.37.tgz#46819028abbe66cfabc60a615c4cc7bcd9156305" - integrity sha512-XoJdN8CELScYLPnEJKo9s0r3tC9/szGnmBEymV1+oLbMrQNeaV5VQqbiYzgKTyDHc12Gc5lPvih3/r6eL/9gig== +xterm-addon-webgl@0.13.0-beta.45: + version "0.13.0-beta.45" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.45.tgz#f1f3c08e2a819970c1af0362eeb61185babcb6fc" + integrity sha512-TXq5mxvG2alo5hSj/aFqHDzR2RSV2HH4is7R7kVmSCVPnl2RgDfAPilXOEJyYFLF09EgiGiG5UZASYJjvJfMRg== -xterm@5.0.0-beta.36: - version "5.0.0-beta.36" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.36.tgz#c07721d04fddc0f86417bc95a2f0824040c0eca9" - integrity sha512-6aND1UOAcCn42WlVrQbIU7a+ZFD4o3Gy2yE1BeDLTCFfK6oqc1QpRrH1plGOUypeabxCTADrw5vhl5W/45kutg== +xterm@5.0.0-beta.44: + version "5.0.0-beta.44" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" + integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== diff --git a/remote/yarn.lock b/remote/yarn.lock index 2a7a7adf0ce..6c8f9ca4e15 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -788,10 +788,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xterm-addon-canvas@0.2.0-beta.17: - version "0.2.0-beta.17" - resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.17.tgz#e84a86530b20bd3edcce16b4566f346cd186ab4d" - integrity sha512-2ukPdCA92VTFYQRE56ylzvI3cfaQYDWd/Mc4jlEItI6sV/EA5RnUbbP+2sFIx0JlmHK6nVYXXNY2p6QRB7MRew== +xterm-addon-canvas@0.2.0-beta.21: + version "0.2.0-beta.21" + resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.21.tgz#df79eac3408dcf24b1d42d4979a227efad3e6836" + integrity sha512-d1JjbPLQibDvG31Ii3M4Hz2m6ZINPU43c+O2j73/5ebBVo9zXV6deUFySedqXj+fFxLDgV0Twn09DrIR/j+PZA== xterm-addon-search@0.10.0-beta.5: version "0.10.0-beta.5" @@ -808,20 +808,20 @@ xterm-addon-unicode11@0.4.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.5.tgz#3900e66f10d2e506133b61d7421aab6878d32665" integrity sha512-+g+fuxAd/tkCEJ/jhdnebXKtdPrhsu4VKWNnB/3qM35GbuGQOasmYFYnKL+HYZMpbQ6YqeZcXTVg/wnCTttz0g== -xterm-addon-webgl@0.13.0-beta.37: - version "0.13.0-beta.37" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.37.tgz#46819028abbe66cfabc60a615c4cc7bcd9156305" - integrity sha512-XoJdN8CELScYLPnEJKo9s0r3tC9/szGnmBEymV1+oLbMrQNeaV5VQqbiYzgKTyDHc12Gc5lPvih3/r6eL/9gig== +xterm-addon-webgl@0.13.0-beta.45: + version "0.13.0-beta.45" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.45.tgz#f1f3c08e2a819970c1af0362eeb61185babcb6fc" + integrity sha512-TXq5mxvG2alo5hSj/aFqHDzR2RSV2HH4is7R7kVmSCVPnl2RgDfAPilXOEJyYFLF09EgiGiG5UZASYJjvJfMRg== xterm-headless@5.0.0-beta.5: version "5.0.0-beta.5" resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.0.0-beta.5.tgz#e29b6c5081f31f887122b7263ba996b0c46b3c22" integrity sha512-CMQ1+prBNF92oBMeZzc2rfTcmOaCGfwwSaoPYNTjyziZT6mZsEg7amajYkb0YAnqJ29MFm4kPGZbU78/dX4k2A== -xterm@5.0.0-beta.36: - version "5.0.0-beta.36" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.36.tgz#c07721d04fddc0f86417bc95a2f0824040c0eca9" - integrity sha512-6aND1UOAcCn42WlVrQbIU7a+ZFD4o3Gy2yE1BeDLTCFfK6oqc1QpRrH1plGOUypeabxCTADrw5vhl5W/45kutg== +xterm@5.0.0-beta.44: + version "5.0.0-beta.44" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" + integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== yallist@^4.0.0: version "4.0.0" diff --git a/yarn.lock b/yarn.lock index c408f749974..8761bffc701 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11365,10 +11365,10 @@ xtend@~2.1.1: dependencies: object-keys "~0.4.0" -xterm-addon-canvas@0.2.0-beta.17: - version "0.2.0-beta.17" - resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.17.tgz#e84a86530b20bd3edcce16b4566f346cd186ab4d" - integrity sha512-2ukPdCA92VTFYQRE56ylzvI3cfaQYDWd/Mc4jlEItI6sV/EA5RnUbbP+2sFIx0JlmHK6nVYXXNY2p6QRB7MRew== +xterm-addon-canvas@0.2.0-beta.21: + version "0.2.0-beta.21" + resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.2.0-beta.21.tgz#df79eac3408dcf24b1d42d4979a227efad3e6836" + integrity sha512-d1JjbPLQibDvG31Ii3M4Hz2m6ZINPU43c+O2j73/5ebBVo9zXV6deUFySedqXj+fFxLDgV0Twn09DrIR/j+PZA== xterm-addon-search@0.10.0-beta.5: version "0.10.0-beta.5" @@ -11385,20 +11385,20 @@ xterm-addon-unicode11@0.4.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.4.0-beta.5.tgz#3900e66f10d2e506133b61d7421aab6878d32665" integrity sha512-+g+fuxAd/tkCEJ/jhdnebXKtdPrhsu4VKWNnB/3qM35GbuGQOasmYFYnKL+HYZMpbQ6YqeZcXTVg/wnCTttz0g== -xterm-addon-webgl@0.13.0-beta.37: - version "0.13.0-beta.37" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.37.tgz#46819028abbe66cfabc60a615c4cc7bcd9156305" - integrity sha512-XoJdN8CELScYLPnEJKo9s0r3tC9/szGnmBEymV1+oLbMrQNeaV5VQqbiYzgKTyDHc12Gc5lPvih3/r6eL/9gig== +xterm-addon-webgl@0.13.0-beta.45: + version "0.13.0-beta.45" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.45.tgz#f1f3c08e2a819970c1af0362eeb61185babcb6fc" + integrity sha512-TXq5mxvG2alo5hSj/aFqHDzR2RSV2HH4is7R7kVmSCVPnl2RgDfAPilXOEJyYFLF09EgiGiG5UZASYJjvJfMRg== xterm-headless@5.0.0-beta.5: version "5.0.0-beta.5" resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.0.0-beta.5.tgz#e29b6c5081f31f887122b7263ba996b0c46b3c22" integrity sha512-CMQ1+prBNF92oBMeZzc2rfTcmOaCGfwwSaoPYNTjyziZT6mZsEg7amajYkb0YAnqJ29MFm4kPGZbU78/dX4k2A== -xterm@5.0.0-beta.36: - version "5.0.0-beta.36" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.36.tgz#c07721d04fddc0f86417bc95a2f0824040c0eca9" - integrity sha512-6aND1UOAcCn42WlVrQbIU7a+ZFD4o3Gy2yE1BeDLTCFfK6oqc1QpRrH1plGOUypeabxCTADrw5vhl5W/45kutg== +xterm@5.0.0-beta.44: + version "5.0.0-beta.44" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" + integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== y18n@^3.2.1: version "3.2.2" From 13b58bb0474ee4230487cb5ccf490eadb4cf93a9 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Mon, 29 Aug 2022 12:29:07 -0700 Subject: [PATCH 12/21] up max url length to 7500 (#159491) up max url length to 7500. Fixes #159191 --- src/vs/code/electron-sandbox/issue/issueReporterMain.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts index ed78a7d1963..7030b64b493 100644 --- a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts +++ b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts @@ -27,7 +27,9 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService'; import { applyZoom, zoomIn, zoomOut } from 'vs/platform/window/electron-sandbox/window'; -const MAX_URL_LENGTH = 2045; +// GitHub has let us know that we could up our limit here to 8k. We chose 7500 to play it safe. +// ref https://github.com/microsoft/vscode/issues/159191 +const MAX_URL_LENGTH = 7500; interface SearchResult { html_url: string; From 304c187e1f7d52fb3846966486c77ae3fcbcf5c1 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Mon, 29 Aug 2022 13:17:55 -0700 Subject: [PATCH 13/21] Add rounded corners to extension button actions (#159496) --- src/vs/workbench/contrib/extensions/browser/media/extension.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/extensions/browser/media/extension.css b/src/vs/workbench/contrib/extensions/browser/media/extension.css index 9ace904aef7..8d5886cf63d 100644 --- a/src/vs/workbench/contrib/extensions/browser/media/extension.css +++ b/src/vs/workbench/contrib/extensions/browser/media/extension.css @@ -199,7 +199,7 @@ } .extension-list-item > .details > .footer > .monaco-action-bar > .actions-container .action-label:not(.icon) { - border-radius: 0; + border-radius: 2px; } .extension-list-item > .details > .footer > .monaco-action-bar > .actions-container .extension-action.label { From 212af8702db15a621195906375ab699044cedf4c Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 29 Aug 2022 14:59:20 -0700 Subject: [PATCH 14/21] get task reconnection to work in remote envs (#159316) * fix #159215 * remove unneeded change --- src/vs/platform/terminal/common/terminal.ts | 3 +++ src/vs/server/node/remoteTerminalChannel.ts | 5 ++++- src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts | 1 - .../contrib/terminal/browser/remoteTerminalBackend.ts | 5 ++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/vs/platform/terminal/common/terminal.ts b/src/vs/platform/terminal/common/terminal.ts index 8554f64ec0d..2d717d0a297 100644 --- a/src/vs/platform/terminal/common/terminal.ts +++ b/src/vs/platform/terminal/common/terminal.ts @@ -580,6 +580,9 @@ export interface IShellLaunchConfigDto { env?: ITerminalEnvironment; useShellEnvironment?: boolean; hideFromUser?: boolean; + reconnectionProperties?: IReconnectionProperties; + type?: 'Task' | 'Local'; + isFeatureTerminal?: boolean; } /** diff --git a/src/vs/server/node/remoteTerminalChannel.ts b/src/vs/server/node/remoteTerminalChannel.ts index 8e8acb95741..7c8f29b1e38 100644 --- a/src/vs/server/node/remoteTerminalChannel.ts +++ b/src/vs/server/node/remoteTerminalChannel.ts @@ -185,7 +185,10 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel< : URI.revive(uriTransformer.transformIncoming(args.shellLaunchConfig.cwd)) ), env: args.shellLaunchConfig.env, - useShellEnvironment: args.shellLaunchConfig.useShellEnvironment + useShellEnvironment: args.shellLaunchConfig.useShellEnvironment, + reconnectionProperties: args.shellLaunchConfig.reconnectionProperties, + type: args.shellLaunchConfig.type, + isFeatureTerminal: args.shellLaunchConfig.isFeatureTerminal }; diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 16c3a44a71e..1dd01498583 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -1323,7 +1323,6 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } // Either no group is used, no terminal with the group exists or splitting an existing terminal failed. const createdTerminal = await this._terminalService.createTerminal({ location: TerminalLocation.Panel, config: launchConfigs }); - this._logService.trace('Created a new task terminal'); createdTerminal.onDisposed((terminal) => this._fireTaskEvent({ kind: TaskEventKind.Terminated, exitReason: terminal.exitReason, taskId: task.getRecentlyUsedKey() })); return createdTerminal; } diff --git a/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts b/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts index bdd21a28f84..123fab0ebdc 100644 --- a/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts +++ b/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts @@ -209,7 +209,10 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack args: shellLaunchConfig.args, cwd: shellLaunchConfig.cwd, env: shellLaunchConfig.env, - useShellEnvironment: shellLaunchConfig.useShellEnvironment + useShellEnvironment: shellLaunchConfig.useShellEnvironment, + reconnectionProperties: shellLaunchConfig.reconnectionProperties, + type: shellLaunchConfig.type, + isFeatureTerminal: shellLaunchConfig.isFeatureTerminal }; const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(); From 1715e06bb254338f163ed75472bc367f7a742a30 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 29 Aug 2022 15:03:31 -0700 Subject: [PATCH 15/21] prompt for permission in trusted work space once per folder for auto run tasks (#159478) fix #159370 --- .../tasks/browser/abstractTaskService.ts | 2 +- .../tasks/browser/runAutomaticTasks.ts | 59 ++++++++----------- .../tasks/browser/task.contribution.ts | 4 +- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 6da4739e321..25e85ead511 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -1228,7 +1228,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } if (runSource === TaskRunSource.User) { const workspaceTasks = await this.getWorkspaceTasks(); - RunAutomaticTasks.promptForPermission(this, this._storageService, this._notificationService, this._workspaceTrustManagementService, this._openerService, this._configurationService, workspaceTasks); + RunAutomaticTasks.runWithPermission(this, this._storageService, this._notificationService, this._workspaceTrustManagementService, this._openerService, this._configurationService, workspaceTasks); } return executeTaskResult; } catch (error) { diff --git a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts index 8936b8112a5..5cf4be90e47 100644 --- a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts +++ b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts @@ -29,7 +29,10 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut @ITaskService private readonly _taskService: ITaskService, @IConfigurationService private readonly _configurationService: IConfigurationService, @IWorkspaceTrustManagementService private readonly _workspaceTrustManagementService: IWorkspaceTrustManagementService, - @ILogService private readonly _logService: ILogService) { + @ILogService private readonly _logService: ILogService, + @IStorageService private readonly _storageService: IStorageService, + @IOpenerService private readonly _openerService: IOpenerService, + @INotificationService private readonly _notificationService: INotificationService) { super(); this._tryRunTasks(); } @@ -42,21 +45,9 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut await Event.toPromise(Event.once(this._taskService.onDidChangeTaskSystemInfo)); } - this._logService.trace('RunAutomaticTasks: Checking if automatic tasks should run.'); - const isFolderAutomaticAllowed = this._configurationService.getValue(ALLOW_AUTOMATIC_TASKS) !== 'off'; - await this._workspaceTrustManagementService.workspaceTrustInitialized; - const isWorkspaceTrusted = this._workspaceTrustManagementService.isWorkspaceTrusted(); - // Only run if allowed. Prompting for permission occurs when a user first tries to run a task. - if (isFolderAutomaticAllowed && isWorkspaceTrusted) { - this._taskService.getWorkspaceTasks(TaskRunSource.FolderOpen).then(workspaceTaskResult => { - const { tasks } = RunAutomaticTasks._findAutoTasks(this._taskService, workspaceTaskResult); - this._logService.trace(`RunAutomaticTasks: Found ${tasks.length} automatic tasks tasks`); - - if (tasks.length > 0) { - RunAutomaticTasks._runTasks(this._taskService, tasks); - } - }); - } + const workspaceTasks = await this._taskService.getWorkspaceTasks(TaskRunSource.FolderOpen); + this._logService.trace(`RunAutomaticTasks: Found ${workspaceTasks.size} automatic tasks`); + await RunAutomaticTasks.runWithPermission(this._taskService, this._storageService, this._notificationService, this._workspaceTrustManagementService, this._openerService, this._configurationService, workspaceTasks); } private static _runTasks(taskService: ITaskService, tasks: Array>) { @@ -128,29 +119,31 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut return { tasks, taskNames, locations }; } - public static async promptForPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService, + public static async runWithPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService, openerService: IOpenerService, configurationService: IConfigurationService, workspaceTaskResult: Map) { const isWorkspaceTrusted = workspaceTrustManagementService.isWorkspaceTrusted; - if (!isWorkspaceTrusted) { - return; - } - if (configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'off') { + if (!isWorkspaceTrusted || configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'off') { return; } - const hasShownPromptForAutomaticTasks = storageService.getBoolean(HAS_PROMPTED_FOR_AUTOMATIC_TASKS, StorageScope.WORKSPACE, undefined); + const hasShownPromptForAutomaticTasks = storageService.getBoolean(HAS_PROMPTED_FOR_AUTOMATIC_TASKS, StorageScope.WORKSPACE, false); const { tasks, taskNames, locations } = RunAutomaticTasks._findAutoTasks(taskService, workspaceTaskResult); - if (taskNames.length > 0) { - if (configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'on') { - RunAutomaticTasks._runTasks(taskService, tasks); - } else if (!hasShownPromptForAutomaticTasks) { - // We have automatic tasks, prompt to allow. - this._showPrompt(notificationService, storageService, openerService, configurationService, taskNames, locations).then(allow => { - if (allow) { - RunAutomaticTasks._runTasks(taskService, tasks); - } - }); - } + + if (taskNames.length === 0) { + return; + } + + if (configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'on') { + RunAutomaticTasks._runTasks(taskService, tasks); + } else if (configurationService.getValue(ALLOW_AUTOMATIC_TASKS) === 'auto' && !hasShownPromptForAutomaticTasks) { + // by default, only prompt once per folder + // otherwise, this can be configured via the setting + this._showPrompt(notificationService, storageService, openerService, configurationService, taskNames, locations).then(allow => { + if (allow) { + storageService.store(HAS_PROMPTED_FOR_AUTOMATIC_TASKS, true, StorageScope.WORKSPACE, StorageTarget.USER); + RunAutomaticTasks._runTasks(taskService, tasks); + } + }); } } diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index 0f9f957a33c..f1e566ae4e3 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -500,11 +500,11 @@ configurationRegistry.registerConfiguration({ type: 'string', enum: ['on', 'auto', 'off'], enumDescriptions: [ - nls.localize('ttask.allowAutomaticTasks.on', "Always"), + nls.localize('task.allowAutomaticTasks.on', "Always"), nls.localize('task.allowAutomaticTasks.auto', "Prompt for permission for each folder"), nls.localize('task.allowAutomaticTasks.off', "Never"), ], - description: nls.localize('task.allowAutomaticTasks', "Enable automatic tasks in the folder."), + description: nls.localize('task.allowAutomaticTasks', "Enable automatic tasks in the folder - note that tasks won't run in an untrusted workspace."), default: 'auto', restricted: true }, From 0d690b3a8f5af9b8812013d713f61b886f27faa5 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Mon, 29 Aug 2022 15:33:03 -0700 Subject: [PATCH 16/21] Clear passwords that don't decrypt (#159506) If a password is not decrypted properly, then it should be removed from the secret storage because it's essentially dead. Fixes #151654 --- .../workbench/api/browser/mainThreadSecretState.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadSecretState.ts b/src/vs/workbench/api/browser/mainThreadSecretState.ts index acd6e3db0c1..1c49ff84612 100644 --- a/src/vs/workbench/api/browser/mainThreadSecretState.ts +++ b/src/vs/workbench/api/browser/mainThreadSecretState.ts @@ -65,9 +65,17 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre if (value.extensionId === extensionId) { return value.content; } - } catch (e) { - this.logService.error(e); - throw new Error('Cannot get password'); + } catch (parseError) { + this.logService.error(parseError); + + // If we can't parse the decrypted value, then it's not a valid secret so we should try to delete it + try { + await this.credentialsService.deletePassword(fullKey, key); + } catch (e) { + this.logService.error(e); + } + + throw new Error('Unable to parse decrypted password'); } } From 71c216d91feecec286c7f0b7fb0a492c6873bf28 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 15:35:23 -0700 Subject: [PATCH 17/21] Fix lint errors in our npm scripts (#159501) --- build/npm/jsconfig.json | 2 +- build/npm/update-all-grammars.mjs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/npm/jsconfig.json b/build/npm/jsconfig.json index 41d18dab432..2b8f9ad1953 100644 --- a/build/npm/jsconfig.json +++ b/build/npm/jsconfig.json @@ -4,7 +4,7 @@ "lib": [ "ES2020" ], - "module": "node12", + "module": "node16", "checkJs": true, "noEmit": true } diff --git a/build/npm/update-all-grammars.mjs b/build/npm/update-all-grammars.mjs index 2da48570661..e0d34e42beb 100644 --- a/build/npm/update-all-grammars.mjs +++ b/build/npm/update-all-grammars.mjs @@ -6,7 +6,7 @@ import { spawn as _spawn } from 'child_process'; import { readdirSync, readFileSync } from 'fs'; import { join } from 'path'; -import url from 'url' +import url from 'url'; async function spawn(cmd, args, opts) { return new Promise((c, e) => { @@ -20,7 +20,7 @@ async function main() { for (const extension of readdirSync('extensions')) { try { - let packageJSON = JSON.parse(readFileSync(join('extensions', extension, 'package.json')).toString()); + const packageJSON = JSON.parse(readFileSync(join('extensions', extension, 'package.json')).toString()); if (!(packageJSON && packageJSON.scripts && packageJSON.scripts['update-grammar'])) { continue; } From a13e5e1da6d87e4dac3bfd9e61145f67dec29a43 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 15:52:54 -0700 Subject: [PATCH 18/21] Also apply max-width to videos in webviews (#159500) --- extensions/markdown-language-features/media/markdown.css | 2 +- .../workbench/contrib/webview/browser/pre/index-no-csp.html | 2 +- src/vs/workbench/contrib/webview/browser/pre/index.html | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/markdown-language-features/media/markdown.css b/extensions/markdown-language-features/media/markdown.css index 47c2a443423..e25367bcdce 100644 --- a/extensions/markdown-language-features/media/markdown.css +++ b/extensions/markdown-language-features/media/markdown.css @@ -113,7 +113,7 @@ ol ol { margin-bottom: 0; } -img { +img, video { max-width: 100%; max-height: 100%; } diff --git a/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html b/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html index d0ce103adc8..f070ed0bb60 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html +++ b/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html @@ -99,7 +99,7 @@ padding: 0 20px; } - img { + img, video { max-width: 100%; max-height: 100%; } diff --git a/src/vs/workbench/contrib/webview/browser/pre/index.html b/src/vs/workbench/contrib/webview/browser/pre/index.html index 6c00e8b5da2..701a0e8304e 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/index.html +++ b/src/vs/workbench/contrib/webview/browser/pre/index.html @@ -5,7 +5,7 @@ + content="default-src 'none'; script-src 'sha256-EDTzzejMryXNJsvXPm3ha4m5Mi6h2Y//JRojh+K0+bY=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> Date: Mon, 29 Aug 2022 23:40:04 -0700 Subject: [PATCH 19/21] Re-enable running our eslint rules using ts-node (#159495) Resubmission of #157532 with the following changes: - Use `eslint-plugin-local` instead of `yarn` link to run our plugins - Move our plugins to a top level `.eslintplugin` dir (as required by `eslint-plugin-local`) - Update all names to `local/` --- .../code-import-patterns.ts | 4 +- .../eslint => .eslintplugin}/code-layering.ts | 0 .../code-no-look-behind-regex.ts | 0 .../code-no-nls-in-standalone-editor.ts | 0 .../code-no-standalone-editor.ts | 0 .../code-no-test-only.ts | 0 .../code-no-unexternalized-strings.ts | 0 .../code-no-unused-expressions.ts | 0 .../code-translation-remind.ts | 0 .eslintplugin/index.js | 12 + .eslintplugin/tsconfig.json | 26 ++ {build/lib/eslint => .eslintplugin}/utils.ts | 0 .../vscode-dts-cancellation.ts | 0 .../vscode-dts-create-func.ts | 0 .../vscode-dts-event-naming.ts | 0 .../vscode-dts-interface-naming.ts | 0 .../vscode-dts-literal-or-types.ts | 0 .../vscode-dts-provider-naming.ts | 0 .../vscode-dts-region-comments.ts | 0 .../vscode-dts-use-thenable.ts | 0 .../vscode-dts-vscode-in-comments.ts | 0 .eslintrc.json | 43 +-- .vscode/settings.json | 5 - build/eslint.js | 3 +- build/hygiene.js | 3 +- build/lib/eslint/code-import-patterns.js | 199 ------------- build/lib/eslint/code-layering.js | 68 ----- build/lib/eslint/code-no-look-behind-regex.js | 42 --- .../code-no-nls-in-standalone-editor.js | 38 --- build/lib/eslint/code-no-standalone-editor.js | 41 --- build/lib/eslint/code-no-test-only.js | 17 -- .../eslint/code-no-unexternalized-strings.js | 111 ------- .../lib/eslint/code-no-unused-expressions.js | 119 -------- build/lib/eslint/code-translation-remind.js | 57 ---- build/lib/eslint/utils.js | 37 --- build/lib/eslint/vscode-dts-cancellation.js | 33 --- build/lib/eslint/vscode-dts-create-func.js | 34 --- build/lib/eslint/vscode-dts-event-naming.js | 86 ------ .../lib/eslint/vscode-dts-interface-naming.js | 30 -- .../lib/eslint/vscode-dts-literal-or-types.js | 25 -- .../lib/eslint/vscode-dts-provider-naming.js | 37 --- .../lib/eslint/vscode-dts-region-comments.js | 35 --- build/lib/eslint/vscode-dts-use-thenable.js | 24 -- .../eslint/vscode-dts-vscode-in-comments.js | 45 --- build/package.json | 2 - build/tsconfig.build.json | 3 + build/yarn.lock | 279 +----------------- extensions/git/src/git.ts | 2 +- package.json | 3 + .../commandDetectionCapability.ts | 2 +- .../partialCommandDetectionCapability.ts | 2 +- .../common/xterm/shellIntegrationAddon.ts | 2 +- .../colorRegistry.releaseTest.ts | 2 +- .../nativeLocalProcessExtensionHost.ts | 4 +- .../vscode.proposed.customEditorMove.d.ts | 2 +- ...e.proposed.inlineCompletionsAdditions.d.ts | 4 +- .../vscode.proposed.notebookDebugOptions.d.ts | 2 +- src/vscode-dts/vscode.proposed.resolvers.d.ts | 2 +- test/monaco/esm-check/index.js | 2 +- yarn.lock | 154 +++++++++- 60 files changed, 240 insertions(+), 1401 deletions(-) rename {build/lib/eslint => .eslintplugin}/code-import-patterns.ts (98%) rename {build/lib/eslint => .eslintplugin}/code-layering.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-look-behind-regex.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-nls-in-standalone-editor.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-standalone-editor.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-test-only.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-unexternalized-strings.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-no-unused-expressions.ts (100%) rename {build/lib/eslint => .eslintplugin}/code-translation-remind.ts (100%) create mode 100644 .eslintplugin/index.js create mode 100644 .eslintplugin/tsconfig.json rename {build/lib/eslint => .eslintplugin}/utils.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-cancellation.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-create-func.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-event-naming.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-interface-naming.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-literal-or-types.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-provider-naming.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-region-comments.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-use-thenable.ts (100%) rename {build/lib/eslint => .eslintplugin}/vscode-dts-vscode-in-comments.ts (100%) delete mode 100644 build/lib/eslint/code-import-patterns.js delete mode 100644 build/lib/eslint/code-layering.js delete mode 100644 build/lib/eslint/code-no-look-behind-regex.js delete mode 100644 build/lib/eslint/code-no-nls-in-standalone-editor.js delete mode 100644 build/lib/eslint/code-no-standalone-editor.js delete mode 100644 build/lib/eslint/code-no-test-only.js delete mode 100644 build/lib/eslint/code-no-unexternalized-strings.js delete mode 100644 build/lib/eslint/code-no-unused-expressions.js delete mode 100644 build/lib/eslint/code-translation-remind.js delete mode 100644 build/lib/eslint/utils.js delete mode 100644 build/lib/eslint/vscode-dts-cancellation.js delete mode 100644 build/lib/eslint/vscode-dts-create-func.js delete mode 100644 build/lib/eslint/vscode-dts-event-naming.js delete mode 100644 build/lib/eslint/vscode-dts-interface-naming.js delete mode 100644 build/lib/eslint/vscode-dts-literal-or-types.js delete mode 100644 build/lib/eslint/vscode-dts-provider-naming.js delete mode 100644 build/lib/eslint/vscode-dts-region-comments.js delete mode 100644 build/lib/eslint/vscode-dts-use-thenable.js delete mode 100644 build/lib/eslint/vscode-dts-vscode-in-comments.js diff --git a/build/lib/eslint/code-import-patterns.ts b/.eslintplugin/code-import-patterns.ts similarity index 98% rename from build/lib/eslint/code-import-patterns.ts rename to .eslintplugin/code-import-patterns.ts index 72b63a45b35..c9a24c849d7 100644 --- a/build/lib/eslint/code-import-patterns.ts +++ b/.eslintplugin/code-import-patterns.ts @@ -6,10 +6,10 @@ import * as eslint from 'eslint'; import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as path from 'path'; -import * as minimatch from 'minimatch'; +import minimatch from 'minimatch'; import { createImportRuleListener } from './utils'; -const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); +const REPO_ROOT = path.normalize(path.join(__dirname, '../')); interface ConditionalPattern { when?: 'hasBrowser' | 'hasNode' | 'test'; diff --git a/build/lib/eslint/code-layering.ts b/.eslintplugin/code-layering.ts similarity index 100% rename from build/lib/eslint/code-layering.ts rename to .eslintplugin/code-layering.ts diff --git a/build/lib/eslint/code-no-look-behind-regex.ts b/.eslintplugin/code-no-look-behind-regex.ts similarity index 100% rename from build/lib/eslint/code-no-look-behind-regex.ts rename to .eslintplugin/code-no-look-behind-regex.ts diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/.eslintplugin/code-no-nls-in-standalone-editor.ts similarity index 100% rename from build/lib/eslint/code-no-nls-in-standalone-editor.ts rename to .eslintplugin/code-no-nls-in-standalone-editor.ts diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/.eslintplugin/code-no-standalone-editor.ts similarity index 100% rename from build/lib/eslint/code-no-standalone-editor.ts rename to .eslintplugin/code-no-standalone-editor.ts diff --git a/build/lib/eslint/code-no-test-only.ts b/.eslintplugin/code-no-test-only.ts similarity index 100% rename from build/lib/eslint/code-no-test-only.ts rename to .eslintplugin/code-no-test-only.ts diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/.eslintplugin/code-no-unexternalized-strings.ts similarity index 100% rename from build/lib/eslint/code-no-unexternalized-strings.ts rename to .eslintplugin/code-no-unexternalized-strings.ts diff --git a/build/lib/eslint/code-no-unused-expressions.ts b/.eslintplugin/code-no-unused-expressions.ts similarity index 100% rename from build/lib/eslint/code-no-unused-expressions.ts rename to .eslintplugin/code-no-unused-expressions.ts diff --git a/build/lib/eslint/code-translation-remind.ts b/.eslintplugin/code-translation-remind.ts similarity index 100% rename from build/lib/eslint/code-translation-remind.ts rename to .eslintplugin/code-translation-remind.ts diff --git a/.eslintplugin/index.js b/.eslintplugin/index.js new file mode 100644 index 00000000000..9f45316837a --- /dev/null +++ b/.eslintplugin/index.js @@ -0,0 +1,12 @@ +const glob = require('glob'); +const path = require('path'); + +require('ts-node').register({ experimentalResolver: true, transpileOnly: true }); + +// Re-export all .ts files as rules +const rules = {}; +glob.sync(`${__dirname}/*.ts`).forEach((file) => { + rules[path.basename(file, '.ts')] = require(file); +}); + +exports.rules = rules; diff --git a/.eslintplugin/tsconfig.json b/.eslintplugin/tsconfig.json new file mode 100644 index 00000000000..0da715fd036 --- /dev/null +++ b/.eslintplugin/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es2020", + "lib": [ + "ES2020" + ], + "module": "commonjs", + "esModuleInterop": true, + "alwaysStrict": true, + "allowJs": true, + "strict": true, + "exactOptionalPropertyTypes": false, + "useUnknownInCatchVariables": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "newLine": "lf", + "noEmit": true + }, + "include": [ + "**/*.ts", + "**/*.js" + ], + "exclude": [ + "node_modules/**" + ] +} diff --git a/build/lib/eslint/utils.ts b/.eslintplugin/utils.ts similarity index 100% rename from build/lib/eslint/utils.ts rename to .eslintplugin/utils.ts diff --git a/build/lib/eslint/vscode-dts-cancellation.ts b/.eslintplugin/vscode-dts-cancellation.ts similarity index 100% rename from build/lib/eslint/vscode-dts-cancellation.ts rename to .eslintplugin/vscode-dts-cancellation.ts diff --git a/build/lib/eslint/vscode-dts-create-func.ts b/.eslintplugin/vscode-dts-create-func.ts similarity index 100% rename from build/lib/eslint/vscode-dts-create-func.ts rename to .eslintplugin/vscode-dts-create-func.ts diff --git a/build/lib/eslint/vscode-dts-event-naming.ts b/.eslintplugin/vscode-dts-event-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-event-naming.ts rename to .eslintplugin/vscode-dts-event-naming.ts diff --git a/build/lib/eslint/vscode-dts-interface-naming.ts b/.eslintplugin/vscode-dts-interface-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-interface-naming.ts rename to .eslintplugin/vscode-dts-interface-naming.ts diff --git a/build/lib/eslint/vscode-dts-literal-or-types.ts b/.eslintplugin/vscode-dts-literal-or-types.ts similarity index 100% rename from build/lib/eslint/vscode-dts-literal-or-types.ts rename to .eslintplugin/vscode-dts-literal-or-types.ts diff --git a/build/lib/eslint/vscode-dts-provider-naming.ts b/.eslintplugin/vscode-dts-provider-naming.ts similarity index 100% rename from build/lib/eslint/vscode-dts-provider-naming.ts rename to .eslintplugin/vscode-dts-provider-naming.ts diff --git a/build/lib/eslint/vscode-dts-region-comments.ts b/.eslintplugin/vscode-dts-region-comments.ts similarity index 100% rename from build/lib/eslint/vscode-dts-region-comments.ts rename to .eslintplugin/vscode-dts-region-comments.ts diff --git a/build/lib/eslint/vscode-dts-use-thenable.ts b/.eslintplugin/vscode-dts-use-thenable.ts similarity index 100% rename from build/lib/eslint/vscode-dts-use-thenable.ts rename to .eslintplugin/vscode-dts-use-thenable.ts diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.ts b/.eslintplugin/vscode-dts-vscode-in-comments.ts similarity index 100% rename from build/lib/eslint/vscode-dts-vscode-in-comments.ts rename to .eslintplugin/vscode-dts-vscode-in-comments.ts diff --git a/.eslintrc.json b/.eslintrc.json index d86f6103a7d..3ad6a748650 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,7 +8,8 @@ "plugins": [ "@typescript-eslint", "jsdoc", - "header" + "header", + "local" ], "rules": { "constructor-super": "warn", @@ -61,17 +62,17 @@ ] } ], - "code-no-unused-expressions": [ + "local/code-no-unused-expressions": [ "warn", { "allowTernary": true } ], - "code-translation-remind": "warn", - "code-no-nls-in-standalone-editor": "warn", - "code-no-standalone-editor": "warn", - "code-no-unexternalized-strings": "warn", - "code-layering": [ + "local/code-translation-remind": "warn", + "local/code-no-nls-in-standalone-editor": "warn", + "local/code-no-standalone-editor": "warn", + "local/code-no-unexternalized-strings": "warn", + "local/code-layering": [ "warn", { "common": [], @@ -122,8 +123,8 @@ "**/*.test.ts" ], "rules": { - "code-no-test-only": "error", - "code-no-unexternalized-strings": "off" + "local/code-no-test-only": "error", + "local/code-no-unexternalized-strings": "off" } }, { @@ -132,14 +133,14 @@ "**/vscode.proposed.*.d.ts" ], "rules": { - "vscode-dts-create-func": "warn", - "vscode-dts-literal-or-types": "warn", - "vscode-dts-interface-naming": "warn", - "vscode-dts-cancellation": "warn", - "vscode-dts-use-thenable": "warn", - "vscode-dts-region-comments": "warn", - "vscode-dts-vscode-in-comments": "warn", - "vscode-dts-provider-naming": [ + "local/vscode-dts-create-func": "warn", + "local/vscode-dts-literal-or-types": "warn", + "local/vscode-dts-interface-naming": "warn", + "local/vscode-dts-cancellation": "warn", + "local/vscode-dts-use-thenable": "warn", + "local/vscode-dts-region-comments": "warn", + "local/vscode-dts-vscode-in-comments": "warn", + "local/vscode-dts-provider-naming": [ "warn", { "allowed": [ @@ -154,7 +155,7 @@ ] } ], - "vscode-dts-event-naming": [ + "local/vscode-dts-event-naming": [ "warn", { "allowed": [ @@ -200,8 +201,8 @@ "src/**/*.ts" ], "rules": { - "code-no-look-behind-regex": "warn", - "code-import-patterns": [ + "local/code-no-look-behind-regex": "warn", + "local/code-import-patterns": [ "warn", { // imports that are allowed in all files of layers: @@ -576,7 +577,7 @@ "test/**/*.ts" ], "rules": { - "code-import-patterns": [ + "local/code-import-patterns": [ "warn", { "target": "test/smoke/**", diff --git a/.vscode/settings.json b/.vscode/settings.json index 71bded80a79..0529bf5aba5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,11 +41,6 @@ } } ], - "eslint.options": { - "rulePaths": [ - "./build/lib/eslint" - ] - }, "typescript.tsdk": "node_modules/typescript/lib", "npm.exclude": "**/extensions/**", "npm.packageManager": "yarn", diff --git a/build/eslint.js b/build/eslint.js index c04f4ef7756..288917b35bf 100644 --- a/build/eslint.js +++ b/build/eslint.js @@ -13,8 +13,7 @@ function eslint() { .src(eslintFilter, { base: '.', follow: true, allowEmpty: true }) .pipe( gulpeslint({ - configFile: '.eslintrc.json', - rulePaths: ['./build/lib/eslint'], + configFile: '.eslintrc.json' }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/hygiene.js b/build/hygiene.js index e18466c8f77..99b757e6d76 100644 --- a/build/hygiene.js +++ b/build/hygiene.js @@ -173,8 +173,7 @@ function hygiene(some, linting = true) { .pipe(filter(eslintFilter)) .pipe( gulpeslint({ - configFile: '.eslintrc.json', - rulePaths: ['./build/lib/eslint'], + configFile: '.eslintrc.json' }) ) .pipe(gulpeslint.formatEach('compact')) diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js deleted file mode 100644 index 47cc3063d1c..00000000000 --- a/build/lib/eslint/code-import-patterns.js +++ /dev/null @@ -1,199 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path = require("path"); -const minimatch = require("minimatch"); -const utils_1 = require("./utils"); -const REPO_ROOT = path.normalize(path.join(__dirname, '../../../')); -function isLayerAllowRule(option) { - return !!(option.when && option.allow); -} -/** - * Returns the filename relative to the project root and using `/` as separators - */ -function getRelativeFilename(context) { - const filename = path.normalize(context.getFilename()); - return filename.substring(REPO_ROOT.length).replace(/\\/g, '/'); -} -module.exports = new class { - constructor() { - this.meta = { - messages: { - badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization', - badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - this._optionsCache = new WeakMap(); - } - create(context) { - const options = context.options; - const configs = this._processOptions(options); - const relativeFilename = getRelativeFilename(context); - for (const config of configs) { - if (minimatch(relativeFilename, config.target)) { - return (0, utils_1.createImportRuleListener)((node, value) => this._checkImport(context, config, node, value)); - } - } - context.report({ - loc: { line: 1, column: 0 }, - messageId: 'badFilename' - }); - return {}; - } - _processOptions(options) { - if (this._optionsCache.has(options)) { - return this._optionsCache.get(options); - } - function orSegment(variants) { - return (variants.length === 1 ? variants[0] : `{${variants.join(',')}}`); - } - const layerRules = [ - { layer: 'common', deps: orSegment(['common']) }, - { layer: 'worker', deps: orSegment(['common', 'worker']) }, - { layer: 'browser', deps: orSegment(['common', 'browser']), isBrowser: true }, - { layer: 'electron-sandbox', deps: orSegment(['common', 'browser', 'electron-sandbox']), isBrowser: true }, - { layer: 'node', deps: orSegment(['common', 'node']), isNode: true }, - { layer: 'electron-browser', deps: orSegment(['common', 'browser', 'node', 'electron-sandbox', 'electron-browser']), isBrowser: true, isNode: true }, - { layer: 'electron-main', deps: orSegment(['common', 'node', 'electron-main']), isNode: true }, - ]; - let browserAllow = []; - let nodeAllow = []; - let testAllow = []; - for (const option of options) { - if (isLayerAllowRule(option)) { - if (option.when === 'hasBrowser') { - browserAllow = option.allow.slice(0); - } - else if (option.when === 'hasNode') { - nodeAllow = option.allow.slice(0); - } - else if (option.when === 'test') { - testAllow = option.allow.slice(0); - } - } - } - function findLayer(layer) { - for (const layerRule of layerRules) { - if (layerRule.layer === layer) { - return layerRule; - } - } - return null; - } - function generateConfig(layerRule, target, rawRestrictions) { - const restrictions = []; - const testRestrictions = [...testAllow]; - if (layerRule.isBrowser) { - restrictions.push(...browserAllow); - } - if (layerRule.isNode) { - restrictions.push(...nodeAllow); - } - for (const rawRestriction of rawRestrictions) { - let importPattern; - let when = undefined; - if (typeof rawRestriction === 'string') { - importPattern = rawRestriction; - } - else { - importPattern = rawRestriction.pattern; - when = rawRestriction.when; - } - if (typeof when === 'undefined' - || (when === 'hasBrowser' && layerRule.isBrowser) - || (when === 'hasNode' && layerRule.isNode)) { - restrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); - testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); - } - else if (when === 'test') { - testRestrictions.push(importPattern.replace(/\/\~$/, `/${layerRule.deps}/**`)); - testRestrictions.push(importPattern.replace(/\/\~$/, `/test/${layerRule.deps}/**`)); - } - } - testRestrictions.push(...restrictions); - return [ - { - target: target.replace(/\/\~$/, `/${layerRule.layer}/**`), - restrictions: restrictions - }, - { - target: target.replace(/\/\~$/, `/test/${layerRule.layer}/**`), - restrictions: testRestrictions - } - ]; - } - const configs = []; - for (const option of options) { - if (isLayerAllowRule(option)) { - continue; - } - const target = option.target; - const targetIsVS = /^src\/vs\//.test(target); - const restrictions = (typeof option.restrictions === 'string' ? [option.restrictions] : option.restrictions).slice(0); - if (targetIsVS) { - // Always add "vs/nls" - restrictions.push('vs/nls'); - } - if (targetIsVS && option.layer) { - // single layer => simple substitution for /~ - const layerRule = findLayer(option.layer); - if (layerRule) { - const [config, testConfig] = generateConfig(layerRule, target, restrictions); - if (option.test) { - configs.push(testConfig); - } - else { - configs.push(config); - } - } - } - else if (targetIsVS && /\/\~$/.test(target)) { - // generate all layers - for (const layerRule of layerRules) { - const [config, testConfig] = generateConfig(layerRule, target, restrictions); - configs.push(config); - configs.push(testConfig); - } - } - else { - configs.push({ target, restrictions: restrictions.filter(r => typeof r === 'string') }); - } - } - this._optionsCache.set(options, configs); - return configs; - } - _checkImport(context, config, node, importPath) { - // resolve relative paths - if (importPath[0] === '.') { - const relativeFilename = getRelativeFilename(context); - importPath = path.posix.join(path.posix.dirname(relativeFilename), importPath); - if (/^src\/vs\//.test(importPath)) { - // resolve using AMD base url - importPath = importPath.substring('src/'.length); - } - } - const restrictions = config.restrictions; - let matched = false; - for (const pattern of restrictions) { - if (minimatch(importPath, pattern)) { - matched = true; - break; - } - } - if (!matched) { - // None of the restrictions matched - context.report({ - loc: node.loc, - messageId: 'badImport', - data: { - restrictions: restrictions.join(' or ') - } - }); - } - } -}; diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js deleted file mode 100644 index bcb413d9db3..00000000000 --- a/build/lib/eslint/code-layering.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class { - constructor() { - this.meta = { - messages: { - layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - } - create(context) { - const fileDirname = (0, path_1.dirname)(context.getFilename()); - const parts = fileDirname.split(/\\|\//); - const ruleArgs = context.options[0]; - let config; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config.allowed.has(key)) { - config.disallowed.add(key); - } - }); - break; - } - } - if (!config) { - // nothing - return {}; - } - return (0, utils_1.createImportRuleListener)((node, path) => { - if (path[0] === '.') { - path = (0, path_1.join)((0, path_1.dirname)(context.getFilename()), path); - } - const parts = (0, path_1.dirname)(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (config.allowed.has(part)) { - // GOOD - same layer - break; - } - if (config.disallowed.has(part)) { - // BAD - wrong layer - context.report({ - loc: node.loc, - messageId: 'layerbreaker', - data: { - from: part, - allowed: [...config.allowed.keys()].join(', ') - } - }); - break; - } - } - }); - } -}; diff --git a/build/lib/eslint/code-no-look-behind-regex.js b/build/lib/eslint/code-no-look-behind-regex.js deleted file mode 100644 index c7cdf44c181..00000000000 --- a/build/lib/eslint/code-no-look-behind-regex.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -const _positiveLookBehind = /\(\?<=.+/; -const _negativeLookBehind = /\(\? { - const pattern = node.regex?.pattern; - if (_containsLookBehind(pattern)) { - context.report({ - node, - message: 'Look behind assertions are not yet supported in all browsers' - }); - } - }, - // new Regex("...") - ['NewExpression[callee.name="RegExp"] Literal']: (node) => { - if (_containsLookBehind(node.value)) { - context.report({ - node, - message: 'Look behind assertions are not yet supported in all browsers' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js deleted file mode 100644 index 36782a4b5bc..00000000000 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class NoNlsInStandaloneEditorRule { - constructor() { - this.meta = { - messages: { - noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' - } - }; - } - create(context) { - const fileName = context.getFilename(); - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) { - return (0, utils_1.createImportRuleListener)((node, path) => { - // resolve relative paths - if (path[0] === '.') { - path = (0, path_1.join)(context.getFilename(), path); - } - if (/vs(\/|\\)nls/.test(path)) { - context.report({ - loc: node.loc, - messageId: 'noNls' - }); - } - }); - } - return {}; - } -}; diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js deleted file mode 100644 index c57bd560bcf..00000000000 --- a/build/lib/eslint/code-no-standalone-editor.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const path_1 = require("path"); -const utils_1 = require("./utils"); -module.exports = new class NoNlsInStandaloneEditorRule { - constructor() { - this.meta = { - messages: { - badImport: 'Not allowed to import standalone editor modules.' - }, - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' - } - }; - } - create(context) { - if (/vs(\/|\\)editor/.test(context.getFilename())) { - // the vs/editor folder is allowed to use the standalone editor - return {}; - } - return (0, utils_1.createImportRuleListener)((node, path) => { - // resolve relative paths - if (path[0] === '.') { - path = (0, path_1.join)(context.getFilename(), path); - } - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { - context.report({ - loc: node.loc, - messageId: 'badImport' - }); - } - }); - } -}; diff --git a/build/lib/eslint/code-no-test-only.js b/build/lib/eslint/code-no-test-only.js deleted file mode 100644 index 46d144bfcaf..00000000000 --- a/build/lib/eslint/code-no-test-only.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class NoTestOnly { - create(context) { - return { - ['MemberExpression[object.name="test"][property.name="only"]']: (node) => { - return context.report({ - node, - message: 'test.only is a dev-time tool and CANNOT be pushed' - }); - } - }; - } -}; diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js deleted file mode 100644 index 48b591f8d3d..00000000000 --- a/build/lib/eslint/code-no-unexternalized-strings.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -function isStringLiteral(node) { - return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; -} -function isDoubleQuoted(node) { - return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; -} -module.exports = new (_a = class NoUnexternalizedStrings { - constructor() { - this.meta = { - messages: { - doubleQuoted: 'Only use double-quoted strings for externalized strings.', - badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', - duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', - badMessage: 'Message argument to \'{{message}}\' must be a string literal.' - } - }; - } - create(context) { - const externalizedStringLiterals = new Map(); - const doubleQuotedStringLiterals = new Set(); - function collectDoubleQuotedStrings(node) { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - } - function visitLocalizeCall(node) { - // localize(key, message) - const [keyNode, messageNode] = node.arguments; - // (1) - // extract key so that it can be checked later - let key; - if (isStringLiteral(keyNode)) { - doubleQuotedStringLiterals.delete(keyNode); - key = keyNode.value; - } - else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { - for (const property of keyNode.properties) { - if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - doubleQuotedStringLiterals.delete(property.value); - key = property.value.value; - break; - } - } - } - } - } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); - } - // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); - } - } - function reportBadStringsAndBadKeys() { - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } - for (const [key, values] of externalizedStringLiterals) { - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (const value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } - } - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } - } - } - } - } - return { - ['Literal']: (node) => collectDoubleQuotedStrings(node), - ['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node), - ['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), - ['Program:exit']: reportBadStringsAndBadKeys, - }; - } - }, - _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, - _a); diff --git a/build/lib/eslint/code-no-unused-expressions.js b/build/lib/eslint/code-no-unused-expressions.js deleted file mode 100644 index 5d9710072e6..00000000000 --- a/build/lib/eslint/code-no-unused-expressions.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -module.exports = { - meta: { - type: 'suggestion', - docs: { - description: 'disallow unused expressions', - category: 'Best Practices', - recommended: false, - url: 'https://eslint.org/docs/rules/no-unused-expressions' - }, - schema: [ - { - type: 'object', - properties: { - allowShortCircuit: { - type: 'boolean', - default: false - }, - allowTernary: { - type: 'boolean', - default: false - }, - allowTaggedTemplates: { - type: 'boolean', - default: false - } - }, - additionalProperties: false - } - ] - }, - create(context) { - const config = context.options[0] || {}, allowShortCircuit = config.allowShortCircuit || false, allowTernary = config.allowTernary || false, allowTaggedTemplates = config.allowTaggedTemplates || false; - // eslint-disable-next-line jsdoc/require-description - /** - * @param node any node - * @returns whether the given node structurally represents a directive - */ - function looksLikeDirective(node) { - return node.type === 'ExpressionStatement' && - node.expression.type === 'Literal' && typeof node.expression.value === 'string'; - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param predicate ([a] -> Boolean) the function used to make the determination - * @param list the input list - * @returns the leading sequence of members in the given list that pass the given predicate - */ - function takeWhile(predicate, list) { - for (let i = 0; i < list.length; ++i) { - if (!predicate(list[i])) { - return list.slice(0, i); - } - } - return list.slice(); - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param node a Program or BlockStatement node - * @returns the leading sequence of directive nodes in the given node's body - */ - function directives(node) { - return takeWhile(looksLikeDirective, node.body); - } - // eslint-disable-next-line jsdoc/require-description - /** - * @param node any node - * @param ancestors the given node's ancestors - * @returns whether the given node is considered a directive in its current position - */ - function isDirective(node, ancestors) { - const parent = ancestors[ancestors.length - 1], grandparent = ancestors[ancestors.length - 2]; - return (parent.type === 'Program' || parent.type === 'BlockStatement' && - (/Function/u.test(grandparent.type))) && - directives(parent).indexOf(node) >= 0; - } - /** - * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. - * @param node any node - * @returns whether the given node is a valid expression - */ - function isValidExpression(node) { - if (allowTernary) { - // Recursive check for ternary and logical expressions - if (node.type === 'ConditionalExpression') { - return isValidExpression(node.consequent) && isValidExpression(node.alternate); - } - } - if (allowShortCircuit) { - if (node.type === 'LogicalExpression') { - return isValidExpression(node.right); - } - } - if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') { - return true; - } - if (node.type === 'ExpressionStatement') { - return isValidExpression(node.expression); - } - return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await|Chain)Expression$/u.test(node.type) || - (node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0); - } - return { - ExpressionStatement(node) { - if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) { - context.report({ node: node, message: `Expected an assignment or function call and instead saw an expression. ${node.expression}` }); - } - } - }; - } -}; diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js deleted file mode 100644 index 30b63429521..00000000000 --- a/build/lib/eslint/code-translation-remind.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const fs_1 = require("fs"); -const utils_1 = require("./utils"); -module.exports = new (_a = class TranslationRemind { - constructor() { - this.meta = { - messages: { - missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' - } - }; - } - create(context) { - return (0, utils_1.createImportRuleListener)((node, path) => this._checkImport(context, node, path)); - } - _checkImport(context, node, path) { - if (path !== TranslationRemind.NLS_MODULE) { - return; - } - const currentFile = context.getFilename(); - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - const resource = matchService ? matchService[0] : matchPart[0]; - let resourceDefined = false; - let json; - try { - json = (0, fs_1.readFileSync)('./build/lib/i18n.resources.json', 'utf8'); - } - catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - workbenchResources.forEach((existingResource) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - if (!resourceDefined) { - context.report({ - loc: node.loc, - messageId: 'missing', - data: { resource } - }); - } - } - }, - _a.NLS_MODULE = 'vs/nls', - _a); diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js deleted file mode 100644 index c58e4e24be1..00000000000 --- a/build/lib/eslint/utils.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createImportRuleListener = void 0; -function createImportRuleListener(validateImport) { - function _checkImport(node) { - if (node && node.type === 'Literal' && typeof node.value === 'string') { - validateImport(node, node.value); - } - } - return { - // import ??? from 'module' - ImportDeclaration: (node) => { - _checkImport(node.source); - }, - // import('module').then(...) OR await import('module') - ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => { - _checkImport(node); - }, - // import foo = ... - ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => { - _checkImport(node); - }, - // export ?? from 'module' - ExportAllDeclaration: (node) => { - _checkImport(node.source); - }, - // export {foo} from 'module' - ExportNamedDeclaration: (node) => { - _checkImport(node.source); - }, - }; -} -exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint/vscode-dts-cancellation.js b/build/lib/eslint/vscode-dts-cancellation.js deleted file mode 100644 index 65b9e4c1fe1..00000000000 --- a/build/lib/eslint/vscode-dts-cancellation.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new class ApiProviderNaming { - constructor() { - this.meta = { - messages: { - noToken: 'Function lacks a cancellation token, preferable as last argument', - } - }; - } - create(context) { - return { - ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node) => { - let found = false; - for (const param of node.params) { - if (param.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - found = found || param.name === 'token'; - } - } - if (!found) { - context.report({ - node, - messageId: 'noToken' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-create-func.js b/build/lib/eslint/vscode-dts-create-func.js deleted file mode 100644 index e9ec659cef1..00000000000 --- a/build/lib/eslint/vscode-dts-create-func.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new class ApiLiteralOrTypes { - constructor() { - this.meta = { - docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#creating-objects' }, - messages: { sync: '`createXYZ`-functions are constructor-replacements and therefore must return sync', } - }; - } - create(context) { - return { - ['TSDeclareFunction Identifier[name=/create.*/]']: (node) => { - const decl = node.parent; - if (decl.returnType?.typeAnnotation.type !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) { - return; - } - if (decl.returnType.typeAnnotation.typeName.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) { - return; - } - const ident = decl.returnType.typeAnnotation.typeName.name; - if (ident === 'Promise' || ident === 'Thenable') { - context.report({ - node, - messageId: 'sync' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-event-naming.js b/build/lib/eslint/vscode-dts-event-naming.js deleted file mode 100644 index 747e224b397..00000000000 --- a/build/lib/eslint/vscode-dts-event-naming.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -module.exports = new (_a = class ApiEventNaming { - constructor() { - this.meta = { - docs: { - url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#event-naming' - }, - messages: { - naming: 'Event names must follow this patten: `on[Did|Will]`', - verb: 'Unknown verb \'{{verb}}\' - is this really a verb? Iff so, then add this verb to the configuration', - subject: 'Unknown subject \'{{subject}}\' - This subject has not been used before but it should refer to something in the API', - unknown: 'UNKNOWN event declaration, lint-rule needs tweaking' - } - }; - } - create(context) { - const config = context.options[0]; - const allowed = new Set(config.allowed); - const verbs = new Set(config.verbs); - return { - ['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node) => { - const def = node.parent?.parent?.parent; - const ident = this.getIdent(def); - if (!ident) { - // event on unknown structure... - return context.report({ - node, - message: 'unknown' - }); - } - if (allowed.has(ident.name)) { - // configured exception - return; - } - const match = ApiEventNaming._nameRegExp.exec(ident.name); - if (!match) { - context.report({ - node: ident, - messageId: 'naming' - }); - return; - } - // check that is spelled out (configured) as verb - if (!verbs.has(match[2].toLowerCase())) { - context.report({ - node: ident, - messageId: 'verb', - data: { verb: match[2] } - }); - } - // check that a subject (if present) has occurred - if (match[3]) { - const regex = new RegExp(match[3], 'ig'); - const parts = context.getSourceCode().getText().split(regex); - if (parts.length < 3) { - context.report({ - node: ident, - messageId: 'subject', - data: { subject: match[3] } - }); - } - } - } - }; - } - getIdent(def) { - if (!def) { - return; - } - if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - return def; - } - else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { - return def.key; - } - return this.getIdent(def.parent); - } - }, - _a._nameRegExp = /on(Did|Will)([A-Z][a-z]+)([A-Z][a-z]+)?/, - _a); diff --git a/build/lib/eslint/vscode-dts-interface-naming.js b/build/lib/eslint/vscode-dts-interface-naming.js deleted file mode 100644 index 70ca810825b..00000000000 --- a/build/lib/eslint/vscode-dts-interface-naming.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -module.exports = new (_a = class ApiInterfaceNaming { - constructor() { - this.meta = { - messages: { - naming: 'Interfaces must not be prefixed with uppercase `I`', - } - }; - } - create(context) { - return { - ['TSInterfaceDeclaration Identifier']: (node) => { - const name = node.name; - if (ApiInterfaceNaming._nameRegExp.test(name)) { - context.report({ - node, - messageId: 'naming' - }); - } - } - }; - } - }, - _a._nameRegExp = /I[A-Z]/, - _a); diff --git a/build/lib/eslint/vscode-dts-literal-or-types.js b/build/lib/eslint/vscode-dts-literal-or-types.js deleted file mode 100644 index e4c075db91c..00000000000 --- a/build/lib/eslint/vscode-dts-literal-or-types.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiLiteralOrTypes { - constructor() { - this.meta = { - docs: { url: 'https://github.com/microsoft/vscode/wiki/Extension-API-guidelines#enums' }, - messages: { useEnum: 'Use enums, not literal-or-types', } - }; - } - create(context) { - return { - ['TSTypeAnnotation TSUnionType']: (node) => { - if (node.types.every(value => value.type === 'TSLiteralType')) { - context.report({ - node: node, - messageId: 'useEnum' - }); - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-provider-naming.js b/build/lib/eslint/vscode-dts-provider-naming.js deleted file mode 100644 index 44c2ddd5568..00000000000 --- a/build/lib/eslint/vscode-dts-provider-naming.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -module.exports = new (_a = class ApiProviderNaming { - constructor() { - this.meta = { - messages: { - naming: 'A provider should only have functions like provideXYZ or resolveXYZ', - } - }; - } - create(context) { - const config = context.options[0]; - const allowed = new Set(config.allowed); - return { - ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature']: (node) => { - const interfaceName = (node.parent?.parent).id.name; - if (allowed.has(interfaceName)) { - // allowed - return; - } - const methodName = node.key.name; - if (!ApiProviderNaming._providerFunctionNames.test(methodName)) { - context.report({ - node, - messageId: 'naming' - }); - } - } - }; - } - }, - _a._providerFunctionNames = /^(provide|resolve|prepare).+/, - _a); diff --git a/build/lib/eslint/vscode-dts-region-comments.js b/build/lib/eslint/vscode-dts-region-comments.js deleted file mode 100644 index 2dc9487314e..00000000000 --- a/build/lib/eslint/vscode-dts-region-comments.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiEventNaming { - constructor() { - this.meta = { - messages: { - comment: 'region comments should start with a camel case identifier, `:`, then either a GH issue link or owner, e.g #region myProposalName: https://github.com/microsoft/vscode/issues/', - } - }; - } - create(context) { - const sourceCode = context.getSourceCode(); - return { - ['Program']: (_node) => { - for (const comment of sourceCode.getAllComments()) { - if (comment.type !== 'Line') { - continue; - } - if (!/^\s*#region /.test(comment.value)) { - continue; - } - if (!/^\s*#region ([a-z]+): (@[a-z]+|https:\/\/github.com\/microsoft\/vscode\/issues\/\d+)/i.test(comment.value)) { - context.report({ - node: comment, - messageId: 'comment', - }); - } - } - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-use-thenable.js b/build/lib/eslint/vscode-dts-use-thenable.js deleted file mode 100644 index 7e23953cb69..00000000000 --- a/build/lib/eslint/vscode-dts-use-thenable.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiEventNaming { - constructor() { - this.meta = { - messages: { - usage: 'Use the Thenable-type instead of the Promise type', - } - }; - } - create(context) { - return { - ['TSTypeAnnotation TSTypeReference Identifier[name="Promise"]']: (node) => { - context.report({ - node, - messageId: 'usage', - }); - } - }; - } -}; diff --git a/build/lib/eslint/vscode-dts-vscode-in-comments.js b/build/lib/eslint/vscode-dts-vscode-in-comments.js deleted file mode 100644 index 8f9a13fb01f..00000000000 --- a/build/lib/eslint/vscode-dts-vscode-in-comments.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -module.exports = new class ApiVsCodeInComments { - constructor() { - this.meta = { - messages: { - comment: `Don't use the term 'vs code' in comments` - } - }; - } - create(context) { - const sourceCode = context.getSourceCode(); - return { - ['Program']: (_node) => { - for (const comment of sourceCode.getAllComments()) { - if (comment.type !== 'Block') { - continue; - } - if (!comment.range) { - continue; - } - const startIndex = comment.range[0] + '/*'.length; - const re = /vs code/ig; - let match; - while ((match = re.exec(comment.value))) { - // Allow using 'VS Code' in quotes - if (comment.value[match.index - 1] === `'` && comment.value[match.index + match[0].length] === `'`) { - continue; - } - // Types for eslint seem incorrect - const start = sourceCode.getLocFromIndex(startIndex + match.index); - const end = sourceCode.getLocFromIndex(startIndex + match.index + match[0].length); - context.report({ - messageId: 'comment', - loc: { start, end } - }); - } - } - } - }; - } -}; diff --git a/build/package.json b/build/package.json index 3b46323c250..dc22cad2a22 100644 --- a/build/package.json +++ b/build/package.json @@ -40,8 +40,6 @@ "@types/underscore": "^1.8.9", "@types/webpack": "^4.41.25", "@types/xml2js": "0.0.33", - "@typescript-eslint/experimental-utils": "^5.10.0", - "@typescript-eslint/parser": "^5.10.0", "@vscode/iconv-lite-umd": "0.7.0", "byline": "^5.0.0", "colors": "^1.4.0", diff --git a/build/tsconfig.build.json b/build/tsconfig.build.json index 0a00f2d0f48..801c7735b06 100644 --- a/build/tsconfig.build.json +++ b/build/tsconfig.build.json @@ -7,5 +7,8 @@ }, "include": [ "**/*.ts" + ], + "exclude": [ + "lib/eslint-plugin-vscode/**/*" ] } diff --git a/build/yarn.lock b/build/yarn.lock index 4ea17c7f5d4..84168ceb8a2 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -232,27 +232,6 @@ dependencies: cross-spawn "^7.0.1" -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - "@opentelemetry/api@^1.0.1": version "1.0.3" resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.0.3.tgz#13a12ae9e05c2a782f7b5e84c3cbfda4225eaf80" @@ -470,11 +449,6 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== -"@types/json-schema@^7.0.9": - version "7.0.9" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" - integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== - "@types/keyv@*": version "3.1.1" resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7" @@ -682,103 +656,6 @@ dependencies: "@types/node" "*" -"@typescript-eslint/experimental-utils@^5.10.0": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.10.1.tgz#49fa5a7800ed08ea70aef14fccb14fbae85116ab" - integrity sha512-Ryeb8nkJa/1zKl8iujNtJC8tgj6PgaY0sDUnrTqbmC70nrKKkZaHfiRDTcqICmCSCEQyLQcJAoh0AukLaIaGTw== - dependencies: - "@typescript-eslint/utils" "5.10.1" - -"@typescript-eslint/parser@^5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.0.tgz#8f59e036f5f1cffc178cacbd5ccdd02aeb96c91c" - integrity sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw== - dependencies: - "@typescript-eslint/scope-manager" "5.10.0" - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/typescript-estree" "5.10.0" - debug "^4.3.2" - -"@typescript-eslint/scope-manager@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz#bb5d872e8b9e36203908595507fbc4d3105329cb" - integrity sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg== - dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" - -"@typescript-eslint/scope-manager@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz#f0539c73804d2423506db2475352a4dec36cd809" - integrity sha512-Lyvi559Gvpn94k7+ElXNMEnXu/iundV5uFmCUNnftbFrUbAJ1WBoaGgkbOBm07jVZa682oaBU37ao/NGGX4ZDg== - dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" - -"@typescript-eslint/types@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.0.tgz#beb3cb345076f5b088afe996d57bcd1dfddaa75c" - integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ== - -"@typescript-eslint/types@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.1.tgz#dca9bd4cb8c067fc85304a31f38ec4766ba2d1ea" - integrity sha512-ZvxQ2QMy49bIIBpTqFiOenucqUyjTQ0WNLhBM6X1fh1NNlYAC6Kxsx8bRTY3jdYsYg44a0Z/uEgQkohbR0H87Q== - -"@typescript-eslint/typescript-estree@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz#4be24a3dea0f930bb1397c46187d0efdd955a224" - integrity sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA== - dependencies: - "@typescript-eslint/types" "5.10.0" - "@typescript-eslint/visitor-keys" "5.10.0" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" - -"@typescript-eslint/typescript-estree@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" - integrity sha512-PwIGnH7jIueXv4opcwEbVGDATjGPO1dx9RkUl5LlHDSe+FXxPwFL5W/qYd5/NHr7f6lo/vvTrAzd0KlQtRusJQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.1.tgz#fa682a33af47080ba2c4368ee0ad2128213a1196" - integrity sha512-RRmlITiUbLuTRtn/gcPRi4202niF+q7ylFLCKu4c+O/PcpRvZ/nAUwQ2G00bZgpWkhrNLNnvhZLbDn8Ml0qsQw== - dependencies: - "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.10.1" - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/typescript-estree" "5.10.1" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - -"@typescript-eslint/visitor-keys@5.10.0": - version "5.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz#770215497ad67cd15a572b52089991d5dfe06281" - integrity sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ== - dependencies: - "@typescript-eslint/types" "5.10.0" - eslint-visitor-keys "^3.0.0" - -"@typescript-eslint/visitor-keys@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.1.tgz#29102de692f59d7d34ecc457ed59ab5fc558010b" - integrity sha512-NjQ0Xinhy9IL979tpoTRuLKxMc0zJC7QVSdeerXs2/QvOy2yRkzX5dRb10X5woNUdJgU8G3nYRDlI33sq1K4YQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - eslint-visitor-keys "^3.0.0" - "@vscode/iconv-lite-umd@0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48" @@ -877,11 +754,6 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - asar@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/asar/-/asar-3.0.3.tgz#1fef03c2d6d2de0cbad138788e4f7ae03b129c7b" @@ -971,7 +843,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^3.0.1, braces@~3.0.2: +braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -1395,13 +1267,6 @@ dir-compare@^2.4.0: commander "2.9.0" minimatch "3.0.4" -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - dom-serializer@^1.0.1, dom-serializer@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.3.2.tgz#6206437d32ceefaec7161803230c7a20bc1b4d91" @@ -1611,48 +1476,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" - integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - events@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379" @@ -1692,29 +1515,11 @@ fancy-log@^1.3.3: parse-node-version "^1.0.0" time-stamp "^1.0.0" -fast-glob@^3.2.9: - version "3.2.11" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" - integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fastq@^1.6.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" - integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== - dependencies: - reusify "^1.0.4" - fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -1840,7 +1645,7 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= -glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0: +glob-parent@^5.1.1, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -1901,18 +1706,6 @@ globalthis@^1.0.1: dependencies: define-properties "^1.1.3" -globby@^11.0.4: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - got@11.8.5: version "11.8.5" resolved "https://registry.yarnpkg.com/got/-/got-11.8.5.tgz#ce77d045136de56e8f024bebb82ea349bc730046" @@ -2064,11 +1857,6 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== - inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -2130,7 +1918,7 @@ is-glob@^4.0.1: dependencies: is-extglob "^2.1.1" -is-glob@^4.0.3, is-glob@~4.0.1: +is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -2412,19 +2200,6 @@ mdurl@^1.0.1: resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromatch@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" - integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== - dependencies: - braces "^3.0.1" - picomatch "^2.2.3" - mime-db@1.45.0: version "1.45.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.45.0.tgz#cceeda21ccd7c3a745eba2decd55d4b73e7879ea" @@ -2678,11 +2453,6 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - pend@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" @@ -2693,7 +2463,7 @@ picomatch@^2.0.4: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== -picomatch@^2.2.1, picomatch@^2.2.3: +picomatch@^2.2.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -2809,11 +2579,6 @@ qs@^6.9.1: dependencies: side-channel "^1.0.4" -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - quick-lru@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" @@ -2894,11 +2659,6 @@ responselike@^2.0.0: dependencies: lowercase-keys "^2.0.0" -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - rimraf@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -2918,13 +2678,6 @@ roarr@^2.15.3: semver-compare "^1.0.0" sprintf-js "^1.1.2" -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -2972,13 +2725,6 @@ semver@^7.3.2: dependencies: lru-cache "^6.0.0" -semver@^7.3.5: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - serialize-error@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18" @@ -3031,11 +2777,6 @@ simple-get@^3.0.3: once "^1.3.1" simple-concat "^1.0.0" -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -3260,11 +3001,6 @@ tslib@^1.10.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^1.8.1: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== - tslib@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c" @@ -3275,13 +3011,6 @@ tslib@^2.2.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 392ec661728..1ccd1602469 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -481,7 +481,7 @@ export class Git { const repoUri = Uri.file(repoPath); const pathUri = Uri.file(repositoryPath); if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) { - // eslint-disable-next-line code-no-look-behind-regex + // eslint-disable-next-line local/code-no-look-behind-regex const match = /(?<=^\/?)([a-zA-Z])(?=:\/)/.exec(pathUri.path); if (match !== null) { const [, letter] = match; diff --git a/package.json b/package.json index 7b1f0b735cb..363c03c152b 100644 --- a/package.json +++ b/package.json @@ -123,6 +123,7 @@ "@types/winreg": "^1.2.30", "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", + "@typescript-eslint/experimental-utils": "^5.10.0", "@typescript-eslint/eslint-plugin": "^5.10.0", "@typescript-eslint/parser": "^5.10.0", "@vscode/telemetry-extractor": "^1.9.8", @@ -141,6 +142,7 @@ "eslint": "8.7.0", "eslint-plugin-header": "3.1.1", "eslint-plugin-jsdoc": "^39.3.2", + "eslint-plugin-local": "^1.0.0", "event-stream": "3.3.4", "fancy-log": "^1.3.3", "fast-plist": "0.1.2", @@ -200,6 +202,7 @@ "source-map-support": "^0.3.2", "style-loader": "^1.3.0", "ts-loader": "^9.2.7", + "ts-node": "^10.9.1", "tsec": "0.1.4", "typescript": "^4.9.0-dev.20220825", "typescript-formatter": "7.1.0", diff --git a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts index f4b242a0c69..c26ac475b39 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts @@ -10,7 +10,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { ICommandDetectionCapability, TerminalCapability, ITerminalCommand, IHandleCommandOptions, ICommandInvalidationRequest, CommandInvalidationReason } from 'vs/platform/terminal/common/capabilities/capabilities'; import { ISerializedCommand, ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line local/code-import-patterns import type { IBuffer, IBufferLine, IDisposable, IMarker, Terminal } from 'xterm-headless'; export interface ICurrentPartialCommand { diff --git a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts index 932413459a3..a1b063d0961 100644 --- a/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.ts @@ -6,7 +6,7 @@ import { Emitter } from 'vs/base/common/event'; import { IPartialCommandDetectionCapability, TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line local/code-import-patterns import { IMarker, Terminal } from 'xterm-headless'; const enum Constants { diff --git a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts index b824242c7b5..552c897f278 100644 --- a/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts +++ b/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts @@ -12,7 +12,7 @@ import { ICommandDetectionCapability, ICwdDetectionCapability, TerminalCapabilit import { PartialCommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/partialCommandDetectionCapability'; import { ILogService } from 'vs/platform/log/common/log'; // Importing types is safe in any layer -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line local/code-import-patterns import type { ITerminalAddon, Terminal } from 'xterm-headless'; import { ISerializedCommandDetectionCapability } from 'vs/platform/terminal/common/terminalProcess'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; diff --git a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts index 4bd0f073a2c..2c9535a63f8 100644 --- a/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts +++ b/src/vs/workbench/contrib/themes/test/electron-browser/colorRegistry.releaseTest.ts @@ -13,7 +13,7 @@ import { getPathFromAmdModule } from 'vs/base/test/node/testUtils'; import { CancellationToken } from 'vs/base/common/cancellation'; import { RequestService } from 'vs/platform/request/node/requestService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; -// eslint-disable-next-line code-import-patterns +// eslint-disable-next-line local/code-import-patterns import 'vs/workbench/workbench.desktop.main'; import { NullLogService } from 'vs/platform/log/common/log'; import { mock } from 'vs/base/test/common/mock'; diff --git a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts index 35d0657b669..8cc4de5338c 100644 --- a/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* eslint-disable code-import-patterns */ -/* eslint-disable code-layering */ +/* eslint-disable local/code-import-patterns */ +/* eslint-disable local/code-layering */ import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; diff --git a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts index f988913ea61..007d59e74b8 100644 --- a/src/vscode-dts/vscode.proposed.customEditorMove.d.ts +++ b/src/vscode-dts/vscode.proposed.customEditorMove.d.ts @@ -23,7 +23,7 @@ declare module 'vscode' { * * @return Thenable indicating that the webview editor has been moved. */ - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line local/vscode-dts-provider-naming moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable; } } diff --git a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts index f1fbb770d8e..8ec3e6109f8 100644 --- a/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +++ b/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts @@ -16,7 +16,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProviderNew { - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line local/vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItemNew): void; } @@ -29,7 +29,7 @@ declare module 'vscode' { } export interface InlineCompletionItemProvider { - // eslint-disable-next-line vscode-dts-provider-naming + // eslint-disable-next-line local/vscode-dts-provider-naming handleDidShowCompletionItem?(completionItem: InlineCompletionItem): void; } diff --git a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts index 80fc9fd9423..a05e21671b3 100644 --- a/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts +++ b/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts @@ -5,7 +5,7 @@ declare module 'vscode' { - // eslint-disable-next-line vscode-dts-region-comments + // eslint-disable-next-line local/vscode-dts-region-comments // @roblourens: debugUI.simple: https://github.com/microsoft/vscode/issues/147264. Used for Jupyter's Run By Line. // suppressSaveBeforeStart: https://github.com/microsoft/vscode/issues/147263. Used to enable debugging untitled/unsaved notebooks. diff --git a/src/vscode-dts/vscode.proposed.resolvers.d.ts b/src/vscode-dts/vscode.proposed.resolvers.d.ts index 1575fa7c8b9..292b5a5fb23 100644 --- a/src/vscode-dts/vscode.proposed.resolvers.d.ts +++ b/src/vscode-dts/vscode.proposed.resolvers.d.ts @@ -196,7 +196,7 @@ declare module 'vscode' { export interface ResourceLabelFormatting { label: string; // myLabel:/${path} // For historic reasons we use an or string here. Once we finalize this API we should start using enums instead and adopt it in extensions. - // eslint-disable-next-line vscode-dts-literal-or-types + // eslint-disable-next-line local/vscode-dts-literal-or-types separator: '/' | '\\' | ''; tildify?: boolean; normalizeDriveLetter?: boolean; diff --git a/test/monaco/esm-check/index.js b/test/monaco/esm-check/index.js index 3e585d5bd58..ba37a07c252 100644 --- a/test/monaco/esm-check/index.js +++ b/test/monaco/esm-check/index.js @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// eslint-disable-next-line code-no-standalone-editor +// eslint-disable-next-line local/code-no-standalone-editor import * as monaco from './out/vs/editor/editor.main.js'; monaco.editor.create(document.getElementById('container'), { diff --git a/yarn.lock b/yarn.lock index 8761bffc701..17fee22266c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -303,6 +303,13 @@ "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@discoveryjs/json-ext@^0.5.0": version "0.5.3" resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz#90420f9f9c6d3987f176a19a7d8e764271a2f55d" @@ -418,6 +425,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping@^0.3.9": version "0.3.14" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" @@ -695,6 +710,26 @@ mkdirp "^1.0.4" path-browserify "^1.0.1" +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -1020,6 +1055,13 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/experimental-utils@^5.10.0": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.35.1.tgz#4ec46ad8cd04001e44536f427c553f120a262c9b" + integrity sha512-nF7JD9alMkhEx50QYDUdP8koeHtldnm7EfZkr68ikkc87ffFBIPkH3dqoWyOeQeIiJicB0uHzpMXKR6PP+1Jbg== + dependencies: + "@typescript-eslint/utils" "5.35.1" + "@typescript-eslint/parser@^5.10.0": version "5.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.0.tgz#8f59e036f5f1cffc178cacbd5ccdd02aeb96c91c" @@ -1038,6 +1080,14 @@ "@typescript-eslint/types" "5.10.0" "@typescript-eslint/visitor-keys" "5.10.0" +"@typescript-eslint/scope-manager@5.35.1": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.35.1.tgz#ccb69d54b7fd0f2d0226a11a75a8f311f525ff9e" + integrity sha512-kCYRSAzIW9ByEIzmzGHE50NGAvAP3wFTaZevgWva7GpquDyFPFcmvVkFJGWJJktg/hLwmys/FZwqM9EKr2u24Q== + dependencies: + "@typescript-eslint/types" "5.35.1" + "@typescript-eslint/visitor-keys" "5.35.1" + "@typescript-eslint/type-utils@5.10.0": version "5.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz#8524b9479c19c478347a7df216827e749e4a51e5" @@ -1052,6 +1102,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.0.tgz#beb3cb345076f5b088afe996d57bcd1dfddaa75c" integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ== +"@typescript-eslint/types@5.35.1": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.35.1.tgz#af355fe52a0cc88301e889bc4ada72f279b63d61" + integrity sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ== + "@typescript-eslint/typescript-estree@5.10.0": version "5.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz#4be24a3dea0f930bb1397c46187d0efdd955a224" @@ -1065,6 +1120,19 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.35.1": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.35.1.tgz#db878a39a0dbdc9bb133f11cdad451770bfba211" + integrity sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA== + dependencies: + "@typescript-eslint/types" "5.35.1" + "@typescript-eslint/visitor-keys" "5.35.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/utils@5.10.0": version "5.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.0.tgz#c3d152a85da77c400e37281355561c72fb1b5a65" @@ -1077,6 +1145,18 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" +"@typescript-eslint/utils@5.35.1": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.35.1.tgz#ae1399afbfd6aa7d0ed1b7d941e9758d950250eb" + integrity sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.35.1" + "@typescript-eslint/types" "5.35.1" + "@typescript-eslint/typescript-estree" "5.35.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + "@typescript-eslint/visitor-keys@5.10.0": version "5.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz#770215497ad67cd15a572b52089991d5dfe06281" @@ -1085,6 +1165,14 @@ "@typescript-eslint/types" "5.10.0" eslint-visitor-keys "^3.0.0" +"@typescript-eslint/visitor-keys@5.35.1": + version "5.35.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.35.1.tgz#285e9e34aed7c876f16ff646a3984010035898e6" + integrity sha512-cEB1DvBVo1bxbW/S5axbGPE6b7FIMAbo3w+AGq6zNDA7+NYJOIkKj/sInfTv4edxd4PxJSgdN4t6/pbvgA+n5g== + dependencies: + "@typescript-eslint/types" "5.35.1" + eslint-visitor-keys "^3.3.0" + "@ungap/promise-all-settled@1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" @@ -1470,6 +1558,11 @@ acorn-jsx@^5.3.1: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + acorn@^6.0.7, acorn@^6.4.1: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" @@ -1698,6 +1791,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2988,6 +3086,11 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3542,6 +3645,11 @@ diff@5.0.0, diff@^5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -3965,6 +4073,11 @@ eslint-plugin-jsdoc@^39.3.2: semver "^7.3.7" spdx-expression-parse "^3.0.1" +eslint-plugin-local@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-local/-/eslint-plugin-local-1.0.0.tgz#f0c07011c95fec42bfb4d909debb6ea035f3b2a4" + integrity sha512-bcwcQnKL/Iw5Vi/F2lG1he5oKD2OGjhsLmrcctkWrWq5TujgiaYb0cj3pZgr3XI54inNVnneOFdAx1daLoYLJQ== + eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -4018,6 +4131,11 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.1.0, eslint-visitor-keys@^3.2 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz#6fbb166a6798ee5991358bc2daa1ba76cc1254a1" integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + eslint@8.7.0: version "8.7.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.7.0.tgz#22e036842ee5b7cf87b03fe237731675b4d3633c" @@ -5057,7 +5175,7 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" -globby@^11.0.4: +globby@^11.0.4, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -6844,6 +6962,11 @@ make-dir@^3.0.2: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -10437,6 +10560,25 @@ ts-morph@^15.1.0: "@ts-morph/common" "~0.16.0" code-block-writer "^11.0.0" +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tsec@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/tsec/-/tsec-0.1.4.tgz#dc8743c28ad01230ea4692e326866e0d54487f3f" @@ -10779,6 +10921,11 @@ uuid@^8.3.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + v8-compile-cache@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" @@ -11573,6 +11720,11 @@ ylru@^1.2.0: resolved "https://registry.yarnpkg.com/ylru/-/ylru-1.2.1.tgz#f576b63341547989c1de7ba288760923b27fe84f" integrity sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ== +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" From e0aef147005ba2e22e1b388dd88f950999bba7a3 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 29 Aug 2022 23:40:52 -0700 Subject: [PATCH 20/21] Use dedicated renderers for different list elements (#158986) * Use dedicated renderers for different list elements * Fix hardcoding command ids --- .../codeAction/browser/codeActionMenu.ts | 295 ++++++++++-------- 1 file changed, 171 insertions(+), 124 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts b/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts index 504ffc53fe9..f1db901343f 100644 --- a/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts +++ b/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts @@ -11,7 +11,7 @@ import { Action, IAction, Separator } from 'vs/base/common/actions'; import { canceled } from 'vs/base/common/errors'; import { ResolvedKeybinding } from 'vs/base/common/keybindings'; import { Lazy } from 'vs/base/common/lazy'; -import { Disposable, dispose, MutableDisposable, IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { Disposable, MutableDisposable, IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import 'vs/css!./media/action'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; @@ -101,138 +101,127 @@ export interface ICodeMenuOptions { optionsAsChildren?: boolean; } -export interface ICodeActionMenuTemplateData { - root: HTMLElement; - text: HTMLElement; - detail: HTMLElement; - decoratorRight: HTMLElement; - disposables: IDisposable[]; - icon: HTMLElement; +interface ICodeActionMenuTemplateData { + readonly root: HTMLElement; + readonly text: HTMLElement; + readonly disposables: DisposableStore; + readonly icon: HTMLElement; +} + +enum TemplateIds { + Header = 'header', + Separator = 'separator', + Base = 'base', } -const TEMPLATE_ID = 'codeActionWidget'; const codeActionLineHeight = 24; const headerLineHeight = 26; // TODO: Take a look at user storage for this so it is preserved across windows and on reload. let showDisabled = false; -class CodeMenuRenderer implements IListRenderer { +class CodeActionItemRenderer implements IListRenderer { constructor( private readonly acceptKeybindings: [string, string], @IKeybindingService private readonly keybindingService: IKeybindingService, ) { } - get templateId(): string { return TEMPLATE_ID; } + get templateId(): string { return TemplateIds.Base; } renderTemplate(container: HTMLElement): ICodeActionMenuTemplateData { - const data: ICodeActionMenuTemplateData = Object.create(null); - data.disposables = []; - data.root = container; - data.text = document.createElement('span'); - const iconContainer = document.createElement('div'); iconContainer.className = 'icon-container'; - - data.icon = document.createElement('div'); - - iconContainer.append(data.icon); container.append(iconContainer); - container.append(data.text); - return data; + const icon = document.createElement('div'); + iconContainer.append(icon); + + const text = document.createElement('span'); + container.append(text); + + return { + root: container, + icon, + text, + disposables: new DisposableStore(), + }; } + renderElement(element: ICodeActionMenuItem, index: number, templateData: ICodeActionMenuTemplateData): void { const data: ICodeActionMenuTemplateData = templateData; - const isSeparator = element.isSeparator; - const isHeader = element.isHeader; + const text = element.action.label; + element.isEnabled = element.action.enabled; - // Renders differently based on element type. - if (isSeparator) { - data.root.classList.add('separator'); - data.root.style.height = '10px'; - } else if (isHeader) { - const text = element.headerTitle; - data.text.textContent = text; - element.isEnabled = false; - data.root.classList.add('group-header'); - } else { - const text = element.action.label; - element.isEnabled = element.action.enabled; + if (element.action instanceof CodeActionAction) { + const openedFromString = (element.params?.options.fromLightbulb) ? CodeActionTriggerSource.Lightbulb : element.params?.trigger.triggerAction; - if (element.action instanceof CodeActionAction) { - const openedFromString = (element.params?.options.fromLightbulb) ? CodeActionTriggerSource.Lightbulb : element.params?.trigger.triggerAction; + // Check documentation type + element.isDocumentation = element.action.action.kind === CodeActionMenu.documentationID; + if (element.isDocumentation) { + element.isEnabled = false; + data.root.classList.add('documentation'); - // Check documentation type - element.isDocumentation = element.action.action.kind === CodeActionMenu.documentationID; + const container = data.root; - if (element.isDocumentation) { - element.isEnabled = false; - data.root.classList.add('documentation'); + const actionbarContainer = dom.append(container, dom.$('.codeActionWidget-action-bar')); - const container = data.root; + const reRenderAction = showDisabled ? + { + id: 'hideMoreCodeActions', + label: localize('hideMoreCodeActions', 'Hide Disabled'), + enabled: true, + run: () => CodeActionMenu.toggleDisabledOptions(element.params) + } : + { + id: 'showMoreCodeActions', + label: localize('showMoreCodeActions', 'Show Disabled'), + enabled: true, + run: () => CodeActionMenu.toggleDisabledOptions(element.params) + }; - const actionbarContainer = dom.append(container, dom.$('.codeActionWidget-action-bar')); + const actionbar = new ActionBar(actionbarContainer); + data.disposables.add(actionbar); - const reRenderAction = showDisabled ? - { - id: 'hideMoreCodeActions', - label: localize('hideMoreCodeActions', 'Hide Disabled'), - enabled: true, - run: () => CodeActionMenu.toggleDisabledOptions(element.params) - } : - { - id: 'showMoreCodeActions', - label: localize('showMoreCodeActions', 'Show Disabled'), - enabled: true, - run: () => CodeActionMenu.toggleDisabledOptions(element.params) - }; - - const actionbar = new ActionBar(actionbarContainer); - data.disposables.push(actionbar); - - if (openedFromString === CodeActionTriggerSource.Refactor && (element.params.codeActions.validActions.length > 0 || element.params.codeActions.allActions.length === element.params.codeActions.validActions.length)) { - actionbar.push([element.action, reRenderAction], { icon: false, label: true }); - } else { - actionbar.push([element.action], { icon: false, label: true }); - } + if (openedFromString === CodeActionTriggerSource.Refactor && (element.params.codeActions.validActions.length > 0 || element.params.codeActions.allActions.length === element.params.codeActions.validActions.length)) { + actionbar.push([element.action, reRenderAction], { icon: false, label: true }); } else { - data.text.textContent = text; + actionbar.push([element.action], { icon: false, label: true }); + } + } else { + data.text.textContent = text; - // Icons and Label modifaction based on group - const group = element.action.action.kind; - if (CodeActionKind.SurroundWith.contains(new CodeActionKind(String(group)))) { - data.icon.className = Codicon.symbolArray.classNames; - } else if (CodeActionKind.Extract.contains(new CodeActionKind(String(group)))) { - data.icon.className = Codicon.wrench.classNames; - } else if (CodeActionKind.Convert.contains(new CodeActionKind(String(group)))) { - data.icon.className = Codicon.zap.classNames; - data.icon.style.color = `var(--vscode-editorLightBulbAutoFix-foreground)`; - } else if (CodeActionKind.QuickFix.contains(new CodeActionKind(String(group)))) { - data.icon.className = Codicon.lightBulb.classNames; - data.icon.style.color = `var(--vscode-editorLightBulb-foreground)`; - } else { - data.icon.className = Codicon.lightBulb.classNames; - data.icon.style.color = `var(--vscode-editorLightBulb-foreground)`; - } + // Icons and Label modifaction based on group + const group = element.action.action.kind; + if (CodeActionKind.SurroundWith.contains(new CodeActionKind(String(group)))) { + data.icon.className = Codicon.symbolArray.classNames; + } else if (CodeActionKind.Extract.contains(new CodeActionKind(String(group)))) { + data.icon.className = Codicon.wrench.classNames; + } else if (CodeActionKind.Convert.contains(new CodeActionKind(String(group)))) { + data.icon.className = Codicon.zap.classNames; + data.icon.style.color = `var(--vscode-editorLightBulbAutoFix-foreground)`; + } else if (CodeActionKind.QuickFix.contains(new CodeActionKind(String(group)))) { + data.icon.className = Codicon.lightBulb.classNames; + data.icon.style.color = `var(--vscode-editorLightBulb-foreground)`; + } else { + data.icon.className = Codicon.lightBulb.classNames; + data.icon.style.color = `var(--vscode-editorLightBulb-foreground)`; + } - // Check if action has disabled reason - if (element.action.action.disabled) { - data.root.title = element.action.action.disabled; - } else { - const updateLabel = () => { - const [accept, preview] = this.acceptKeybindings; + // Check if action has disabled reason + if (element.action.action.disabled) { + data.root.title = element.action.action.disabled; + } else { + const updateLabel = () => { + const [accept, preview] = this.acceptKeybindings; - data.root.title = localize({ key: 'label', comment: ['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"'] }, "{0} to Apply, {1} to Preview", this.keybindingService.lookupKeybinding(accept)?.getLabel(), this.keybindingService.lookupKeybinding(preview)?.getLabel()); + data.root.title = localize({ key: 'label', comment: ['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"'] }, "{0} to Apply, {1} to Preview", this.keybindingService.lookupKeybinding(accept)?.getLabel(), this.keybindingService.lookupKeybinding(preview)?.getLabel()); - }; - updateLabel(); - } + }; + updateLabel(); } } - } if (!element.isEnabled) { @@ -243,8 +232,59 @@ class CodeMenuRenderer implements IListRenderer { + + get templateId(): string { return TemplateIds.Header; } + + renderTemplate(container: HTMLElement): HeaderTemplateData { + container.classList.add('group-header', 'option-disabled'); + + const text = document.createElement('span'); + container.append(text); + + return { + root: container, + text, + }; + } + + renderElement(element: ICodeActionMenuItem, _index: number, templateData: HeaderTemplateData): void { + templateData.text.textContent = element.headerTitle; + element.isEnabled = false; + } + + disposeTemplate(_templateData: HeaderTemplateData): void { + // noop + } +} + +class SeparatorRenderer implements IListRenderer { + + get templateId(): string { return TemplateIds.Separator; } + + renderTemplate(container: HTMLElement): void { + container.classList.add('separator'); + container.style.height = '10px'; + } + + renderElement(_element: ICodeActionMenuItem, _index: number, _templateData: void): void { + // noop + } + + disposeTemplate(_templateData: void): void { + // noop } } @@ -270,13 +310,12 @@ export class CodeActionMenu extends Disposable implements IEditorContribution { } private readonly _keybindingResolver: CodeActionKeybindingResolver; - private listRenderer: CodeMenuRenderer; constructor( private readonly _editor: ICodeEditor, private readonly _delegate: CodeActionWidgetDelegate, @IContextMenuService private readonly _contextMenuService: IContextMenuService, - @IKeybindingService keybindingService: IKeybindingService, + @IKeybindingService private readonly keybindingService: IKeybindingService, @ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService, @ITelemetryService private readonly _telemetryService: ITelemetryService, @IThemeService _themeService: IThemeService, @@ -291,7 +330,6 @@ export class CodeActionMenu extends Disposable implements IEditorContribution { }); this._ctxMenuWidgetVisible = Context.Visible.bindTo(this._contextKeyService); - this.listRenderer = new CodeMenuRenderer([acceptSelectedCodeActionCommand, previewSelectedCodeActionCommand], keybindingService); } get isVisible(): boolean { @@ -384,34 +422,43 @@ export class CodeActionMenu extends Disposable implements IEditorContribution { return 10; } else if (element.isHeader) { return headerLineHeight; + } else { + return codeActionLineHeight; } - return codeActionLineHeight; }, getTemplateId(element) { - return 'codeActionWidget'; - } - }, [this.listRenderer], - { - keyboardSupport: false, - accessibilityProvider: { - getAriaLabel: element => { - if (element.action instanceof CodeActionAction) { - let label = element.action.label; - if (!element.action.enabled) { - if (element.action instanceof CodeActionAction) { - label = localize({ key: 'customCodeActionWidget.labels', comment: ['Code action labels for accessibility.'] }, "{0}, Disabled Reason: {1}", label, element.action.action.disabled); - } - } - return label; - } - return null; - }, - getWidgetAriaLabel: () => localize({ key: 'customCodeActionWidget', comment: ['A Code Action Option'] }, "Code Action Widget"), - getRole: () => 'option', - getWidgetRole: () => 'code-action-widget' + if (element.isHeader) { + return TemplateIds.Header; + } else if (element.isSeparator) { + return TemplateIds.Separator; + } else { + return TemplateIds.Base; } } - ); + }, [ + new CodeActionItemRenderer([acceptSelectedCodeActionCommand, previewSelectedCodeActionCommand], this.keybindingService), + new HeaderRenderer(), + new SeparatorRenderer(), + ], { + keyboardSupport: false, + accessibilityProvider: { + getAriaLabel: element => { + if (element.action instanceof CodeActionAction) { + let label = element.action.label; + if (!element.action.enabled) { + if (element.action instanceof CodeActionAction) { + label = localize({ key: 'customCodeActionWidget.labels', comment: ['Code action labels for accessibility.'] }, "{0}, Disabled Reason: {1}", label, element.action.action.disabled); + } + } + return label; + } + return null; + }, + getWidgetAriaLabel: () => localize({ key: 'customCodeActionWidget', comment: ['A Code Action Option'] }, "Code Action Widget"), + getRole: () => 'option', + getWidgetRole: () => 'code-action-widget' + } + }); const pointerBlockDiv = document.createElement('div'); this.pointerBlock = element.appendChild(pointerBlockDiv); @@ -559,8 +606,8 @@ export class CodeActionMenu extends Disposable implements IEditorContribution { if (!this.codeActionList.value) { return; } - const element = document.getElementById(this.codeActionList.value?.getElementID(index))?.getElementsByTagName('span')[0].offsetWidth; - arr.push(Number(element)); + const element = document.getElementById(this.codeActionList.value?.getElementID(index))?.querySelector('span')?.offsetWidth; + arr.push(element ?? 0); }); // resize observer - can be used in the future since list widget supports dynamic height but not width From 2ffd80aa97a762dd4c3e595fb3eb998203732fcd Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Mon, 29 Aug 2022 23:42:42 -0700 Subject: [PATCH 21/21] Fix error telemetry, fixes #148439 (#159511) * Fix error telemetry, fixes #148439 * Shorten the comment --- .../contrib/preferences/browser/settingsWidgets.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts index 521bb5b72b1..728231fd8bb 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts @@ -384,6 +384,12 @@ export abstract class AbstractListSettingWidget extend this.listDisposables.add(disposableTimeout(() => rowElement.focus())); } + this.listDisposables.add(DOM.addDisposableListener(rowElement, 'click', (e) => { + // There is a parent list widget, which is the one that holds the list of settings. + // Prevent the parent widget from trying to interpret this click event. + e.stopPropagation(); + })); + return rowElement; }