-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
104 lines (102 loc) · 3.02 KB
/
Copy patheslint.config.mjs
File metadata and controls
104 lines (102 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import js from "@eslint/js";
import tseslint from "typescript-eslint";
const nodeGlobals = {
module: "readonly",
console: "readonly",
process: "readonly",
require: "readonly",
Buffer: "readonly",
URL: "readonly",
global: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
setImmediate: "readonly",
queueMicrotask: "readonly",
fetch: "readonly",
AbortSignal: "readonly",
};
export default tseslint.config(
{
ignores: ["vendor/**", "dist/**", "coverage/**", "node_modules/**", "plans/**"],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["resources/sidebar/**", "resources/serverDownload/**"],
languageOptions: {
globals: {
document: "readonly",
window: "readonly",
acquireVsCodeApi: "readonly",
},
},
// Browser-side webview code; not part of the extension bundle's strictness.
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
// Non-shipping code (build scripts, tools, test helpers, test project) keeps
// the relaxed rules: these run in Node, use require() freely, and aren't part
// of the extension bundle.
{
files: [
"scripts/**",
"tools/**",
"stubs/**",
"test-project/**",
"test/**/*.ts",
"esbuild.config.mjs",
],
languageOptions: { globals: nodeGlobals },
rules: {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
},
},
// Shipping source: keep the recommended strictness. `any` is surfaced as a
// warning (a real strictness signal without blocking the build); unused vars
// stay an error (underscore-prefixed names are intentional discards).
// `require()` is an error here too - the few intentional lazy loads carry a
// scoped eslint-disable with a rationale.
{
files: ["src/**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
// Proposed VS Code APIs (registerRemoteAuthorityResolver,
// RemoteAuthorityResolverError, ResolvedAuthority, remoteAuthority) are
// not in @types/vscode. These files cast to `any` to access them.
{
files: [
"src/remote/authorityResolver.ts",
"src/remote/sideload.ts",
"src/host/state.ts",
"src/host/services.ts",
],
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
// Vendored CLI wrapper: the devcontainers-cli module has no type
// declarations, so its launch()/wrapper functions are inherently `any`.
{
files: ["src/devcontainer/api.ts", "src/host/commands.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
);