Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
.eslintrc.json 14.69 KB
Copy Edit Raw Blame History
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
{
"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-nls-in-standalone-editor": "warn",
"local/code-no-standalone-editor": "warn",
"local/code-no-unexternalized-strings": "warn",
"local/code-layering": [
"warn",
{
"common": [],
"node": [
"common"
],
"browser": [
"common"
],
"electron-sandbox": [
"common",
"browser"
],
"electron-browser": [
"common",
"browser",
"node",
"electron-sandbox"
],
"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-no-test-only": "error",
"local/code-no-unexternalized-strings": "off"
}
},
{
"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-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",
"expand",
"grant",
"hide",
"invalidate",
"open",
"override",
"receive",
"register",
"remove",
"rename",
"save",
"send",
"start",
"terminate",
"trigger",
"unregister",
"write"
]
}
]
}
},
{
"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
// - electron-browser
"when": "hasBrowser",
"allow": [
"vs/css!./**/*"
]
},
{
// imports that are allowed in all files of layers:
// - node
// - electron-browser
// - electron-main
"when": "hasNode",
"allow": [
"@parcel/watcher",
"@vscode/sqlite3",
"@vscode/vscode-languagedetection",
"@vscode/ripgrep",
"@vscode/iconv-lite-umd",
"assert",
"child_process",
"console",
"cookie",
"crypto",
"electron",
"events",
"fs",
"graceful-fs",
"http",
"https",
"minimist",
"native-keymap",
"native-watchdog",
"net",
"node-pty",
"os",
"path",
"perf_hooks",
"spdlog",
"stream",
"string_decoder",
"tas-client-umd",
"tls",
"url",
"util",
"v8-inspect-profiler",
"vscode-policy-watcher",
"vscode-proxy-agent",
"vscode-regexpp",
"vscode-textmate",
"windows-process-tree",
"worker_threads",
"xterm",
"xterm-addon-canvas",
"xterm-addon-search",
"xterm-addon-serialize",
"xterm-addon-unicode11",
"xterm-addon-webgl",
"xterm-headless",
"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-browser
// - 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-browser
// - 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/*/~"
]
},
{
"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"
}, // 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/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/*/~"
]
},
{
"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/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
]
}
]
}
}
]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化