@fast-china/eslint-config 2.0.2 → 2.0.4
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/CHANGELOG.md +23 -1
- package/README.md +77 -18
- package/README.zh.md +77 -18
- package/dist/configs/angular.d.mts +41 -0
- package/dist/configs/angular.d.mts.map +1 -0
- package/dist/configs/angular.mjs +33 -0
- package/dist/configs/angular.mjs.map +1 -0
- package/dist/configs/common.d.mts +11 -0
- package/dist/configs/common.d.mts.map +1 -0
- package/dist/configs/common.mjs +20 -0
- package/dist/configs/common.mjs.map +1 -0
- package/dist/configs/environment.d.mts +61 -0
- package/dist/configs/environment.d.mts.map +1 -0
- package/dist/configs/environment.mjs +33 -0
- package/dist/configs/environment.mjs.map +1 -0
- package/dist/configs/ignores.d.mts +15 -0
- package/dist/configs/ignores.d.mts.map +1 -0
- package/dist/configs/ignores.mjs +32 -0
- package/dist/configs/ignores.mjs.map +1 -0
- package/dist/configs/import.d.mts +11 -0
- package/dist/configs/import.d.mts.map +1 -0
- package/dist/configs/import.mjs +21 -0
- package/dist/configs/import.mjs.map +1 -0
- package/dist/configs/index.d.mts +17 -0
- package/dist/configs/index.mjs +17 -0
- package/dist/configs/javascript.d.mts +10 -0
- package/dist/configs/javascript.d.mts.map +1 -0
- package/dist/configs/javascript.mjs +24 -0
- package/dist/configs/javascript.mjs.map +1 -0
- package/dist/configs/json.d.mts +10 -0
- package/dist/configs/json.d.mts.map +1 -0
- package/dist/configs/json.mjs +35 -0
- package/dist/configs/json.mjs.map +1 -0
- package/dist/configs/lodash.d.mts +12 -0
- package/dist/configs/lodash.d.mts.map +1 -0
- package/dist/configs/lodash.mjs +18 -0
- package/dist/configs/lodash.mjs.map +1 -0
- package/dist/configs/markdown.d.mts +10 -0
- package/dist/configs/markdown.d.mts.map +1 -0
- package/dist/configs/markdown.mjs +18 -0
- package/dist/configs/markdown.mjs.map +1 -0
- package/dist/configs/prettier.d.mts +11 -0
- package/dist/configs/prettier.d.mts.map +1 -0
- package/dist/configs/prettier.mjs +17 -0
- package/dist/configs/prettier.mjs.map +1 -0
- package/dist/configs/react.d.mts +86 -0
- package/dist/configs/react.d.mts.map +1 -0
- package/dist/configs/react.mjs +31 -0
- package/dist/configs/react.mjs.map +1 -0
- package/dist/configs/regexp.d.mts +11 -0
- package/dist/configs/regexp.d.mts.map +1 -0
- package/dist/configs/regexp.mjs +19 -0
- package/dist/configs/regexp.mjs.map +1 -0
- package/dist/configs/sort-package.d.mts +11 -0
- package/dist/configs/sort-package.d.mts.map +1 -0
- package/dist/configs/sort-package.mjs +18 -0
- package/dist/configs/sort-package.mjs.map +1 -0
- package/dist/configs/sort-tsconfig.d.mts +10 -0
- package/dist/configs/sort-tsconfig.d.mts.map +1 -0
- package/dist/configs/sort-tsconfig.mjs +18 -0
- package/dist/configs/sort-tsconfig.mjs.map +1 -0
- package/dist/configs/typescript.d.mts +60 -0
- package/dist/configs/typescript.d.mts.map +1 -0
- package/dist/configs/typescript.mjs +44 -0
- package/dist/configs/typescript.mjs.map +1 -0
- package/dist/configs/vue.d.mts +43 -0
- package/dist/configs/vue.d.mts.map +1 -0
- package/dist/configs/vue.mjs +50 -0
- package/dist/configs/vue.mjs.map +1 -0
- package/dist/constants/index.d.mts +34 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +52 -0
- package/dist/constants/index.mjs.map +1 -0
- package/dist/index.d.mts +20 -147
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +31 -402
- package/dist/index.mjs.map +1 -1
- package/dist/rules/angular.d.mts +46 -0
- package/dist/rules/angular.d.mts.map +1 -0
- package/dist/rules/angular.mjs +47 -0
- package/dist/rules/angular.mjs.map +1 -0
- package/dist/rules/common.d.mts +32 -0
- package/dist/rules/common.d.mts.map +1 -0
- package/dist/rules/common.mjs +38 -0
- package/dist/rules/common.mjs.map +1 -0
- package/dist/rules/import.d.mts +24 -0
- package/dist/rules/import.d.mts.map +1 -0
- package/dist/rules/import.mjs +35 -0
- package/dist/rules/import.mjs.map +1 -0
- package/dist/rules/index.d.mts +12 -309
- package/dist/rules/index.mjs +10 -1
- package/dist/rules/javascript.d.mts +48 -0
- package/dist/rules/javascript.d.mts.map +1 -0
- package/dist/rules/javascript.mjs +49 -0
- package/dist/rules/javascript.mjs.map +1 -0
- package/dist/rules/lodash.d.mts +40 -0
- package/dist/rules/lodash.d.mts.map +1 -0
- package/dist/rules/lodash.mjs +43 -0
- package/dist/rules/lodash.mjs.map +1 -0
- package/dist/rules/react.d.mts +26 -0
- package/dist/rules/react.d.mts.map +1 -0
- package/dist/rules/react.mjs +27 -0
- package/dist/rules/react.mjs.map +1 -0
- package/dist/rules/sort-package.d.mts +32 -0
- package/dist/rules/sort-package.d.mts.map +1 -0
- package/dist/rules/sort-package.mjs +75 -0
- package/dist/rules/sort-package.mjs.map +1 -0
- package/dist/rules/sort-tsconfig.d.mts +20 -0
- package/dist/rules/sort-tsconfig.d.mts.map +1 -0
- package/dist/rules/sort-tsconfig.mjs +122 -0
- package/dist/rules/sort-tsconfig.mjs.map +1 -0
- package/dist/rules/typescript.d.mts +34 -0
- package/dist/rules/typescript.d.mts.map +1 -0
- package/dist/rules/typescript.mjs +35 -0
- package/dist/rules/typescript.mjs.map +1 -0
- package/dist/rules/vue.d.mts +24 -0
- package/dist/rules/vue.d.mts.map +1 -0
- package/dist/rules/vue.mjs +33 -0
- package/dist/rules/vue.mjs.map +1 -0
- package/dist/typegen.d.mts +1 -1
- package/docs/engineering-audit.zh.md +25 -23
- package/docs/rules-risk.md +3 -3
- package/docs/rules-risk.zh.md +3 -3
- package/package.json +16 -6
- package/dist/rules/index.d.mts.map +0 -1
- package/dist/rules.mjs +0 -477
- package/dist/rules.mjs.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/rules/sort-package.ts
|
|
2
|
+
/**
|
|
3
|
+
* package.json 属性排序规则。
|
|
4
|
+
*
|
|
5
|
+
* `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。
|
|
6
|
+
* 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。
|
|
7
|
+
*/
|
|
8
|
+
const packageJsonSortRules = {
|
|
9
|
+
"jsonc/sort-array-values": ["error", {
|
|
10
|
+
order: { type: "asc" },
|
|
11
|
+
pathPattern: "^files$"
|
|
12
|
+
}],
|
|
13
|
+
"jsonc/sort-keys": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
order: [
|
|
17
|
+
"name",
|
|
18
|
+
"version",
|
|
19
|
+
"private",
|
|
20
|
+
"packageManager",
|
|
21
|
+
"description",
|
|
22
|
+
"type",
|
|
23
|
+
"keywords",
|
|
24
|
+
"license",
|
|
25
|
+
"homepage",
|
|
26
|
+
"bugs",
|
|
27
|
+
"repository",
|
|
28
|
+
"author",
|
|
29
|
+
"contributors",
|
|
30
|
+
"funding",
|
|
31
|
+
"files",
|
|
32
|
+
"main",
|
|
33
|
+
"module",
|
|
34
|
+
"types",
|
|
35
|
+
"exports",
|
|
36
|
+
"typesVersions",
|
|
37
|
+
"sideEffects",
|
|
38
|
+
"unpkg",
|
|
39
|
+
"jsdelivr",
|
|
40
|
+
"browser",
|
|
41
|
+
"bin",
|
|
42
|
+
"man",
|
|
43
|
+
"directories",
|
|
44
|
+
"publishConfig",
|
|
45
|
+
"scripts",
|
|
46
|
+
"peerDependencies",
|
|
47
|
+
"peerDependenciesMeta",
|
|
48
|
+
"optionalDependencies",
|
|
49
|
+
"dependencies",
|
|
50
|
+
"devDependencies",
|
|
51
|
+
"engines",
|
|
52
|
+
"config",
|
|
53
|
+
"overrides",
|
|
54
|
+
"pnpm",
|
|
55
|
+
"husky",
|
|
56
|
+
"lint-staged",
|
|
57
|
+
"eslintConfig",
|
|
58
|
+
"prettier"
|
|
59
|
+
],
|
|
60
|
+
pathPattern: "^$"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
order: { type: "asc" },
|
|
64
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
order: { type: "asc" },
|
|
68
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { packageJsonSortRules };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=sort-package.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-package.mjs","names":[],"sources":["../../src/rules/sort-package.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * package.json 属性排序规则。\n *\n * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。\n * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。\n */\nexport const packageJsonSortRules = {\n\t// [高影响][可自动修复][按需启用] npm 的 files 清单按字母排序;数组顺序不改打包集合,但首次 diff 较大。\n\t\"jsonc/sort-array-values\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^files$\",\n\t\t},\n\t],\n\t// [高影响][可自动修复][按需启用] 仅排序明确安全的 package.json 区域,不进入 exports 条件对象。\n\t\"jsonc/sort-keys\": [\n\t\t\"error\",\n\t\t// 根字段按常见阅读顺序组织,减少不同项目之间的清单噪声。\n\t\t{\n\t\t\torder: [\n\t\t\t\t\"name\",\n\t\t\t\t\"version\",\n\t\t\t\t\"private\",\n\t\t\t\t\"packageManager\",\n\t\t\t\t\"description\",\n\t\t\t\t\"type\",\n\t\t\t\t\"keywords\",\n\t\t\t\t\"license\",\n\t\t\t\t\"homepage\",\n\t\t\t\t\"bugs\",\n\t\t\t\t\"repository\",\n\t\t\t\t\"author\",\n\t\t\t\t\"contributors\",\n\t\t\t\t\"funding\",\n\t\t\t\t\"files\",\n\t\t\t\t\"main\",\n\t\t\t\t\"module\",\n\t\t\t\t\"types\",\n\t\t\t\t\"exports\",\n\t\t\t\t\"typesVersions\",\n\t\t\t\t\"sideEffects\",\n\t\t\t\t\"unpkg\",\n\t\t\t\t\"jsdelivr\",\n\t\t\t\t\"browser\",\n\t\t\t\t\"bin\",\n\t\t\t\t\"man\",\n\t\t\t\t\"directories\",\n\t\t\t\t\"publishConfig\",\n\t\t\t\t\"scripts\",\n\t\t\t\t\"peerDependencies\",\n\t\t\t\t\"peerDependenciesMeta\",\n\t\t\t\t\"optionalDependencies\",\n\t\t\t\t\"dependencies\",\n\t\t\t\t\"devDependencies\",\n\t\t\t\t\"engines\",\n\t\t\t\t\"config\",\n\t\t\t\t\"overrides\",\n\t\t\t\t\"pnpm\",\n\t\t\t\t\"husky\",\n\t\t\t\t\"lint-staged\",\n\t\t\t\t\"eslintConfig\",\n\t\t\t\t\"prettier\",\n\t\t\t],\n\t\t\tpathPattern: \"^$\",\n\t\t},\n\t\t// 各类依赖映射按包名排序,方便发现重复或异常依赖。\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$\",\n\t\t},\n\t\t// overrides/resolutions 只排序直接键;修改前仍应关注包管理器的模式匹配语义。\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^(?:resolutions|overrides|pnpm.overrides)$\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;AAQA,MAAa,uBAAuB;CAEnC,2BAA2B,CAC1B,SACA;EACC,OAAO,EAAE,MAAM,MAAM;EACrB,aAAa;CACd,CACD;CAEA,mBAAmB;EAClB;EAEA;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;GACA,aAAa;EACd;EAEA;GACC,OAAO,EAAE,MAAM,MAAM;GACrB,aAAa;EACd;EAEA;GACC,OAAO,EAAE,MAAM,MAAM;GACrB,aAAa;EACd;CACD;AACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/rules/sort-tsconfig.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* tsconfig.json 属性排序规则。
|
|
4
|
+
*
|
|
5
|
+
* `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,
|
|
6
|
+
* 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。
|
|
7
|
+
*/
|
|
8
|
+
declare const tsconfigJsonSortRules: {
|
|
9
|
+
"jsonc/no-comments": "off";
|
|
10
|
+
"jsonc/sort-keys": ["error", {
|
|
11
|
+
order: string[];
|
|
12
|
+
pathPattern: string;
|
|
13
|
+
}, {
|
|
14
|
+
order: string[];
|
|
15
|
+
pathPattern: string;
|
|
16
|
+
}];
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { tsconfigJsonSortRules };
|
|
20
|
+
//# sourceMappingURL=sort-tsconfig.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-tsconfig.d.mts","names":[],"sources":["../../src/rules/sort-tsconfig.ts"],"mappings":";;;;;;;cAQa"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//#region src/rules/sort-tsconfig.ts
|
|
2
|
+
/**
|
|
3
|
+
* tsconfig.json 属性排序规则。
|
|
4
|
+
*
|
|
5
|
+
* `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,
|
|
6
|
+
* 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。
|
|
7
|
+
*/
|
|
8
|
+
const tsconfigJsonSortRules = {
|
|
9
|
+
"jsonc/no-comments": "off",
|
|
10
|
+
"jsonc/sort-keys": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
order: [
|
|
14
|
+
"extends",
|
|
15
|
+
"compilerOptions",
|
|
16
|
+
"references",
|
|
17
|
+
"files",
|
|
18
|
+
"include",
|
|
19
|
+
"exclude"
|
|
20
|
+
],
|
|
21
|
+
pathPattern: "^$"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
order: [
|
|
25
|
+
"incremental",
|
|
26
|
+
"composite",
|
|
27
|
+
"tsBuildInfoFile",
|
|
28
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
29
|
+
"disableSolutionSearching",
|
|
30
|
+
"disableReferencedProjectLoad",
|
|
31
|
+
"target",
|
|
32
|
+
"jsx",
|
|
33
|
+
"jsxFactory",
|
|
34
|
+
"jsxFragmentFactory",
|
|
35
|
+
"jsxImportSource",
|
|
36
|
+
"lib",
|
|
37
|
+
"moduleDetection",
|
|
38
|
+
"noLib",
|
|
39
|
+
"reactNamespace",
|
|
40
|
+
"useDefineForClassFields",
|
|
41
|
+
"emitDecoratorMetadata",
|
|
42
|
+
"experimentalDecorators",
|
|
43
|
+
"baseUrl",
|
|
44
|
+
"rootDir",
|
|
45
|
+
"rootDirs",
|
|
46
|
+
"customConditions",
|
|
47
|
+
"module",
|
|
48
|
+
"moduleResolution",
|
|
49
|
+
"moduleSuffixes",
|
|
50
|
+
"noResolve",
|
|
51
|
+
"paths",
|
|
52
|
+
"resolveJsonModule",
|
|
53
|
+
"resolvePackageJsonExports",
|
|
54
|
+
"resolvePackageJsonImports",
|
|
55
|
+
"typeRoots",
|
|
56
|
+
"types",
|
|
57
|
+
"allowArbitraryExtensions",
|
|
58
|
+
"allowImportingTsExtensions",
|
|
59
|
+
"allowUmdGlobalAccess",
|
|
60
|
+
"allowJs",
|
|
61
|
+
"checkJs",
|
|
62
|
+
"maxNodeModuleJsDepth",
|
|
63
|
+
"strict",
|
|
64
|
+
"strictBindCallApply",
|
|
65
|
+
"strictFunctionTypes",
|
|
66
|
+
"strictNullChecks",
|
|
67
|
+
"strictPropertyInitialization",
|
|
68
|
+
"allowUnreachableCode",
|
|
69
|
+
"allowUnusedLabels",
|
|
70
|
+
"alwaysStrict",
|
|
71
|
+
"exactOptionalPropertyTypes",
|
|
72
|
+
"noFallthroughCasesInSwitch",
|
|
73
|
+
"noImplicitAny",
|
|
74
|
+
"noImplicitOverride",
|
|
75
|
+
"noImplicitReturns",
|
|
76
|
+
"noImplicitThis",
|
|
77
|
+
"noPropertyAccessFromIndexSignature",
|
|
78
|
+
"noUncheckedIndexedAccess",
|
|
79
|
+
"noUnusedLocals",
|
|
80
|
+
"noUnusedParameters",
|
|
81
|
+
"useUnknownInCatchVariables",
|
|
82
|
+
"declaration",
|
|
83
|
+
"declarationDir",
|
|
84
|
+
"declarationMap",
|
|
85
|
+
"downlevelIteration",
|
|
86
|
+
"emitBOM",
|
|
87
|
+
"emitDeclarationOnly",
|
|
88
|
+
"importHelpers",
|
|
89
|
+
"importsNotUsedAsValues",
|
|
90
|
+
"inlineSourceMap",
|
|
91
|
+
"inlineSources",
|
|
92
|
+
"isolatedDeclarations",
|
|
93
|
+
"mapRoot",
|
|
94
|
+
"newLine",
|
|
95
|
+
"noEmit",
|
|
96
|
+
"noEmitHelpers",
|
|
97
|
+
"noEmitOnError",
|
|
98
|
+
"outDir",
|
|
99
|
+
"outFile",
|
|
100
|
+
"preserveConstEnums",
|
|
101
|
+
"preserveValueImports",
|
|
102
|
+
"removeComments",
|
|
103
|
+
"sourceMap",
|
|
104
|
+
"sourceRoot",
|
|
105
|
+
"stripInternal",
|
|
106
|
+
"allowSyntheticDefaultImports",
|
|
107
|
+
"esModuleInterop",
|
|
108
|
+
"forceConsistentCasingInFileNames",
|
|
109
|
+
"isolatedModules",
|
|
110
|
+
"preserveSymlinks",
|
|
111
|
+
"verbatimModuleSyntax",
|
|
112
|
+
"skipDefaultLibCheck",
|
|
113
|
+
"skipLibCheck"
|
|
114
|
+
],
|
|
115
|
+
pathPattern: "^compilerOptions$"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { tsconfigJsonSortRules };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=sort-tsconfig.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-tsconfig.mjs","names":[],"sources":["../../src/rules/sort-tsconfig.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * tsconfig.json 属性排序规则。\n *\n * `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,\n * 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。\n */\nexport const tsconfigJsonSortRules = {\n\t// tsconfig 是 JSONC,注释用于解释不直观的编译器取舍,必须保留。\n\t\"jsonc/no-comments\": \"off\",\n\n\t// [高影响][可自动修复][按需启用] 只调整顶层和 compilerOptions 的键顺序,不改写任何选项值或数组。\n\t\"jsonc/sort-keys\": [\n\t\t\"error\",\n\t\t// 顶层按继承、选项、项目引用和文件范围的阅读顺序排列。\n\t\t{\n\t\t\torder: [\"extends\", \"compilerOptions\", \"references\", \"files\", \"include\", \"exclude\"],\n\t\t\tpathPattern: \"^$\",\n\t\t},\n\t\t// compilerOptions 的顺序跟随 TypeScript 文档主题,便于检索和代码审查。\n\t\t{\n\t\t\torder: [\n\t\t\t\t/* Projects */\n\t\t\t\t\"incremental\",\n\t\t\t\t\"composite\",\n\t\t\t\t\"tsBuildInfoFile\",\n\t\t\t\t\"disableSourceOfProjectReferenceRedirect\",\n\t\t\t\t\"disableSolutionSearching\",\n\t\t\t\t\"disableReferencedProjectLoad\",\n\t\t\t\t/* Language and Environment */\n\t\t\t\t\"target\",\n\t\t\t\t\"jsx\",\n\t\t\t\t\"jsxFactory\",\n\t\t\t\t\"jsxFragmentFactory\",\n\t\t\t\t\"jsxImportSource\",\n\t\t\t\t\"lib\",\n\t\t\t\t\"moduleDetection\",\n\t\t\t\t\"noLib\",\n\t\t\t\t\"reactNamespace\",\n\t\t\t\t\"useDefineForClassFields\",\n\t\t\t\t\"emitDecoratorMetadata\",\n\t\t\t\t\"experimentalDecorators\",\n\t\t\t\t/* Modules */\n\t\t\t\t\"baseUrl\",\n\t\t\t\t\"rootDir\",\n\t\t\t\t\"rootDirs\",\n\t\t\t\t\"customConditions\",\n\t\t\t\t\"module\",\n\t\t\t\t\"moduleResolution\",\n\t\t\t\t\"moduleSuffixes\",\n\t\t\t\t\"noResolve\",\n\t\t\t\t\"paths\",\n\t\t\t\t\"resolveJsonModule\",\n\t\t\t\t\"resolvePackageJsonExports\",\n\t\t\t\t\"resolvePackageJsonImports\",\n\t\t\t\t\"typeRoots\",\n\t\t\t\t\"types\",\n\t\t\t\t\"allowArbitraryExtensions\",\n\t\t\t\t\"allowImportingTsExtensions\",\n\t\t\t\t\"allowUmdGlobalAccess\",\n\t\t\t\t/* JavaScript Support */\n\t\t\t\t\"allowJs\",\n\t\t\t\t\"checkJs\",\n\t\t\t\t\"maxNodeModuleJsDepth\",\n\t\t\t\t/* Type Checking */\n\t\t\t\t\"strict\",\n\t\t\t\t\"strictBindCallApply\",\n\t\t\t\t\"strictFunctionTypes\",\n\t\t\t\t\"strictNullChecks\",\n\t\t\t\t\"strictPropertyInitialization\",\n\t\t\t\t\"allowUnreachableCode\",\n\t\t\t\t\"allowUnusedLabels\",\n\t\t\t\t\"alwaysStrict\",\n\t\t\t\t\"exactOptionalPropertyTypes\",\n\t\t\t\t\"noFallthroughCasesInSwitch\",\n\t\t\t\t\"noImplicitAny\",\n\t\t\t\t\"noImplicitOverride\",\n\t\t\t\t\"noImplicitReturns\",\n\t\t\t\t\"noImplicitThis\",\n\t\t\t\t\"noPropertyAccessFromIndexSignature\",\n\t\t\t\t\"noUncheckedIndexedAccess\",\n\t\t\t\t\"noUnusedLocals\",\n\t\t\t\t\"noUnusedParameters\",\n\t\t\t\t\"useUnknownInCatchVariables\",\n\t\t\t\t/* Emit */\n\t\t\t\t\"declaration\",\n\t\t\t\t\"declarationDir\",\n\t\t\t\t\"declarationMap\",\n\t\t\t\t\"downlevelIteration\",\n\t\t\t\t\"emitBOM\",\n\t\t\t\t\"emitDeclarationOnly\",\n\t\t\t\t\"importHelpers\",\n\t\t\t\t\"importsNotUsedAsValues\",\n\t\t\t\t\"inlineSourceMap\",\n\t\t\t\t\"inlineSources\",\n\t\t\t\t\"isolatedDeclarations\",\n\t\t\t\t\"mapRoot\",\n\t\t\t\t\"newLine\",\n\t\t\t\t\"noEmit\",\n\t\t\t\t\"noEmitHelpers\",\n\t\t\t\t\"noEmitOnError\",\n\t\t\t\t\"outDir\",\n\t\t\t\t\"outFile\",\n\t\t\t\t\"preserveConstEnums\",\n\t\t\t\t\"preserveValueImports\",\n\t\t\t\t\"removeComments\",\n\t\t\t\t\"sourceMap\",\n\t\t\t\t\"sourceRoot\",\n\t\t\t\t\"stripInternal\",\n\t\t\t\t/* Interop Constraints */\n\t\t\t\t\"allowSyntheticDefaultImports\",\n\t\t\t\t\"esModuleInterop\",\n\t\t\t\t\"forceConsistentCasingInFileNames\",\n\t\t\t\t\"isolatedModules\",\n\t\t\t\t\"preserveSymlinks\",\n\t\t\t\t\"verbatimModuleSyntax\",\n\t\t\t\t/* Completeness */\n\t\t\t\t\"skipDefaultLibCheck\",\n\t\t\t\t\"skipLibCheck\",\n\t\t\t],\n\t\t\tpathPattern: \"^compilerOptions$\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;AAQA,MAAa,wBAAwB;CAEpC,qBAAqB;CAGrB,mBAAmB;EAClB;EAEA;GACC,OAAO;IAAC;IAAW;IAAmB;IAAc;IAAS;IAAW;GAAS;GACjF,aAAa;EACd;EAEA;GACC,OAAO;IAEN;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;GACD;GACA,aAAa;EACd;CACD;AACD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/rules/typescript.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript 本地覆写规则。
|
|
4
|
+
* 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。
|
|
5
|
+
*/
|
|
6
|
+
declare const typescriptRules: {
|
|
7
|
+
"@typescript-eslint/no-redeclare": "error";
|
|
8
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
9
|
+
args: "after-used";
|
|
10
|
+
argsIgnorePattern: string;
|
|
11
|
+
caughtErrors: "all";
|
|
12
|
+
caughtErrorsIgnorePattern: string;
|
|
13
|
+
ignoreRestSiblings: true;
|
|
14
|
+
varsIgnorePattern: string;
|
|
15
|
+
}];
|
|
16
|
+
"@typescript-eslint/no-namespace": "off";
|
|
17
|
+
"@typescript-eslint/no-explicit-any": "warn";
|
|
18
|
+
"@typescript-eslint/no-require-imports": "error";
|
|
19
|
+
"@typescript-eslint/no-unused-expressions": ["error", {
|
|
20
|
+
allowShortCircuit: true;
|
|
21
|
+
allowTernary: true;
|
|
22
|
+
}];
|
|
23
|
+
"@typescript-eslint/no-inferrable-types": "error";
|
|
24
|
+
"@typescript-eslint/no-non-null-assertion": "warn";
|
|
25
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error";
|
|
26
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
27
|
+
disallowTypeAnnotations: false;
|
|
28
|
+
fixStyle: "inline-type-imports";
|
|
29
|
+
prefer: "type-imports";
|
|
30
|
+
}];
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { typescriptRules };
|
|
34
|
+
//# sourceMappingURL=typescript.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.mts","names":[],"sources":["../../src/rules/typescript.ts"],"mappings":";;;;;cAMa"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/rules/typescript.ts
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript 本地覆写规则。
|
|
4
|
+
* 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。
|
|
5
|
+
*/
|
|
6
|
+
const typescriptRules = {
|
|
7
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
8
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
9
|
+
args: "after-used",
|
|
10
|
+
argsIgnorePattern: "^_",
|
|
11
|
+
caughtErrors: "all",
|
|
12
|
+
caughtErrorsIgnorePattern: "^_",
|
|
13
|
+
ignoreRestSiblings: true,
|
|
14
|
+
varsIgnorePattern: "^_"
|
|
15
|
+
}],
|
|
16
|
+
"@typescript-eslint/no-namespace": "off",
|
|
17
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
18
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
19
|
+
"@typescript-eslint/no-unused-expressions": ["error", {
|
|
20
|
+
allowShortCircuit: true,
|
|
21
|
+
allowTernary: true
|
|
22
|
+
}],
|
|
23
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
24
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
25
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
26
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
27
|
+
disallowTypeAnnotations: false,
|
|
28
|
+
fixStyle: "inline-type-imports",
|
|
29
|
+
prefer: "type-imports"
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { typescriptRules };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=typescript.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/rules/typescript.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * TypeScript 本地覆写规则。\n * 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。\n */\nexport const typescriptRules = {\n\t// 使用 TypeScript 版本避免核心规则误判声明合并、类型和值的同名声明。\n\t\"@typescript-eslint/no-redeclare\": \"error\",\n\t// [高影响][可自动修复] 未使用符号视为错误;以下划线开头可显式表示参数或变量被有意忽略。\n\t\"@typescript-eslint/no-unused-vars\": [\n\t\t\"error\",\n\t\t{\n\t\t\targs: \"after-used\",\n\t\t\targsIgnorePattern: \"^_\",\n\t\t\tcaughtErrors: \"all\",\n\t\t\tcaughtErrorsIgnorePattern: \"^_\",\n\t\t\tignoreRestSiblings: true,\n\t\t\tvarsIgnorePattern: \"^_\",\n\t\t},\n\t],\n\t// [默认关闭] 声明文件、全局扩展和部分 SDK 仍需要 namespace。\n\t\"@typescript-eslint/no-namespace\": \"off\",\n\t// any 会绕过类型检查,但在第三方边界和渐进式类型完善中有合理用途,因此只警告。\n\t\"@typescript-eslint/no-explicit-any\": \"warn\",\n\t// [高影响] 默认要求 ESM import;CommonJS、动态加载或工具链互操作代码可能需要按文件关闭。\n\t\"@typescript-eslint/no-require-imports\": \"error\",\n\t// 使用 TS 版本识别类型断言等语法;允许常见的短路和三元表达式调用模式。\n\t\"@typescript-eslint/no-unused-expressions\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowShortCircuit: true,\n\t\t\tallowTernary: true,\n\t\t},\n\t],\n\t// [可自动修复] 删除可由 TypeScript 明确推断的原始值类型标注,减少重复信息。\n\t\"@typescript-eslint/no-inferrable-types\": \"error\",\n\t// 非空断言可能隐藏空值缺陷;以警告提示逐步消除,避免一次性产生大量阻断错误。\n\t\"@typescript-eslint/no-non-null-assertion\": \"warn\",\n\t// 可选链之后再做非空断言逻辑矛盾,通常表示边界条件设计有误。\n\t\"@typescript-eslint/no-non-null-asserted-optional-chain\": \"error\",\n\t// [高影响][可自动修复] 类型依赖改用内联 type import;需复核仅靠 import 触发的模块副作用。\n\t\"@typescript-eslint/consistent-type-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tdisallowTypeAnnotations: false,\n\t\t\tfixStyle: \"inline-type-imports\",\n\t\t\tprefer: \"type-imports\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;AAMA,MAAa,kBAAkB;CAE9B,mCAAmC;CAEnC,qCAAqC,CACpC,SACA;EACC,MAAM;EACN,mBAAmB;EACnB,cAAc;EACd,2BAA2B;EAC3B,oBAAoB;EACpB,mBAAmB;CACpB,CACD;CAEA,mCAAmC;CAEnC,sCAAsC;CAEtC,yCAAyC;CAEzC,4CAA4C,CAC3C,SACA;EACC,mBAAmB;EACnB,cAAc;CACf,CACD;CAEA,0CAA0C;CAE1C,4CAA4C;CAE5C,0DAA0D;CAE1D,8CAA8C,CAC7C,SACA;EACC,yBAAyB;EACzB,UAAU;EACV,QAAQ;CACT,CACD;AACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/rules/vue.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Vue SFC 本地覆写规则。
|
|
4
|
+
* 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。
|
|
5
|
+
*/
|
|
6
|
+
declare const vueRules: {
|
|
7
|
+
"vue/no-v-html": "warn";
|
|
8
|
+
"vue/require-default-prop": "off";
|
|
9
|
+
"vue/require-explicit-emits": "error";
|
|
10
|
+
"vue/multi-word-component-names": "off";
|
|
11
|
+
"vue/prefer-import-from-vue": "warn";
|
|
12
|
+
"vue/no-dupe-keys": "error";
|
|
13
|
+
"vue/no-mutating-props": "error";
|
|
14
|
+
"vue/no-reserved-component-names": "error";
|
|
15
|
+
"vue/no-v-text-v-html-on-component": "error";
|
|
16
|
+
"vue/custom-event-name-casing": ["error", "camelCase"];
|
|
17
|
+
"vue/one-component-per-file": "off";
|
|
18
|
+
"vue/attributes-order": ["error", {
|
|
19
|
+
order: ("DEFINITION" | "LIST_RENDERING" | "CONDITIONALS" | "RENDER_MODIFIERS" | "GLOBAL" | "UNIQUE" | "OTHER_ATTR" | "EVENTS" | "CONTENT")[];
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { vueRules };
|
|
24
|
+
//# sourceMappingURL=vue.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.mts","names":[],"sources":["../../src/rules/vue.ts"],"mappings":";;;;;cAMa"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/rules/vue.ts
|
|
2
|
+
/**
|
|
3
|
+
* Vue SFC 本地覆写规则。
|
|
4
|
+
* 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。
|
|
5
|
+
*/
|
|
6
|
+
const vueRules = {
|
|
7
|
+
"vue/no-v-html": "warn",
|
|
8
|
+
"vue/require-default-prop": "off",
|
|
9
|
+
"vue/require-explicit-emits": "error",
|
|
10
|
+
"vue/multi-word-component-names": "off",
|
|
11
|
+
"vue/prefer-import-from-vue": "warn",
|
|
12
|
+
"vue/no-dupe-keys": "error",
|
|
13
|
+
"vue/no-mutating-props": "error",
|
|
14
|
+
"vue/no-reserved-component-names": "error",
|
|
15
|
+
"vue/no-v-text-v-html-on-component": "error",
|
|
16
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
17
|
+
"vue/one-component-per-file": "off",
|
|
18
|
+
"vue/attributes-order": ["error", { order: [
|
|
19
|
+
"DEFINITION",
|
|
20
|
+
"LIST_RENDERING",
|
|
21
|
+
"CONDITIONALS",
|
|
22
|
+
"RENDER_MODIFIERS",
|
|
23
|
+
"GLOBAL",
|
|
24
|
+
"UNIQUE",
|
|
25
|
+
"OTHER_ATTR",
|
|
26
|
+
"EVENTS",
|
|
27
|
+
"CONTENT"
|
|
28
|
+
] }]
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { vueRules };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=vue.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.mjs","names":[],"sources":["../../src/rules/vue.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * Vue SFC 本地覆写规则。\n * 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。\n */\nexport const vueRules = {\n\t// [安全关注] v-html 可能引入 XSS;保留 warn 以兼容经过净化的富文本场景。\n\t\"vue/no-v-html\": \"warn\",\n\t// [默认关闭] TypeScript 类型 props 和 required 声明已能表达可选性,不强制每个可选 prop 提供默认值。\n\t\"vue/require-default-prop\": \"off\",\n\t// [高影响] 组件必须声明对外事件;首次启用时会暴露未建模的公共事件 API。\n\t\"vue/require-explicit-emits\": \"error\",\n\t// [默认关闭] 允许 App、Layout 等约定俗成的单词组件名。\n\t\"vue/multi-word-component-names\": \"off\",\n\t// 优先从 vue 入口导入由 Vue 重新导出的 API,避免依赖内部包边界。\n\t\"vue/prefer-import-from-vue\": \"warn\",\n\n\t// 防止 props、data、computed、methods 等组件命名空间出现冲突。\n\t\"vue/no-dupe-keys\": \"error\",\n\t// [高影响] 禁止组件直接修改 props,要求通过事件或本地状态维持单向数据流。\n\t\"vue/no-mutating-props\": \"error\",\n\t// 避免自定义组件名与 Vue 内置组件冲突。\n\t\"vue/no-reserved-component-names\": \"error\",\n\t// [安全关注] 禁止在组件节点上使用 v-text/v-html,避免覆盖组件内容和模糊数据边界。\n\t\"vue/no-v-text-v-html-on-component\": \"error\",\n\t// 统一模板与脚本中的自定义事件名称为 camelCase。\n\t\"vue/custom-event-name-casing\": [\"error\", \"camelCase\"],\n\t// [默认关闭] 允许在一个 SFC 中声明仅供当前文件使用的小型辅助组件。\n\t\"vue/one-component-per-file\": \"off\",\n\t// [高影响][可自动修复] 统一模板属性分组;首次启用可能产生大量仅排序的模板差异。\n\t\"vue/attributes-order\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: [\"DEFINITION\", \"LIST_RENDERING\", \"CONDITIONALS\", \"RENDER_MODIFIERS\", \"GLOBAL\", \"UNIQUE\", \"OTHER_ATTR\", \"EVENTS\", \"CONTENT\"],\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;AAMA,MAAa,WAAW;CAEvB,iBAAiB;CAEjB,4BAA4B;CAE5B,8BAA8B;CAE9B,kCAAkC;CAElC,8BAA8B;CAG9B,oBAAoB;CAEpB,yBAAyB;CAEzB,mCAAmC;CAEnC,qCAAqC;CAErC,gCAAgC,CAAC,SAAS,WAAW;CAErD,8BAA8B;CAE9B,wBAAwB,CACvB,SACA,EACC,OAAO;EAAC;EAAc;EAAkB;EAAgB;EAAoB;EAAU;EAAU;EAAc;EAAU;CAAS,EAClI,CACD;AACD"}
|
package/dist/typegen.d.mts
CHANGED
|
@@ -10491,5 +10491,5 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
10491
10491
|
onlyEquality?: boolean;
|
|
10492
10492
|
}];
|
|
10493
10493
|
//#endregion
|
|
10494
|
-
export { RuleOptions
|
|
10494
|
+
export { RuleOptions };
|
|
10495
10495
|
//# sourceMappingURL=typegen.d.mts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# 工程质量审查报告
|
|
2
2
|
|
|
3
|
-
审查日期:2026-
|
|
3
|
+
审查日期:2026-08-02
|
|
4
4
|
|
|
5
|
-
审查对象:`@fast-china/eslint-config` 2.0.
|
|
5
|
+
审查对象:`@fast-china/eslint-config` 2.0.4 工作区
|
|
6
6
|
|
|
7
7
|
## 结论
|
|
8
8
|
|
|
9
9
|
当前仓库已经具备完整 ESLint Flat Config 开源库所需的核心能力:稳定且精简的公共 API、明确的语言作用域、可选类型感知检查、精确规则类型、可重复构建、集成测试、CI、发布归档检查和中英文文档。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
默认场景面向普通 Vue 3 + Vite + TypeScript 浏览器后台管理项目;React、Angular、Markdown 和清单排序按需启用,Lodash 策略通过 `configs` 子路径独立组合。配置仍支持 JavaScript、Node.js 工程文件、JSON 方言、正则表达式和模块导入检查,项目覆写始终位于内置配置之后。
|
|
12
12
|
|
|
13
13
|
## 审查范围
|
|
14
14
|
|
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
|
|
23
23
|
## 当前工程基线
|
|
24
24
|
|
|
25
|
-
| 领域 | 状态 | 质量保障
|
|
26
|
-
| -------------- | ---- |
|
|
27
|
-
| 公共 API | 通过 |
|
|
28
|
-
| Flat Config | 通过 | 所有语言和插件配置限定到明确文件范围,项目覆写最后应用
|
|
29
|
-
| Vue 3 | 通过 | `vue-eslint-parser` 处理 SFC,TypeScript 解析器正确嵌套
|
|
30
|
-
| React | 通过 | 按需覆盖 JSX/TSX、组件、官方 Hooks、Compiler 诊断与 DOM 安全
|
|
31
|
-
| Angular | 通过 | 按需覆盖框架 TypeScript、外部 HTML、内联模板与模板无障碍
|
|
32
|
-
| TypeScript | 通过 | 默认使用推荐规则,可选 Project Service 类型感知模式
|
|
33
|
-
| JavaScript | 通过 | 应用 `@eslint/js` 推荐规则并区分应用环境与 Node.js 工程文件
|
|
34
|
-
| 数据与文档文件 | 通过 | JSON、JSONC、JSON5 和 Markdown 分别使用对应语言配置
|
|
35
|
-
| 规则自动补全 | 通过 | 从 ESLint 核心和随包插件 schema 生成精确 `RuleOptions`
|
|
36
|
-
| Lodash 策略 | 通过 | 可选统一 `lodash` 或 `lodash-unified`,默认不限制项目依赖选择
|
|
37
|
-
| 清单排序 | 通过 | 默认关闭;启用后不会重排 `package.json#exports` 条件键
|
|
38
|
-
| Prettier | 通过 | 只关闭冲突规则,格式化由 Prettier CLI 或编辑器负责
|
|
39
|
-
| 构建与发布 | 通过 | tsdown 生成 `.mjs`、`.d.mts` 和 source map,`prepack` 执行完整质量门禁
|
|
40
|
-
| 自动化验证 | 通过 | 运行时测试、消费者类型测试、格式检查、静态检查和 Node.js 多版本 CI
|
|
25
|
+
| 领域 | 状态 | 质量保障 |
|
|
26
|
+
| -------------- | ---- | ---------------------------------------------------------------------- |
|
|
27
|
+
| 公共 API | 通过 | 根入口保持精简,配置片段、glob 常量和原始规则由独立子路径提供 |
|
|
28
|
+
| Flat Config | 通过 | 所有语言和插件配置限定到明确文件范围,项目覆写最后应用 |
|
|
29
|
+
| Vue 3 | 通过 | `vue-eslint-parser` 处理 SFC,TypeScript 解析器正确嵌套 |
|
|
30
|
+
| React | 通过 | 按需覆盖 JSX/TSX、组件、官方 Hooks、Compiler 诊断与 DOM 安全 |
|
|
31
|
+
| Angular | 通过 | 按需覆盖框架 TypeScript、外部 HTML、内联模板与模板无障碍 |
|
|
32
|
+
| TypeScript | 通过 | 默认使用推荐规则,可选 Project Service 类型感知模式 |
|
|
33
|
+
| JavaScript | 通过 | 应用 `@eslint/js` 推荐规则并区分应用环境与 Node.js 工程文件 |
|
|
34
|
+
| 数据与文档文件 | 通过 | JSON、JSONC、JSON5 和 Markdown 分别使用对应语言配置 |
|
|
35
|
+
| 规则自动补全 | 通过 | 从 ESLint 核心和随包插件 schema 生成精确 `RuleOptions` |
|
|
36
|
+
| Lodash 策略 | 通过 | 可选统一 `lodash` 或 `lodash-unified`,默认不限制项目依赖选择 |
|
|
37
|
+
| 清单排序 | 通过 | 默认关闭;启用后不会重排 `package.json#exports` 条件键 |
|
|
38
|
+
| Prettier | 通过 | 只关闭冲突规则,格式化由 Prettier CLI 或编辑器负责 |
|
|
39
|
+
| 构建与发布 | 通过 | tsdown 生成 `.mjs`、`.d.mts` 和 source map,`prepack` 执行完整质量门禁 |
|
|
40
|
+
| 自动化验证 | 通过 | 运行时测试、消费者类型测试、格式检查、静态检查和 Node.js 多版本 CI |
|
|
41
41
|
|
|
42
42
|
## 配置组合模型
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
1. 内置忽略项、项目附加忽略项和可选 `.gitignore`。
|
|
47
47
|
2. 应用运行环境、项目全局变量和 Node.js 工程文件全局变量。
|
|
48
|
-
3. JavaScript、import-x、
|
|
48
|
+
3. JavaScript、import-x、RegExp、TypeScript、JSON 方言、Vue、React、Angular 和 Markdown 配置。
|
|
49
49
|
4. 可选 `package.json`、`tsconfig*.json` 排序配置。
|
|
50
50
|
5. Prettier 冲突关闭配置。
|
|
51
51
|
6. 工厂级 `rules` 与调用方传入的文件级覆写。
|
|
@@ -60,9 +60,11 @@
|
|
|
60
60
|
- `src/typegen.d.ts` 由规则 schema 生成,不允许手工编辑。
|
|
61
61
|
- React、Angular 插件也参与类型生成,因此框架规则名与选项可获得同样的精确自动补全。
|
|
62
62
|
- ESLint 或插件升级后必须运行 `pnpm typegen` 并审查类型差异。
|
|
63
|
+
- `@fast-china/eslint-config/configs` 提供全部配置创建函数及其选项类型,支持高级调用方自行组合。
|
|
64
|
+
- `@fast-china/eslint-config/constants` 集中提供配置片段使用的文件 glob,避免调用方复制字符串。
|
|
63
65
|
- `@fast-china/eslint-config/rules` 提供有完整注释的原始规则记录,便于高级组合。
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
`createLodashConfigs()` 使用 ESLint 核心 `no-restricted-imports`,因此无需增加插件依赖。它通过 `configs` 子路径按需组合,负责防止静态 import/export 混用包入口,不负责安装目标包,也不检查动态 `import()` 或 CommonJS `require()`。
|
|
66
68
|
|
|
67
69
|
## 质量门禁
|
|
68
70
|
|
|
@@ -82,11 +84,11 @@ pnpm pack --dry-run
|
|
|
82
84
|
5. Prettier 格式检查。
|
|
83
85
|
6. 消费者类型测试和运行时集成测试。
|
|
84
86
|
|
|
85
|
-
发布归档必须包含根入口和 `./rules` 子入口的 JavaScript 与声明文件,以及生成的 JavaScript、声明 source map;且不得包含源码缓存、测试缓存或本地依赖目录。
|
|
87
|
+
发布归档必须包含根入口和 `./configs`、`./constants`、`./rules` 子入口的 JavaScript 与声明文件,以及生成的 JavaScript、声明 source map;且不得包含源码缓存、测试缓存或本地依赖目录。
|
|
86
88
|
|
|
87
89
|
## CI 与发布边界
|
|
88
90
|
|
|
89
|
-
GitHub Actions 在 `master`、`main` 推送和 Pull Request 上运行,覆盖 Node.js 22.18 和 24.
|
|
91
|
+
GitHub Actions 在 `master`、`main` 推送和 Pull Request 上运行,覆盖 Node.js 22.18 和 24.18。CI 使用 pnpm 11.x、冻结锁文件安装、完整质量门禁和发布归档预览。
|
|
90
92
|
|
|
91
93
|
CI 只验证代码和发布包,不自动发布 npm。正式发布仍由维护者确认版本、Changelog、归档内容和 npm 身份后执行。
|
|
92
94
|
|
package/docs/rules-risk.md
CHANGED
|
@@ -13,7 +13,7 @@ High impact does not mean inherently unsafe. It means adoption or fix review is
|
|
|
13
13
|
|
|
14
14
|
## Bundled preset sources
|
|
15
15
|
|
|
16
|
-
`fastConfig()` defaults to Vue 3
|
|
16
|
+
`fastConfig()` defaults to a conventional Vue 3 browser administration project with TypeScript, JavaScript, import, RegExp, JSON, and the Prettier compatibility layer. React, Angular, Markdown, type-aware TypeScript linting, and manifest sorting are opt-in. Lodash policies are separate fragments from the `configs` subpath.
|
|
17
17
|
|
|
18
18
|
| Scope | Inherited preset | Notes |
|
|
19
19
|
| ---------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
@@ -25,7 +25,7 @@ High impact does not mean inherently unsafe. It means adoption or fix review is
|
|
|
25
25
|
| Imports | `eslint-plugin-import-x` `recommended` | Local rules add import placement, deduplication, and ordering. Resolver-dependent checks stay disabled. |
|
|
26
26
|
| RegExp | `eslint-plugin-regexp` `flat/recommended` | Some rules can rewrite regular expressions; run tests after bulk fixes. |
|
|
27
27
|
| JSON dialects | The matching `eslint-plugin-jsonc` `flat/recommended-*` preset | JSON, JSONC, and JSON5 are scoped separately. |
|
|
28
|
-
| Markdown
|
|
28
|
+
| Markdown (opt-in) | `@eslint/markdown` `recommended` | Checks Markdown structure and syntax. |
|
|
29
29
|
| Prettier compatibility | `eslint-config-prettier/flat` | Disables conflicting rules only; it does not run Prettier through ESLint. |
|
|
30
30
|
|
|
31
31
|
The exact upstream rule set is defined by the dependency versions in `pnpm-lock.yaml`. Review the effective config with the config inspector whenever ESLint or a plugin is upgraded instead of copying an upstream list that will become stale.
|
|
@@ -57,7 +57,7 @@ The exact upstream rule set is defined by the dependency versions in `pnpm-lock.
|
|
|
57
57
|
- React requires `react: true`. Its upstream recommended and official Hooks presets include blocking component, Hooks, and React Compiler rules; review existing custom hook and memoization patterns when adopting it.
|
|
58
58
|
- Angular requires `angular: true`. The framework bundle enables `prefer-inject`, OnPush change detection, standalone components, modern template control flow, and template accessibility. These policies are intentionally not active in the default Vue configuration.
|
|
59
59
|
- The `jsonc/sort-keys` and `jsonc/sort-array-values` manifest rules require `sortPackageJson: true` or `sortTsconfig: true`. Isolate the first fix and verify the publish manifest.
|
|
60
|
-
- Lodash import restrictions require `
|
|
60
|
+
- Lodash import restrictions require `createLodashConfigs("lodash")` or `createLodashConfigs("lodash-unified")` from the `configs` subpath. They use `no-restricted-imports` to prevent mixed static package entry points but do not inspect dynamic `import()` or CommonJS `require()`.
|
|
61
61
|
- Resolver-dependent import checks such as `import-x/no-unresolved` and `import-x/named` stay disabled.
|
|
62
62
|
- Keys inside `package.json#exports` are never sorted. Node conditional exports use key order during matching, so reordering can change the loaded file.
|
|
63
63
|
|
package/docs/rules-risk.zh.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## 内置预置来源
|
|
17
17
|
|
|
18
|
-
`fastConfig()`
|
|
18
|
+
`fastConfig()` 默认面向普通 Vue 3 浏览器后台管理项目,开启 TypeScript、JavaScript、import、RegExp、JSON 与 Prettier 兼容层;React、Angular、Markdown、TypeScript 类型感知和清单排序按需启用。Lodash 策略通过 `configs` 子路径独立组合。
|
|
19
19
|
|
|
20
20
|
| 范围 | 默认继承 | 说明 |
|
|
21
21
|
| ---------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
| import | `eslint-plugin-import-x` 的 `recommended` | 本库额外配置导入位置、去重和排序。解析器相关规则默认关闭,避免绑定具体别名方案。 |
|
|
28
28
|
| RegExp | `eslint-plugin-regexp` 的 `flat/recommended` | 部分规则可自动改写正则表达式,批量修复后需运行测试。 |
|
|
29
29
|
| JSON/JSONC/JSON5 | `eslint-plugin-jsonc` 对应方言的 `flat/recommended-*` | 三种方言按扩展名隔离,不会互相叠加。 |
|
|
30
|
-
| Markdown
|
|
30
|
+
| Markdown(按需) | `@eslint/markdown` 的 `recommended` | 检查 Markdown 结构和语法。 |
|
|
31
31
|
| Prettier 兼容 | `eslint-config-prettier/flat` | 只关闭冲突的格式规则,不会在 ESLint 内执行 Prettier。 |
|
|
32
32
|
|
|
33
33
|
上游预置的具体规则集合由锁文件中的依赖版本决定,升级 ESLint 或任一插件时都可能变化。审查实际生效配置时,应以配置检查器和 `pnpm-lock.yaml` 为准,而不是复制一份很快过期的上游规则列表。
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
- React 仅在 `react: true` 时启用。其上游推荐预置和官方 Hooks 预置包含阻断级组件、Hooks 与 React Compiler 规则;接入旧项目时应重点审查自定义 Hook 和 memoization 写法。
|
|
62
62
|
- Angular 仅在 `angular: true` 时启用。框架规则默认要求 `inject()`、OnPush 变更检测、独立组件、现代模板控制流和模板无障碍;这些约束不会进入默认 Vue 配置。
|
|
63
63
|
- 清单排序规则 `jsonc/sort-keys`、`jsonc/sort-array-values` 分别仅在 `sortPackageJson: true`、`sortTsconfig: true` 时启用;首次修复应单独提交并核对发布清单。
|
|
64
|
-
- Lodash
|
|
64
|
+
- Lodash 静态导入限制仅在从 `configs` 子路径调用 `createLodashConfigs("lodash")` 或 `createLodashConfigs("lodash-unified")` 时启用。该策略使用 `no-restricted-imports` 阻止混用包入口,但不会检查动态 `import()` 或 CommonJS `require()`。
|
|
65
65
|
- `import-x/no-unresolved`、`import-x/named` 等依赖 resolver 的检查默认关闭。
|
|
66
66
|
- `package.json` 的 `exports` 条件键永不自动排序。Node 条件导出按键顺序匹配,改写顺序可能改变实际加载文件。
|
|
67
67
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fast-china/eslint-config",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Opinionated, typed ESLint Flat Config for Vue 3, React, Angular, Vite, TypeScript, JavaScript, and Node.js.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -43,6 +43,16 @@
|
|
|
43
43
|
"import": "./dist/index.mjs",
|
|
44
44
|
"default": "./dist/index.mjs"
|
|
45
45
|
},
|
|
46
|
+
"./configs": {
|
|
47
|
+
"types": "./dist/configs/index.d.mts",
|
|
48
|
+
"import": "./dist/configs/index.mjs",
|
|
49
|
+
"default": "./dist/configs/index.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./constants": {
|
|
52
|
+
"types": "./dist/constants/index.d.mts",
|
|
53
|
+
"import": "./dist/constants/index.mjs",
|
|
54
|
+
"default": "./dist/constants/index.mjs"
|
|
55
|
+
},
|
|
46
56
|
"./rules": {
|
|
47
57
|
"types": "./dist/rules/index.d.mts",
|
|
48
58
|
"import": "./dist/rules/index.mjs",
|
|
@@ -72,13 +82,13 @@
|
|
|
72
82
|
},
|
|
73
83
|
"peerDependencies": {
|
|
74
84
|
"eslint": "^10.0.0",
|
|
75
|
-
"typescript": "
|
|
85
|
+
"typescript": "^6.0.0"
|
|
76
86
|
},
|
|
77
87
|
"dependencies": {
|
|
78
88
|
"@angular-eslint/eslint-plugin": "^22.1.0",
|
|
79
89
|
"@angular-eslint/eslint-plugin-template": "^22.1.0",
|
|
80
90
|
"@angular-eslint/template-parser": "^22.1.0",
|
|
81
|
-
"@eslint-react/eslint-plugin": "^5.18.
|
|
91
|
+
"@eslint-react/eslint-plugin": "^5.18.1",
|
|
82
92
|
"@eslint/js": "^10.0.0",
|
|
83
93
|
"@eslint/markdown": "^8.0.3",
|
|
84
94
|
"eslint-config-flat-gitignore": "^2.0.0",
|
|
@@ -88,12 +98,12 @@
|
|
|
88
98
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
89
99
|
"eslint-plugin-regexp": "^3.1.1",
|
|
90
100
|
"eslint-plugin-vue": "^10.10.0",
|
|
91
|
-
"globals": "^17.
|
|
101
|
+
"globals": "^17.8.0",
|
|
92
102
|
"typescript-eslint": "^8.65.0",
|
|
93
103
|
"vue-eslint-parser": "^10.4.1"
|
|
94
104
|
},
|
|
95
105
|
"devDependencies": {
|
|
96
|
-
"@eslint/config-inspector": "^3.1.
|
|
106
|
+
"@eslint/config-inspector": "^3.1.1",
|
|
97
107
|
"@types/node": "^24.13.3",
|
|
98
108
|
"eslint": "^10.8.0",
|
|
99
109
|
"eslint-typegen": "^2.3.1",
|
|
@@ -103,7 +113,7 @@
|
|
|
103
113
|
"typescript": "^6.0.3"
|
|
104
114
|
},
|
|
105
115
|
"engines": {
|
|
106
|
-
"node": "^22.18.0 ||
|
|
116
|
+
"node": "^22.18.0 || ^24.18.0",
|
|
107
117
|
"pnpm": "^11.0.0"
|
|
108
118
|
}
|
|
109
119
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/rules/angular.ts","../../src/rules/common.ts","../../src/rules/import.ts","../../src/rules/javascript.ts","../../src/rules/lodash.ts","../../src/rules/react.ts","../../src/rules/sort-package.ts","../../src/rules/sort-tsconfig.ts","../../src/rules/typescript.ts","../../src/rules/vue.ts"],"mappings":";;;;;;;;cAQa;;;;;;;;;;;;;;;;cA8BA;;;;;;;cAYA;;;;;;;;;;;;;;;;;;;;;cC1CA;;;;;;;;;;;;;;;;;;;;;;;;;cCLA;;;;;;;;;;;;;;;;;;;;;;;;;cCGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCEA;;;;;;;;;;;;;;;;;;cA+BA;;;;;;;;;;;;;;;;;;;;;cC9BA;;;;;;;;;;;;;;;;;;;;;;;cCDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCAA;;;;;;;;;;;;;;;;cCFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCAA"}
|