eslint: fix bracket notation in workbench services (#334774)

* eslint: enable no bracket notation rule

Enable code-no-bracket-notation-for-identifiers for JavaScript and TypeScript files while grandfathering the 509 files with existing violations in a CODEOWNERS-gated allowlist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: update bracket allowlist owners

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: group bracket notation exclusions

Organize the existing baseline by feature area so cleanup can be tracked and assigned without changing the excluded file set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: test no bracket notation rule

Add RuleTester coverage for valid accesses, diagnostics, and autofix edge cases. Preserve escaped string-literal property names by checking their raw source before reporting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* eslint: fix bracket notation in workbench services

Replace identifier-safe bracket access in workbench UI and service files, remove the cleaned group from the rule allowlist, and expose protected seams for strongly typed default-account tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Dmitriy Vasyura
2026-09-12 20:33:23 +00:00
committed by GitHub
co-authored by Copilot
parent 3addbda66f
commit b0240f6065
21 changed files with 88 additions and 110 deletions
+1 -23
View File
@@ -508,27 +508,5 @@ extensions/git/src/ipc/ipcClient.ts
extensions/git/src/ipc/ipcServer.ts
extensions/git/src/util.ts
# Workbench UI and remaining services (23 files)
src/vs/workbench/browser/parts/editor/editor.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts
src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.ts
src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts
src/vs/workbench/contrib/issue/electron-browser/nativeGitHubUploadService.ts
src/vs/workbench/contrib/localization/electron-browser/localization.contribution.ts
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts
src/vs/workbench/contrib/policyExport/test/node/policyExport.integrationTest.ts
src/vs/workbench/contrib/search/browser/replaceService.ts
src/vs/workbench/contrib/tags/electron-browser/workspaceTags.ts
src/vs/workbench/contrib/tags/electron-browser/workspaceTagsService.ts
src/vs/workbench/contrib/themes/browser/themes.contribution.ts
src/vs/workbench/contrib/themes/test/node/colorRegistry.releaseTest.ts
src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.ts
src/vs/workbench/contrib/update/common/updateInfoParser.ts
src/vs/workbench/contrib/webview/browser/pre/service-worker.js
src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput.ts
# Default account service tests (1 file)
src/vs/workbench/services/accounts/test/browser/defaultAccount.test.ts
src/vs/workbench/services/actions/common/menusExtensionPoint.ts
src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.ts
src/vs/workbench/services/textfile/test/node/encoding/encoding.integrationTest.ts
src/vs/workbench/services/themes/common/colorThemeData.ts
+51 -51
View File
@@ -125,61 +125,61 @@ function validateEditorPartOptions(options: IEditorPartOptions): IEditorPartOpti
}
return verifyObject<IEditorPartOptions>({
'wrapTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['wrapTabs']),
'scrollToSwitchTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['scrollToSwitchTabs']),
'highlightModifiedTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['highlightModifiedTabs']),
'tabActionReserveSpace': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabActionReserveSpace']),
'tabActionCloseVisibility': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabActionCloseVisibility']),
'tabActionUnpinVisibility': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabActionUnpinVisibility']),
'showTabIndex': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['showTabIndex']),
'alwaysShowEditorActions': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['alwaysShowEditorActions']),
'pinnedTabsOnSeparateRow': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['pinnedTabsOnSeparateRow']),
'focusRecentEditorAfterClose': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['focusRecentEditorAfterClose']),
'showIcons': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['showIcons']),
'enablePreview': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['enablePreview']),
'enablePreviewFromQuickOpen': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['enablePreviewFromQuickOpen']),
'enablePreviewFromCodeNavigation': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['enablePreviewFromCodeNavigation']),
'closeOnFileDelete': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['closeOnFileDelete']),
'closeEmptyGroups': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['closeEmptyGroups']),
'revealIfOpen': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['revealIfOpen']),
'swipeToNavigate': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['swipeToNavigate']),
'mouseBackForwardToNavigate': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['mouseBackForwardToNavigate']),
'restoreViewState': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['restoreViewState']),
'splitOnDragAndDrop': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['splitOnDragAndDrop']),
'allowDropIntoGroup': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['allowDropIntoGroup']),
'dragToOpenWindow': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['dragToOpenWindow']),
'centeredLayoutFixedWidth': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['centeredLayoutFixedWidth']),
'hasIcons': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['hasIcons']),
'wrapTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.wrapTabs),
'scrollToSwitchTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.scrollToSwitchTabs),
'highlightModifiedTabs': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.highlightModifiedTabs),
'tabActionReserveSpace': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabActionReserveSpace),
'tabActionCloseVisibility': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabActionCloseVisibility),
'tabActionUnpinVisibility': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabActionUnpinVisibility),
'showTabIndex': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.showTabIndex),
'alwaysShowEditorActions': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.alwaysShowEditorActions),
'pinnedTabsOnSeparateRow': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.pinnedTabsOnSeparateRow),
'focusRecentEditorAfterClose': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.focusRecentEditorAfterClose),
'showIcons': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.showIcons),
'enablePreview': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.enablePreview),
'enablePreviewFromQuickOpen': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.enablePreviewFromQuickOpen),
'enablePreviewFromCodeNavigation': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.enablePreviewFromCodeNavigation),
'closeOnFileDelete': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.closeOnFileDelete),
'closeEmptyGroups': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.closeEmptyGroups),
'revealIfOpen': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.revealIfOpen),
'swipeToNavigate': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.swipeToNavigate),
'mouseBackForwardToNavigate': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.mouseBackForwardToNavigate),
'restoreViewState': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.restoreViewState),
'splitOnDragAndDrop': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.splitOnDragAndDrop),
'allowDropIntoGroup': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.allowDropIntoGroup),
'dragToOpenWindow': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.dragToOpenWindow),
'centeredLayoutFixedWidth': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.centeredLayoutFixedWidth),
'hasIcons': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.hasIcons),
'tabSizingFixedMinWidth': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabSizingFixedMinWidth']),
'tabSizingFixedMaxWidth': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabSizingFixedMaxWidth']),
'tabSizingFixedMinWidth': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabSizingFixedMinWidth),
'tabSizingFixedMaxWidth': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabSizingFixedMaxWidth),
'showTabs': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['showTabs'], ['multiple', 'single', 'none']),
'tabActionLocation': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabActionLocation'], ['left', 'right']),
'tabSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabSizing'], ['fit', 'shrink', 'fixed']),
'pinnedTabSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['pinnedTabSizing'], ['normal', 'compact', 'shrink']),
'tabHeight': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['tabHeight'], ['default', 'compact']),
'preventPinnedEditorClose': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['preventPinnedEditorClose'], ['keyboardAndMouse', 'keyboard', 'mouse', 'never']),
'titleScrollbarSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['titleScrollbarSizing'], ['default', 'large']),
'titleScrollbarVisibility': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['titleScrollbarVisibility'], ['auto', 'visible', 'hidden']),
'openPositioning': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['openPositioning'], ['left', 'right', 'first', 'last']),
'openSideBySideDirection': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['openSideBySideDirection'], ['right', 'down']),
'labelFormat': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['labelFormat'], ['default', 'short', 'medium', 'long']),
'splitInGroupLayout': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['splitInGroupLayout'], ['vertical', 'horizontal']),
'splitSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['splitSizing'], ['distribute', 'split', 'auto']),
'doubleClickTabToToggleEditorGroupSizes': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['doubleClickTabToToggleEditorGroupSizes'], ['maximize', 'expand', 'off']),
'editorActionsLocation': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS['editorActionsLocation'], ['default', 'titleBar', 'hidden']),
'autoLockGroups': new SetVerifier<string>(DEFAULT_EDITOR_PART_OPTIONS['autoLockGroups']),
'showTabs': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.showTabs, ['multiple', 'single', 'none']),
'tabActionLocation': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabActionLocation, ['left', 'right']),
'tabSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabSizing, ['fit', 'shrink', 'fixed']),
'pinnedTabSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.pinnedTabSizing, ['normal', 'compact', 'shrink']),
'tabHeight': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.tabHeight, ['default', 'compact']),
'preventPinnedEditorClose': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.preventPinnedEditorClose, ['keyboardAndMouse', 'keyboard', 'mouse', 'never']),
'titleScrollbarSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.titleScrollbarSizing, ['default', 'large']),
'titleScrollbarVisibility': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.titleScrollbarVisibility, ['auto', 'visible', 'hidden']),
'openPositioning': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.openPositioning, ['left', 'right', 'first', 'last']),
'openSideBySideDirection': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.openSideBySideDirection, ['right', 'down']),
'labelFormat': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.labelFormat, ['default', 'short', 'medium', 'long']),
'splitInGroupLayout': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.splitInGroupLayout, ['vertical', 'horizontal']),
'splitSizing': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.splitSizing, ['distribute', 'split', 'auto']),
'doubleClickTabToToggleEditorGroupSizes': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.doubleClickTabToToggleEditorGroupSizes, ['maximize', 'expand', 'off']),
'editorActionsLocation': new EnumVerifier(DEFAULT_EDITOR_PART_OPTIONS.editorActionsLocation, ['default', 'titleBar', 'hidden']),
'autoLockGroups': new SetVerifier<string>(DEFAULT_EDITOR_PART_OPTIONS.autoLockGroups),
'limit': new ObjectVerifier<IEditorPartLimitOptions>(DEFAULT_EDITOR_PART_OPTIONS['limit'], {
'enabled': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['limit']['enabled']),
'value': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS['limit']['value']),
'perEditorGroup': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['limit']['perEditorGroup']),
'excludeDirty': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['limit']['excludeDirty'])
'limit': new ObjectVerifier<IEditorPartLimitOptions>(DEFAULT_EDITOR_PART_OPTIONS.limit, {
'enabled': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.limit.enabled),
'value': new NumberVerifier(DEFAULT_EDITOR_PART_OPTIONS.limit.value),
'perEditorGroup': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.limit.perEditorGroup),
'excludeDirty': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.limit.excludeDirty)
}),
'decorations': new ObjectVerifier<IEditorPartDecorationOptions>(DEFAULT_EDITOR_PART_OPTIONS['decorations'], {
'badges': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['decorations']['badges']),
'colors': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS['decorations']['colors'])
'decorations': new ObjectVerifier<IEditorPartDecorationOptions>(DEFAULT_EDITOR_PART_OPTIONS.decorations, {
'badges': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.decorations.badges),
'colors': new BooleanVerifier(DEFAULT_EDITOR_PART_OPTIONS.decorations.colors)
}),
}, options);
}
@@ -754,7 +754,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
const resource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH });
if (URI.isUri(resource)) {
descriptor['resource'] = this.toResourceTelemetryDescriptor(resource);
descriptor.resource = this.toResourceTelemetryDescriptor(resource);
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
@@ -764,10 +764,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return descriptor;
} else if (resource) {
if (resource.primary) {
descriptor['resource'] = this.toResourceTelemetryDescriptor(resource.primary);
descriptor.resource = this.toResourceTelemetryDescriptor(resource.primary);
}
if (resource.secondary) {
descriptor['resourceSecondary'] = this.toResourceTelemetryDescriptor(resource.secondary);
descriptor.resourceSecondary = this.toResourceTelemetryDescriptor(resource.secondary);
}
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
@@ -1106,7 +1106,7 @@ Registry.as<IConfigurationMigrationRegistry>(WorkbenchExtensions.ConfigurationMi
}]);
function getDelaysFromConfig(accessor: (key: string) => any, type: 'general' | 'errorAtPosition' | 'warningAtPosition'): { announcement: number; sound: number } | undefined {
return accessor(`accessibility.signalOptions.experimental.delays.${type}`) || accessor('accessibility.signalOptions')?.['experimental.delays']?.[`${type}`] || accessor('accessibility.signalOptions')?.['delays']?.[`${type}`];
return accessor(`accessibility.signalOptions.experimental.delays.${type}`) || accessor('accessibility.signalOptions')?.['experimental.delays']?.[`${type}`] || accessor('accessibility.signalOptions')?.delays?.[`${type}`];
}
function getVolumeFromConfig(accessor: (key: string) => any): string | undefined {
@@ -181,7 +181,7 @@ export class BulkEditPane extends ViewPane {
}
private _setState(state: State): void {
this.element.dataset['state'] = state;
this.element.dataset.state = state;
}
async setInput(edit: ResourceEdit[], token: CancellationToken): Promise<ResourceEdit[] | undefined> {
@@ -346,13 +346,13 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget {
}
showLoading(): void {
this._parent.dataset['state'] = State.Loading;
this._parent.dataset.state = State.Loading;
this.setTitle(localize('title.loading', "Loading..."));
this._show();
}
showMessage(message: string): void {
this._parent.dataset['state'] = State.Message;
this._parent.dataset.state = State.Message;
this.setTitle('');
this.setMetaTitle('');
this._message.innerText = message;
@@ -377,7 +377,7 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget {
: localize('empt.callsTo', "No callers of '{0}'", model.root.name));
} else {
this._parent.dataset['state'] = State.Data;
this._parent.dataset.state = State.Data;
if (!viewState || this._tree.getFocus().length === 0) {
this._tree.setFocus([root.children[0].element]);
}
@@ -28,7 +28,7 @@ export class NativeGitHubUploadService extends Disposable implements IGitHubUplo
async resolveRepositoryId(owner: string, repo: string, token?: string): Promise<string> {
const headers: Record<string, string> = { 'Accept': 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28' };
if (token) {
headers['Authorization'] = `Bearer ${token}`;
headers.Authorization = `Bearer ${token}`;
}
const r = await fetch(`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`, { headers });
if (!r.ok) {
@@ -164,7 +164,7 @@ class NativeLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchC
};
const searchAction = {
label: translations['searchMarketplace'],
label: translations.searchMarketplace,
run: async () => {
logUserReaction('search');
await this.extensionsWorkbenchService.openSearch(`tag:lp-${locale}`);
@@ -172,7 +172,7 @@ class NativeLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchC
};
const installAndRestartAction = {
label: translations['installAndRestart'],
label: translations.installAndRestart,
run: async () => {
logUserReaction('installAndRestart');
await this.localeService.setLocale({
@@ -119,7 +119,7 @@ export class PolicyExportContribution extends Disposable implements IWorkbenchCo
// Checks DISTRO_PRODUCT_JSON env var (for testing),
// then falls back to fetching from GitHub API with GITHUB_TOKEN.
const distroProduct = await this.getDistroProductJson();
const extensionPolicies = distroProduct['extensionConfigurationPolicy'] as Record<string, ExtensionConfigurationPolicyEntry | ExtensionConfigurationPolicyReferenceEntry> | undefined;
const extensionPolicies = distroProduct.extensionConfigurationPolicy as Record<string, ExtensionConfigurationPolicyEntry | ExtensionConfigurationPolicyReferenceEntry> | undefined;
// Reference-shaped product entries (extension settings attaching to an in-code-owned
// policy), collected by owning policy name so they can be linked below.
const productReferencesByPolicyName = new Map<string, string[]>();
@@ -39,7 +39,7 @@ const toReplaceResource = (fileResource: URI): URI => {
};
const toFileResource = (replaceResource: URI): URI => {
return replaceResource.with({ scheme: JSON.parse(replaceResource.query)['scheme'], fragment: '', query: '' });
return replaceResource.with({ scheme: JSON.parse(replaceResource.query).scheme, fragment: '', query: '' });
};
export class ReplacePreviewContentProvider implements ITextModelContentProvider, IWorkbenchContribution {
@@ -146,7 +146,7 @@ export class WorkspaceTags implements IWorkbenchContribution {
const names = (<IFileStat[]>[]).concat(...results.map(result => result.success ? (result.stat!.children || []) : [])).map(c => c.name);
const referencesAzure = WorkspaceTags.searchArray(names, /azure/i);
if (referencesAzure) {
tags['node'] = true;
tags.node = true;
}
return tags;
},
@@ -179,7 +179,7 @@ export class WorkspaceTags implements IWorkbenchContribution {
});
})).then(javas => {
if (javas.indexOf(true) !== -1) {
tags['java'] = true;
tags.java = true;
}
return tags;
});
@@ -1405,7 +1405,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
const content = await this.fileService.readFile(aiGeneratedWorkspaces);
const workspaces = JSON.parse(content.value.toString()) as string[];
if (workspaces.indexOf(workspace.folders[0].uri.toString()) > -1) {
tags['aiGenerated'] = true;
tags.aiGenerated = true;
}
} catch (e) {
// Ignore errors when resolving file contents
@@ -1556,7 +1556,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
const packageJsonPromises = getFilePromises('package.json', this.fileService, this.textFileService, content => {
try {
const packageJsonContents = JSON.parse(content.value);
const dependencies = Object.keys(packageJsonContents['dependencies'] || {}).concat(Object.keys(packageJsonContents['devDependencies'] || {}));
const dependencies = Object.keys(packageJsonContents.dependencies || {}).concat(Object.keys(packageJsonContents.devDependencies || {}));
for (const dependency of dependencies) {
if (dependency.startsWith('react-native')) {
@@ -688,7 +688,7 @@ interface ThemeItem extends IQuickPickItem {
function isItem(i: QuickPickInput<ThemeItem>): i is ThemeItem {
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
return (<any>i)['type'] !== 'separator';
return (<any>i).type !== 'separator';
}
const defaultThemeDescriptions: Record<string, string> = {
@@ -202,14 +202,14 @@ async function getColorsFromExtension(): Promise<{ [id: string]: string }> {
for (const folder of extFolders) {
try {
const packageJSON = JSON.parse((await fs.promises.readFile(path.join(extPath, folder, 'package.json'))).toString());
const contributes = packageJSON['contributes'];
const contributes = packageJSON.contributes;
if (contributes) {
const colors = contributes['colors'];
const colors = contributes.colors;
if (colors) {
for (const color of colors) {
const colorId = color['id'];
const colorId = color.id;
if (colorId) {
result[colorId] = colorId['description'];
result[colorId] = color.description;
}
}
}
@@ -341,13 +341,13 @@ export class TypeHierarchyTreePeekWidget extends peekView.PeekViewWidget {
}
showLoading(): void {
this._parent.dataset['state'] = State.Loading;
this._parent.dataset.state = State.Loading;
this.setTitle(localize('title.loading', "Loading..."));
this._show();
}
showMessage(message: string): void {
this._parent.dataset['state'] = State.Message;
this._parent.dataset.state = State.Message;
this.setTitle('');
this.setMetaTitle('');
this._message.innerText = message;
@@ -371,7 +371,7 @@ export class TypeHierarchyTreePeekWidget extends peekView.PeekViewWidget {
: localize('empt.subtypes', "No subtypes of '{0}'", model.root.name));
} else {
this._parent.dataset['state'] = State.Data;
this._parent.dataset.state = State.Data;
if (!viewState || this._tree.getFocus().length === 0) {
this._tree.setFocus([root.children[0].element]);
}
@@ -126,12 +126,12 @@ function buildParsedInput(markdown: string, meta: { buttons?: unknown; bannerIma
function parseUpdateInfoFrontmatter(text: string): IParsedUpdateInfoInput {
const blockMatch = text.match(/^---[ \t]*\r?\n(?<json>[\s\S]*?)\r?\n---[ \t]*(?:\r?\n(?<body>[\s\S]*))?$/);
if (blockMatch?.groups) {
return parseUpdateInfoFrontmatterMatch(text, blockMatch.groups['json'], blockMatch.groups['body'] ?? '');
return parseUpdateInfoFrontmatterMatch(text, blockMatch.groups.json, blockMatch.groups.body ?? '');
}
const inlineMatch = text.match(/^---[ \t]*(?<json>\{.*\})[ \t]*---[ \t]*(?<body>[\s\S]*)$/);
if (inlineMatch?.groups) {
return parseUpdateInfoFrontmatterMatch(text, inlineMatch.groups['json'], inlineMatch.groups['body']);
return parseUpdateInfoFrontmatterMatch(text, inlineMatch.groups.json, inlineMatch.groups.body);
}
return { markdown: text };
@@ -490,7 +490,7 @@ async function processResourceRequest(
};
if (entry.etag) {
headers['ETag'] = entry.etag;
headers.ETag = entry.etag;
headers['Cache-Control'] = 'no-cache';
}
if (entry.mtime) {
@@ -89,7 +89,7 @@ export class WalkThroughInput extends EditorInput {
override getTelemetryDescriptor(): { [key: string]: unknown } {
const descriptor = super.getTelemetryDescriptor();
descriptor['target'] = this.getTelemetryFrom();
descriptor.target = this.getTelemetryFrom();
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"target" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
@@ -1186,18 +1186,18 @@ class CommandsTableRenderer extends Disposable implements IExtensionFeatureTable
// Add to commandPalette array any commands not explicitly contributed to it
const implicitlyOnCommandPalette = index(commands, c => c.id);
if (menus['commandPalette']) {
for (const command of menus['commandPalette']) {
if (menus.commandPalette) {
for (const command of menus.commandPalette) {
delete implicitlyOnCommandPalette[command.command];
}
}
if (Object.keys(implicitlyOnCommandPalette).length) {
if (!menus['commandPalette']) {
menus['commandPalette'] = [];
if (!menus.commandPalette) {
menus.commandPalette = [];
}
for (const command in implicitlyOnCommandPalette) {
menus['commandPalette'].push({ command });
menus.commandPalette.push({ command });
}
}
@@ -278,7 +278,7 @@ export class WorkspaceExtensionsConfigService extends Disposable implements IWor
private async resolveWorkspaceExtensionConfig(workspaceConfigurationResource: URI): Promise<IExtensionsConfigContent | undefined> {
try {
const content = await this.fileService.readFile(workspaceConfigurationResource);
const extensionsConfigContent = <IExtensionsConfigContent | undefined>parse(content.value.toString())['extensions'];
const extensionsConfigContent = <IExtensionsConfigContent | undefined>parse(content.value.toString()).extensions;
return extensionsConfigContent ? this.parseExtensionConfig(extensionsConfigContent) : undefined;
} catch (e) { /* Ignore */ }
return undefined;
@@ -717,7 +717,7 @@ export class ColorThemeData implements IWorkbenchColorTheme {
}
static fromExtensionTheme(theme: IThemeExtensionPoint, colorThemeLocation: URI, extensionData: ExtensionData): ColorThemeData {
const baseTheme: string = theme['uiTheme'] || 'vs-dark';
const baseTheme: string = theme.uiTheme || 'vs-dark';
const themeSelector = toCSSSelector(extensionData.extensionId, theme.path);
const id = `${baseTheme} ${themeSelector}`;
const label = theme.label || basename(theme.path);