vscode/.eslintrc.json
Johannes Rieken 2d0b92d89b
some ensureNoDisposablesAreLeakedInTestSuite (#203026)
* some `ensureNoDisposablesAreLeakedInTestSuite`

https://github.com/microsoft/vscode/issues/200091

* update eslint file
2024-01-22 16:46:40 +01:00

1120 lines
41 KiB
JSON

{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jsdoc",
"header",
"local"
],
"rules": {
"constructor-super": "warn",
"curly": "warn",
"eqeqeq": "warn",
"prefer-const": [
"warn",
{
"destructuring": "all"
}
],
"no-buffer-constructor": "warn",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-debugger": "warn",
"no-duplicate-case": "warn",
"no-duplicate-imports": "warn",
"no-eval": "warn",
"no-async-promise-executor": "warn",
"no-extra-semi": "warn",
"no-new-wrappers": "warn",
"no-redeclare": "off",
"no-sparse-arrays": "warn",
"no-throw-literal": "warn",
"no-unsafe-finally": "warn",
"no-unused-labels": "warn",
"no-restricted-globals": [
"warn",
"name",
"length",
"event",
"closed",
"external",
"status",
"origin",
"orientation",
"context"
], // non-complete list of globals that are easy to access unintentionally
"no-var": "warn",
"jsdoc/no-types": "warn",
"semi": "off",
"@typescript-eslint/semi": "warn",
"@typescript-eslint/member-delimiter-style": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "class",
"format": [
"PascalCase"
]
}
],
"local/code-no-unused-expressions": [
"warn",
{
"allowTernary": true
}
],
"local/code-translation-remind": "warn",
"local/code-no-native-private": "warn",
"local/code-no-nls-in-standalone-editor": "warn",
"local/code-no-standalone-editor": "warn",
"local/code-no-unexternalized-strings": "warn",
"local/code-must-use-super-dispose": "warn",
"local/code-declare-service-brand": "warn",
"local/code-layering": [
"warn",
{
"common": [],
"node": [
"common"
],
"browser": [
"common"
],
"electron-sandbox": [
"common",
"browser"
],
"electron-main": [
"common",
"node"
]
}
],
"header/header": [
2,
"block",
[
"---------------------------------------------------------------------------------------------",
" * Copyright (c) Microsoft Corporation. All rights reserved.",
" * Licensed under the MIT License. See License.txt in the project root for license information.",
" *--------------------------------------------------------------------------------------------"
]
]
},
"overrides": [
{
"files": [
"*.js"
],
"rules": {
"jsdoc/no-types": "off"
}
},
{
"files": [
"**/*.test.ts"
],
"rules": {
"local/code-must-use-super-dispose": "off",
"local/code-no-test-only": "error",
"local/code-no-test-async-suite": "warn",
"local/code-no-unexternalized-strings": "off",
"local/code-must-use-result": [
"warn",
[
{
"message": "Expression must be awaited",
"functions": [
"assertSnapshot",
"assertHeap"
]
}
]
]
}
},
{
"files": [
"src/vs/**/*.test.ts"
],
"rules": {
"local/code-ensure-no-disposables-leak-in-test": [
"warn",
{
// Files should (only) be removed from the list they adopt the leak detector
"exclude": [
"src/vs/base/test/browser/browser.test.ts",
"src/vs/base/test/browser/ui/scrollbar/scrollableElement.test.ts",
"src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts",
"src/vs/editor/contrib/codeAction/test/browser/codeActionKeybindingResolver.test.ts",
"src/vs/editor/contrib/codeAction/test/browser/codeActionModel.test.ts",
"src/vs/editor/contrib/gotoSymbol/test/browser/referencesModel.test.ts",
"src/vs/editor/contrib/smartSelect/test/browser/smartSelect.test.ts",
"src/vs/editor/contrib/snippet/test/browser/snippetSession.test.ts",
"src/vs/editor/contrib/suggest/test/browser/completionModel.test.ts",
"src/vs/editor/contrib/suggest/test/browser/suggestMemory.test.ts",
"src/vs/editor/test/common/services/languageService.test.ts",
"src/vs/editor/test/node/classification/typescript.test.ts",
"src/vs/editor/test/node/diffing/defaultLinesDiffComputer.test.ts",
"src/vs/editor/test/node/diffing/fixtures.test.ts",
"src/vs/platform/configuration/test/common/configuration.test.ts",
"src/vs/platform/contextkey/test/common/contextkey.test.ts",
"src/vs/platform/contextkey/test/common/parser.test.ts",
"src/vs/platform/contextkey/test/common/scanner.test.ts",
"src/vs/platform/extensions/test/common/extensionValidator.test.ts",
"src/vs/platform/instantiation/test/common/graph.test.ts",
"src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts",
"src/vs/platform/keybinding/test/common/keybindingLabels.test.ts",
"src/vs/platform/keybinding/test/common/keybindingResolver.test.ts",
"src/vs/platform/markers/test/common/markerService.test.ts",
"src/vs/platform/opener/test/common/opener.test.ts",
"src/vs/platform/progress/test/common/progress.test.ts",
"src/vs/platform/registry/test/common/platform.test.ts",
"src/vs/platform/remote/test/common/remoteHosts.test.ts",
"src/vs/platform/telemetry/test/browser/1dsAppender.test.ts",
"src/vs/platform/workspace/test/common/workspace.test.ts",
"src/vs/platform/workspaces/test/electron-main/workspaces.test.ts",
"src/vs/workbench/api/test/browser/extHostApiCommands.test.ts",
"src/vs/workbench/api/test/browser/extHostBulkEdits.test.ts",
"src/vs/workbench/api/test/browser/extHostDocumentSaveParticipant.test.ts",
"src/vs/workbench/api/test/browser/extHostTypeConverter.test.ts",
"src/vs/workbench/api/test/browser/extHostWorkspace.test.ts",
"src/vs/workbench/api/test/browser/mainThreadConfiguration.test.ts",
"src/vs/workbench/api/test/browser/mainThreadDocuments.test.ts",
"src/vs/workbench/api/test/common/extHostExtensionActivator.test.ts",
"src/vs/workbench/api/test/node/extHostTunnelService.test.ts",
"src/vs/workbench/contrib/bulkEdit/test/browser/bulkCellEdits.test.ts",
"src/vs/workbench/contrib/chat/test/common/chatWordCounter.test.ts",
"src/vs/workbench/contrib/editSessions/test/browser/editSessions.test.ts",
"src/vs/workbench/contrib/extensions/test/common/extensionQuery.test.ts",
"src/vs/workbench/contrib/notebook/test/browser/notebookExecutionService.test.ts",
"src/vs/workbench/contrib/notebook/test/browser/notebookExecutionStateService.test.ts",
"src/vs/workbench/contrib/snippets/test/browser/snippetFile.test.ts",
"src/vs/workbench/contrib/snippets/test/browser/snippetsRegistry.test.ts",
"src/vs/workbench/contrib/snippets/test/browser/snippetsRewrite.test.ts",
"src/vs/workbench/contrib/tasks/test/common/problemMatcher.test.ts",
"src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts",
"src/vs/workbench/services/commands/test/common/commandService.test.ts",
"src/vs/workbench/services/extensions/test/common/extensionDescriptionRegistry.test.ts",
"src/vs/workbench/services/keybinding/test/browser/keybindingIO.test.ts",
"src/vs/workbench/services/keybinding/test/node/fallbackKeyboardMapper.test.ts",
"src/vs/workbench/services/keybinding/test/node/macLinuxKeyboardMapper.test.ts",
"src/vs/workbench/services/keybinding/test/node/windowsKeyboardMapper.test.ts",
"src/vs/workbench/services/userActivity/test/browser/domActivityTracker.test.ts",
"src/vs/workbench/test/browser/quickAccess.test.ts"
]
}
]
}
},
{
"files": [
"**/vscode.d.ts",
"**/vscode.proposed.*.d.ts"
],
"rules": {
"local/vscode-dts-create-func": "warn",
"local/vscode-dts-literal-or-types": "warn",
"local/vscode-dts-string-type-literals": "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": [
"FileSystemProvider",
"TreeDataProvider",
"TestProvider",
"CustomEditorProvider",
"CustomReadonlyEditorProvider",
"TerminalLinkProvider",
"AuthenticationProvider",
"NotebookContentProvider"
]
}
],
"local/vscode-dts-event-naming": [
"warn",
{
"allowed": [
"onCancellationRequested",
"event"
],
"verbs": [
"accept",
"change",
"close",
"collapse",
"create",
"delete",
"discover",
"dispose",
"drop",
"edit",
"end",
"execute",
"expand",
"grant",
"hide",
"invalidate",
"open",
"override",
"perform",
"receive",
"register",
"remove",
"rename",
"save",
"send",
"start",
"terminate",
"trigger",
"unregister",
"write"
]
}
]
}
},
{
"files": [
"**/vscode.d.ts"
],
"rules": {
"jsdoc/tag-lines": "off",
"jsdoc/valid-types": "off",
"jsdoc/no-multi-asterisks": [
"warn",
{
"allowWhitespace": true
}
],
"jsdoc/require-jsdoc": [
"warn",
{
"enableFixer": false,
"contexts": [
"TSInterfaceDeclaration",
"TSPropertySignature",
"TSMethodSignature",
"TSDeclareFunction",
"ClassDeclaration",
"MethodDefinition",
"PropertyDeclaration",
"TSEnumDeclaration",
"TSEnumMember",
"ExportNamedDeclaration"
]
}
],
"jsdoc/check-param-names": [
"warn",
{
"enableFixer": false,
"checkDestructured": false
}
],
"jsdoc/require-returns": "warn"
}
},
{
"files": [
"src/**/{common,browser}/**/*.ts"
],
"rules": {
"local/code-amd-node-module": "warn"
}
},
{
"files": [
"src/**/{browser,electron-sandbox}/**/*.ts"
],
"rules": {
"local/code-no-global-document-listener": "warn",
"no-restricted-syntax": [
"warn",
{
"selector": "BinaryExpression[operator='instanceof'][right.name='MouseEvent']",
"message": "Use DOM.isMouseEvent() to support multi-window scenarios."
},
{
"selector": "BinaryExpression[operator='instanceof'][right.name='KeyboardEvent']",
"message": "Use DOM.isKeyboardEvent() to support multi-window scenarios."
},
{
"selector": "BinaryExpression[operator='instanceof'][right.name='PointerEvent']",
"message": "Use DOM.isPointerEvent() to support multi-window scenarios."
},
{
"selector": "BinaryExpression[operator='instanceof'][right.name='DragEvent']",
"message": "Use DOM.isDragEvent() to support multi-window scenarios."
},
{
"selector": "MemberExpression[object.name='document'][property.name='activeElement']",
"message": "Use <targetWindow>.document.activeElement to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='contains']",
"message": "Use <targetWindow>.document.contains to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='styleSheets']",
"message": "Use <targetWindow>.document.styleSheets to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='fullscreenElement']",
"message": "Use <targetWindow>.document.fullscreenElement to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='body']",
"message": "Use <targetWindow>.document.body to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='addEventListener']",
"message": "Use <targetWindow>.document.addEventListener to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='removeEventListener']",
"message": "Use <targetWindow>.document.removeEventListener to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='hasFocus']",
"message": "Use <targetWindow>.document.hasFocus to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='head']",
"message": "Use <targetWindow>.document.head to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='exitFullscreen']",
"message": "Use <targetWindow>.document.exitFullscreen to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getElementById']",
"message": "Use <targetWindow>.document.getElementById to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getElementsByClassName']",
"message": "Use <targetWindow>.document.getElementsByClassName to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getElementsByName']",
"message": "Use <targetWindow>.document.getElementsByName to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getElementsByTagName']",
"message": "Use <targetWindow>.document.getElementsByTagName to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getElementsByTagNameNS']",
"message": "Use <targetWindow>.document.getElementsByTagNameNS to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='getSelection']",
"message": "Use <targetWindow>.document.getSelection to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='open']",
"message": "Use <targetWindow>.document.open to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='close']",
"message": "Use <targetWindow>.document.close to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='documentElement']",
"message": "Use <targetWindow>.document.documentElement to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='visibilityState']",
"message": "Use <targetWindow>.document.visibilityState to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='querySelector']",
"message": "Use <targetWindow>.document.querySelector to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='querySelectorAll']",
"message": "Use <targetWindow>.document.querySelectorAll to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='elementFromPoint']",
"message": "Use <targetWindow>.document.elementFromPoint to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='elementsFromPoint']",
"message": "Use <targetWindow>.document.elementsFromPoint to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='onkeydown']",
"message": "Use <targetWindow>.document.onkeydown to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='onkeyup']",
"message": "Use <targetWindow>.document.onkeyup to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='onmousedown']",
"message": "Use <targetWindow>.document.onmousedown to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='onmouseup']",
"message": "Use <targetWindow>.document.onmouseup to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"selector": "MemberExpression[object.name='document'][property.name='execCommand']",
"message": "Use <targetWindow>.document.execCommand to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
}
],
"no-restricted-globals": [
"warn",
"name",
"length",
"event",
"closed",
"external",
"status",
"origin",
"orientation",
"context",
{
"name": "setInterval",
"message": "Use <targetWindow>.setInterval to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "clearInterval",
"message": "Use <targetWindow>.clearInterval to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "requestAnimationFrame",
"message": "Use <targetWindow>.requestAnimationFrame to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "cancelAnimationFrame",
"message": "Use <targetWindow>.cancelAnimationFrame to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "requestIdleCallback",
"message": "Use <targetWindow>.requestIdleCallback to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "cancelIdleCallback",
"message": "Use <targetWindow>.cancelIdleCallback to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "window",
"message": "Use <targetWindow> to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "addEventListener",
"message": "Use <targetWindow>.addEventListener to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "removeEventListener",
"message": "Use <targetWindow>.removeEventListener to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "getComputedStyle",
"message": "Use <targetWindow>.getComputedStyle to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "focus",
"message": "Use <targetWindow>.focus to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "blur",
"message": "Use <targetWindow>.blur to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "close",
"message": "Use <targetWindow>.close to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "dispatchEvent",
"message": "Use <targetWindow>.dispatchEvent to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "getSelection",
"message": "Use <targetWindow>.getSelection to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "matchMedia",
"message": "Use <targetWindow>.matchMedia to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "open",
"message": "Use <targetWindow>.open to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "parent",
"message": "Use <targetWindow>.parent to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "postMessage",
"message": "Use <targetWindow>.postMessage to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "devicePixelRatio",
"message": "Use <targetWindow>.devicePixelRatio to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "frames",
"message": "Use <targetWindow>.frames to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "frameElement",
"message": "Use <targetWindow>.frameElement to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "innerHeight",
"message": "Use <targetWindow>.innerHeight to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "innerWidth",
"message": "Use <targetWindow>.innerWidth to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "outerHeight",
"message": "Use <targetWindow>.outerHeight to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "outerWidth",
"message": "Use <targetWindow>.outerWidth to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "opener",
"message": "Use <targetWindow>.opener to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "origin",
"message": "Use <targetWindow>.origin to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "screen",
"message": "Use <targetWindow>.screen to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "screenLeft",
"message": "Use <targetWindow>.screenLeft to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "screenTop",
"message": "Use <targetWindow>.screenTop to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "screenX",
"message": "Use <targetWindow>.screenX to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "screenY",
"message": "Use <targetWindow>.screenY to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "scrollX",
"message": "Use <targetWindow>.scrollX to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "scrollY",
"message": "Use <targetWindow>.scrollY to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "top",
"message": "Use <targetWindow>.top to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
},
{
"name": "visualViewport",
"message": "Use <targetWindow>.visualViewport to support multi-window scenarios. Resolve targetWindow with DOM.getWindow(element) or DOM.getActiveWindow() or use the predefined mainWindow constant."
}
]
}
},
{
"files": [
"src/**/*.ts"
],
"rules": {
"local/code-no-look-behind-regex": "warn",
"local/code-import-patterns": [
"warn",
{
// imports that are allowed in all files of layers:
// - browser
// - electron-sandbox
"when": "hasBrowser",
"allow": [
"vs/css!./**/*"
]
},
{
// imports that are allowed in all files of layers:
// - node
// - electron-main
"when": "hasNode",
"allow": [
"@parcel/watcher",
"@vscode/sqlite3",
"@vscode/vscode-languagedetection",
"@vscode/ripgrep",
"@vscode/iconv-lite-umd",
"@vscode/policy-watcher",
"@vscode/proxy-agent",
"@vscode/spdlog",
"@vscode/windows-process-tree",
"assert",
"child_process",
"console",
"cookie",
"crypto",
"dns",
"electron",
"events",
"fs",
"fs/promises",
"graceful-fs",
"http",
"https",
"minimist",
"native-keymap",
"native-watchdog",
"net",
"node-pty",
"os",
"path",
"perf_hooks",
"readline",
"stream",
"string_decoder",
"tas-client-umd",
"tls",
"url",
"util",
"v8-inspect-profiler",
"vscode-regexpp",
"vscode-textmate",
"worker_threads",
"@xterm/addon-canvas",
"@xterm/addon-image",
"@xterm/addon-search",
"@xterm/addon-serialize",
"@xterm/addon-unicode11",
"@xterm/addon-webgl",
"@xterm/headless",
"@xterm/xterm",
"yauzl",
"yazl",
"zlib"
]
},
{
// imports that are allowed in all /test/ files
"when": "test",
"allow": [
"vs/css.build",
"assert",
"sinon",
"sinon-test"
]
},
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!! Do not relax these rules !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// A path ending in /~ has a special meaning. It indicates a template position
// which will be substituted with one or more layers.
//
// When /~ is used in the target, the rule will be expanded to 14 distinct rules.
// e.g. "src/vs/base/~" will be expanded to:
// - src/vs/base/common
// - src/vs/base/worker
// - src/vs/base/browser
// - src/vs/base/electron-sandbox
// - src/vs/base/node
// - src/vs/base/electron-main
// - src/vs/base/test/common
// - src/vs/base/test/worker
// - src/vs/base/test/browser
// - src/vs/base/test/electron-sandbox
// - src/vs/base/test/node
// - src/vs/base/test/electron-main
//
// When /~ is used in the restrictions, it will be replaced with the correct
// layers that can be used e.g. "src/vs/base/electron-sandbox" will be able
// to import "{common,browser,electron-sanbox}", etc.
//
// It is possible to use /~ in the restrictions property even without using it in
// the target property by adding a layer property.
{
"target": "src/vs/base/~",
"restrictions": [
"vs/base/~"
]
},
{
"target": "src/vs/base/parts/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~"
]
},
{
"target": "src/vs/platform/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"tas-client-umd", // node module allowed even in /common/
"@microsoft/1ds-core-js", // node module allowed even in /common/
"@microsoft/1ds-post-js" // node module allowed even in /common/
]
},
{
"target": "src/vs/editor/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~"
]
},
{
"target": "src/vs/editor/contrib/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~"
]
},
{
"target": "src/vs/editor/standalone/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/standalone/~"
]
},
{
"target": "src/vs/editor/editor.all.ts",
"layer": "browser",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~"
]
},
{
"target": "src/vs/editor/editor.worker.ts",
"layer": "worker",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~"
]
},
{
"target": "src/vs/editor/{editor.api.ts,editor.main.ts}",
"layer": "browser",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/standalone/~",
"vs/editor/*"
]
},
{
"target": "src/vs/workbench/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/workbench/~",
"vs/workbench/services/*/~",
"assert",
{
"when": "test",
"pattern": "vs/workbench/contrib/*/~"
} // TODO@layers
]
},
{
"target": "src/vs/workbench/api/~",
"restrictions": [
"vscode",
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/workbench/api/~",
"vs/workbench/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/contrib/terminalContrib/*/~"
]
},
{
"target": "src/vs/workbench/services/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/workbench/~",
"vs/workbench/services/*/~",
{
"when": "test",
"pattern": "vs/workbench/contrib/*/~"
}, // TODO@layers
"tas-client-umd", // node module allowed even in /common/
"vscode-textmate", // node module allowed even in /common/
"@vscode/vscode-languagedetection" // node module allowed even in /common/
]
},
{
"target": "src/vs/workbench/contrib/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/workbench/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vscode-notebook-renderer", // Type only import
{
"when": "hasBrowser",
"pattern": "@xterm/xterm"
}, // node module allowed even in /browser/
{
"when": "hasBrowser",
"pattern": "@xterm/addon-*"
}, // node module allowed even in /browser/
{
"when": "hasBrowser",
"pattern": "vscode-textmate"
} // node module allowed even in /browser/
]
},
{
"target": "src/vs/workbench/contrib/terminalContrib/*/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/workbench/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
// Only allow terminalContrib to import from itself, this works because
// terminalContrib is one extra folder deep
"vs/workbench/contrib/terminalContrib/*/~",
"vscode-notebook-renderer", // Type only import
{
"when": "hasBrowser",
"pattern": "@xterm/xterm"
}, // node module allowed even in /browser/
{
"when": "hasBrowser",
"pattern": "@xterm/addon-*"
}, // node module allowed even in /browser/
{
"when": "hasBrowser",
"pattern": "vscode-textmate"
} // node module allowed even in /browser/
]
},
{
"target": "src/vs/code/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/code/~",
{
"when": "hasBrowser",
"pattern": "vs/workbench/workbench.web.main"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/~"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/services/*/~"
}
]
},
{
"target": "src/vs/server/~",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/server/~"
]
},
{
"target": "src/vs/workbench/contrib/terminal/terminal.all.ts",
"layer": "browser",
"restrictions": [
"vs/workbench/contrib/**"
]
},
{
"target": "src/vs/workbench/workbench.common.main.ts",
"layer": "browser",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/contrib/terminal/terminal.all"
]
},
{
"target": "src/vs/workbench/workbench.web.main.ts",
"layer": "browser",
"restrictions": [
"vs/base/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
]
},
{
"target": "src/vs/workbench/workbench.desktop.main.ts",
"layer": "electron-sandbox",
"restrictions": [
"vs/base/*/~",
"vs/base/parts/*/~",
"vs/platform/*/~",
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
]
},
{
"target": "src/vs/amdX.ts",
"restrictions": [
"vs/base/common/*"
]
},
{
"target": "src/vs/workbench/{workbench.desktop.main.nls.js,workbench.web.main.nls.js}",
"restrictions": []
},
{
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.ts,nls.build.ts,nls.mock.ts}",
"restrictions": []
},
{
"target": "src/vscode-dts/**",
"restrictions": []
},
{
"target": "src/{bootstrap-amd.js,bootstrap-fork.js,bootstrap-node.js,bootstrap-window.js,bootstrap.js,cli.js,main.js,server-cli.js,server-main.js}",
"restrictions": []
}
]
}
},
{
"files": [
"test/**/*.ts"
],
"rules": {
"local/code-import-patterns": [
"warn",
{
"target": "test/smoke/**",
"restrictions": [
"test/automation",
"test/smoke/**",
"@vscode/*",
"@parcel/*",
"@playwright/*",
"*" // node modules
]
},
{
"target": "test/automation/**",
"restrictions": [
"test/automation/**",
"@vscode/*",
"@parcel/*",
"playwright-core/**",
"@playwright/*",
"*" // node modules
]
},
{
"target": "test/integration/**",
"restrictions": [
"test/integration/**",
"@vscode/*",
"@parcel/*",
"@playwright/*",
"*" // node modules
]
},
{
"target": "test/monaco/**",
"restrictions": [
"test/monaco/**",
"@vscode/*",
"@parcel/*",
"@playwright/*",
"*" // node modules
]
}
]
}
}
]
}