-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy patheslint.config.js
More file actions
198 lines (195 loc) · 7.35 KB
/
eslint.config.js
File metadata and controls
198 lines (195 loc) · 7.35 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
const js = require("@eslint/js");
const tseslint = require("@typescript-eslint/eslint-plugin");
const tsparser = require("@typescript-eslint/parser");
const prettier = require("eslint-plugin-prettier");
const promise = require("eslint-plugin-promise");
const security = require("eslint-plugin-security");
const prettierConfig = require("eslint-config-prettier");
module.exports = [
js.configs.recommended,
{
files: ["src/**/*.ts"],
languageOptions: {
parser: tsparser,
parserOptions: {
project: "./tsconfig.json",
},
globals: {
// Mocha globals for test files
describe: "readonly",
it: "readonly",
xit: "readonly",
before: "readonly",
beforeEach: "readonly",
after: "readonly",
afterEach: "readonly",
context: "readonly",
specify: "readonly",
xdescribe: "readonly",
xcontext: "readonly",
xspecify: "readonly",
// Node.js globals
console: "readonly",
__filename: "readonly",
__dirname: "readonly",
module: "readonly",
setTimeout: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
prettier,
promise,
security,
},
rules: {
// TypeScript ESLint rules
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/consistent-type-assertions": ["warn", { assertionStyle: "as" }],
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true,
// Handle exported enum members correctly
args: "after-used",
vars: "all",
caughtErrors: "all",
},
],
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/space-infix-ops": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/typedef": [
"error",
{
arrayDestructuring: true,
arrowParameter: true,
memberVariableDeclaration: true,
objectDestructuring: true,
parameter: true,
propertyDeclaration: true,
variableDeclaration: true,
},
],
"@typescript-eslint/unified-signatures": "error",
// Standard ESLint rules
"no-unused-vars": "off", // Disabled in favor of @typescript-eslint/no-unused-vars
"array-callback-return": "error",
"arrow-body-style": ["error", "as-needed"],
"constructor-super": "error",
curly: ["error", "all"],
"max-len": [
"warn",
{
code: 120,
ignorePattern: "^(?!.*/(/|\\*) .* .*).*$",
},
],
"no-async-promise-executor": "error",
"no-await-in-loop": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-constant-condition": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-imports": "error",
"no-restricted-globals": "error",
"no-eval": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-irregular-whitespace": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loss-of-precision": "error",
"no-nested-ternary": "error",
"no-plusplus": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unreachable": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-private-class-members": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"object-shorthand": ["error", "always"],
"one-var": ["error", "never"],
"padding-line-between-statements": [
"warn",
{
blankLine: "always",
prev: "*",
next: [
"class",
"do",
"for",
"function",
"if",
"multiline-block-like",
"multiline-const",
"multiline-expression",
"multiline-let",
"multiline-var",
"switch",
"try",
"while",
],
},
{
blankLine: "always",
prev: [
"class",
"do",
"for",
"function",
"if",
"multiline-block-like",
"multiline-const",
"multiline-expression",
"multiline-let",
"multiline-var",
"switch",
"try",
"while",
],
next: "*",
},
{
blankLine: "always",
prev: "*",
next: ["continue", "return"],
},
],
"prefer-template": "error",
"prettier/prettier": "error",
"promise/prefer-await-to-then": "error",
"require-atomic-updates": "error",
"require-await": "warn",
"security/detect-non-literal-fs-filename": "off",
"security/detect-object-injection": "off",
"spaced-comment": ["warn", "always"],
"sort-imports": ["error", { allowSeparatedGroups: true, ignoreCase: true }],
},
},
prettierConfig,
];