@lobehub/eslint-config 2.1.0 → 2.1.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/eslint-typegen.d.ts +10199 -0
- package/dist/index.cjs +19 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ const eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist
|
|
|
41
41
|
const typescript_eslint = __toESM(require("typescript-eslint"));
|
|
42
42
|
const eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"));
|
|
43
43
|
const eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"));
|
|
44
|
+
const eslint_plugin_yml = __toESM(require("eslint-plugin-yml"));
|
|
44
45
|
|
|
45
46
|
//#region src/globs.ts
|
|
46
47
|
const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -55,6 +56,7 @@ const GLOB_TEST = [
|
|
|
55
56
|
"**/*.spec.{js,jsx,ts,tsx}",
|
|
56
57
|
"**/__tests__/**/*.{js,jsx,ts,tsx}"
|
|
57
58
|
];
|
|
59
|
+
const GLOB_YAML = ["**/*.yaml", "**/*.yml"];
|
|
58
60
|
const GLOB_IGNORES = [
|
|
59
61
|
"**/node_modules/**",
|
|
60
62
|
"**/dist/**",
|
|
@@ -501,10 +503,21 @@ function unused() {
|
|
|
501
503
|
}]);
|
|
502
504
|
}
|
|
503
505
|
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/configs/yml.ts
|
|
508
|
+
function yml(options) {
|
|
509
|
+
const { yml: ymlOption = true } = options;
|
|
510
|
+
if (!ymlOption) return [];
|
|
511
|
+
return (0, eslint_config.defineConfig)([...eslint_plugin_yml.default.configs.recommended, { rules: { "yml/quotes": ["error", {
|
|
512
|
+
avoidEscape: true,
|
|
513
|
+
prefer: "single"
|
|
514
|
+
}] } }]);
|
|
515
|
+
}
|
|
516
|
+
|
|
504
517
|
//#endregion
|
|
505
518
|
//#region src/index.ts
|
|
506
519
|
function defineConfig(options = {}, ...userConfigs) {
|
|
507
|
-
const { a11y: a11yOption = false, ignores: userIgnores = [], next: nextOption = false, react: reactOption = false, reactNative: reactNativeOption = false, regexp: regexpOption = true, sortImports = true, sortKeys = true, typeChecked = false, typescript: tsOption = true } = options;
|
|
520
|
+
const { a11y: a11yOption = false, ignores: userIgnores = [], next: nextOption = false, react: reactOption = false, reactNative: reactNativeOption = false, regexp: regexpOption = true, sortImports = true, sortKeys = true, typeChecked = false, typescript: tsOption = true, yml: ymlOption = true } = options;
|
|
508
521
|
const configs = [
|
|
509
522
|
ignores(userIgnores),
|
|
510
523
|
...javascript(),
|
|
@@ -544,6 +557,10 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
544
557
|
regexp: regexpOption
|
|
545
558
|
}),
|
|
546
559
|
...unused(),
|
|
560
|
+
...yml({
|
|
561
|
+
...options,
|
|
562
|
+
yml: ymlOption
|
|
563
|
+
}),
|
|
547
564
|
...eslintCommentsConfig(),
|
|
548
565
|
...userConfigs
|
|
549
566
|
];
|
|
@@ -560,4 +577,5 @@ exports.GLOB_TEST = GLOB_TEST
|
|
|
560
577
|
exports.GLOB_TS = GLOB_TS
|
|
561
578
|
exports.GLOB_TSX = GLOB_TSX
|
|
562
579
|
exports.GLOB_TS_ALL = GLOB_TS_ALL
|
|
580
|
+
exports.GLOB_YAML = GLOB_YAML
|
|
563
581
|
exports.defineConfig = defineConfig
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./eslint-typegen.d.ts" />
|
|
1
2
|
import { ParserOptions, ParserOptions as ParserOptions$1 } from "@typescript-eslint/parser";
|
|
2
3
|
import { Linter, Linter as Linter$1 } from "eslint";
|
|
3
4
|
|
|
@@ -65,6 +66,11 @@ interface Options {
|
|
|
65
66
|
* @default true
|
|
66
67
|
*/
|
|
67
68
|
typescript?: boolean | 'strict';
|
|
69
|
+
/**
|
|
70
|
+
* 是否启用 YAML 规则(如字符串使用单引号)
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
yml?: boolean;
|
|
68
74
|
}
|
|
69
75
|
type FlatConfig = Linter$1.Config;
|
|
70
76
|
type FlatConfigArray = Linter$1.Config[]; //#endregion
|
|
@@ -77,6 +83,7 @@ declare const GLOB_JS_ALL: string[];
|
|
|
77
83
|
declare const GLOB_TS_ALL: string[];
|
|
78
84
|
declare const GLOB_SRC: string[];
|
|
79
85
|
declare const GLOB_TEST: string[];
|
|
86
|
+
declare const GLOB_YAML: string[];
|
|
80
87
|
declare const GLOB_IGNORES: string[];
|
|
81
88
|
|
|
82
89
|
//#endregion
|
|
@@ -85,5 +92,5 @@ declare const GLOB_IGNORES: string[];
|
|
|
85
92
|
declare function defineConfig(options?: Options, ...userConfigs: FlatConfig[]): FlatConfigArray;
|
|
86
93
|
|
|
87
94
|
//#endregion
|
|
88
|
-
export { FlatConfig, FlatConfigArray, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, Linter, Options, ParserOptions, defineConfig };
|
|
95
|
+
export { FlatConfig, FlatConfigArray, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, GLOB_YAML, Linter, Options, ParserOptions, defineConfig };
|
|
89
96
|
//# sourceMappingURL=index.d.cts.map
|
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;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AAmFA;AACA;;;;ACvFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;AAEA;kBDOkB;;;AEHlB;;EAA4B,KAAU,CAAA,EAAA,OAAA,GAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAAY;;AAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFiEtF,UAAA,GAAa,QAAA,CAAO;KACpB,eAAA,GAAkB,QAAA,CAAO;;cCvFxB,OAAA;cACA,QAAA;cACA,OAAA;cACA,QAAA;ADAI,cCEJ,WDmBK,EAAA,MAAa,EAAA;AA8DnB,cChFC,WDgFY,EAAA,MAAO,EAAA;AACpB,cChFC,QDgFc,EAAA,MAAG,EAAA;cC9EjB;cAMA;cAEA;;;;AAjBb;iBCqBgB,YAAA,WAAsB,yBAA8B,eAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./eslint-typegen.d.ts" />
|
|
1
2
|
import { ParserOptions, ParserOptions as ParserOptions$1 } from "@typescript-eslint/parser";
|
|
2
3
|
import { Linter, Linter as Linter$1 } from "eslint";
|
|
3
4
|
|
|
@@ -65,6 +66,11 @@ interface Options {
|
|
|
65
66
|
* @default true
|
|
66
67
|
*/
|
|
67
68
|
typescript?: boolean | 'strict';
|
|
69
|
+
/**
|
|
70
|
+
* 是否启用 YAML 规则(如字符串使用单引号)
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
yml?: boolean;
|
|
68
74
|
}
|
|
69
75
|
type FlatConfig = Linter$1.Config;
|
|
70
76
|
type FlatConfigArray = Linter$1.Config[]; //#endregion
|
|
@@ -77,6 +83,7 @@ declare const GLOB_JS_ALL: string[];
|
|
|
77
83
|
declare const GLOB_TS_ALL: string[];
|
|
78
84
|
declare const GLOB_SRC: string[];
|
|
79
85
|
declare const GLOB_TEST: string[];
|
|
86
|
+
declare const GLOB_YAML: string[];
|
|
80
87
|
declare const GLOB_IGNORES: string[];
|
|
81
88
|
|
|
82
89
|
//#endregion
|
|
@@ -85,5 +92,5 @@ declare const GLOB_IGNORES: string[];
|
|
|
85
92
|
declare function defineConfig(options?: Options, ...userConfigs: FlatConfig[]): FlatConfigArray;
|
|
86
93
|
|
|
87
94
|
//#endregion
|
|
88
|
-
export { FlatConfig, FlatConfigArray, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, Linter, Options, ParserOptions, defineConfig };
|
|
95
|
+
export { FlatConfig, FlatConfigArray, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, GLOB_YAML, Linter, Options, ParserOptions, defineConfig };
|
|
89
96
|
//# sourceMappingURL=index.d.ts.map
|
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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/globs.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;UAGiB,OAAA;;AAAjB;AAmFA;AACA;;;;ACvFA;EACa,OAAA,CAAA,EAAA,MAAQ,EAAA;EACR;AACb;AAEA;AACA;EACa,IAAA,CAAA,EAAA,OAA2C;EAE3C;AAMb;AAEA;kBDOkB;;;AEHlB;;EAA4B,KAAU,CAAA,EAAA,OAAA,GAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAAY;;AAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFiEtF,UAAA,GAAa,QAAA,CAAO;KACpB,eAAA,GAAkB,QAAA,CAAO;;cCvFxB,OAAA;cACA,QAAA;cACA,OAAA;cACA,QAAA;ADAI,cCEJ,WDmBK,EAAA,MAAa,EAAA;AA8DnB,cChFC,WDgFY,EAAA,MAAO,EAAM;AAC1B,cChFC,QDgFc,EAAA,MAAG,EAAA;cC9EjB;cAMA;cAEA;;;;AAjBb;iBCqBgB,YAAA,WAAsB,yBAA8B,eAAe"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import perfectionistPlugin from "eslint-plugin-perfectionist";
|
|
|
17
17
|
import tseslint from "typescript-eslint";
|
|
18
18
|
import unicornPlugin from "eslint-plugin-unicorn";
|
|
19
19
|
import unusedImportsPlugin from "eslint-plugin-unused-imports";
|
|
20
|
+
import eslintPluginYml from "eslint-plugin-yml";
|
|
20
21
|
|
|
21
22
|
//#region src/globs.ts
|
|
22
23
|
const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -31,6 +32,7 @@ const GLOB_TEST = [
|
|
|
31
32
|
"**/*.spec.{js,jsx,ts,tsx}",
|
|
32
33
|
"**/__tests__/**/*.{js,jsx,ts,tsx}"
|
|
33
34
|
];
|
|
35
|
+
const GLOB_YAML = ["**/*.yaml", "**/*.yml"];
|
|
34
36
|
const GLOB_IGNORES = [
|
|
35
37
|
"**/node_modules/**",
|
|
36
38
|
"**/dist/**",
|
|
@@ -477,10 +479,21 @@ function unused() {
|
|
|
477
479
|
}]);
|
|
478
480
|
}
|
|
479
481
|
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/configs/yml.ts
|
|
484
|
+
function yml(options) {
|
|
485
|
+
const { yml: ymlOption = true } = options;
|
|
486
|
+
if (!ymlOption) return [];
|
|
487
|
+
return defineConfig$1([...eslintPluginYml.configs.recommended, { rules: { "yml/quotes": ["error", {
|
|
488
|
+
avoidEscape: true,
|
|
489
|
+
prefer: "single"
|
|
490
|
+
}] } }]);
|
|
491
|
+
}
|
|
492
|
+
|
|
480
493
|
//#endregion
|
|
481
494
|
//#region src/index.ts
|
|
482
495
|
function defineConfig(options = {}, ...userConfigs) {
|
|
483
|
-
const { a11y: a11yOption = false, ignores: userIgnores = [], next: nextOption = false, react: reactOption = false, reactNative: reactNativeOption = false, regexp: regexpOption = true, sortImports = true, sortKeys = true, typeChecked = false, typescript: tsOption = true } = options;
|
|
496
|
+
const { a11y: a11yOption = false, ignores: userIgnores = [], next: nextOption = false, react: reactOption = false, reactNative: reactNativeOption = false, regexp: regexpOption = true, sortImports = true, sortKeys = true, typeChecked = false, typescript: tsOption = true, yml: ymlOption = true } = options;
|
|
484
497
|
const configs = [
|
|
485
498
|
ignores(userIgnores),
|
|
486
499
|
...javascript(),
|
|
@@ -520,6 +533,10 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
520
533
|
regexp: regexpOption
|
|
521
534
|
}),
|
|
522
535
|
...unused(),
|
|
536
|
+
...yml({
|
|
537
|
+
...options,
|
|
538
|
+
yml: ymlOption
|
|
539
|
+
}),
|
|
523
540
|
...eslintCommentsConfig(),
|
|
524
541
|
...userConfigs
|
|
525
542
|
];
|
|
@@ -527,5 +544,5 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
527
544
|
}
|
|
528
545
|
|
|
529
546
|
//#endregion
|
|
530
|
-
export { GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, defineConfig };
|
|
547
|
+
export { GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_JS_ALL, GLOB_SRC, GLOB_TEST, GLOB_TS, GLOB_TSX, GLOB_TS_ALL, GLOB_YAML, defineConfig };
|
|
531
548
|
//# sourceMappingURL=index.js.map
|
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': 0,\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, GLOB_TEST } from '../globs';\n\nconst GLOB_SCRIPTS = ['**/scripts/**'];\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 // Only disallow console.log, allow console.warn/error/info/etc.\n 'no-console': [\n 'error',\n {\n allow: [\n 'warn',\n 'error',\n 'info',\n\n 'table',\n\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n\n 'assert',\n 'clear',\n ],\n },\n ],\n 'no-empty': 'warn',\n 'no-extra-boolean-cast': 'off',\n 'no-unused-vars': 'off',\n },\n },\n // Allow all console in test and script files\n {\n files: [...GLOB_TEST, ...GLOB_SCRIPTS],\n rules: {\n 'no-console': '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': 'off',\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}'];\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 // Styles\n 'unicorn/catch-error-name': 0,\n 'unicorn/explicit-length-check': 0,\n 'unicorn/no-array-callback-reference': 0,\n 'unicorn/require-module-specifiers': 0,\n 'unicorn/no-array-for-each': 0,\n 'unicorn/no-negated-condition': 0,\n 'unicorn/no-null': 0,\n 'unicorn/no-typeof-undefined': 0,\n 'unicorn/no-useless-undefined': 0,\n 'unicorn/prefer-code-point': 0,\n 'unicorn/prefer-number-properties': 0,\n 'unicorn/prefer-query-selector': 0,\n 'unicorn/prefer-spread': 0,\n 'unicorn/prefer-ternary': 0,\n 'unicorn/prefer-type-error': 0,\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, type FlatConfigArray, type 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;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;;;;ACxBD,SAAgB,uBAAuB;AACrC,QAAO,eAAa,CAClB;EACE,GAAG,eAAe;EAClB,OAAO;EACP,OAAO;GACL,GAAG,eAAe,YAAY;GAE9B,yDAAyD;GAEzD,uDAAuD;GAEvD,0DAA0D;GAE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,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","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/configs/yml.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_YAML = ['**/*.yaml', '**/*.yml'];\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': 0,\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, GLOB_TEST } from '../globs';\n\nconst GLOB_SCRIPTS = ['**/scripts/**'];\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 // Only disallow console.log, allow console.warn/error/info/etc.\n 'no-console': [\n 'error',\n {\n allow: [\n 'warn',\n 'error',\n 'info',\n\n 'table',\n\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n\n 'assert',\n 'clear',\n ],\n },\n ],\n 'no-empty': 'warn',\n 'no-extra-boolean-cast': 'off',\n 'no-unused-vars': 'off',\n },\n },\n // Allow all console in test and script files\n {\n files: [...GLOB_TEST, ...GLOB_SCRIPTS],\n rules: {\n 'no-console': '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,\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': 'off',\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}'];\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 // Styles\n 'unicorn/catch-error-name': 0,\n 'unicorn/explicit-length-check': 0,\n 'unicorn/no-array-callback-reference': 0,\n 'unicorn/require-module-specifiers': 0,\n 'unicorn/no-array-for-each': 0,\n 'unicorn/no-negated-condition': 0,\n 'unicorn/no-null': 0,\n 'unicorn/no-typeof-undefined': 0,\n 'unicorn/no-useless-undefined': 0,\n 'unicorn/prefer-code-point': 0,\n 'unicorn/prefer-number-properties': 0,\n 'unicorn/prefer-query-selector': 0,\n 'unicorn/prefer-spread': 0,\n 'unicorn/prefer-ternary': 0,\n 'unicorn/prefer-type-error': 0,\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 { defineConfig } from 'eslint/config';\nimport eslintPluginYml from 'eslint-plugin-yml';\n\nimport { type Options } from '../types';\n\nexport function yml(options: Options) {\n const { yml: ymlOption = true } = options;\n\n if (!ymlOption) return [];\n\n return defineConfig([\n ...eslintPluginYml.configs.recommended,\n {\n rules: {\n 'yml/quotes': [\n 'error',\n {\n avoidEscape: true,\n prefer: 'single',\n },\n ],\n },\n },\n ]);\n}\n","// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./eslint-typegen.d.ts\" />\n\nimport { 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 { yml } from './configs/yml';\nimport { type FlatConfig, type FlatConfigArray, type 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 yml: ymlOption = 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 ...yml({ ...options, yml: ymlOption }),\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;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,YAAY,CAAC,aAAa,UAAW;AAElD,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;ACrBD,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;;;;ACxBD,SAAgB,uBAAuB;AACrC,QAAO,eAAa,CAClB;EACE,GAAG,eAAe;EAClB,OAAO;EACP,OAAO;GACL,GAAG,eAAe,YAAY;GAE9B,yDAAyD;GAEzD,uDAAuD;GAEvD,0DAA0D;GAE1D,0DAA0D;GAE1D,2DAA2D;EAC5D;CAEJ,CAAA,EAAC;A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AAA,EACF,EAEJ,CAAA,EAAC;AACH;;;;ACHD,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,MACvB,KAAK,YAAY,MAClB,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,IAAI;GAAE,GAAG;GAAS,KAAK;EAAW,EAAC;EACtC,GAAG,sBAAsB;EAEzB,GAAG;CACJ;AAED,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/eslint-config",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.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": {
|
|
@@ -46,10 +46,12 @@
|
|
|
46
46
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
47
47
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
48
48
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
49
|
+
"eslint-plugin-yml": "^3.1.2",
|
|
49
50
|
"globals": "^17.3.0",
|
|
50
51
|
"typescript-eslint": "^8.54.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
54
|
+
"eslint-typegen": "^2.3.0",
|
|
53
55
|
"glob": "^13.0.1"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
@@ -69,7 +71,9 @@
|
|
|
69
71
|
"registry": "https://registry.npmjs.org"
|
|
70
72
|
},
|
|
71
73
|
"scripts": {
|
|
74
|
+
"prebuild": "node ./scripts/generate-eslint-typegen.mjs",
|
|
72
75
|
"build": "tsdown",
|
|
76
|
+
"postbuild": "node ./scripts/postbuild.mjs",
|
|
73
77
|
"dev": "tsdown --watch",
|
|
74
78
|
"test": "vitest run",
|
|
75
79
|
"type-check": "tsc --noEmit"
|