-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
99 lines (97 loc) · 2.62 KB
/
eslint.config.js
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
// @ts-check
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/prefer-nullish-coalescing": "error",
// Enforce modern JavaScript
"prefer-template": "error",
"prefer-arrow-callback": "error",
// Stricter JavaScript
"no-new-native-nonconstructor": "error",
"no-constant-binary-expression": "error",
"prefer-object-has-own": "error", // ES2022+
// Strict types
"eqeqeq": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/restrict-plus-operands": [
"error",
{
"allowAny": false,
"allowBoolean": false,
"allowNullish": false,
"allowNumberAndString": false,
"allowRegExp": false
}
],
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
"allowNumber": false,
"allowString": false
}
],
"@typescript-eslint/no-unsafe-type-assertion": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/no-useless-empty-export": "error",
// Force usage of "node:" protocol for Node builtins
"no-restricted-imports": [
"error",
"assert",
"buffer",
"child_process",
"cluster",
"crypto",
"dgram",
"dns",
"domain",
"events",
"freelist",
"fs",
"http",
"https",
"module",
"net",
"os",
"path",
"punycode",
"querystring",
"readline",
"repl",
"smalloc",
"stream",
"string_decoder",
"sys",
"timers",
"tls",
"tracing",
"tty",
"url",
"util",
"vm",
"zlib"
]
},
},
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
});