@wondermarin/eslint-config 1.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -12
- package/dist/main.d.ts +36 -0
- package/dist/main.js +1583 -0
- package/package.json +54 -21
- package/configs/base.json +0 -343
- package/configs/react.json +0 -118
- package/configs/typescript.json +0 -141
package/dist/main.js
ADDED
|
@@ -0,0 +1,1583 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path, { join } from 'node:path';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
|
|
5
|
+
// node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
6
|
+
function isPlainObject(value) {
|
|
7
|
+
if (value === null || typeof value !== "object") {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const prototype = Object.getPrototypeOf(value);
|
|
11
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (Symbol.iterator in value) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (Symbol.toStringTag in value) {
|
|
18
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
23
|
+
if (!isPlainObject(defaults)) {
|
|
24
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
25
|
+
}
|
|
26
|
+
const object = Object.assign({}, defaults);
|
|
27
|
+
for (const key in baseObject) {
|
|
28
|
+
if (key === "__proto__" || key === "constructor") {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const value = baseObject[key];
|
|
32
|
+
if (value === null || value === void 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
39
|
+
object[key] = [...value, ...object[key]];
|
|
40
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
41
|
+
object[key] = _defu(
|
|
42
|
+
value,
|
|
43
|
+
object[key],
|
|
44
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
45
|
+
merger
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
object[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return object;
|
|
52
|
+
}
|
|
53
|
+
function createDefu(merger) {
|
|
54
|
+
return (...arguments_) => (
|
|
55
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
56
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
var defu = createDefu();
|
|
60
|
+
|
|
61
|
+
// src/configs/javascript.ts
|
|
62
|
+
function javascriptConfig() {
|
|
63
|
+
return [
|
|
64
|
+
{
|
|
65
|
+
name: "wondermarin/eslint-config/javascript",
|
|
66
|
+
files: ["**/*.?([cm])js" /* JS */, "**/*.jsx" /* JSX */, "**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
67
|
+
rules: {
|
|
68
|
+
"accessor-pairs": [
|
|
69
|
+
"error",
|
|
70
|
+
{
|
|
71
|
+
enforceForClassMembers: true,
|
|
72
|
+
getWithoutSet: false,
|
|
73
|
+
setWithoutGet: true
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"array-callback-return": [
|
|
77
|
+
"error",
|
|
78
|
+
{
|
|
79
|
+
allowImplicit: false,
|
|
80
|
+
allowVoid: false,
|
|
81
|
+
checkForEach: false
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"arrow-body-style": ["error", "as-needed", { requireReturnForObjectLiteral: false }],
|
|
85
|
+
"block-scoped-var": "error",
|
|
86
|
+
camelcase: [
|
|
87
|
+
"error",
|
|
88
|
+
{
|
|
89
|
+
ignoreDestructuring: false,
|
|
90
|
+
ignoreGlobals: false,
|
|
91
|
+
ignoreImports: false,
|
|
92
|
+
properties: "never"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"capitalized-comments": "off",
|
|
96
|
+
"class-methods-use-this": "off",
|
|
97
|
+
complexity: "off",
|
|
98
|
+
"consistent-return": "off",
|
|
99
|
+
"consistent-this": "off",
|
|
100
|
+
"constructor-super": "error",
|
|
101
|
+
curly: "off",
|
|
102
|
+
"default-case": "error",
|
|
103
|
+
"default-case-last": "error",
|
|
104
|
+
"default-param-last": "error",
|
|
105
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
106
|
+
eqeqeq: ["error", "always"],
|
|
107
|
+
"for-direction": "error",
|
|
108
|
+
"func-name-matching": "off",
|
|
109
|
+
"func-names": ["error", "as-needed"],
|
|
110
|
+
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
|
|
111
|
+
"getter-return": ["error", { allowImplicit: false }],
|
|
112
|
+
"grouped-accessor-pairs": ["error", "getBeforeSet"],
|
|
113
|
+
"guard-for-in": "off",
|
|
114
|
+
"id-denylist": "off",
|
|
115
|
+
"id-length": "off",
|
|
116
|
+
"id-match": "off",
|
|
117
|
+
"init-declarations": "off",
|
|
118
|
+
"logical-assignment-operators": ["error", "always", { enforceForIfStatements: true }],
|
|
119
|
+
"max-classes-per-file": [
|
|
120
|
+
"error",
|
|
121
|
+
{
|
|
122
|
+
ignoreExpressions: false,
|
|
123
|
+
max: 1
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"max-depth": "off",
|
|
127
|
+
"max-lines": "off",
|
|
128
|
+
"max-lines-per-function": "off",
|
|
129
|
+
"max-nested-callbacks": "off",
|
|
130
|
+
"max-params": "off",
|
|
131
|
+
"max-statements": "off",
|
|
132
|
+
"new-cap": [
|
|
133
|
+
"error",
|
|
134
|
+
{
|
|
135
|
+
capIsNew: false,
|
|
136
|
+
newIsCap: true,
|
|
137
|
+
properties: false
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"no-alert": "error",
|
|
141
|
+
"no-array-constructor": "error",
|
|
142
|
+
"no-async-promise-executor": "error",
|
|
143
|
+
"no-await-in-loop": "off",
|
|
144
|
+
"no-bitwise": "off",
|
|
145
|
+
"no-caller": "error",
|
|
146
|
+
"no-case-declarations": "error",
|
|
147
|
+
"no-class-assign": "error",
|
|
148
|
+
"no-compare-neg-zero": "error",
|
|
149
|
+
"no-cond-assign": ["error", "always"],
|
|
150
|
+
"no-console": "off",
|
|
151
|
+
"no-const-assign": "error",
|
|
152
|
+
"no-constant-binary-expression": "error",
|
|
153
|
+
"no-constant-condition": ["error", { checkLoops: true }],
|
|
154
|
+
"no-constructor-return": "error",
|
|
155
|
+
"no-continue": "off",
|
|
156
|
+
"no-control-regex": "error",
|
|
157
|
+
"no-debugger": "error",
|
|
158
|
+
"no-delete-var": "error",
|
|
159
|
+
"no-div-regex": "error",
|
|
160
|
+
"no-dupe-args": "error",
|
|
161
|
+
"no-dupe-class-members": "error",
|
|
162
|
+
"no-dupe-else-if": "error",
|
|
163
|
+
"no-dupe-keys": "error",
|
|
164
|
+
"no-duplicate-case": "error",
|
|
165
|
+
"no-duplicate-imports": ["error", { includeExports: true }],
|
|
166
|
+
"no-else-return": ["error", { allowElseIf: false }],
|
|
167
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
168
|
+
"no-empty-character-class": "error",
|
|
169
|
+
"no-empty-function": "error",
|
|
170
|
+
"no-empty-pattern": ["error", { allowObjectPatternsAsParameters: false }],
|
|
171
|
+
"no-empty-static-block": "error",
|
|
172
|
+
"no-eq-null": "error",
|
|
173
|
+
"no-eval": ["error", { allowIndirect: false }],
|
|
174
|
+
"no-ex-assign": "error",
|
|
175
|
+
"no-extend-native": "error",
|
|
176
|
+
"no-extra-bind": "error",
|
|
177
|
+
"no-extra-boolean-cast": ["error", { enforceForInnerExpressions: false }],
|
|
178
|
+
"no-extra-label": "error",
|
|
179
|
+
"no-fallthrough": ["error", { allowEmptyCase: true }],
|
|
180
|
+
"no-func-assign": "error",
|
|
181
|
+
"no-global-assign": "error",
|
|
182
|
+
"no-implicit-coercion": "off",
|
|
183
|
+
"no-implicit-globals": "off",
|
|
184
|
+
"no-implied-eval": "error",
|
|
185
|
+
"no-import-assign": "error",
|
|
186
|
+
"no-inline-comments": "error",
|
|
187
|
+
"no-inner-declarations": ["error", "functions"],
|
|
188
|
+
"no-invalid-regexp": "error",
|
|
189
|
+
"no-invalid-this": ["error", { capIsConstructor: true }],
|
|
190
|
+
"no-irregular-whitespace": [
|
|
191
|
+
"error",
|
|
192
|
+
{
|
|
193
|
+
skipComments: false,
|
|
194
|
+
skipJSXText: false,
|
|
195
|
+
skipRegExps: false,
|
|
196
|
+
skipStrings: true,
|
|
197
|
+
skipTemplates: true
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"no-iterator": "error",
|
|
201
|
+
"no-label-var": "error",
|
|
202
|
+
"no-labels": [
|
|
203
|
+
"error",
|
|
204
|
+
{
|
|
205
|
+
allowLoop: false,
|
|
206
|
+
allowSwitch: false
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"no-lone-blocks": "error",
|
|
210
|
+
"no-lonely-if": "off",
|
|
211
|
+
"no-loop-func": "error",
|
|
212
|
+
"no-loss-of-precision": "error",
|
|
213
|
+
"no-magic-numbers": "off",
|
|
214
|
+
"no-misleading-character-class": ["error", { allowEscape: false }],
|
|
215
|
+
"no-multi-assign": ["error", { ignoreNonDeclaration: false }],
|
|
216
|
+
"no-multi-str": "error",
|
|
217
|
+
"no-negated-condition": "error",
|
|
218
|
+
"no-nested-ternary": "off",
|
|
219
|
+
"no-new": "error",
|
|
220
|
+
"no-new-func": "error",
|
|
221
|
+
"no-new-native-nonconstructor": "error",
|
|
222
|
+
"no-new-wrappers": "error",
|
|
223
|
+
"no-nonoctal-decimal-escape": "error",
|
|
224
|
+
"no-obj-calls": "error",
|
|
225
|
+
"no-object-constructor": "error",
|
|
226
|
+
"no-octal": "error",
|
|
227
|
+
"no-octal-escape": "error",
|
|
228
|
+
"no-param-reassign": "off",
|
|
229
|
+
"no-plusplus": "off",
|
|
230
|
+
"no-promise-executor-return": ["error", { allowVoid: false }],
|
|
231
|
+
"no-proto": "error",
|
|
232
|
+
"no-prototype-builtins": "error",
|
|
233
|
+
"no-redeclare": ["error", { builtinGlobals: true }],
|
|
234
|
+
"no-regex-spaces": "error",
|
|
235
|
+
"no-restricted-exports": "off",
|
|
236
|
+
"no-restricted-globals": "off",
|
|
237
|
+
"no-restricted-imports": "off",
|
|
238
|
+
"no-restricted-properties": "off",
|
|
239
|
+
"no-restricted-syntax": "off",
|
|
240
|
+
"no-return-assign": ["error", "except-parens"],
|
|
241
|
+
"no-script-url": "error",
|
|
242
|
+
"no-self-assign": ["error", { props: true }],
|
|
243
|
+
"no-self-compare": "error",
|
|
244
|
+
"no-sequences": ["error", { allowInParentheses: true }],
|
|
245
|
+
"no-setter-return": "error",
|
|
246
|
+
"no-shadow": "off",
|
|
247
|
+
"no-shadow-restricted-names": "error",
|
|
248
|
+
"no-sparse-arrays": "error",
|
|
249
|
+
"no-template-curly-in-string": "error",
|
|
250
|
+
"no-ternary": "off",
|
|
251
|
+
"no-this-before-super": "error",
|
|
252
|
+
"no-throw-literal": "error",
|
|
253
|
+
"no-undef": ["error", { typeof: false }],
|
|
254
|
+
"no-undef-init": "error",
|
|
255
|
+
"no-undefined": "off",
|
|
256
|
+
"no-underscore-dangle": [
|
|
257
|
+
"error",
|
|
258
|
+
{
|
|
259
|
+
allowAfterSuper: false,
|
|
260
|
+
allowAfterThis: false,
|
|
261
|
+
allowAfterThisConstructor: false,
|
|
262
|
+
allowFunctionParams: false,
|
|
263
|
+
allowInArrayDestructuring: false,
|
|
264
|
+
allowInObjectDestructuring: false,
|
|
265
|
+
enforceInClassFields: false,
|
|
266
|
+
enforceInMethodNames: false
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"no-unexpected-multiline": "error",
|
|
270
|
+
"no-unmodified-loop-condition": "error",
|
|
271
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
272
|
+
"no-unreachable": "error",
|
|
273
|
+
"no-unreachable-loop": "error",
|
|
274
|
+
"no-unsafe-finally": "error",
|
|
275
|
+
"no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
|
|
276
|
+
"no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
|
|
277
|
+
"no-unused-expressions": [
|
|
278
|
+
"error",
|
|
279
|
+
{
|
|
280
|
+
allowShortCircuit: false,
|
|
281
|
+
allowTaggedTemplates: false,
|
|
282
|
+
allowTernary: false,
|
|
283
|
+
enforceForJSX: false
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"no-unused-labels": "error",
|
|
287
|
+
"no-unused-private-class-members": "error",
|
|
288
|
+
"no-unused-vars": [
|
|
289
|
+
"error",
|
|
290
|
+
{
|
|
291
|
+
args: "after-used",
|
|
292
|
+
caughtErrors: "all",
|
|
293
|
+
ignoreRestSiblings: true,
|
|
294
|
+
vars: "all"
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"no-use-before-define": [
|
|
298
|
+
"error",
|
|
299
|
+
{
|
|
300
|
+
allowNamedExports: false,
|
|
301
|
+
classes: true,
|
|
302
|
+
functions: true,
|
|
303
|
+
variables: true
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"no-useless-assignment": "error",
|
|
307
|
+
"no-useless-backreference": "error",
|
|
308
|
+
"no-useless-call": "error",
|
|
309
|
+
"no-useless-catch": "error",
|
|
310
|
+
"no-useless-computed-key": ["error", { enforceForClassMembers: true }],
|
|
311
|
+
"no-useless-concat": "error",
|
|
312
|
+
"no-useless-constructor": "error",
|
|
313
|
+
"no-useless-escape": "error",
|
|
314
|
+
"no-useless-rename": [
|
|
315
|
+
"error",
|
|
316
|
+
{
|
|
317
|
+
ignoreDestructuring: false,
|
|
318
|
+
ignoreExport: false,
|
|
319
|
+
ignoreImport: false
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"no-useless-return": "error",
|
|
323
|
+
"no-var": "error",
|
|
324
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
325
|
+
"no-warning-comments": "off",
|
|
326
|
+
"no-with": "error",
|
|
327
|
+
"object-shorthand": [
|
|
328
|
+
"error",
|
|
329
|
+
"always",
|
|
330
|
+
{
|
|
331
|
+
avoidExplicitReturnArrows: false,
|
|
332
|
+
avoidQuotes: false,
|
|
333
|
+
ignoreConstructors: false
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"one-var": ["error", "never"],
|
|
337
|
+
"operator-assignment": ["error", "always"],
|
|
338
|
+
"prefer-arrow-callback": [
|
|
339
|
+
"error",
|
|
340
|
+
{
|
|
341
|
+
allowNamedFunctions: false,
|
|
342
|
+
allowUnboundThis: false
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
"prefer-const": [
|
|
346
|
+
"error",
|
|
347
|
+
{
|
|
348
|
+
destructuring: "all",
|
|
349
|
+
ignoreReadBeforeAssign: false
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
"prefer-destructuring": [
|
|
353
|
+
"error",
|
|
354
|
+
{
|
|
355
|
+
array: true,
|
|
356
|
+
object: true
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
enforceForRenamedProperties: false
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
"prefer-exponentiation-operator": "error",
|
|
363
|
+
"prefer-named-capture-group": "off",
|
|
364
|
+
"prefer-numeric-literals": "off",
|
|
365
|
+
"prefer-object-has-own": "error",
|
|
366
|
+
"prefer-object-spread": "error",
|
|
367
|
+
"prefer-promise-reject-errors": "off",
|
|
368
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
369
|
+
"prefer-rest-params": "error",
|
|
370
|
+
"prefer-spread": "error",
|
|
371
|
+
"prefer-template": "error",
|
|
372
|
+
radix: ["error", "always"],
|
|
373
|
+
"require-atomic-updates": ["error", { allowProperties: false }],
|
|
374
|
+
"require-await": "error",
|
|
375
|
+
"require-unicode-regexp": ["error", { requireFlag: "u" }],
|
|
376
|
+
"require-yield": "error",
|
|
377
|
+
"sort-imports": "off",
|
|
378
|
+
"sort-keys": "off",
|
|
379
|
+
"sort-vars": "off",
|
|
380
|
+
strict: ["error", "never"],
|
|
381
|
+
"symbol-description": "error",
|
|
382
|
+
"unicode-bom": ["error", "never"],
|
|
383
|
+
"use-isnan": [
|
|
384
|
+
"error",
|
|
385
|
+
{
|
|
386
|
+
enforceForIndexOf: true,
|
|
387
|
+
enforceForSwitchCase: true
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
391
|
+
"vars-on-top": "error",
|
|
392
|
+
yoda: [
|
|
393
|
+
"error",
|
|
394
|
+
"never",
|
|
395
|
+
{
|
|
396
|
+
exceptRange: false,
|
|
397
|
+
onlyEquality: false
|
|
398
|
+
}
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/utils/interop-default.ts
|
|
406
|
+
async function interopDefault(module) {
|
|
407
|
+
return Promise.resolve(module).then((v) => v.default ?? v);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// src/configs/typescript.ts
|
|
411
|
+
async function typescriptConfig() {
|
|
412
|
+
const [typescriptParser, typescriptPlugin] = await Promise.all([
|
|
413
|
+
interopDefault(import('@typescript-eslint/parser')),
|
|
414
|
+
interopDefault(import('@typescript-eslint/eslint-plugin'))
|
|
415
|
+
]);
|
|
416
|
+
return [
|
|
417
|
+
{
|
|
418
|
+
name: "wondermarin/eslint-config/typescript",
|
|
419
|
+
files: ["**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
420
|
+
languageOptions: {
|
|
421
|
+
parser: typescriptParser,
|
|
422
|
+
parserOptions: {
|
|
423
|
+
project: true,
|
|
424
|
+
tsconfigRootDir: process.cwd()
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
plugins: {
|
|
428
|
+
"@typescript-eslint": typescriptPlugin
|
|
429
|
+
},
|
|
430
|
+
rules: {
|
|
431
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
432
|
+
"@typescript-eslint/array-type": ["error", { default: "array" }],
|
|
433
|
+
"@typescript-eslint/await-thenable": "error",
|
|
434
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
435
|
+
"error",
|
|
436
|
+
{
|
|
437
|
+
minimumDescriptionLength: 3,
|
|
438
|
+
"ts-check": "allow-with-description",
|
|
439
|
+
"ts-expect-error": "allow-with-description",
|
|
440
|
+
"ts-ignore": "allow-with-description",
|
|
441
|
+
"ts-nocheck": "allow-with-description"
|
|
442
|
+
}
|
|
443
|
+
],
|
|
444
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
445
|
+
"@typescript-eslint/class-literal-property-style": ["error", "fields"],
|
|
446
|
+
"@typescript-eslint/class-methods-use-this": "off",
|
|
447
|
+
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
|
|
448
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
|
449
|
+
"@typescript-eslint/consistent-return": "off",
|
|
450
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
451
|
+
"error",
|
|
452
|
+
{
|
|
453
|
+
assertionStyle: "as",
|
|
454
|
+
objectLiteralTypeAssertions: "allow-as-parameter"
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
458
|
+
"@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
|
|
459
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
460
|
+
"error",
|
|
461
|
+
{
|
|
462
|
+
disallowTypeAnnotations: true,
|
|
463
|
+
fixStyle: "inline-type-imports",
|
|
464
|
+
prefer: "type-imports"
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
"@typescript-eslint/default-param-last": "error",
|
|
468
|
+
"@typescript-eslint/dot-notation": [
|
|
469
|
+
"error",
|
|
470
|
+
{
|
|
471
|
+
allowIndexSignaturePropertyAccess: false,
|
|
472
|
+
allowKeywords: true,
|
|
473
|
+
allowPrivateClassPropertyAccess: false,
|
|
474
|
+
allowProtectedClassPropertyAccess: false
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
478
|
+
"@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "explicit" }],
|
|
479
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
480
|
+
"@typescript-eslint/init-declarations": "off",
|
|
481
|
+
"@typescript-eslint/max-params": "off",
|
|
482
|
+
"@typescript-eslint/member-ordering": "off",
|
|
483
|
+
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
484
|
+
"@typescript-eslint/naming-convention": [
|
|
485
|
+
"error",
|
|
486
|
+
{
|
|
487
|
+
selector: "accessor",
|
|
488
|
+
format: ["strictCamelCase"],
|
|
489
|
+
leadingUnderscore: "forbid",
|
|
490
|
+
trailingUnderscore: "forbid"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
selector: "classMethod",
|
|
494
|
+
format: ["strictCamelCase"],
|
|
495
|
+
leadingUnderscore: "forbid",
|
|
496
|
+
trailingUnderscore: "forbid"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
selector: "objectLiteralMethod",
|
|
500
|
+
format: ["strictCamelCase", "StrictPascalCase"],
|
|
501
|
+
leadingUnderscore: "forbid",
|
|
502
|
+
trailingUnderscore: "forbid"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
selector: "typeMethod",
|
|
506
|
+
format: ["strictCamelCase", "StrictPascalCase"],
|
|
507
|
+
leadingUnderscore: "forbid",
|
|
508
|
+
trailingUnderscore: "forbid"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
selector: "classProperty",
|
|
512
|
+
format: ["strictCamelCase"],
|
|
513
|
+
leadingUnderscore: "forbid",
|
|
514
|
+
trailingUnderscore: "forbid"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
selector: "class",
|
|
518
|
+
format: ["StrictPascalCase"],
|
|
519
|
+
leadingUnderscore: "forbid",
|
|
520
|
+
trailingUnderscore: "forbid"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
selector: "enum",
|
|
524
|
+
format: ["StrictPascalCase"],
|
|
525
|
+
prefix: ["E"],
|
|
526
|
+
leadingUnderscore: "forbid",
|
|
527
|
+
trailingUnderscore: "forbid"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
selector: "interface",
|
|
531
|
+
format: ["StrictPascalCase"],
|
|
532
|
+
prefix: ["I"],
|
|
533
|
+
leadingUnderscore: "forbid",
|
|
534
|
+
trailingUnderscore: "forbid"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
selector: "typeAlias",
|
|
538
|
+
format: ["StrictPascalCase"],
|
|
539
|
+
prefix: ["T"],
|
|
540
|
+
leadingUnderscore: "forbid",
|
|
541
|
+
trailingUnderscore: "forbid"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
selector: "typeParameter",
|
|
545
|
+
format: ["StrictPascalCase"],
|
|
546
|
+
leadingUnderscore: "forbid",
|
|
547
|
+
trailingUnderscore: "forbid"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
selector: "function",
|
|
551
|
+
format: ["strictCamelCase", "StrictPascalCase"],
|
|
552
|
+
leadingUnderscore: "forbid",
|
|
553
|
+
trailingUnderscore: "forbid"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
selector: "parameter",
|
|
557
|
+
format: ["strictCamelCase"],
|
|
558
|
+
leadingUnderscore: "forbid",
|
|
559
|
+
trailingUnderscore: "forbid"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
selector: "variable",
|
|
563
|
+
format: ["strictCamelCase", "StrictPascalCase"],
|
|
564
|
+
leadingUnderscore: "forbid",
|
|
565
|
+
trailingUnderscore: "forbid"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
selector: "enumMember",
|
|
569
|
+
format: ["StrictPascalCase", "UPPER_CASE"],
|
|
570
|
+
leadingUnderscore: "forbid",
|
|
571
|
+
trailingUnderscore: "forbid"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
selector: "import",
|
|
575
|
+
format: ["strictCamelCase", "StrictPascalCase"],
|
|
576
|
+
leadingUnderscore: "forbid",
|
|
577
|
+
trailingUnderscore: "forbid"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
selector: "parameterProperty",
|
|
581
|
+
format: ["strictCamelCase"],
|
|
582
|
+
leadingUnderscore: "forbid",
|
|
583
|
+
trailingUnderscore: "forbid"
|
|
584
|
+
}
|
|
585
|
+
],
|
|
586
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
587
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
588
|
+
"@typescript-eslint/no-base-to-string": "error",
|
|
589
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
590
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
591
|
+
"error",
|
|
592
|
+
{
|
|
593
|
+
ignoreArrowShorthand: false,
|
|
594
|
+
ignoreVoidOperator: false
|
|
595
|
+
}
|
|
596
|
+
],
|
|
597
|
+
"@typescript-eslint/no-dupe-class-members": "off",
|
|
598
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
599
|
+
"@typescript-eslint/no-duplicate-type-constituents": [
|
|
600
|
+
"error",
|
|
601
|
+
{
|
|
602
|
+
ignoreIntersections: false,
|
|
603
|
+
ignoreUnions: false
|
|
604
|
+
}
|
|
605
|
+
],
|
|
606
|
+
"@typescript-eslint/no-dynamic-delete": "off",
|
|
607
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
608
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
609
|
+
"error",
|
|
610
|
+
{
|
|
611
|
+
allowInterfaces: "never",
|
|
612
|
+
allowObjectTypes: "never"
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
616
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
617
|
+
"@typescript-eslint/no-extraneous-class": [
|
|
618
|
+
"error",
|
|
619
|
+
{
|
|
620
|
+
allowConstructorOnly: false,
|
|
621
|
+
allowEmpty: false,
|
|
622
|
+
allowStaticOnly: false,
|
|
623
|
+
allowWithDecorator: true
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
"@typescript-eslint/no-floating-promises": [
|
|
627
|
+
"error",
|
|
628
|
+
{
|
|
629
|
+
checkThenables: true,
|
|
630
|
+
ignoreIIFE: true,
|
|
631
|
+
ignoreVoid: true
|
|
632
|
+
}
|
|
633
|
+
],
|
|
634
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
635
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
636
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
637
|
+
"@typescript-eslint/no-inferrable-types": [
|
|
638
|
+
"error",
|
|
639
|
+
{
|
|
640
|
+
ignoreParameters: false,
|
|
641
|
+
ignoreProperties: false
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
"@typescript-eslint/no-invalid-this": "off",
|
|
645
|
+
"@typescript-eslint/no-invalid-void-type": [
|
|
646
|
+
"error",
|
|
647
|
+
{
|
|
648
|
+
allowAsThisParameter: false,
|
|
649
|
+
allowInGenericTypeArguments: true
|
|
650
|
+
}
|
|
651
|
+
],
|
|
652
|
+
"@typescript-eslint/no-loop-func": "off",
|
|
653
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
654
|
+
"@typescript-eslint/no-meaningless-void-operator": ["error", { checkNever: false }],
|
|
655
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
656
|
+
"@typescript-eslint/no-misused-promises": [
|
|
657
|
+
"error",
|
|
658
|
+
{
|
|
659
|
+
checksConditionals: true,
|
|
660
|
+
checksSpreads: true,
|
|
661
|
+
checksVoidReturn: {
|
|
662
|
+
attributes: false
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
667
|
+
"@typescript-eslint/no-namespace": [
|
|
668
|
+
"error",
|
|
669
|
+
{
|
|
670
|
+
allowDeclarations: false,
|
|
671
|
+
allowDefinitionFiles: true
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
675
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
676
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
677
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
678
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
679
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
680
|
+
"@typescript-eslint/no-restricted-imports": "off",
|
|
681
|
+
"@typescript-eslint/no-restricted-types": "off",
|
|
682
|
+
"@typescript-eslint/no-shadow": "off",
|
|
683
|
+
"@typescript-eslint/no-this-alias": ["error", { allowDestructuring: true }],
|
|
684
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": [
|
|
685
|
+
"error",
|
|
686
|
+
{
|
|
687
|
+
allowComparingNullableBooleansToFalse: false,
|
|
688
|
+
allowComparingNullableBooleansToTrue: false
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
692
|
+
"error",
|
|
693
|
+
{
|
|
694
|
+
allowConstantLoopConditions: false,
|
|
695
|
+
checkTypePredicates: true
|
|
696
|
+
}
|
|
697
|
+
],
|
|
698
|
+
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
699
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
700
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
701
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
702
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
703
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
704
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
705
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
706
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
707
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
708
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
709
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
710
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
711
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
712
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
713
|
+
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
714
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
715
|
+
"error",
|
|
716
|
+
{
|
|
717
|
+
allowShortCircuit: false,
|
|
718
|
+
allowTaggedTemplates: false,
|
|
719
|
+
allowTernary: false,
|
|
720
|
+
enforceForJSX: false
|
|
721
|
+
}
|
|
722
|
+
],
|
|
723
|
+
"@typescript-eslint/no-unused-vars": [
|
|
724
|
+
"error",
|
|
725
|
+
{
|
|
726
|
+
args: "after-used",
|
|
727
|
+
caughtErrors: "all",
|
|
728
|
+
ignoreClassWithStaticInitBlock: false,
|
|
729
|
+
ignoreRestSiblings: true,
|
|
730
|
+
reportUsedIgnorePattern: true,
|
|
731
|
+
vars: "all"
|
|
732
|
+
}
|
|
733
|
+
],
|
|
734
|
+
"@typescript-eslint/no-use-before-define": [
|
|
735
|
+
"error",
|
|
736
|
+
{
|
|
737
|
+
allowNamedExports: false,
|
|
738
|
+
classes: true,
|
|
739
|
+
enums: true,
|
|
740
|
+
functions: true,
|
|
741
|
+
ignoreTypeReferences: true,
|
|
742
|
+
typedefs: true,
|
|
743
|
+
variables: true
|
|
744
|
+
}
|
|
745
|
+
],
|
|
746
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
747
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
748
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
749
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
|
750
|
+
"@typescript-eslint/only-throw-error": "off",
|
|
751
|
+
"@typescript-eslint/parameter-properties": "off",
|
|
752
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
753
|
+
"@typescript-eslint/prefer-destructuring": [
|
|
754
|
+
"error",
|
|
755
|
+
{
|
|
756
|
+
array: true,
|
|
757
|
+
object: true
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
enforceForDeclarationWithTypeAnnotation: false,
|
|
761
|
+
enforceForRenamedProperties: false
|
|
762
|
+
}
|
|
763
|
+
],
|
|
764
|
+
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
765
|
+
"@typescript-eslint/prefer-find": "error",
|
|
766
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
767
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
768
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
769
|
+
"@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
|
|
770
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
771
|
+
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
772
|
+
"error",
|
|
773
|
+
{
|
|
774
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
775
|
+
ignoreConditionalTests: true,
|
|
776
|
+
ignoreMixedLogicalExpressions: true,
|
|
777
|
+
ignorePrimitives: {
|
|
778
|
+
bigint: false,
|
|
779
|
+
boolean: false,
|
|
780
|
+
number: false,
|
|
781
|
+
string: false
|
|
782
|
+
},
|
|
783
|
+
ignoreTernaryTests: false
|
|
784
|
+
}
|
|
785
|
+
],
|
|
786
|
+
"@typescript-eslint/prefer-optional-chain": [
|
|
787
|
+
"error",
|
|
788
|
+
{
|
|
789
|
+
allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: false,
|
|
790
|
+
checkAny: true,
|
|
791
|
+
checkBigInt: true,
|
|
792
|
+
checkBoolean: true,
|
|
793
|
+
checkNumber: true,
|
|
794
|
+
checkString: true,
|
|
795
|
+
checkUnknown: true,
|
|
796
|
+
requireNullish: false
|
|
797
|
+
}
|
|
798
|
+
],
|
|
799
|
+
"@typescript-eslint/prefer-promise-reject-errors": "off",
|
|
800
|
+
"@typescript-eslint/prefer-readonly": ["error", { onlyInlineLambdas: false }],
|
|
801
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
802
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
803
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
804
|
+
"@typescript-eslint/prefer-return-this-type": "error",
|
|
805
|
+
"@typescript-eslint/prefer-string-starts-ends-with": ["error", { allowSingleElementEquality: "never" }],
|
|
806
|
+
"@typescript-eslint/promise-function-async": [
|
|
807
|
+
"error",
|
|
808
|
+
{
|
|
809
|
+
allowAny: true,
|
|
810
|
+
checkArrowFunctions: true,
|
|
811
|
+
checkFunctionDeclarations: true,
|
|
812
|
+
checkFunctionExpressions: true,
|
|
813
|
+
checkMethodDeclarations: true
|
|
814
|
+
}
|
|
815
|
+
],
|
|
816
|
+
"@typescript-eslint/require-array-sort-compare": ["error", { ignoreStringArrays: true }],
|
|
817
|
+
"@typescript-eslint/require-await": "error",
|
|
818
|
+
"@typescript-eslint/restrict-plus-operands": [
|
|
819
|
+
"error",
|
|
820
|
+
{
|
|
821
|
+
allowAny: false,
|
|
822
|
+
allowBoolean: false,
|
|
823
|
+
allowNullish: false,
|
|
824
|
+
allowNumberAndString: false,
|
|
825
|
+
allowRegExp: false,
|
|
826
|
+
skipCompoundAssignments: false
|
|
827
|
+
}
|
|
828
|
+
],
|
|
829
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
830
|
+
"error",
|
|
831
|
+
{
|
|
832
|
+
allowAny: true,
|
|
833
|
+
allowArray: true,
|
|
834
|
+
allowBoolean: true,
|
|
835
|
+
allowNullish: true,
|
|
836
|
+
allowNumber: true,
|
|
837
|
+
allowRegExp: true
|
|
838
|
+
}
|
|
839
|
+
],
|
|
840
|
+
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
|
841
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
842
|
+
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
843
|
+
"error",
|
|
844
|
+
{
|
|
845
|
+
allowDefaultCaseForExhaustiveSwitch: true,
|
|
846
|
+
requireDefaultForNonUnion: false
|
|
847
|
+
}
|
|
848
|
+
],
|
|
849
|
+
"@typescript-eslint/triple-slash-reference": [
|
|
850
|
+
"error",
|
|
851
|
+
{
|
|
852
|
+
lib: "always",
|
|
853
|
+
path: "never",
|
|
854
|
+
types: "prefer-import"
|
|
855
|
+
}
|
|
856
|
+
],
|
|
857
|
+
"@typescript-eslint/typedef": "off",
|
|
858
|
+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: false }],
|
|
859
|
+
"@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: false }],
|
|
860
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
861
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
862
|
+
"default-param-last": "off",
|
|
863
|
+
"dot-notation": "off",
|
|
864
|
+
"no-array-constructor": "off",
|
|
865
|
+
"no-dupe-class-members": "off",
|
|
866
|
+
"no-empty-function": "off",
|
|
867
|
+
"no-implied-eval": "off",
|
|
868
|
+
"no-invalid-this": "off",
|
|
869
|
+
"no-loop-func": "off",
|
|
870
|
+
"no-magic-numbers": "off",
|
|
871
|
+
"no-redeclare": "off",
|
|
872
|
+
"no-restricted-imports": "off",
|
|
873
|
+
"no-shadow": "off",
|
|
874
|
+
"no-throw-literal": "off",
|
|
875
|
+
"no-undef": "off",
|
|
876
|
+
"no-unused-expressions": "off",
|
|
877
|
+
"no-unused-vars": "off",
|
|
878
|
+
"no-use-before-define": "off",
|
|
879
|
+
"no-useless-constructor": "off",
|
|
880
|
+
"prefer-destructuring": "off",
|
|
881
|
+
"require-await": "off"
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// src/configs/stylistic.ts
|
|
888
|
+
async function stylisticConfig() {
|
|
889
|
+
const [prettierConfig, prettierPlugin, stylisticPlugin, perfectionistPlugin] = await Promise.all([
|
|
890
|
+
interopDefault(import('eslint-config-prettier')),
|
|
891
|
+
interopDefault(import('eslint-plugin-prettier')),
|
|
892
|
+
interopDefault(import('@stylistic/eslint-plugin')),
|
|
893
|
+
interopDefault(import('eslint-plugin-perfectionist'))
|
|
894
|
+
]);
|
|
895
|
+
return [
|
|
896
|
+
{
|
|
897
|
+
name: "wondermarin/eslint-config/prettier",
|
|
898
|
+
files: ["**/*.?([cm])js" /* JS */, "**/*.jsx" /* JSX */, "**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
899
|
+
plugins: {
|
|
900
|
+
prettier: prettierPlugin
|
|
901
|
+
},
|
|
902
|
+
rules: {
|
|
903
|
+
"prettier/prettier": "error",
|
|
904
|
+
...prettierConfig.rules
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
name: "wondermarin/eslint-config/stylistic",
|
|
909
|
+
files: ["**/*.?([cm])js" /* JS */, "**/*.jsx" /* JSX */, "**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
910
|
+
plugins: {
|
|
911
|
+
"@stylistic": stylisticPlugin
|
|
912
|
+
},
|
|
913
|
+
rules: {
|
|
914
|
+
"@stylistic/array-bracket-newline": "off",
|
|
915
|
+
"@stylistic/array-bracket-spacing": "off",
|
|
916
|
+
"@stylistic/array-element-newline": "off",
|
|
917
|
+
"@stylistic/arrow-parens": "off",
|
|
918
|
+
"@stylistic/arrow-spacing": "off",
|
|
919
|
+
"@stylistic/block-spacing": "off",
|
|
920
|
+
"@stylistic/brace-style": "off",
|
|
921
|
+
"@stylistic/comma-dangle": "off",
|
|
922
|
+
"@stylistic/comma-spacing": "off",
|
|
923
|
+
"@stylistic/comma-style": "off",
|
|
924
|
+
"@stylistic/computed-property-spacing": "off",
|
|
925
|
+
"@stylistic/dot-location": "off",
|
|
926
|
+
"@stylistic/eol-last": "off",
|
|
927
|
+
"@stylistic/function-call-argument-newline": "off",
|
|
928
|
+
"@stylistic/function-call-spacing": "off",
|
|
929
|
+
"@stylistic/function-paren-newline": "off",
|
|
930
|
+
"@stylistic/generator-star-spacing": "off",
|
|
931
|
+
"@stylistic/implicit-arrow-linebreak": "off",
|
|
932
|
+
"@stylistic/indent": "off",
|
|
933
|
+
"@stylistic/indent-binary-ops": "off",
|
|
934
|
+
"@stylistic/jsx-child-element-spacing": "off",
|
|
935
|
+
"@stylistic/jsx-closing-bracket-location": "off",
|
|
936
|
+
"@stylistic/jsx-closing-tag-location": "off",
|
|
937
|
+
"@stylistic/jsx-curly-brace-presence": "off",
|
|
938
|
+
"@stylistic/jsx-curly-newline": "off",
|
|
939
|
+
"@stylistic/jsx-curly-spacing": "off",
|
|
940
|
+
"@stylistic/jsx-equals-spacing": "off",
|
|
941
|
+
"@stylistic/jsx-first-prop-new-line": "off",
|
|
942
|
+
"@stylistic/jsx-function-call-newline": "off",
|
|
943
|
+
"@stylistic/jsx-indent-props": "off",
|
|
944
|
+
"@stylistic/jsx-max-props-per-line": "off",
|
|
945
|
+
"@stylistic/jsx-newline": "off",
|
|
946
|
+
"@stylistic/jsx-one-expression-per-line": "off",
|
|
947
|
+
"@stylistic/jsx-pascal-case": "off",
|
|
948
|
+
"@stylistic/jsx-props-no-multi-spaces": "off",
|
|
949
|
+
"@stylistic/jsx-quotes": "off",
|
|
950
|
+
"@stylistic/jsx-self-closing-comp": "off",
|
|
951
|
+
"@stylistic/jsx-sort-props": "off",
|
|
952
|
+
"@stylistic/jsx-tag-spacing": "off",
|
|
953
|
+
"@stylistic/jsx-wrap-multilines": "off",
|
|
954
|
+
"@stylistic/key-spacing": "off",
|
|
955
|
+
"@stylistic/keyword-spacing": "off",
|
|
956
|
+
"@stylistic/line-comment-position": "off",
|
|
957
|
+
"@stylistic/linebreak-style": "off",
|
|
958
|
+
"@stylistic/lines-around-comment": "off",
|
|
959
|
+
"@stylistic/lines-between-class-members": "off",
|
|
960
|
+
"@stylistic/max-len": "off",
|
|
961
|
+
"@stylistic/max-statements-per-line": "off",
|
|
962
|
+
"@stylistic/member-delimiter-style": "off",
|
|
963
|
+
"@stylistic/multiline-comment-style": "off",
|
|
964
|
+
"@stylistic/multiline-ternary": "off",
|
|
965
|
+
"@stylistic/new-parens": "off",
|
|
966
|
+
"@stylistic/newline-per-chained-call": "off",
|
|
967
|
+
"@stylistic/no-confusing-arrow": "off",
|
|
968
|
+
"@stylistic/no-extra-parens": "off",
|
|
969
|
+
"@stylistic/no-extra-semi": "off",
|
|
970
|
+
"@stylistic/no-floating-decimal": "off",
|
|
971
|
+
"@stylistic/no-mixed-operators": "off",
|
|
972
|
+
"@stylistic/no-mixed-spaces-and-tabs": "off",
|
|
973
|
+
"@stylistic/no-multi-spaces": "off",
|
|
974
|
+
"@stylistic/no-multiple-empty-lines": "off",
|
|
975
|
+
"@stylistic/no-tabs": "off",
|
|
976
|
+
"@stylistic/no-trailing-spaces": "off",
|
|
977
|
+
"@stylistic/no-whitespace-before-property": "off",
|
|
978
|
+
"@stylistic/nonblock-statement-body-position": "off",
|
|
979
|
+
"@stylistic/object-curly-newline": "off",
|
|
980
|
+
"@stylistic/object-curly-spacing": "off",
|
|
981
|
+
"@stylistic/object-property-newline": "off",
|
|
982
|
+
"@stylistic/one-var-declaration-per-line": "off",
|
|
983
|
+
"@stylistic/operator-linebreak": "off",
|
|
984
|
+
"@stylistic/padded-blocks": "off",
|
|
985
|
+
"@stylistic/padding-line-between-statements": [
|
|
986
|
+
"error",
|
|
987
|
+
{
|
|
988
|
+
blankLine: "always",
|
|
989
|
+
next: "*",
|
|
990
|
+
prev: [
|
|
991
|
+
"block-like",
|
|
992
|
+
"case",
|
|
993
|
+
"class",
|
|
994
|
+
"debugger",
|
|
995
|
+
"default",
|
|
996
|
+
"directive",
|
|
997
|
+
"do",
|
|
998
|
+
"expression",
|
|
999
|
+
"for",
|
|
1000
|
+
"function",
|
|
1001
|
+
"if",
|
|
1002
|
+
"iife",
|
|
1003
|
+
"multiline-expression",
|
|
1004
|
+
"multiline-const",
|
|
1005
|
+
"multiline-let",
|
|
1006
|
+
"switch",
|
|
1007
|
+
"throw",
|
|
1008
|
+
"try",
|
|
1009
|
+
"while",
|
|
1010
|
+
"with"
|
|
1011
|
+
]
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
blankLine: "always",
|
|
1015
|
+
next: [
|
|
1016
|
+
"block-like",
|
|
1017
|
+
"break",
|
|
1018
|
+
"case",
|
|
1019
|
+
"class",
|
|
1020
|
+
"continue",
|
|
1021
|
+
"debugger",
|
|
1022
|
+
"default",
|
|
1023
|
+
"do",
|
|
1024
|
+
"expression",
|
|
1025
|
+
"for",
|
|
1026
|
+
"function",
|
|
1027
|
+
"if",
|
|
1028
|
+
"iife",
|
|
1029
|
+
"multiline-expression",
|
|
1030
|
+
"multiline-const",
|
|
1031
|
+
"multiline-let",
|
|
1032
|
+
"return",
|
|
1033
|
+
"singleline-const",
|
|
1034
|
+
"singleline-let",
|
|
1035
|
+
"switch",
|
|
1036
|
+
"throw",
|
|
1037
|
+
"try",
|
|
1038
|
+
"while",
|
|
1039
|
+
"with"
|
|
1040
|
+
],
|
|
1041
|
+
prev: "*"
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
blankLine: "any",
|
|
1045
|
+
next: "expression",
|
|
1046
|
+
prev: "expression"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
blankLine: "any",
|
|
1050
|
+
next: ["singleline-const", "singleline-let"],
|
|
1051
|
+
prev: ["singleline-const", "singleline-let"]
|
|
1052
|
+
}
|
|
1053
|
+
],
|
|
1054
|
+
"@stylistic/quote-props": "off",
|
|
1055
|
+
"@stylistic/quotes": "off",
|
|
1056
|
+
"@stylistic/rest-spread-spacing": "off",
|
|
1057
|
+
"@stylistic/semi": "off",
|
|
1058
|
+
"@stylistic/semi-spacing": "off",
|
|
1059
|
+
"@stylistic/semi-style": "off",
|
|
1060
|
+
"@stylistic/space-before-blocks": "off",
|
|
1061
|
+
"@stylistic/space-before-function-paren": "off",
|
|
1062
|
+
"@stylistic/space-in-parens": "off",
|
|
1063
|
+
"@stylistic/space-infix-ops": "off",
|
|
1064
|
+
"@stylistic/space-unary-ops": "off",
|
|
1065
|
+
"@stylistic/spaced-comment": "off",
|
|
1066
|
+
"@stylistic/switch-colon-spacing": "off",
|
|
1067
|
+
"@stylistic/template-curly-spacing": "off",
|
|
1068
|
+
"@stylistic/template-tag-spacing": "off",
|
|
1069
|
+
"@stylistic/type-annotation-spacing": "off",
|
|
1070
|
+
"@stylistic/type-generic-spacing": "off",
|
|
1071
|
+
"@stylistic/type-named-tuple-spacing": "off",
|
|
1072
|
+
"@stylistic/wrap-iife": "off",
|
|
1073
|
+
"@stylistic/wrap-regex": "off",
|
|
1074
|
+
"@stylistic/yield-star-spacing": "off"
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
name: "wondermarin/eslint-config/perfectionist",
|
|
1079
|
+
files: ["**/*.?([cm])js" /* JS */, "**/*.jsx" /* JSX */, "**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
1080
|
+
plugins: {
|
|
1081
|
+
perfectionist: perfectionistPlugin
|
|
1082
|
+
},
|
|
1083
|
+
rules: {
|
|
1084
|
+
"perfectionist/sort-array-includes": "off",
|
|
1085
|
+
"perfectionist/sort-astro-attributes": "off",
|
|
1086
|
+
"perfectionist/sort-classes": "off",
|
|
1087
|
+
"perfectionist/sort-enums": "off",
|
|
1088
|
+
"perfectionist/sort-exports": [
|
|
1089
|
+
"error",
|
|
1090
|
+
{
|
|
1091
|
+
type: "line-length",
|
|
1092
|
+
order: "desc",
|
|
1093
|
+
ignoreCase: true,
|
|
1094
|
+
partitionByComment: false,
|
|
1095
|
+
partitionByNewLine: true,
|
|
1096
|
+
groupKind: "values-first",
|
|
1097
|
+
matcher: "minimatch"
|
|
1098
|
+
}
|
|
1099
|
+
],
|
|
1100
|
+
"perfectionist/sort-imports": [
|
|
1101
|
+
"error",
|
|
1102
|
+
{
|
|
1103
|
+
type: "line-length",
|
|
1104
|
+
order: "desc",
|
|
1105
|
+
ignoreCase: true,
|
|
1106
|
+
internalPattern: ["@/**"],
|
|
1107
|
+
sortSideEffects: false,
|
|
1108
|
+
newlinesBetween: "always",
|
|
1109
|
+
maxLineLength: 120,
|
|
1110
|
+
groups: [
|
|
1111
|
+
"builtin",
|
|
1112
|
+
"builtin-type",
|
|
1113
|
+
"external",
|
|
1114
|
+
"external-type",
|
|
1115
|
+
"internal",
|
|
1116
|
+
"internal-type",
|
|
1117
|
+
"parent",
|
|
1118
|
+
"parent-type",
|
|
1119
|
+
"sibling",
|
|
1120
|
+
"sibling-type",
|
|
1121
|
+
"index",
|
|
1122
|
+
"index-type",
|
|
1123
|
+
"side-effect",
|
|
1124
|
+
"side-effect-style"
|
|
1125
|
+
],
|
|
1126
|
+
customGroups: {},
|
|
1127
|
+
matcher: "minimatch",
|
|
1128
|
+
environment: "node"
|
|
1129
|
+
}
|
|
1130
|
+
],
|
|
1131
|
+
"perfectionist/sort-interfaces": "off",
|
|
1132
|
+
"perfectionist/sort-intersection-types": "off",
|
|
1133
|
+
"perfectionist/sort-jsx-props": "off",
|
|
1134
|
+
"perfectionist/sort-maps": "off",
|
|
1135
|
+
"perfectionist/sort-named-exports": [
|
|
1136
|
+
"error",
|
|
1137
|
+
{
|
|
1138
|
+
type: "line-length",
|
|
1139
|
+
order: "desc",
|
|
1140
|
+
ignoreCase: true,
|
|
1141
|
+
groupKind: "values-first",
|
|
1142
|
+
partitionByComment: false,
|
|
1143
|
+
partitionByNewLine: true,
|
|
1144
|
+
matcher: "minimatch"
|
|
1145
|
+
}
|
|
1146
|
+
],
|
|
1147
|
+
"perfectionist/sort-named-imports": [
|
|
1148
|
+
"error",
|
|
1149
|
+
{
|
|
1150
|
+
type: "line-length",
|
|
1151
|
+
order: "desc",
|
|
1152
|
+
ignoreCase: true,
|
|
1153
|
+
ignoreAlias: false,
|
|
1154
|
+
groupKind: "values-first",
|
|
1155
|
+
partitionByComment: false,
|
|
1156
|
+
partitionByNewLine: true,
|
|
1157
|
+
matcher: "minimatch"
|
|
1158
|
+
}
|
|
1159
|
+
],
|
|
1160
|
+
"perfectionist/sort-object-types": "off",
|
|
1161
|
+
"perfectionist/sort-objects": "off",
|
|
1162
|
+
"perfectionist/sort-svelte-attributes": "off",
|
|
1163
|
+
"perfectionist/sort-switch-case": "off",
|
|
1164
|
+
"perfectionist/sort-union-types": "off",
|
|
1165
|
+
"perfectionist/sort-variable-declarations": "off",
|
|
1166
|
+
"perfectionist/sort-vue-attributes": "off"
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
];
|
|
1170
|
+
}
|
|
1171
|
+
var removedMethodNames = /* @__PURE__ */ new Map([
|
|
1172
|
+
["getSource", "getText"],
|
|
1173
|
+
["getSourceLines", "getLines"],
|
|
1174
|
+
["getAllComments", "getAllComments"],
|
|
1175
|
+
["getDeclaredVariables", "getDeclaredVariables"],
|
|
1176
|
+
["getNodeByRangeIndex", "getNodeByRangeIndex"],
|
|
1177
|
+
["getCommentsBefore", "getCommentsBefore"],
|
|
1178
|
+
["getCommentsAfter", "getCommentsAfter"],
|
|
1179
|
+
["getCommentsInside", "getCommentsInside"],
|
|
1180
|
+
["getJSDocComment", "getJSDocComment"],
|
|
1181
|
+
["getFirstToken", "getFirstToken"],
|
|
1182
|
+
["getFirstTokens", "getFirstTokens"],
|
|
1183
|
+
["getLastToken", "getLastToken"],
|
|
1184
|
+
["getLastTokens", "getLastTokens"],
|
|
1185
|
+
["getTokenAfter", "getTokenAfter"],
|
|
1186
|
+
["getTokenBefore", "getTokenBefore"],
|
|
1187
|
+
["getTokenByRangeStart", "getTokenByRangeStart"],
|
|
1188
|
+
["getTokens", "getTokens"],
|
|
1189
|
+
["getTokensAfter", "getTokensAfter"],
|
|
1190
|
+
["getTokensBefore", "getTokensBefore"],
|
|
1191
|
+
["getTokensBetween", "getTokensBetween"]
|
|
1192
|
+
]);
|
|
1193
|
+
var fixedUpRuleReplacements = /* @__PURE__ */ new WeakMap();
|
|
1194
|
+
var fixedUpRules = /* @__PURE__ */ new WeakSet();
|
|
1195
|
+
var fixedUpPluginReplacements = /* @__PURE__ */ new WeakMap();
|
|
1196
|
+
var fixedUpPlugins = /* @__PURE__ */ new WeakSet();
|
|
1197
|
+
function fixupRule(ruleDefinition) {
|
|
1198
|
+
if (fixedUpRuleReplacements.has(ruleDefinition)) {
|
|
1199
|
+
return fixedUpRuleReplacements.get(ruleDefinition);
|
|
1200
|
+
}
|
|
1201
|
+
const isLegacyRule = typeof ruleDefinition === "function";
|
|
1202
|
+
if (!isLegacyRule && fixedUpRules.has(ruleDefinition)) {
|
|
1203
|
+
return ruleDefinition;
|
|
1204
|
+
}
|
|
1205
|
+
const originalCreate = isLegacyRule ? ruleDefinition : ruleDefinition.create.bind(ruleDefinition);
|
|
1206
|
+
function ruleCreate(context) {
|
|
1207
|
+
if ("getScope" in context) {
|
|
1208
|
+
return originalCreate(context);
|
|
1209
|
+
}
|
|
1210
|
+
const sourceCode = context.sourceCode;
|
|
1211
|
+
let currentNode = sourceCode.ast;
|
|
1212
|
+
const newContext = Object.assign(Object.create(context), {
|
|
1213
|
+
parserServices: sourceCode.parserServices,
|
|
1214
|
+
/*
|
|
1215
|
+
* The following methods rely on the current node in the traversal,
|
|
1216
|
+
* so we need to add them manually.
|
|
1217
|
+
*/
|
|
1218
|
+
getScope() {
|
|
1219
|
+
return sourceCode.getScope(currentNode);
|
|
1220
|
+
},
|
|
1221
|
+
getAncestors() {
|
|
1222
|
+
return sourceCode.getAncestors(currentNode);
|
|
1223
|
+
},
|
|
1224
|
+
markVariableAsUsed(variable) {
|
|
1225
|
+
sourceCode.markVariableAsUsed(variable, currentNode);
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
for (const [
|
|
1229
|
+
contextMethodName,
|
|
1230
|
+
sourceCodeMethodName
|
|
1231
|
+
] of removedMethodNames) {
|
|
1232
|
+
newContext[contextMethodName] = sourceCode[sourceCodeMethodName].bind(sourceCode);
|
|
1233
|
+
}
|
|
1234
|
+
Object.freeze(newContext);
|
|
1235
|
+
const visitor = originalCreate(newContext);
|
|
1236
|
+
for (const [methodName, method] of Object.entries(visitor)) {
|
|
1237
|
+
if (methodName.startsWith("on")) {
|
|
1238
|
+
visitor[methodName] = (...args) => {
|
|
1239
|
+
currentNode = args[methodName === "onCodePathSegmentLoop" ? 2 : 1];
|
|
1240
|
+
return method.call(visitor, ...args);
|
|
1241
|
+
};
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
visitor[methodName] = (...args) => {
|
|
1245
|
+
currentNode = args[0];
|
|
1246
|
+
return method.call(visitor, ...args);
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
return visitor;
|
|
1250
|
+
}
|
|
1251
|
+
const newRuleDefinition = {
|
|
1252
|
+
...isLegacyRule ? void 0 : ruleDefinition,
|
|
1253
|
+
create: ruleCreate
|
|
1254
|
+
};
|
|
1255
|
+
fixedUpRuleReplacements.set(ruleDefinition, newRuleDefinition);
|
|
1256
|
+
fixedUpRules.add(newRuleDefinition);
|
|
1257
|
+
return newRuleDefinition;
|
|
1258
|
+
}
|
|
1259
|
+
function fixupPluginRules(plugin) {
|
|
1260
|
+
if (fixedUpPluginReplacements.has(plugin)) {
|
|
1261
|
+
return fixedUpPluginReplacements.get(plugin);
|
|
1262
|
+
}
|
|
1263
|
+
if (fixedUpPlugins.has(plugin) || !plugin.rules) {
|
|
1264
|
+
return plugin;
|
|
1265
|
+
}
|
|
1266
|
+
const newPlugin = {
|
|
1267
|
+
...plugin,
|
|
1268
|
+
rules: Object.fromEntries(
|
|
1269
|
+
Object.entries(plugin.rules).map(([ruleId, ruleDefinition]) => [
|
|
1270
|
+
ruleId,
|
|
1271
|
+
fixupRule(ruleDefinition)
|
|
1272
|
+
])
|
|
1273
|
+
)
|
|
1274
|
+
};
|
|
1275
|
+
fixedUpPluginReplacements.set(plugin, newPlugin);
|
|
1276
|
+
fixedUpPlugins.add(newPlugin);
|
|
1277
|
+
return newPlugin;
|
|
1278
|
+
}
|
|
1279
|
+
function convertIgnorePatternToMinimatch(pattern) {
|
|
1280
|
+
const isNegated = pattern.startsWith("!");
|
|
1281
|
+
const negatedPrefix = isNegated ? "!" : "";
|
|
1282
|
+
const patternToTest = (isNegated ? pattern.slice(1) : pattern).trimEnd();
|
|
1283
|
+
if (["", "**", "/**", "**/"].includes(patternToTest)) {
|
|
1284
|
+
return `${negatedPrefix}${patternToTest}`;
|
|
1285
|
+
}
|
|
1286
|
+
const firstIndexOfSlash = patternToTest.indexOf("/");
|
|
1287
|
+
const matchEverywherePrefix = firstIndexOfSlash < 0 || firstIndexOfSlash === patternToTest.length - 1 ? "**/" : "";
|
|
1288
|
+
const patternWithoutLeadingSlash = firstIndexOfSlash === 0 ? patternToTest.slice(1) : patternToTest;
|
|
1289
|
+
const escapedPatternWithoutLeadingSlash = patternWithoutLeadingSlash.replaceAll(
|
|
1290
|
+
/(?=((?:\\.|[^{(])*))\1([{(])/guy,
|
|
1291
|
+
"$1\\$2"
|
|
1292
|
+
);
|
|
1293
|
+
const matchInsideSuffix = patternToTest.endsWith("/**") ? "/*" : "";
|
|
1294
|
+
return `${negatedPrefix}${matchEverywherePrefix}${escapedPatternWithoutLeadingSlash}${matchInsideSuffix}`;
|
|
1295
|
+
}
|
|
1296
|
+
function includeIgnoreFile(ignoreFilePath) {
|
|
1297
|
+
if (!path.isAbsolute(ignoreFilePath)) {
|
|
1298
|
+
throw new Error("The ignore file location must be an absolute path.");
|
|
1299
|
+
}
|
|
1300
|
+
const ignoreFile = fs.readFileSync(ignoreFilePath, "utf8");
|
|
1301
|
+
const lines = ignoreFile.split(/\r?\n/u);
|
|
1302
|
+
return {
|
|
1303
|
+
name: "Imported .gitignore patterns",
|
|
1304
|
+
ignores: lines.map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map(convertIgnorePatternToMinimatch)
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// src/configs/react.ts
|
|
1309
|
+
async function reactConfig() {
|
|
1310
|
+
const [reactPlugin, reactHooksPlugin] = await Promise.all([
|
|
1311
|
+
interopDefault(import('eslint-plugin-react')),
|
|
1312
|
+
// @ts-expect-error missing types
|
|
1313
|
+
interopDefault(import('eslint-plugin-react-hooks'))
|
|
1314
|
+
]);
|
|
1315
|
+
return [
|
|
1316
|
+
{
|
|
1317
|
+
name: "wondermarin/eslint-config/react",
|
|
1318
|
+
files: ["**/*.jsx" /* JSX */, "**/*.tsx" /* TSX */],
|
|
1319
|
+
languageOptions: {
|
|
1320
|
+
parserOptions: {
|
|
1321
|
+
ecmaFeatures: {
|
|
1322
|
+
jsx: true
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
settings: {
|
|
1327
|
+
react: {
|
|
1328
|
+
version: "detect"
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
plugins: {
|
|
1332
|
+
react: reactPlugin,
|
|
1333
|
+
"react-hooks": fixupPluginRules(reactHooksPlugin)
|
|
1334
|
+
},
|
|
1335
|
+
rules: {
|
|
1336
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1337
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1338
|
+
"react/boolean-prop-naming": "off",
|
|
1339
|
+
"react/button-has-type": [
|
|
1340
|
+
"error",
|
|
1341
|
+
{
|
|
1342
|
+
button: true,
|
|
1343
|
+
reset: true,
|
|
1344
|
+
submit: true
|
|
1345
|
+
}
|
|
1346
|
+
],
|
|
1347
|
+
"react/checked-requires-onchange-or-readonly": [
|
|
1348
|
+
"error",
|
|
1349
|
+
{
|
|
1350
|
+
ignoreExclusiveCheckedAttribute: false,
|
|
1351
|
+
ignoreMissingProperties: false
|
|
1352
|
+
}
|
|
1353
|
+
],
|
|
1354
|
+
"react/default-props-match-prop-types": "off",
|
|
1355
|
+
"react/destructuring-assignment": [
|
|
1356
|
+
"error",
|
|
1357
|
+
"always",
|
|
1358
|
+
{
|
|
1359
|
+
destructureInSignature: "always",
|
|
1360
|
+
ignoreClassFields: false
|
|
1361
|
+
}
|
|
1362
|
+
],
|
|
1363
|
+
"react/display-name": "off",
|
|
1364
|
+
"react/forbid-component-props": "off",
|
|
1365
|
+
"react/forbid-dom-props": "off",
|
|
1366
|
+
"react/forbid-elements": "off",
|
|
1367
|
+
"react/forbid-foreign-prop-types": "off",
|
|
1368
|
+
"react/forbid-prop-types": "off",
|
|
1369
|
+
"react/function-component-definition": [
|
|
1370
|
+
"error",
|
|
1371
|
+
{
|
|
1372
|
+
namedComponents: "function-declaration",
|
|
1373
|
+
unnamedComponents: "arrow-function"
|
|
1374
|
+
}
|
|
1375
|
+
],
|
|
1376
|
+
"react/hook-use-state": ["error", { allowDestructuredState: true }],
|
|
1377
|
+
"react/iframe-missing-sandbox": "error",
|
|
1378
|
+
"react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: false }],
|
|
1379
|
+
"react/jsx-curly-brace-presence": [
|
|
1380
|
+
"error",
|
|
1381
|
+
{
|
|
1382
|
+
children: "never",
|
|
1383
|
+
propElementValues: "always",
|
|
1384
|
+
props: "never"
|
|
1385
|
+
}
|
|
1386
|
+
],
|
|
1387
|
+
"react/jsx-filename-extension": "off",
|
|
1388
|
+
"react/jsx-fragments": ["error", "element"],
|
|
1389
|
+
"react/jsx-handler-names": [
|
|
1390
|
+
"error",
|
|
1391
|
+
{
|
|
1392
|
+
checkInlineFunction: true,
|
|
1393
|
+
checkLocalVariables: true,
|
|
1394
|
+
eventHandlerPrefix: "handle",
|
|
1395
|
+
eventHandlerPropPrefix: "on"
|
|
1396
|
+
}
|
|
1397
|
+
],
|
|
1398
|
+
"react/jsx-key": [
|
|
1399
|
+
"error",
|
|
1400
|
+
{
|
|
1401
|
+
checkFragmentShorthand: true,
|
|
1402
|
+
checkKeyMustBeforeSpread: true,
|
|
1403
|
+
warnOnDuplicates: true
|
|
1404
|
+
}
|
|
1405
|
+
],
|
|
1406
|
+
"react/jsx-max-depth": "off",
|
|
1407
|
+
"react/jsx-no-bind": [
|
|
1408
|
+
"error",
|
|
1409
|
+
{
|
|
1410
|
+
allowArrowFunctions: true,
|
|
1411
|
+
allowBind: false,
|
|
1412
|
+
allowFunctions: false,
|
|
1413
|
+
ignoreDOMComponents: false,
|
|
1414
|
+
ignoreRefs: false
|
|
1415
|
+
}
|
|
1416
|
+
],
|
|
1417
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
1418
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
1419
|
+
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
|
|
1420
|
+
"react/jsx-no-leaked-render": ["error", { validStrategies: ["coerce", "ternary"] }],
|
|
1421
|
+
"react/jsx-no-literals": "off",
|
|
1422
|
+
"react/jsx-no-script-url": "error",
|
|
1423
|
+
"react/jsx-no-target-blank": [
|
|
1424
|
+
"error",
|
|
1425
|
+
{
|
|
1426
|
+
allowReferrer: false,
|
|
1427
|
+
enforceDynamicLinks: "always",
|
|
1428
|
+
forms: false,
|
|
1429
|
+
links: true,
|
|
1430
|
+
warnOnSpreadAttributes: false
|
|
1431
|
+
}
|
|
1432
|
+
],
|
|
1433
|
+
"react/jsx-no-undef": ["error", { allowGlobals: false }],
|
|
1434
|
+
"react/jsx-no-useless-fragment": ["error", { allowExpressions: false }],
|
|
1435
|
+
"react/jsx-pascal-case": [
|
|
1436
|
+
"error",
|
|
1437
|
+
{
|
|
1438
|
+
allowAllCaps: false,
|
|
1439
|
+
allowLeadingUnderscore: false,
|
|
1440
|
+
allowNamespace: false
|
|
1441
|
+
}
|
|
1442
|
+
],
|
|
1443
|
+
"react/jsx-props-no-spread-multi": "error",
|
|
1444
|
+
"react/jsx-props-no-spreading": "off",
|
|
1445
|
+
"react/jsx-sort-props": "off",
|
|
1446
|
+
"react/jsx-uses-react": "off",
|
|
1447
|
+
"react/jsx-uses-vars": "error",
|
|
1448
|
+
"react/no-access-state-in-setstate": "error",
|
|
1449
|
+
"react/no-adjacent-inline-elements": "off",
|
|
1450
|
+
"react/no-array-index-key": "off",
|
|
1451
|
+
"react/no-arrow-function-lifecycle": "error",
|
|
1452
|
+
"react/no-children-prop": ["error", { allowFunctions: false }],
|
|
1453
|
+
"react/no-danger": "off",
|
|
1454
|
+
"react/no-danger-with-children": "error",
|
|
1455
|
+
"react/no-deprecated": "error",
|
|
1456
|
+
"react/no-did-mount-set-state": "error",
|
|
1457
|
+
"react/no-did-update-set-state": "error",
|
|
1458
|
+
"react/no-direct-mutation-state": "error",
|
|
1459
|
+
"react/no-find-dom-node": "error",
|
|
1460
|
+
"react/no-invalid-html-attribute": "error",
|
|
1461
|
+
"react/no-is-mounted": "error",
|
|
1462
|
+
"react/no-multi-comp": ["error", { ignoreStateless: false }],
|
|
1463
|
+
"react/no-namespace": "error",
|
|
1464
|
+
"react/no-object-type-as-default-prop": "error",
|
|
1465
|
+
"react/no-redundant-should-component-update": "error",
|
|
1466
|
+
"react/no-render-return-value": "error",
|
|
1467
|
+
"react/no-set-state": "off",
|
|
1468
|
+
"react/no-string-refs": ["error", { noTemplateLiterals: true }],
|
|
1469
|
+
"react/no-this-in-sfc": "error",
|
|
1470
|
+
"react/no-typos": "error",
|
|
1471
|
+
"react/no-unescaped-entities": "error",
|
|
1472
|
+
"react/no-unknown-property": ["error", { requireDataLowercase: true }],
|
|
1473
|
+
"react/no-unsafe": ["error", { checkAliases: false }],
|
|
1474
|
+
"react/no-unstable-nested-components": ["error", { allowAsProps: false }],
|
|
1475
|
+
"react/no-unused-class-component-methods": "error",
|
|
1476
|
+
"react/no-unused-prop-types": ["error", { skipShapeProps: true }],
|
|
1477
|
+
"react/no-unused-state": "error",
|
|
1478
|
+
"react/no-will-update-set-state": "error",
|
|
1479
|
+
"react/prefer-es6-class": ["error", "always"],
|
|
1480
|
+
"react/prefer-exact-props": "off",
|
|
1481
|
+
"react/prefer-read-only-props": "error",
|
|
1482
|
+
"react/prefer-stateless-function": ["error", { ignorePureComponents: false }],
|
|
1483
|
+
"react/prop-types": ["error", { skipUndeclared: false }],
|
|
1484
|
+
"react/react-in-jsx-scope": "off",
|
|
1485
|
+
"react/require-default-props": "off",
|
|
1486
|
+
"react/require-optimization": "error",
|
|
1487
|
+
"react/require-render-return": "error",
|
|
1488
|
+
"react/self-closing-comp": [
|
|
1489
|
+
"error",
|
|
1490
|
+
{
|
|
1491
|
+
component: true,
|
|
1492
|
+
html: true
|
|
1493
|
+
}
|
|
1494
|
+
],
|
|
1495
|
+
"react/sort-comp": "off",
|
|
1496
|
+
"react/sort-default-props": "off",
|
|
1497
|
+
"react/sort-prop-types": "off",
|
|
1498
|
+
"react/state-in-constructor": ["error", "always"],
|
|
1499
|
+
"react/static-property-placement": "off",
|
|
1500
|
+
"react/style-prop-object": "error",
|
|
1501
|
+
"react/void-dom-elements-no-children": "error",
|
|
1502
|
+
"react/forward-ref-uses-ref": "error"
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
];
|
|
1506
|
+
}
|
|
1507
|
+
function baseConfig() {
|
|
1508
|
+
return [
|
|
1509
|
+
{
|
|
1510
|
+
name: "wondermarin/eslint-config",
|
|
1511
|
+
files: ["**/*.?([cm])js" /* JS */, "**/*.jsx" /* JSX */, "**/*.?([cm])ts" /* TS */, "**/*.tsx" /* TSX */, "**/*.vue" /* VUE */],
|
|
1512
|
+
languageOptions: {
|
|
1513
|
+
ecmaVersion: 2024,
|
|
1514
|
+
sourceType: "module",
|
|
1515
|
+
parserOptions: {
|
|
1516
|
+
ecmaVersion: 2024,
|
|
1517
|
+
sourceType: "module"
|
|
1518
|
+
},
|
|
1519
|
+
globals: {
|
|
1520
|
+
...globals.node,
|
|
1521
|
+
...globals.browser
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
name: "wondermarin/eslint-config/ignores",
|
|
1527
|
+
ignores: includeIgnoreFile(join(process.cwd(), ".gitignore")).ignores
|
|
1528
|
+
}
|
|
1529
|
+
];
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
// src/configs/json.ts
|
|
1533
|
+
async function jsonConfig() {
|
|
1534
|
+
const [jsoncParser, packageJsonPlugin] = await Promise.all([
|
|
1535
|
+
interopDefault(import('jsonc-eslint-parser')),
|
|
1536
|
+
interopDefault(import('eslint-plugin-package-json'))
|
|
1537
|
+
]);
|
|
1538
|
+
return [
|
|
1539
|
+
{
|
|
1540
|
+
name: "wondermarin/eslint-config/package-json",
|
|
1541
|
+
files: ["**/package.json" /* PACKAGE_JSON */],
|
|
1542
|
+
languageOptions: {
|
|
1543
|
+
parser: jsoncParser
|
|
1544
|
+
},
|
|
1545
|
+
plugins: {
|
|
1546
|
+
"package-json": packageJsonPlugin
|
|
1547
|
+
},
|
|
1548
|
+
rules: {
|
|
1549
|
+
"package-json/order-properties": ["error", { order: "sort-package-json" }],
|
|
1550
|
+
"package-json/repository-shorthand": ["error", { form: "object" }],
|
|
1551
|
+
"package-json/sort-collections": [
|
|
1552
|
+
"error",
|
|
1553
|
+
["scripts", "config", "dependencies", "peerDependencies", "devDependencies"]
|
|
1554
|
+
],
|
|
1555
|
+
"package-json/unique-dependencies": "error",
|
|
1556
|
+
"package-json/valid-local-dependency": "error",
|
|
1557
|
+
"package-json/valid-name": "error",
|
|
1558
|
+
"package-json/valid-package-def": "error",
|
|
1559
|
+
"package-json/valid-repository-directory": "error",
|
|
1560
|
+
"package-json/valid-version": "error"
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
];
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// src/main.ts
|
|
1567
|
+
async function wondermarin(options) {
|
|
1568
|
+
options = defu(options, {
|
|
1569
|
+
javascript: true,
|
|
1570
|
+
stylistic: true,
|
|
1571
|
+
json: true
|
|
1572
|
+
});
|
|
1573
|
+
const config = [...baseConfig()];
|
|
1574
|
+
if (options.javascript) config.push(...javascriptConfig());
|
|
1575
|
+
if (options.typescript) config.push(...await typescriptConfig());
|
|
1576
|
+
if (options.stylistic) config.push(...await stylisticConfig());
|
|
1577
|
+
if (options.json) config.push(...await jsonConfig());
|
|
1578
|
+
if (options.react) config.push(...await reactConfig());
|
|
1579
|
+
return config;
|
|
1580
|
+
}
|
|
1581
|
+
var main_default = wondermarin;
|
|
1582
|
+
|
|
1583
|
+
export { main_default as default };
|