@lobehub/eslint-config 2.0.0-beta.10 → 2.0.0-beta.2
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/dist/index.cjs +39 -87
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
//#endregion
|
|
25
25
|
const eslint_config = __toESM(require("eslint/config"));
|
|
26
26
|
const eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"));
|
|
27
|
-
const __eslint_community_eslint_plugin_eslint_comments_configs = __toESM(require("@eslint-community/eslint-plugin-eslint-comments/configs"));
|
|
28
27
|
const eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"));
|
|
29
28
|
const eslint_plugin_simple_import_sort = __toESM(require("eslint-plugin-simple-import-sort"));
|
|
30
29
|
const __eslint_js = __toESM(require("@eslint/js"));
|
|
@@ -87,23 +86,6 @@ function a11y(options) {
|
|
|
87
86
|
}]);
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/configs/eslint-comments.ts
|
|
92
|
-
function eslintCommentsConfig() {
|
|
93
|
-
return (0, eslint_config.defineConfig)([{
|
|
94
|
-
...__eslint_community_eslint_plugin_eslint_comments_configs.default.recommended,
|
|
95
|
-
files: GLOB_SRC,
|
|
96
|
-
rules: {
|
|
97
|
-
...__eslint_community_eslint_plugin_eslint_comments_configs.default.recommended.rules,
|
|
98
|
-
"@eslint-community/eslint-comments/disable-enable-pair": "off",
|
|
99
|
-
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
|
100
|
-
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
101
|
-
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
102
|
-
"@eslint-community/eslint-comments/no-aggregating-enable": "error"
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
89
|
//#endregion
|
|
108
90
|
//#region src/configs/ignores.ts
|
|
109
91
|
function ignores(userIgnores = []) {
|
|
@@ -127,7 +109,7 @@ function imports(options) {
|
|
|
127
109
|
"import-x/no-duplicates": "error",
|
|
128
110
|
"import-x/no-mutable-exports": "error",
|
|
129
111
|
"import-x/no-self-import": "error",
|
|
130
|
-
"import-x/consistent-type-specifier-style": ["error", "prefer-
|
|
112
|
+
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
131
113
|
}
|
|
132
114
|
}]);
|
|
133
115
|
if (sortImports) configs.push({
|
|
@@ -209,7 +191,7 @@ function react(options) {
|
|
|
209
191
|
...eslint_plugin_react_hooks.default.configs.recommended.rules,
|
|
210
192
|
"@eslint-react/dom/no-dangerously-set-innerhtml": "off",
|
|
211
193
|
"@eslint-react/no-array-index-key": "warn",
|
|
212
|
-
"@eslint-react/no-leaked-conditional-rendering": "
|
|
194
|
+
"@eslint-react/no-leaked-conditional-rendering": "warn",
|
|
213
195
|
"react/self-closing-comp": "warn",
|
|
214
196
|
"react-refresh/only-export-components": ["warn", {
|
|
215
197
|
allowConstantExport: true,
|
|
@@ -332,7 +314,7 @@ function typescript(options) {
|
|
|
332
314
|
rules: {
|
|
333
315
|
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
334
316
|
disallowTypeAnnotations: false,
|
|
335
|
-
fixStyle: "
|
|
317
|
+
fixStyle: "separate-type-imports",
|
|
336
318
|
prefer: "type-imports"
|
|
337
319
|
}],
|
|
338
320
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
@@ -384,73 +366,44 @@ const GLOB_NEXT_APP_FILES = [
|
|
|
384
366
|
"**/app/**/robots.{js,ts}",
|
|
385
367
|
"**/app/**/manifest.{js,ts}"
|
|
386
368
|
];
|
|
387
|
-
const GLOB_CONFIG_FILES = ["**/*.config.{js,mjs,ts,mts,cjs,cts}", "**/.*.{js,mjs,ts,mts,cjs,cts}"];
|
|
388
369
|
function unicorn() {
|
|
389
|
-
return (0, eslint_config.defineConfig)([
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
rules
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
"unicorn/no-useless-switch-case": "warn",
|
|
422
|
-
"unicorn/no-zero-fractions": "warn",
|
|
423
|
-
"unicorn/number-literal-case": "warn",
|
|
424
|
-
"unicorn/switch-case-braces": "warn",
|
|
425
|
-
"unicorn/text-encoding-identifier-case": "warn",
|
|
426
|
-
"unicorn/import-style": "warn",
|
|
427
|
-
"unicorn/prefer-array-find": "warn",
|
|
428
|
-
"unicorn/prefer-array-flat": "warn",
|
|
429
|
-
"unicorn/prefer-array-flat-map": "warn",
|
|
430
|
-
"unicorn/prefer-array-index-of": "warn",
|
|
431
|
-
"unicorn/prefer-array-some": "warn",
|
|
432
|
-
"unicorn/prefer-at": "warn",
|
|
433
|
-
"unicorn/prefer-date-now": "warn",
|
|
434
|
-
"unicorn/prefer-includes": "warn",
|
|
435
|
-
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
436
|
-
"unicorn/prefer-node-protocol": "warn",
|
|
437
|
-
"unicorn/prefer-object-from-entries": "warn",
|
|
438
|
-
"unicorn/prefer-regexp-test": "warn",
|
|
439
|
-
"unicorn/prefer-string-replace-all": "warn",
|
|
440
|
-
"unicorn/prefer-string-slice": "warn",
|
|
441
|
-
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
442
|
-
"unicorn/prefer-structured-clone": "warn"
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
files: GLOB_NEXT_APP_FILES,
|
|
447
|
-
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
files: GLOB_CONFIG_FILES,
|
|
451
|
-
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
370
|
+
return (0, eslint_config.defineConfig)([{
|
|
371
|
+
files: GLOB_SRC,
|
|
372
|
+
plugins: { unicorn: eslint_plugin_unicorn.default },
|
|
373
|
+
rules: {
|
|
374
|
+
...eslint_plugin_unicorn.default.configs["flat/recommended"].rules,
|
|
375
|
+
"unicorn/catch-error-name": "off",
|
|
376
|
+
"unicorn/explicit-length-check": "off",
|
|
377
|
+
"unicorn/filename-case": "off",
|
|
378
|
+
"unicorn/import-style": "off",
|
|
379
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
380
|
+
"unicorn/no-array-callback-reference": "off",
|
|
381
|
+
"unicorn/no-array-for-each": "off",
|
|
382
|
+
"unicorn/no-array-push-push": "off",
|
|
383
|
+
"unicorn/no-array-reduce": "off",
|
|
384
|
+
"unicorn/no-empty-file": "warn",
|
|
385
|
+
"unicorn/no-negated-condition": "off",
|
|
386
|
+
"unicorn/no-nested-ternary": "off",
|
|
387
|
+
"unicorn/no-null": "off",
|
|
388
|
+
"unicorn/no-typeof-undefined": "off",
|
|
389
|
+
"unicorn/no-useless-undefined": "off",
|
|
390
|
+
"unicorn/prefer-code-point": "off",
|
|
391
|
+
"unicorn/prefer-logical-operator-over-ternary": "off",
|
|
392
|
+
"unicorn/prefer-module": "off",
|
|
393
|
+
"unicorn/prefer-number-properties": "off",
|
|
394
|
+
"unicorn/prefer-query-selector": "off",
|
|
395
|
+
"unicorn/prefer-spread": "off",
|
|
396
|
+
"unicorn/prefer-string-raw": "off",
|
|
397
|
+
"unicorn/prefer-string-replace-all": "warn",
|
|
398
|
+
"unicorn/prefer-ternary": "off",
|
|
399
|
+
"unicorn/prefer-type-error": "off",
|
|
400
|
+
"unicorn/prevent-abbreviations": "off",
|
|
401
|
+
"unicorn/switch-case-braces": "warn"
|
|
452
402
|
}
|
|
453
|
-
|
|
403
|
+
}, {
|
|
404
|
+
files: GLOB_NEXT_APP_FILES,
|
|
405
|
+
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
406
|
+
}]);
|
|
454
407
|
}
|
|
455
408
|
|
|
456
409
|
//#endregion
|
|
@@ -514,7 +467,6 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
514
467
|
regexp: regexpOption
|
|
515
468
|
}),
|
|
516
469
|
...unused(),
|
|
517
|
-
...eslintCommentsConfig(),
|
|
518
470
|
...userConfigs
|
|
519
471
|
];
|
|
520
472
|
return configs;
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AA6EA;AACA;;;;ACjFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;;kBDSkB;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AA6EA;AACA;;;;ACjFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;;kBDSkB;;AERlB;;;EAAkD,KAAkB,CAAA,EAAA,OAAA,GAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAAU;AAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFgEtF,UAAA,GAAa,QAAA,CAAO;KACpB,eAAA,GAAkB,QAAA,CAAO;;cCjFxB,OAAA;cACA,QAAA;cACA,OAAA;cACA,QAAA;ADAI,cCEJ,WDmBK,EAAA,MAAa,EAAA;AAwDnB,cC1EC,WD0EY,EAAA,MAAO,EAAA;AACpB,cC1EC,QD0Ec,EAAA,MAAG,EAAA;cCxEjB;cAMA;;;;;iBCCG,YAAA,WAAsB,yBAA8B,eAAe"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AA6EA;AACA;;;;ACjFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;;kBDSkB;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AA6EA;AACA;;;;ACjFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;;kBDSkB;;AERlB;;;EAAkD,KAAkB,CAAA,EAAA,OAAA,GAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAAU;AAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFgEtF,UAAA,GAAa,QAAA,CAAO;KACpB,eAAA,GAAkB,QAAA,CAAO;;cCjFxB,OAAA;cACA,QAAA;cACA,OAAA;cACA,QAAA;ADAI,cCEJ,WDmBK,EAAA,MAAa,EAAA;AAwDnB,cC1EC,WD0EY,EAAA,MAAO,EAAA;AACpB,cC1EC,QD0Ec,EAAA,MAAG,EAAA;cCxEjB;cAMA;;;;;iBCCG,YAAA,WAAsB,yBAA8B,eAAe"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineConfig as defineConfig$1 } from "eslint/config";
|
|
2
2
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
3
|
-
import eslintComments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
4
3
|
import { importX } from "eslint-plugin-import-x";
|
|
5
4
|
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
6
5
|
import js from "@eslint/js";
|
|
@@ -63,23 +62,6 @@ function a11y(options) {
|
|
|
63
62
|
}]);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/configs/eslint-comments.ts
|
|
68
|
-
function eslintCommentsConfig() {
|
|
69
|
-
return defineConfig$1([{
|
|
70
|
-
...eslintComments.recommended,
|
|
71
|
-
files: GLOB_SRC,
|
|
72
|
-
rules: {
|
|
73
|
-
...eslintComments.recommended.rules,
|
|
74
|
-
"@eslint-community/eslint-comments/disable-enable-pair": "off",
|
|
75
|
-
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
|
76
|
-
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
77
|
-
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
78
|
-
"@eslint-community/eslint-comments/no-aggregating-enable": "error"
|
|
79
|
-
}
|
|
80
|
-
}]);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
65
|
//#endregion
|
|
84
66
|
//#region src/configs/ignores.ts
|
|
85
67
|
function ignores(userIgnores = []) {
|
|
@@ -103,7 +85,7 @@ function imports(options) {
|
|
|
103
85
|
"import-x/no-duplicates": "error",
|
|
104
86
|
"import-x/no-mutable-exports": "error",
|
|
105
87
|
"import-x/no-self-import": "error",
|
|
106
|
-
"import-x/consistent-type-specifier-style": ["error", "prefer-
|
|
88
|
+
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
107
89
|
}
|
|
108
90
|
}]);
|
|
109
91
|
if (sortImports) configs.push({
|
|
@@ -185,7 +167,7 @@ function react(options) {
|
|
|
185
167
|
...reactHooksPlugin.configs.recommended.rules,
|
|
186
168
|
"@eslint-react/dom/no-dangerously-set-innerhtml": "off",
|
|
187
169
|
"@eslint-react/no-array-index-key": "warn",
|
|
188
|
-
"@eslint-react/no-leaked-conditional-rendering": "
|
|
170
|
+
"@eslint-react/no-leaked-conditional-rendering": "warn",
|
|
189
171
|
"react/self-closing-comp": "warn",
|
|
190
172
|
"react-refresh/only-export-components": ["warn", {
|
|
191
173
|
allowConstantExport: true,
|
|
@@ -308,7 +290,7 @@ function typescript(options) {
|
|
|
308
290
|
rules: {
|
|
309
291
|
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
310
292
|
disallowTypeAnnotations: false,
|
|
311
|
-
fixStyle: "
|
|
293
|
+
fixStyle: "separate-type-imports",
|
|
312
294
|
prefer: "type-imports"
|
|
313
295
|
}],
|
|
314
296
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
@@ -360,73 +342,44 @@ const GLOB_NEXT_APP_FILES = [
|
|
|
360
342
|
"**/app/**/robots.{js,ts}",
|
|
361
343
|
"**/app/**/manifest.{js,ts}"
|
|
362
344
|
];
|
|
363
|
-
const GLOB_CONFIG_FILES = ["**/*.config.{js,mjs,ts,mts,cjs,cts}", "**/.*.{js,mjs,ts,mts,cjs,cts}"];
|
|
364
345
|
function unicorn() {
|
|
365
|
-
return defineConfig$1([
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
rules
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
"unicorn/no-useless-switch-case": "warn",
|
|
398
|
-
"unicorn/no-zero-fractions": "warn",
|
|
399
|
-
"unicorn/number-literal-case": "warn",
|
|
400
|
-
"unicorn/switch-case-braces": "warn",
|
|
401
|
-
"unicorn/text-encoding-identifier-case": "warn",
|
|
402
|
-
"unicorn/import-style": "warn",
|
|
403
|
-
"unicorn/prefer-array-find": "warn",
|
|
404
|
-
"unicorn/prefer-array-flat": "warn",
|
|
405
|
-
"unicorn/prefer-array-flat-map": "warn",
|
|
406
|
-
"unicorn/prefer-array-index-of": "warn",
|
|
407
|
-
"unicorn/prefer-array-some": "warn",
|
|
408
|
-
"unicorn/prefer-at": "warn",
|
|
409
|
-
"unicorn/prefer-date-now": "warn",
|
|
410
|
-
"unicorn/prefer-includes": "warn",
|
|
411
|
-
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
412
|
-
"unicorn/prefer-node-protocol": "warn",
|
|
413
|
-
"unicorn/prefer-object-from-entries": "warn",
|
|
414
|
-
"unicorn/prefer-regexp-test": "warn",
|
|
415
|
-
"unicorn/prefer-string-replace-all": "warn",
|
|
416
|
-
"unicorn/prefer-string-slice": "warn",
|
|
417
|
-
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
418
|
-
"unicorn/prefer-structured-clone": "warn"
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
files: GLOB_NEXT_APP_FILES,
|
|
423
|
-
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
files: GLOB_CONFIG_FILES,
|
|
427
|
-
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
346
|
+
return defineConfig$1([{
|
|
347
|
+
files: GLOB_SRC,
|
|
348
|
+
plugins: { unicorn: unicornPlugin },
|
|
349
|
+
rules: {
|
|
350
|
+
...unicornPlugin.configs["flat/recommended"].rules,
|
|
351
|
+
"unicorn/catch-error-name": "off",
|
|
352
|
+
"unicorn/explicit-length-check": "off",
|
|
353
|
+
"unicorn/filename-case": "off",
|
|
354
|
+
"unicorn/import-style": "off",
|
|
355
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
356
|
+
"unicorn/no-array-callback-reference": "off",
|
|
357
|
+
"unicorn/no-array-for-each": "off",
|
|
358
|
+
"unicorn/no-array-push-push": "off",
|
|
359
|
+
"unicorn/no-array-reduce": "off",
|
|
360
|
+
"unicorn/no-empty-file": "warn",
|
|
361
|
+
"unicorn/no-negated-condition": "off",
|
|
362
|
+
"unicorn/no-nested-ternary": "off",
|
|
363
|
+
"unicorn/no-null": "off",
|
|
364
|
+
"unicorn/no-typeof-undefined": "off",
|
|
365
|
+
"unicorn/no-useless-undefined": "off",
|
|
366
|
+
"unicorn/prefer-code-point": "off",
|
|
367
|
+
"unicorn/prefer-logical-operator-over-ternary": "off",
|
|
368
|
+
"unicorn/prefer-module": "off",
|
|
369
|
+
"unicorn/prefer-number-properties": "off",
|
|
370
|
+
"unicorn/prefer-query-selector": "off",
|
|
371
|
+
"unicorn/prefer-spread": "off",
|
|
372
|
+
"unicorn/prefer-string-raw": "off",
|
|
373
|
+
"unicorn/prefer-string-replace-all": "warn",
|
|
374
|
+
"unicorn/prefer-ternary": "off",
|
|
375
|
+
"unicorn/prefer-type-error": "off",
|
|
376
|
+
"unicorn/prevent-abbreviations": "off",
|
|
377
|
+
"unicorn/switch-case-braces": "warn"
|
|
428
378
|
}
|
|
429
|
-
|
|
379
|
+
}, {
|
|
380
|
+
files: GLOB_NEXT_APP_FILES,
|
|
381
|
+
rules: { "unicorn/no-anonymous-default-export": "off" }
|
|
382
|
+
}]);
|
|
430
383
|
}
|
|
431
384
|
|
|
432
385
|
//#endregion
|
|
@@ -490,7 +443,6 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
490
443
|
regexp: regexpOption
|
|
491
444
|
}),
|
|
492
445
|
...unused(),
|
|
493
|
-
...eslintCommentsConfig(),
|
|
494
446
|
...userConfigs
|
|
495
447
|
];
|
|
496
448
|
return configs;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options: Options","userIgnores: string[]","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","configs: FlatConfigArray"],"sources":["../src/globs.ts","../src/configs/a11y.ts","../src/configs/eslint-comments.ts","../src/configs/ignores.ts","../src/configs/imports.ts","../src/configs/javascript.ts","../src/configs/next.ts","../src/configs/react.ts","../src/configs/react-native.ts","../src/configs/regexp.ts","../src/configs/sorting.ts","../src/configs/typescript.ts","../src/configs/unicorn.ts","../src/configs/unused.ts","../src/index.ts"],"sourcesContent":["export const GLOB_JS = '**/*.?([cm])js';\nexport const GLOB_JSX = '**/*.?([cm])jsx';\nexport const GLOB_TS = '**/*.?([cm])ts';\nexport const GLOB_TSX = '**/*.?([cm])tsx';\n\nexport const GLOB_JS_ALL = [GLOB_JS, GLOB_JSX];\nexport const GLOB_TS_ALL = [GLOB_TS, GLOB_TSX];\nexport const GLOB_SRC = [...GLOB_JS_ALL, ...GLOB_TS_ALL];\n\nexport const GLOB_TEST = [\n '**/*.test.{js,jsx,ts,tsx}',\n '**/*.spec.{js,jsx,ts,tsx}',\n '**/__tests__/**/*.{js,jsx,ts,tsx}',\n];\n\nexport const GLOB_IGNORES = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.next/**',\n '**/coverage/**',\n '**/.turbo/**',\n '**/out/**',\n '**/*.min.*',\n '**/public/**',\n];\n","import { defineConfig } from 'eslint/config';\nimport jsxA11y from 'eslint-plugin-jsx-a11y';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function a11y(options: Options) {\n const { a11y: a11yOption, react: reactOption } = options;\n\n if (!a11yOption || !reactOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n 'jsx-a11y': jsxA11y,\n },\n rules: {\n ...jsxA11y.flatConfigs.recommended.rules,\n 'jsx-a11y/alt-text': 'warn',\n 'jsx-a11y/anchor-has-content': 'warn',\n 'jsx-a11y/anchor-is-valid': 'warn',\n 'jsx-a11y/click-events-have-key-events': 'warn',\n 'jsx-a11y/no-static-element-interactions': 'warn',\n },\n },\n ]);\n}\n","import eslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs';\nimport { defineConfig } from 'eslint/config';\n\nimport { GLOB_SRC } from '../globs';\n\nexport function eslintCommentsConfig() {\n return defineConfig([\n {\n ...eslintComments.recommended,\n files: GLOB_SRC,\n rules: {\n ...eslintComments.recommended.rules,\n // 允许文件级别的 eslint-disable 没有对应的 eslint-enable\n '@eslint-community/eslint-comments/disable-enable-pair': 'off',\n // 禁止未使用的 eslint-disable 注释(可自动修复)\n '@eslint-community/eslint-comments/no-unused-disable': 'error',\n // 禁止没有规则名的 eslint-disable(必须指定具体规则)\n '@eslint-community/eslint-comments/no-unlimited-disable': 'error',\n // 禁止重复的 eslint-disable\n '@eslint-community/eslint-comments/no-duplicate-disable': 'error',\n // 禁止一个 eslint-enable 同时启用多个 eslint-disable(鼓励合并多行 disable 注释)\n '@eslint-community/eslint-comments/no-aggregating-enable': 'error',\n },\n },\n ]);\n}\n","import { GLOB_IGNORES } from '../globs';\nimport type { FlatConfig } from '../types';\n\nexport function ignores(userIgnores: string[] = []): FlatConfig {\n return {\n ignores: [...GLOB_IGNORES, ...userIgnores],\n };\n}\n","import { defineConfig } from 'eslint/config';\nimport { importX } from 'eslint-plugin-import-x';\nimport simpleImportSort from 'eslint-plugin-simple-import-sort';\n\nimport { GLOB_SRC } from '../globs';\nimport type { Options } from '../types';\n\nexport function imports(options: Options) {\n const { sortImports = true } = options;\n\n const configs = defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n 'import-x': importX as any,\n },\n settings: {\n 'import-x/resolver': {\n node: true,\n typescript: true,\n },\n },\n rules: {\n 'import-x/first': 'error',\n 'import-x/newline-after-import': 'error',\n 'import-x/no-duplicates': 'error',\n 'import-x/no-mutable-exports': 'error',\n 'import-x/no-self-import': 'error',\n 'import-x/consistent-type-specifier-style': ['error', 'prefer-inline'],\n },\n },\n ]);\n\n if (sortImports) {\n configs.push({\n files: GLOB_SRC,\n plugins: {\n 'simple-import-sort': simpleImportSort,\n },\n rules: {\n 'simple-import-sort/imports': 'error',\n 'simple-import-sort/exports': 'error',\n 'sort-imports': 'off',\n },\n });\n }\n\n return configs;\n}\n","import js from '@eslint/js';\nimport { defineConfig } from 'eslint/config';\nimport globals from 'globals';\n\nimport { GLOB_SRC } from '../globs';\n\nexport function javascript() {\n return defineConfig([\n {\n ...js.configs.recommended,\n files: GLOB_SRC,\n languageOptions: {\n ecmaVersion: 'latest',\n globals: {\n ...globals.browser,\n ...globals.node,\n ...globals.es2021,\n },\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n ecmaVersion: 'latest',\n sourceType: 'module',\n },\n sourceType: 'module',\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n },\n rules: {\n ...js.configs.recommended.rules,\n 'no-empty': 'warn',\n 'no-extra-boolean-cast': 'off',\n 'no-unused-vars': 'off',\n },\n },\n ]);\n}\n","import nextPlugin from '@next/eslint-plugin-next';\nimport { defineConfig } from 'eslint/config';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function next(options: Options) {\n const { next: nextOption } = options;\n\n if (!nextOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n '@next/next': nextPlugin,\n },\n rules: {\n ...nextPlugin.configs.recommended.rules,\n ...nextPlugin.configs['core-web-vitals'].rules,\n '@next/next/no-img-element': 'off',\n },\n },\n ]);\n}\n","import eslintReact from '@eslint-react/eslint-plugin';\nimport { defineConfig } from 'eslint/config';\nimport reactPlugin from 'eslint-plugin-react';\nimport reactCompiler from 'eslint-plugin-react-compiler';\nimport reactHooksPlugin from 'eslint-plugin-react-hooks';\nimport reactRefresh from 'eslint-plugin-react-refresh';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function react(options: Options) {\n const { react: reactOption, reactCompiler: reactCompilerOption } = options;\n\n if (!reactOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n const configs = defineConfig([\n {\n files,\n ...eslintReact.configs['recommended-typescript'],\n },\n {\n files,\n plugins: {\n 'react': reactPlugin,\n 'react-hooks': reactHooksPlugin,\n 'react-refresh': reactRefresh,\n },\n rules: {\n ...reactHooksPlugin.configs.recommended.rules,\n\n '@eslint-react/dom/no-dangerously-set-innerhtml': 'off',\n '@eslint-react/no-array-index-key': 'warn',\n '@eslint-react/no-leaked-conditional-rendering': 'off',\n\n 'react/self-closing-comp': 'warn',\n\n 'react-refresh/only-export-components': [\n 'warn',\n {\n allowConstantExport: true,\n allowExportNames:\n reactOption === 'next'\n ? [\n 'dynamic',\n 'dynamicParams',\n 'revalidate',\n 'fetchCache',\n 'runtime',\n 'preferredRegion',\n 'maxDuration',\n 'config',\n 'generateStaticParams',\n 'metadata',\n 'generateMetadata',\n 'viewport',\n 'generateViewport',\n ]\n : reactOption === 'remix'\n ? ['meta', 'links', 'headers', 'loader', 'action']\n : undefined,\n },\n ],\n },\n settings: {\n 'react-x': {\n version: 'detect',\n },\n },\n },\n ]);\n\n if (reactCompilerOption) {\n configs.push({\n files,\n plugins: {\n 'react-compiler': reactCompiler,\n },\n rules: {\n 'react-compiler/react-compiler': 'error',\n },\n });\n }\n\n return configs;\n}\n","import { defineConfig } from 'eslint/config';\nimport reactNativePlugin from 'eslint-plugin-react-native';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function reactNative(options: Options) {\n const { reactNative: reactNativeOption } = options;\n\n if (!reactNativeOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n 'react-native': reactNativePlugin,\n },\n languageOptions: {\n globals: {\n __DEV__: 'readonly',\n },\n },\n rules: {\n 'react-native/no-color-literals': 'warn',\n 'react-native/no-inline-styles': 'warn',\n 'react-native/no-raw-text': 'off',\n 'react-native/no-single-element-style-arrays': 'warn',\n 'react-native/no-unused-styles': 'error',\n 'react-native/split-platform-components': 'warn',\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport regexpPlugin from 'eslint-plugin-regexp';\n\nimport { GLOB_SRC } from '../globs';\nimport type { Options } from '../types';\n\nexport function regexp(options: Options) {\n const { regexp: regexpOption = true } = options;\n\n if (!regexpOption) return [];\n\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n regexp: regexpPlugin,\n },\n rules: {\n ...(regexpPlugin.configs['flat/recommended'].rules as any),\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport perfectionistPlugin from 'eslint-plugin-perfectionist';\nimport reactPlugin from 'eslint-plugin-react';\n\nimport { GLOB_JSX, GLOB_TS_ALL, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function sorting(options: Options) {\n const { sortKeys = true } = options;\n\n if (!sortKeys) return [];\n\n return defineConfig([\n // TypeScript interface and enum sorting\n {\n files: GLOB_TS_ALL,\n plugins: {\n perfectionist: perfectionistPlugin,\n },\n rules: {\n 'perfectionist/sort-enums': [\n 'error',\n {\n order: 'asc',\n type: 'natural',\n },\n ],\n 'perfectionist/sort-interfaces': [\n 'error',\n {\n order: 'asc',\n type: 'natural',\n },\n ],\n },\n },\n // JSX props sorting\n {\n files: [GLOB_JSX, GLOB_TSX],\n plugins: {\n react: reactPlugin,\n },\n rules: {\n 'react/jsx-sort-props': [\n 'warn',\n {\n callbacksLast: true,\n multiline: 'last',\n shorthandFirst: true,\n },\n ],\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport tseslint from 'typescript-eslint';\n\nimport { GLOB_TS_ALL } from '../globs';\nimport type { Options } from '../types';\n\nexport function typescript(options: Options) {\n const {\n typescript: tsOption,\n typeChecked,\n tsconfigPath,\n parserOptions: userParserOptions,\n } = options;\n\n if (!tsOption) return [];\n\n const isStrict = tsOption === 'strict';\n\n const baseConfigs = isStrict\n ? typeChecked\n ? tseslint.configs.strictTypeChecked\n : tseslint.configs.strict\n : typeChecked\n ? tseslint.configs.recommendedTypeChecked\n : tseslint.configs.recommended;\n\n const configs = defineConfig([\n ...baseConfigs,\n {\n files: GLOB_TS_ALL,\n languageOptions: {\n parser: tseslint.parser,\n parserOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n ...(typeChecked && {\n projectService: !tsconfigPath,\n project: tsconfigPath,\n }),\n ...userParserOptions,\n },\n },\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n disallowTypeAnnotations: false,\n fixStyle: 'inline-type-imports',\n prefer: 'type-imports',\n },\n ],\n '@typescript-eslint/method-signature-style': ['error', 'property'],\n '@typescript-eslint/no-import-type-side-effects': 'error',\n '@typescript-eslint/no-unused-expressions': [\n 'error',\n {\n allowShortCircuit: true,\n allowTaggedTemplates: true,\n allowTernary: true,\n },\n ],\n\n ...(isStrict\n ? {}\n : {\n '@typescript-eslint/ban-ts-comment': 'off',\n '@typescript-eslint/no-explicit-any': 'off',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-require-imports': 'off',\n }),\n\n '@typescript-eslint/no-unused-vars': 'off',\n '@typescript-eslint/no-use-before-define': 'off',\n '@typescript-eslint/no-useless-constructor': 'off',\n },\n },\n ]);\n\n if (typeChecked) {\n configs.push({\n files: GLOB_TS_ALL,\n rules: {\n '@typescript-eslint/await-thenable': 'error',\n '@typescript-eslint/no-floating-promises': 'error',\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],\n '@typescript-eslint/require-await': 'error',\n },\n });\n }\n\n return configs;\n}\n","import { defineConfig } from 'eslint/config';\nimport unicornPlugin from 'eslint-plugin-unicorn';\n\nimport { GLOB_SRC } from '../globs';\n\nconst GLOB_NEXT_APP_FILES = [\n '**/app/**/page.{js,jsx,ts,tsx}',\n '**/app/**/layout.{js,jsx,ts,tsx}',\n '**/app/**/loading.{js,jsx,ts,tsx}',\n '**/app/**/error.{js,jsx,ts,tsx}',\n '**/app/**/not-found.{js,jsx,ts,tsx}',\n '**/app/**/template.{js,jsx,ts,tsx}',\n '**/app/**/default.{js,jsx,ts,tsx}',\n '**/app/**/route.{js,ts}',\n '**/app/**/opengraph-image.{js,jsx,ts,tsx}',\n '**/app/**/twitter-image.{js,jsx,ts,tsx}',\n '**/app/**/apple-icon.{js,jsx,ts,tsx}',\n '**/app/**/icon.{js,jsx,ts,tsx}',\n '**/app/**/sitemap.{js,ts}',\n '**/app/**/robots.{js,ts}',\n '**/app/**/manifest.{js,ts}',\n];\n\nconst GLOB_CONFIG_FILES = ['**/*.config.{js,mjs,ts,mts,cjs,cts}', '**/.*.{js,mjs,ts,mts,cjs,cts}'];\n\nexport function unicorn() {\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n unicorn: unicornPlugin,\n },\n rules: {\n // ===== Error Prevention / Bug Detection =====\n 'unicorn/better-regex': 'warn',\n 'unicorn/error-message': 'error',\n 'unicorn/new-for-builtins': 'error',\n 'unicorn/no-abusive-eslint-disable': 'error',\n 'unicorn/no-accessor-recursion': 'error',\n 'unicorn/no-await-in-promise-methods': 'error',\n 'unicorn/no-immediate-mutation': 'error',\n 'unicorn/no-instanceof-builtins': 'error',\n 'unicorn/no-invalid-fetch-options': 'error',\n 'unicorn/no-invalid-remove-event-listener': 'error',\n 'unicorn/no-negation-in-equality-check': 'error',\n 'unicorn/no-single-promise-in-promise-methods': 'error',\n 'unicorn/no-thenable': 'error',\n 'unicorn/throw-new-error': 'error',\n\n // ===== Code Cleanliness =====\n 'unicorn/escape-case': 'warn',\n 'unicorn/no-anonymous-default-export': 'error',\n 'unicorn/no-console-spaces': 'warn',\n 'unicorn/no-empty-file': 'warn',\n 'unicorn/no-lonely-if': 'warn',\n 'unicorn/no-new-array': 'error',\n 'unicorn/no-new-buffer': 'error',\n 'unicorn/no-unnecessary-await': 'error',\n 'unicorn/no-unreadable-iife': 'warn',\n 'unicorn/no-useless-fallback-in-spread': 'warn',\n 'unicorn/no-useless-length-check': 'warn',\n 'unicorn/no-useless-promise-resolve-reject': 'warn',\n 'unicorn/no-useless-spread': 'warn',\n 'unicorn/no-useless-switch-case': 'warn',\n 'unicorn/no-zero-fractions': 'warn',\n 'unicorn/number-literal-case': 'warn',\n 'unicorn/switch-case-braces': 'warn',\n 'unicorn/text-encoding-identifier-case': 'warn',\n 'unicorn/import-style': 'warn',\n\n // ===== Modern APIs =====\n 'unicorn/prefer-array-find': 'warn',\n 'unicorn/prefer-array-flat': 'warn',\n 'unicorn/prefer-array-flat-map': 'warn',\n 'unicorn/prefer-array-index-of': 'warn',\n 'unicorn/prefer-array-some': 'warn',\n 'unicorn/prefer-at': 'warn',\n 'unicorn/prefer-date-now': 'warn',\n 'unicorn/prefer-includes': 'warn',\n 'unicorn/prefer-logical-operator-over-ternary': 'warn',\n 'unicorn/prefer-node-protocol': 'warn',\n 'unicorn/prefer-object-from-entries': 'warn',\n 'unicorn/prefer-regexp-test': 'warn',\n 'unicorn/prefer-string-replace-all': 'warn',\n 'unicorn/prefer-string-slice': 'warn',\n 'unicorn/prefer-string-starts-ends-with': 'warn',\n 'unicorn/prefer-structured-clone': 'warn',\n },\n },\n {\n files: GLOB_NEXT_APP_FILES,\n rules: {\n 'unicorn/no-anonymous-default-export': 'off',\n },\n },\n {\n files: GLOB_CONFIG_FILES,\n rules: {\n 'unicorn/no-anonymous-default-export': 'off',\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport unusedImportsPlugin from 'eslint-plugin-unused-imports';\n\nimport { GLOB_SRC } from '../globs';\n\nexport function unused() {\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n 'unused-imports': unusedImportsPlugin,\n },\n rules: {\n 'unused-imports/no-unused-imports': 'error',\n 'unused-imports/no-unused-vars': [\n 'warn',\n {\n args: 'after-used',\n argsIgnorePattern: '^_',\n vars: 'all',\n varsIgnorePattern: '^_',\n },\n ],\n },\n },\n ]);\n}\n","import { a11y } from './configs/a11y';\nimport { eslintCommentsConfig } from './configs/eslint-comments';\nimport { ignores } from './configs/ignores';\nimport { imports } from './configs/imports';\nimport { javascript } from './configs/javascript';\nimport { next } from './configs/next';\nimport { react } from './configs/react';\nimport { reactNative } from './configs/react-native';\nimport { regexp } from './configs/regexp';\nimport { sorting } from './configs/sorting';\nimport { typescript } from './configs/typescript';\nimport { unicorn } from './configs/unicorn';\nimport { unused } from './configs/unused';\nimport type { FlatConfig, FlatConfigArray, Options } from './types';\n\nexport type { FlatConfig, FlatConfigArray, Linter, Options, ParserOptions } from './types';\n\nexport function defineConfig(options: Options = {}, ...userConfigs: FlatConfig[]): FlatConfigArray {\n const {\n a11y: a11yOption = false,\n ignores: userIgnores = [],\n next: nextOption = false,\n react: reactOption = false,\n reactNative: reactNativeOption = false,\n regexp: regexpOption = true,\n sortImports = true,\n sortKeys = true,\n typeChecked = false,\n typescript: tsOption = true,\n } = options;\n\n const configs: FlatConfigArray = [\n ignores(userIgnores),\n ...javascript(),\n ...typescript({ ...options, typeChecked, typescript: tsOption }),\n ...react({ ...options, react: reactOption }),\n ...reactNative({ ...options, reactNative: reactNativeOption }),\n ...next({ ...options, next: nextOption }),\n ...a11y({ ...options, a11y: a11yOption, react: reactOption }),\n ...imports({ ...options, sortImports }),\n ...unicorn(),\n ...sorting({ ...options, sortKeys }),\n ...regexp({ ...options, regexp: regexpOption }),\n ...unused(),\n ...eslintCommentsConfig(),\n // 用户自定义配置(最高优先级)\n ...userConfigs,\n ];\n\n return configs;\n}\n\nexport * from './globs';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU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eAAa,CAClB;EACE,OAAO;EACP,SAAS,EACP,kBAAkB,oBACnB;EACD,OAAO;GACL,oCAAoC;GACpC,iCAAiC,CAC/B,QACA;IACE,MAAM;IACN,mBAAmB;IACnB,MAAM;IACN,mBAAmB;GAEtB,CAAA;EACF;CAEJ,CAAA,EAAC;AACH;;;;ACTD,SAAgB,aAAaC,UAAmB,CAAE,GAAE,GAAG,aAA4C;CACjG,MAAM,EACJ,MAAM,aAAa,OACnB,SAAS,cAAc,CAAE,GACzB,MAAM,aAAa,OACnB,OAAO,cAAc,OACrB,aAAa,oBAAoB,OACjC,QAAQ,eAAe,MACvB,cAAc,MACd,WAAW,MACX,cAAc,OACd,YAAY,WAAW,MACxB,GAAG;CAEJ,MAAMC,UAA2B;EAC/B,QAAQ,YAAY;EACpB,GAAG,YAAY;EACf,GAAG,WAAW;GAAE,GAAG;GAAS;GAAa,YAAY;EAAU,EAAC;EAChE,GAAG,MAAM;GAAE,GAAG;GAAS,OAAO;EAAa,EAAC;EAC5C,GAAG,YAAY;GAAE,GAAG;GAAS,aAAa;EAAmB,EAAC;EAC9D,GAAG,KAAK;GAAE,GAAG;GAAS,MAAM;EAAY,EAAC;EACzC,GAAG,KAAK;GAAE,GAAG;GAAS,MAAM;GAAY,OAAO;EAAa,EAAC;EAC7D,GAAG,QAAQ;GAAE,GAAG;GAAS;EAAa,EAAC;EACvC,GAAG,SAAS;EACZ,GAAG,QAAQ;GAAE,GAAG;GAAS;EAAU,EAAC;EACpC,GAAG,OAAO;GAAE,GAAG;GAAS,QAAQ;EAAc,EAAC;EAC/C,GAAG,QAAQ;EACX,GAAG,sBAAsB;EAEzB,GAAG;CACJ;AAED,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["options: Options","userIgnores: string[]","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","options: Options","configs: FlatConfigArray"],"sources":["../src/globs.ts","../src/configs/a11y.ts","../src/configs/ignores.ts","../src/configs/imports.ts","../src/configs/javascript.ts","../src/configs/next.ts","../src/configs/react.ts","../src/configs/react-native.ts","../src/configs/regexp.ts","../src/configs/sorting.ts","../src/configs/typescript.ts","../src/configs/unicorn.ts","../src/configs/unused.ts","../src/index.ts"],"sourcesContent":["export const GLOB_JS = '**/*.?([cm])js';\nexport const GLOB_JSX = '**/*.?([cm])jsx';\nexport const GLOB_TS = '**/*.?([cm])ts';\nexport const GLOB_TSX = '**/*.?([cm])tsx';\n\nexport const GLOB_JS_ALL = [GLOB_JS, GLOB_JSX];\nexport const GLOB_TS_ALL = [GLOB_TS, GLOB_TSX];\nexport const GLOB_SRC = [...GLOB_JS_ALL, ...GLOB_TS_ALL];\n\nexport const GLOB_TEST = [\n '**/*.test.{js,jsx,ts,tsx}',\n '**/*.spec.{js,jsx,ts,tsx}',\n '**/__tests__/**/*.{js,jsx,ts,tsx}',\n];\n\nexport const GLOB_IGNORES = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.next/**',\n '**/coverage/**',\n '**/.turbo/**',\n '**/out/**',\n '**/*.min.*',\n '**/public/**',\n];\n","import { defineConfig } from 'eslint/config';\nimport jsxA11y from 'eslint-plugin-jsx-a11y';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function a11y(options: Options) {\n const { a11y: a11yOption, react: reactOption } = options;\n\n if (!a11yOption || !reactOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n 'jsx-a11y': jsxA11y,\n },\n rules: {\n ...jsxA11y.flatConfigs.recommended.rules,\n 'jsx-a11y/alt-text': 'warn',\n 'jsx-a11y/anchor-has-content': 'warn',\n 'jsx-a11y/anchor-is-valid': 'warn',\n 'jsx-a11y/click-events-have-key-events': 'warn',\n 'jsx-a11y/no-static-element-interactions': 'warn',\n },\n },\n ]);\n}\n","import { GLOB_IGNORES } from '../globs';\nimport type { FlatConfig } from '../types';\n\nexport function ignores(userIgnores: string[] = []): FlatConfig {\n return {\n ignores: [...GLOB_IGNORES, ...userIgnores],\n };\n}\n","import { defineConfig } from 'eslint/config';\nimport { importX } from 'eslint-plugin-import-x';\nimport simpleImportSort from 'eslint-plugin-simple-import-sort';\n\nimport { GLOB_SRC } from '../globs';\nimport type { Options } from '../types';\n\nexport function imports(options: Options) {\n const { sortImports = true } = options;\n\n const configs = defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n 'import-x': importX as any,\n },\n settings: {\n 'import-x/resolver': {\n node: true,\n typescript: true,\n },\n },\n rules: {\n 'import-x/first': 'error',\n 'import-x/newline-after-import': 'error',\n 'import-x/no-duplicates': 'error',\n 'import-x/no-mutable-exports': 'error',\n 'import-x/no-self-import': 'error',\n 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],\n },\n },\n ]);\n\n if (sortImports) {\n configs.push({\n files: GLOB_SRC,\n plugins: {\n 'simple-import-sort': simpleImportSort,\n },\n rules: {\n 'simple-import-sort/imports': 'error',\n 'simple-import-sort/exports': 'error',\n 'sort-imports': 'off',\n },\n });\n }\n\n return configs;\n}\n","import js from '@eslint/js';\nimport { defineConfig } from 'eslint/config';\nimport globals from 'globals';\n\nimport { GLOB_SRC } from '../globs';\n\nexport function javascript() {\n return defineConfig([\n {\n ...js.configs.recommended,\n files: GLOB_SRC,\n languageOptions: {\n ecmaVersion: 'latest',\n globals: {\n ...globals.browser,\n ...globals.node,\n ...globals.es2021,\n },\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n ecmaVersion: 'latest',\n sourceType: 'module',\n },\n sourceType: 'module',\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n },\n rules: {\n ...js.configs.recommended.rules,\n 'no-empty': 'warn',\n 'no-extra-boolean-cast': 'off',\n 'no-unused-vars': 'off',\n },\n },\n ]);\n}\n","import nextPlugin from '@next/eslint-plugin-next';\nimport { defineConfig } from 'eslint/config';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function next(options: Options) {\n const { next: nextOption } = options;\n\n if (!nextOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n '@next/next': nextPlugin,\n },\n rules: {\n ...nextPlugin.configs.recommended.rules,\n ...nextPlugin.configs['core-web-vitals'].rules,\n '@next/next/no-img-element': 'off',\n },\n },\n ]);\n}\n","import eslintReact from '@eslint-react/eslint-plugin';\nimport { defineConfig } from 'eslint/config';\nimport reactPlugin from 'eslint-plugin-react';\nimport reactCompiler from 'eslint-plugin-react-compiler';\nimport reactHooksPlugin from 'eslint-plugin-react-hooks';\nimport reactRefresh from 'eslint-plugin-react-refresh';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function react(options: Options) {\n const { react: reactOption, reactCompiler: reactCompilerOption } = options;\n\n if (!reactOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n const configs = defineConfig([\n {\n files,\n ...eslintReact.configs['recommended-typescript'],\n },\n {\n files,\n plugins: {\n 'react': reactPlugin,\n 'react-hooks': reactHooksPlugin,\n 'react-refresh': reactRefresh,\n },\n rules: {\n ...reactHooksPlugin.configs.recommended.rules,\n\n '@eslint-react/dom/no-dangerously-set-innerhtml': 'off',\n '@eslint-react/no-array-index-key': 'warn',\n '@eslint-react/no-leaked-conditional-rendering': 'warn',\n\n 'react/self-closing-comp': 'warn',\n\n 'react-refresh/only-export-components': [\n 'warn',\n {\n allowConstantExport: true,\n allowExportNames:\n reactOption === 'next'\n ? [\n 'dynamic',\n 'dynamicParams',\n 'revalidate',\n 'fetchCache',\n 'runtime',\n 'preferredRegion',\n 'maxDuration',\n 'config',\n 'generateStaticParams',\n 'metadata',\n 'generateMetadata',\n 'viewport',\n 'generateViewport',\n ]\n : reactOption === 'remix'\n ? ['meta', 'links', 'headers', 'loader', 'action']\n : undefined,\n },\n ],\n },\n settings: {\n 'react-x': {\n version: 'detect',\n },\n },\n },\n ]);\n\n if (reactCompilerOption) {\n configs.push({\n files,\n plugins: {\n 'react-compiler': reactCompiler,\n },\n rules: {\n 'react-compiler/react-compiler': 'error',\n },\n });\n }\n\n return configs;\n}\n","import { defineConfig } from 'eslint/config';\nimport reactNativePlugin from 'eslint-plugin-react-native';\n\nimport { GLOB_JSX, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function reactNative(options: Options) {\n const { reactNative: reactNativeOption } = options;\n\n if (!reactNativeOption) return [];\n\n const files = [GLOB_JSX, GLOB_TSX];\n\n return defineConfig([\n {\n files,\n plugins: {\n 'react-native': reactNativePlugin,\n },\n languageOptions: {\n globals: {\n __DEV__: 'readonly',\n },\n },\n rules: {\n 'react-native/no-color-literals': 'warn',\n 'react-native/no-inline-styles': 'warn',\n 'react-native/no-raw-text': 'off',\n 'react-native/no-single-element-style-arrays': 'warn',\n 'react-native/no-unused-styles': 'error',\n 'react-native/split-platform-components': 'warn',\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport regexpPlugin from 'eslint-plugin-regexp';\n\nimport { GLOB_SRC } from '../globs';\nimport type { Options } from '../types';\n\nexport function regexp(options: Options) {\n const { regexp: regexpOption = true } = options;\n\n if (!regexpOption) return [];\n\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n regexp: regexpPlugin,\n },\n rules: {\n ...(regexpPlugin.configs['flat/recommended'].rules as any),\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport perfectionistPlugin from 'eslint-plugin-perfectionist';\nimport reactPlugin from 'eslint-plugin-react';\n\nimport { GLOB_JSX, GLOB_TS_ALL, GLOB_TSX } from '../globs';\nimport type { Options } from '../types';\n\nexport function sorting(options: Options) {\n const { sortKeys = true } = options;\n\n if (!sortKeys) return [];\n\n return defineConfig([\n // TypeScript interface and enum sorting\n {\n files: GLOB_TS_ALL,\n plugins: {\n perfectionist: perfectionistPlugin,\n },\n rules: {\n 'perfectionist/sort-enums': [\n 'error',\n {\n order: 'asc',\n type: 'natural',\n },\n ],\n 'perfectionist/sort-interfaces': [\n 'error',\n {\n order: 'asc',\n type: 'natural',\n },\n ],\n },\n },\n // JSX props sorting\n {\n files: [GLOB_JSX, GLOB_TSX],\n plugins: {\n react: reactPlugin,\n },\n rules: {\n 'react/jsx-sort-props': [\n 'warn',\n {\n callbacksLast: true,\n multiline: 'last',\n shorthandFirst: true,\n },\n ],\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport tseslint from 'typescript-eslint';\n\nimport { GLOB_TS_ALL } from '../globs';\nimport type { Options } from '../types';\n\nexport function typescript(options: Options) {\n const {\n typescript: tsOption,\n typeChecked,\n tsconfigPath,\n parserOptions: userParserOptions,\n } = options;\n\n if (!tsOption) return [];\n\n const isStrict = tsOption === 'strict';\n\n const baseConfigs = isStrict\n ? typeChecked\n ? tseslint.configs.strictTypeChecked\n : tseslint.configs.strict\n : typeChecked\n ? tseslint.configs.recommendedTypeChecked\n : tseslint.configs.recommended;\n\n const configs = defineConfig([\n ...baseConfigs,\n {\n files: GLOB_TS_ALL,\n languageOptions: {\n parser: tseslint.parser,\n parserOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n ...(typeChecked && {\n projectService: !tsconfigPath,\n project: tsconfigPath,\n }),\n ...userParserOptions,\n },\n },\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n disallowTypeAnnotations: false,\n fixStyle: 'separate-type-imports',\n prefer: 'type-imports',\n },\n ],\n '@typescript-eslint/method-signature-style': ['error', 'property'],\n '@typescript-eslint/no-import-type-side-effects': 'error',\n '@typescript-eslint/no-unused-expressions': [\n 'error',\n {\n allowShortCircuit: true,\n allowTaggedTemplates: true,\n allowTernary: true,\n },\n ],\n\n ...(isStrict\n ? {}\n : {\n '@typescript-eslint/ban-ts-comment': 'off',\n '@typescript-eslint/no-explicit-any': 'off',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-require-imports': 'off',\n }),\n\n '@typescript-eslint/no-unused-vars': 'off',\n '@typescript-eslint/no-use-before-define': 'off',\n '@typescript-eslint/no-useless-constructor': 'off',\n },\n },\n ]);\n\n if (typeChecked) {\n configs.push({\n files: GLOB_TS_ALL,\n rules: {\n '@typescript-eslint/await-thenable': 'error',\n '@typescript-eslint/no-floating-promises': 'error',\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],\n '@typescript-eslint/require-await': 'error',\n },\n });\n }\n\n return configs;\n}\n","import { defineConfig } from 'eslint/config';\nimport unicornPlugin from 'eslint-plugin-unicorn';\n\nimport { GLOB_SRC } from '../globs';\n\nconst GLOB_NEXT_APP_FILES = [\n '**/app/**/page.{js,jsx,ts,tsx}',\n '**/app/**/layout.{js,jsx,ts,tsx}',\n '**/app/**/loading.{js,jsx,ts,tsx}',\n '**/app/**/error.{js,jsx,ts,tsx}',\n '**/app/**/not-found.{js,jsx,ts,tsx}',\n '**/app/**/template.{js,jsx,ts,tsx}',\n '**/app/**/default.{js,jsx,ts,tsx}',\n '**/app/**/route.{js,ts}',\n '**/app/**/opengraph-image.{js,jsx,ts,tsx}',\n '**/app/**/twitter-image.{js,jsx,ts,tsx}',\n '**/app/**/apple-icon.{js,jsx,ts,tsx}',\n '**/app/**/icon.{js,jsx,ts,tsx}',\n '**/app/**/sitemap.{js,ts}',\n '**/app/**/robots.{js,ts}',\n '**/app/**/manifest.{js,ts}',\n];\n\nexport function unicorn() {\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n unicorn: unicornPlugin,\n },\n rules: {\n ...unicornPlugin.configs['flat/recommended'].rules,\n 'unicorn/catch-error-name': 'off',\n 'unicorn/explicit-length-check': 'off',\n 'unicorn/filename-case': 'off',\n 'unicorn/import-style': 'off',\n 'unicorn/no-anonymous-default-export': 'error',\n 'unicorn/no-array-callback-reference': 'off',\n 'unicorn/no-array-for-each': 'off',\n 'unicorn/no-array-push-push': 'off',\n 'unicorn/no-array-reduce': 'off',\n 'unicorn/no-empty-file': 'warn',\n 'unicorn/no-negated-condition': 'off',\n 'unicorn/no-nested-ternary': 'off',\n 'unicorn/no-null': 'off',\n 'unicorn/no-typeof-undefined': 'off',\n 'unicorn/no-useless-undefined': 'off',\n 'unicorn/prefer-code-point': 'off',\n 'unicorn/prefer-logical-operator-over-ternary': 'off',\n 'unicorn/prefer-module': 'off',\n 'unicorn/prefer-number-properties': 'off',\n 'unicorn/prefer-query-selector': 'off',\n 'unicorn/prefer-spread': 'off',\n 'unicorn/prefer-string-raw': 'off',\n 'unicorn/prefer-string-replace-all': 'warn',\n 'unicorn/prefer-ternary': 'off',\n 'unicorn/prefer-type-error': 'off',\n 'unicorn/prevent-abbreviations': 'off',\n 'unicorn/switch-case-braces': 'warn',\n },\n },\n {\n files: GLOB_NEXT_APP_FILES,\n rules: {\n 'unicorn/no-anonymous-default-export': 'off',\n },\n },\n ]);\n}\n","import { defineConfig } from 'eslint/config';\nimport unusedImportsPlugin from 'eslint-plugin-unused-imports';\n\nimport { GLOB_SRC } from '../globs';\n\nexport function unused() {\n return defineConfig([\n {\n files: GLOB_SRC,\n plugins: {\n 'unused-imports': unusedImportsPlugin,\n },\n rules: {\n 'unused-imports/no-unused-imports': 'error',\n 'unused-imports/no-unused-vars': [\n 'warn',\n {\n args: 'after-used',\n argsIgnorePattern: '^_',\n vars: 'all',\n varsIgnorePattern: '^_',\n },\n ],\n },\n },\n ]);\n}\n","import { a11y } from './configs/a11y';\nimport { ignores } from './configs/ignores';\nimport { imports } from './configs/imports';\nimport { javascript } from './configs/javascript';\nimport { next } from './configs/next';\nimport { react } from './configs/react';\nimport { reactNative } from './configs/react-native';\nimport { regexp } from './configs/regexp';\nimport { sorting } from './configs/sorting';\nimport { typescript } from './configs/typescript';\nimport { unicorn } from './configs/unicorn';\nimport { unused } from './configs/unused';\nimport type { FlatConfig, FlatConfigArray, Options } from './types';\n\nexport type { FlatConfig, FlatConfigArray, Linter, Options, ParserOptions } from './types';\n\nexport function defineConfig(options: Options = {}, ...userConfigs: FlatConfig[]): FlatConfigArray {\n const {\n a11y: a11yOption = false,\n ignores: userIgnores = [],\n next: nextOption = false,\n react: reactOption = false,\n reactNative: reactNativeOption = false,\n regexp: regexpOption = true,\n sortImports = true,\n sortKeys = true,\n typeChecked = false,\n typescript: tsOption = true,\n } = options;\n\n const configs: FlatConfigArray = [\n ignores(userIgnores),\n ...javascript(),\n ...typescript({ ...options, typeChecked, typescript: tsOption }),\n ...react({ ...options, react: reactOption }),\n ...reactNative({ ...options, reactNative: reactNativeOption }),\n ...next({ ...options, next: nextOption }),\n ...a11y({ ...options, a11y: a11yOption, react: reactOption }),\n ...imports({ ...options, sortImports }),\n ...unicorn(),\n ...sorting({ ...options, sortKeys }),\n ...regexp({ ...options, regexp: regexpOption }),\n ...unused(),\n // 用户自定义配置(最高优先级)\n ...userConfigs,\n ];\n\n return configs;\n}\n\nexport * from './globs';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AACvB,MAAa,WAAW;AAExB,MAAa,cAAc,CAAC,SAAS,QAAS;AAC9C,MAAa,cAAc,CAAC,SAAS,QAAS;AAC9C,MAAa,WAAW,CAAC,GAAG,aAAa,GAAG,WAAY;AAExD,MAAa,YAAY;CACvB;CACA;CACA;AACD;AAED,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;ACnBD,SAAgB,KAAKA,SAAkB;CACrC,MAAM,EAAE,MAAM,YAAY,OAAO,aAAa,GAAG;AAEjD,MAAK,eAAe,YAAa,QAAO,CAAE;CAE1C,MAAM,QAAQ,CAAC,UAAU,QAAS;AAElC,QAAO,eAAa,CAClB;EACE;EACA,SAAS,EACP,YAAY,QACb;EACD,OAAO;GACL,GAAG,QAAQ,YAAY,YAAY;GACnC,qBAAqB;GACrB,+BAA+B;GAC/B,4BAA4B;GAC5B,yCAAyC;GACzC,2CAA2C;EAC5C;CAEJ,CAAA,EAAC;AACH;;;;AC1BD,SAAg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QAAO,eAAa,CAClB;EACE,OAAO;EACP,SAAS,EACP,kBAAkB,oBACnB;EACD,OAAO;GACL,oCAAoC;GACpC,iCAAiC,CAC/B,QACA;IACE,MAAM;IACN,mBAAmB;IACnB,MAAM;IACN,mBAAmB;GAEtB,CAAA;EACF;CAEJ,CAAA,EAAC;AACH;;;;ACVD,SAAgB,aAAaC,UAAmB,CAAE,GAAE,GAAG,aAA4C;CACjG,MAAM,EACJ,MAAM,aAAa,OACnB,SAAS,cAAc,CAAE,GACzB,MAAM,aAAa,OACnB,OAAO,cAAc,OACrB,aAAa,oBAAoB,OACjC,QAAQ,eAAe,MACvB,cAAc,MACd,WAAW,MACX,cAAc,OACd,YAAY,WAAW,MACxB,GAAG;CAEJ,MAAMC,UAA2B;EAC/B,QAAQ,YAAY;EACpB,GAAG,YAAY;EACf,GAAG,WAAW;GAAE,GAAG;GAAS;GAAa,YAAY;EAAU,EAAC;EAChE,GAAG,MAAM;GAAE,GAAG;GAAS,OAAO;EAAa,EAAC;EAC5C,GAAG,YAAY;GAAE,GAAG;GAAS,aAAa;EAAmB,EAAC;EAC9D,GAAG,KAAK;GAAE,GAAG;GAAS,MAAM;EAAY,EAAC;EACzC,GAAG,KAAK;GAAE,GAAG;GAAS,MAAM;GAAY,OAAO;EAAa,EAAC;EAC7D,GAAG,QAAQ;GAAE,GAAG;GAAS;EAAa,EAAC;EACvC,GAAG,SAAS;EACZ,GAAG,QAAQ;GAAE,GAAG;GAAS;EAAU,EAAC;EACpC,GAAG,OAAO;GAAE,GAAG;GAAS,QAAQ;EAAc,EAAC;EAC/C,GAAG,QAAQ;EAEX,GAAG;CACJ;AAED,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/eslint-config",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "ESLint Flat Config configuration for LobeHub projects",
|
|
5
5
|
"homepage": "https://github.com/lobehub/lobe-lint/tree/master/packages/eslint-config",
|
|
6
6
|
"bugs": {
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
32
31
|
"@eslint-react/eslint-plugin": "^2.9.4",
|
|
33
32
|
"@eslint/js": "^9.39.2",
|
|
34
33
|
"@next/eslint-plugin-next": "^16.1.6",
|