@fast-china/eslint-config 2.1.4 → 2.1.6
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 +22 -0
- package/README.md +11 -2
- package/README.zh.md +11 -2
- package/dist/configs/angular.d.mts +2 -3
- package/dist/configs/common.d.mts +1 -2
- package/dist/configs/environment.d.mts +4 -5
- package/dist/configs/ignores.d.mts +3 -4
- package/dist/configs/import.d.mts +1 -2
- package/dist/configs/javascript.d.mts +1 -2
- package/dist/configs/json.d.mts +1 -2
- package/dist/configs/lodash.d.mts +2 -3
- package/dist/configs/markdown.d.mts +1 -2
- package/dist/configs/prettier.d.mts +1 -2
- package/dist/configs/prettier.mjs +1 -0
- package/dist/configs/prettier.mjs.map +1 -1
- package/dist/configs/react.d.mts +2 -3
- package/dist/configs/regexp.d.mts +1 -2
- package/dist/configs/sort-package.d.mts +1 -2
- package/dist/configs/sort-tsconfig.d.mts +1 -2
- package/dist/configs/typescript.d.mts +10 -7
- package/dist/configs/typescript.mjs +13 -5
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/uniapp.d.mts +1 -2
- package/dist/configs/vue.d.mts +1 -2
- package/dist/configs/vue.mjs +7 -2
- package/dist/configs/vue.mjs.map +1 -1
- package/dist/constants/index.d.mts +17 -18
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/import.mjs +0 -1
- package/dist/plugins/import.mjs.map +1 -1
- package/dist/rules/angular.d.mts +3 -4
- package/dist/rules/common.d.mts +5 -5
- package/dist/rules/common.mjs +8 -1
- package/dist/rules/common.mjs.map +1 -1
- package/dist/rules/import.d.mts +1 -2
- package/dist/rules/javascript.d.mts +1 -2
- package/dist/rules/lodash.d.mts +2 -3
- package/dist/rules/react.d.mts +1 -2
- package/dist/rules/regexp.d.mts +1 -2
- package/dist/rules/sort-package.d.mts +1 -2
- package/dist/rules/sort-tsconfig.d.mts +1 -2
- package/dist/rules/typescript.d.mts +36 -7
- package/dist/rules/typescript.mjs +29 -5
- package/dist/rules/typescript.mjs.map +1 -1
- package/dist/rules/vue.d.mts +1 -2
- package/dist/typegen.d.mts +78 -24
- package/docs/engineering-audit.zh.md +3 -3
- package/docs/rules-risk.md +25 -16
- package/docs/rules-risk.zh.md +15 -6
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,28 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 2.1.6 - 2026-09-11
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added exhaustive switch checks, type-only export enforcement, readonly private-member detection, direct `eval` rejection, multiline brace consistency, and final-position `default` branches.
|
|
14
|
+
- Added runtime coverage for TypeScript, TSX, Vue, and NVue rule precedence, concise Vue `defineEmits` validators, Promise waiting policy, and retained Promise misuse checks.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Replaced `recommendedTypeChecked` with the official `strictTypeChecked` and `stylisticTypeChecked` baselines without enabling the mechanical `all` preset.
|
|
19
|
+
- Required return types for named TypeScript and TSX functions while preserving contextual inference for inline callbacks; Vue and NVue SFCs no longer require function-return or module-boundary annotations and may keep declarative callback parameters without underscore prefixes.
|
|
20
|
+
- Made Promise waiting, ordering, and error handling an application decision by disabling `no-floating-promises` and `strict-void-return`, while retaining `no-misused-promises`, `await-thenable`, `require-await`, correctness-only `return-await`, and unsafe-type checks.
|
|
21
|
+
- Rejected `void promise` workarounds, allowed concise void-returning arrow callbacks and numeric template interpolation, preserved primitive `||` semantics, and retained distinct public overloads with meaningful parameter names or JSDoc.
|
|
22
|
+
- Reduced syntax-only enforcement for type declarations, indexed objects, literal class properties, RegExp calls, dynamic object deletion, and static utility classes; deprecated APIs and apparently unnecessary runtime guards now warn instead of blocking builds.
|
|
23
|
+
- Updated runtime and development dependencies to their latest compatible releases while retaining TypeScript 6, tsdown 0.22, and the existing peer compatibility ranges.
|
|
24
|
+
|
|
25
|
+
## 2.1.5 - 2026-09-01
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Unified `extraFileExtensions: [".vue", ".nvue"]` across type-aware TypeScript, TSX, Vue, and NVue parsing so Project Service does not reload the project while linting mixed file types.
|
|
30
|
+
|
|
9
31
|
## 2.1.4 - 2026-08-30
|
|
10
32
|
|
|
11
33
|
### Changed
|
package/README.md
CHANGED
|
@@ -108,15 +108,24 @@ Trailing configs have the highest precedence. `defineRules()` leaves the object
|
|
|
108
108
|
|
|
109
109
|
## TypeScript
|
|
110
110
|
|
|
111
|
-
`createTypeScriptConfigs()`, Vue SFCs, and React TSX always use `
|
|
111
|
+
`createTypeScriptConfigs()`, Vue SFCs, and React TSX always use `strictTypeChecked` plus `stylisticTypeChecked` with:
|
|
112
112
|
|
|
113
113
|
```js
|
|
114
114
|
parserOptions: {
|
|
115
115
|
projectService: true,
|
|
116
|
+
extraFileExtensions: [".vue", ".nvue"],
|
|
116
117
|
}
|
|
117
118
|
```
|
|
118
119
|
|
|
119
|
-
Linted files must belong to a discoverable `tsconfig.json`. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary.
|
|
120
|
+
Linted files must belong to a discoverable `tsconfig.json`. The same `extraFileExtensions` list is applied to TypeScript, TSX, Vue, and NVue files so Project Service does not reload the project while linting mixed file types. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary, but every type-aware file override in the same project must keep `extraFileExtensions` identical.
|
|
121
|
+
|
|
122
|
+
Developers decide whether a Promise must be awaited, returned, or handled from the required ordering and error semantics. Therefore, `no-floating-promises` and `strict-void-return` are disabled, framework allowlists are unnecessary, and `void promise` is rejected. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe type rules remain strict, so invalid async callbacks, invalid `await` expressions, and `async` functions without asynchronous behavior are still reported.
|
|
123
|
+
|
|
124
|
+
`return-await` keeps the strict preset's `error-handling-correctness-only` mode instead of forcing stylistic `await` expressions.
|
|
125
|
+
|
|
126
|
+
Named TypeScript and TSX functions and module boundaries require explicit types, while inline callbacks and already typed function expressions keep contextual inference. Vue/NVue SFCs disable function-return and module-boundary annotations and allow unused parameters in declarative callbacks such as `defineEmits` validators; unused variables and imports are still reported. Standalone SFC handler parameters that cannot be inferred back from templates still require explicit types.
|
|
127
|
+
|
|
128
|
+
Type-only exports use `export type`, and private members assigned only during construction use `readonly`. Primitive values retain the semantic choice between `||` and `??`, while public overloads with different parameter names or standalone JSDoc are preserved. Shared JavaScript rules reject `eval` and the `void` operator, require consistent braces for multiline branches, and place an existing `default` branch last.
|
|
120
129
|
|
|
121
130
|
## React
|
|
122
131
|
|
package/README.zh.md
CHANGED
|
@@ -110,15 +110,24 @@ export default fastConfig(
|
|
|
110
110
|
|
|
111
111
|
## TypeScript
|
|
112
112
|
|
|
113
|
-
`createTypeScriptConfigs()`、Vue SFC 和 React TSX 始终使用 `
|
|
113
|
+
`createTypeScriptConfigs()`、Vue SFC 和 React TSX 始终使用 `strictTypeChecked`、`stylisticTypeChecked` 与:
|
|
114
114
|
|
|
115
115
|
```js
|
|
116
116
|
parserOptions: {
|
|
117
117
|
projectService: true,
|
|
118
|
+
extraFileExtensions: [".vue", ".nvue"],
|
|
118
119
|
}
|
|
119
120
|
```
|
|
120
121
|
|
|
121
|
-
被检查文件必须属于可发现的 `tsconfig.json
|
|
122
|
+
被检查文件必须属于可发现的 `tsconfig.json`。TypeScript、TSX、Vue 与 NVue 统一使用相同的 `extraFileExtensions`,避免混合检查文件时 Project Service 重载项目。不再提供 `typeChecked` 和 `tsconfigRootDir` 包装选项;复杂 monorepo 如需指定根目录,可在后置 Flat Config 中直接覆盖 `languageOptions.parserOptions`,但同一项目中所有类型感知文件覆盖必须保持 `extraFileExtensions` 完全一致。
|
|
123
|
+
|
|
124
|
+
Promise 是否需要等待、返回或处理异常由开发者根据业务顺序和异常语义决定,因此 `no-floating-promises` 与 `strict-void-return` 默认关闭,不维护框架 API 白名单,也不使用 `void promise` 规避检查。`no-misused-promises`、`await-thenable`、`require-await` 及 unsafe 类型规则继续严格启用,异步回调误用、错误的 `await` 和无异步语义的 `async` 仍会报错。
|
|
125
|
+
|
|
126
|
+
`return-await` 保持严格预置的 `error-handling-correctness-only` 模式,不为了风格强制增加 `await`。
|
|
127
|
+
|
|
128
|
+
普通 TypeScript 与 TSX 的命名函数和模块边界要求显式类型,内联回调和已有函数类型约束的表达式继续使用上下文推断。Vue/NVue SFC 关闭函数返回类型与模块边界类型要求,并允许 `defineEmits` 校验器等声明型回调保留未使用形参;普通未使用变量和导入仍会报错。SFC 中无法从模板反向推断的独立处理函数参数仍应显式标注类型。
|
|
129
|
+
|
|
130
|
+
纯类型导出使用 `export type`,只在构造阶段赋值的私有成员使用 `readonly`。原始类型保留 `||` 与 `??` 的业务语义选择;具有不同参数名或独立 JSDoc 的公共重载不强制合并。共享 JavaScript 规则禁止 `eval` 和 `void` 操作符,要求多行条件分支使用一致的花括号,并将已有的 `default` 分支放在最后。
|
|
122
131
|
|
|
123
132
|
## React
|
|
124
133
|
|
|
@@ -10,7 +10,7 @@ import { defineConfig } from "eslint/config";
|
|
|
10
10
|
* 这些选项不会修改 Angular 编译器、CLI 或模板类型检查配置。调用方应先组合
|
|
11
11
|
* `createBaseConfigs()`,以提供统一的类型感知 TypeScript 配置。
|
|
12
12
|
*/
|
|
13
|
-
interface AngularConfigOptions {
|
|
13
|
+
export interface AngularConfigOptions {
|
|
14
14
|
/**
|
|
15
15
|
* 是否使用 Angular 官方 processor,从 TypeScript 文件的
|
|
16
16
|
* `@Component({ template: ... })` 元数据中提取内联 HTML 并复用模板规则进行检查。
|
|
@@ -40,7 +40,6 @@ interface AngularConfigOptions {
|
|
|
40
40
|
* @param options - 控制内联模板处理与模板无障碍规则的 Angular 选项。
|
|
41
41
|
* @returns 按 TypeScript 源码、外部模板顺序排列的 ESLint Flat Config 数组。
|
|
42
42
|
*/
|
|
43
|
-
declare const createAngularConfigs: ({ inlineTemplates, templateAccessibility }?: AngularConfigOptions) => ReturnType<typeof defineConfig>;
|
|
43
|
+
export declare const createAngularConfigs: ({ inlineTemplates, templateAccessibility }?: AngularConfigOptions) => ReturnType<typeof defineConfig>;
|
|
44
44
|
//#endregion
|
|
45
|
-
export { AngularConfigOptions, createAngularConfigs };
|
|
46
45
|
//# sourceMappingURL=angular.d.mts.map
|
|
@@ -10,7 +10,6 @@ import { defineConfig } from "eslint/config";
|
|
|
10
10
|
* @param files - 应用公共规则的 ESLint glob 列表。
|
|
11
11
|
* @returns 包含公共规则与无效禁用指令检查的 Flat Config 数组。
|
|
12
12
|
*/
|
|
13
|
-
declare const createCommonConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
13
|
+
export declare const createCommonConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { createCommonConfigs };
|
|
16
15
|
//# sourceMappingURL=common.d.mts.map
|
|
@@ -8,7 +8,7 @@ import { Linter } from "eslint";
|
|
|
8
8
|
* - `"node"` 仅提供 Node.js 全局变量。
|
|
9
9
|
* - `"universal"` 同时提供浏览器与 Node.js 全局变量。
|
|
10
10
|
*/
|
|
11
|
-
type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
11
|
+
export type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
12
12
|
/**
|
|
13
13
|
* 运行时全局变量配置片段的选项。
|
|
14
14
|
*
|
|
@@ -19,7 +19,7 @@ type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
|
19
19
|
* 应用代码与 Node.js 工程文件使用两个独立 Flat Config 片段,避免浏览器源码无条件获得
|
|
20
20
|
* `process`、`Buffer` 等 Node.js 全局变量,也避免配置文件误报这些合法全局变量未定义。
|
|
21
21
|
*/
|
|
22
|
-
interface EnvironmentConfigOptions {
|
|
22
|
+
export interface EnvironmentConfigOptions {
|
|
23
23
|
/**
|
|
24
24
|
* 应用代码实际运行的环境,决定 `files` 范围内注入哪组标准全局变量。
|
|
25
25
|
*
|
|
@@ -66,7 +66,7 @@ interface EnvironmentConfigOptions {
|
|
|
66
66
|
* @param options - 运行时环境、目标文件范围与项目级全局变量。
|
|
67
67
|
* @returns 依次包含应用运行时环境和 Node.js 工程文件环境的 Flat Config 数组。
|
|
68
68
|
*/
|
|
69
|
-
declare const createEnvironmentConfigs: ({ environment, files, nodeFiles, globals: projectGlobals }?: EnvironmentConfigOptions) => ReturnType<typeof defineConfig>;
|
|
69
|
+
export declare const createEnvironmentConfigs: ({ environment, files, nodeFiles, globals: projectGlobals }?: EnvironmentConfigOptions) => ReturnType<typeof defineConfig>;
|
|
70
70
|
/**
|
|
71
71
|
* 创建 Node.js 配置、脚本、测试和 CLI 文件的末尾规则覆写。
|
|
72
72
|
*
|
|
@@ -77,7 +77,6 @@ declare const createEnvironmentConfigs: ({ environment, files, nodeFiles, global
|
|
|
77
77
|
* @param nodeFiles - 当前已启用的 JavaScript/TypeScript 文件 glob。
|
|
78
78
|
* @returns Node 工具文件规则覆写数组。
|
|
79
79
|
*/
|
|
80
|
-
declare const createNodeToolingConfigs: (nodeFiles?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
80
|
+
export declare const createNodeToolingConfigs: (nodeFiles?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
81
81
|
//#endregion
|
|
82
|
-
export { EnvironmentConfigOptions, RuntimeEnvironment, createEnvironmentConfigs, createNodeToolingConfigs };
|
|
83
82
|
//# sourceMappingURL=environment.d.mts.map
|
|
@@ -7,14 +7,14 @@ import { defineConfig } from "eslint/config";
|
|
|
7
7
|
* 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检
|
|
8
8
|
* 应由项目维护的文件。
|
|
9
9
|
*/
|
|
10
|
-
declare const DEFAULT_IGNORE_PATTERNS: readonly string[];
|
|
10
|
+
export declare const DEFAULT_IGNORE_PATTERNS: readonly string[];
|
|
11
11
|
/**
|
|
12
12
|
* 创建全局忽略配置,并在默认集合之后追加项目自定义模式。
|
|
13
13
|
*
|
|
14
14
|
* @param additionalPatterns - 追加到 {@link DEFAULT_IGNORE_PATTERNS} 之后的 ESLint 全局忽略模式。
|
|
15
15
|
* @returns 包含单个命名全局忽略片段的 Flat Config 数组。
|
|
16
16
|
*/
|
|
17
|
-
declare const createGlobalIgnores: (additionalPatterns?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
17
|
+
export declare const createGlobalIgnores: (additionalPatterns?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
18
18
|
/**
|
|
19
19
|
* 创建读取项目 `.gitignore` 的全局忽略配置。
|
|
20
20
|
*
|
|
@@ -24,7 +24,6 @@ declare const createGlobalIgnores: (additionalPatterns?: readonly string[]) => R
|
|
|
24
24
|
*
|
|
25
25
|
* @returns 包含 `.gitignore` 转换结果的 Flat Config 数组。
|
|
26
26
|
*/
|
|
27
|
-
declare const createGitignoreConfigs: () => ReturnType<typeof defineConfig>;
|
|
27
|
+
export declare const createGitignoreConfigs: () => ReturnType<typeof defineConfig>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { DEFAULT_IGNORE_PATTERNS, createGitignoreConfigs, createGlobalIgnores };
|
|
30
29
|
//# sourceMappingURL=ignores.d.mts.map
|
|
@@ -10,7 +10,6 @@ import { defineConfig } from "eslint/config";
|
|
|
10
10
|
* @param files - 应用 import-x 推荐规则与本地覆盖规则的 ESLint glob 列表。
|
|
11
11
|
* @returns 包含 import-x 插件预置和本地规则的 Flat Config 数组。
|
|
12
12
|
*/
|
|
13
|
-
declare const createImportConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
13
|
+
export declare const createImportConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { createImportConfigs };
|
|
16
15
|
//# sourceMappingURL=import.d.mts.map
|
|
@@ -10,7 +10,6 @@ import { defineConfig } from "eslint/config";
|
|
|
10
10
|
* @param files - 应用 JavaScript 基础规则的 ESLint glob 列表。
|
|
11
11
|
* @returns 包含 JavaScript 推荐预置、本地规则与 JSX 解析设置的 Flat Config 数组。
|
|
12
12
|
*/
|
|
13
|
-
declare const createJavaScriptConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
13
|
+
export declare const createJavaScriptConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { createJavaScriptConfigs };
|
|
16
15
|
//# sourceMappingURL=javascript.d.mts.map
|
package/dist/configs/json.d.mts
CHANGED
|
@@ -10,7 +10,6 @@ import { defineConfig } from "eslint/config";
|
|
|
10
10
|
*
|
|
11
11
|
* @returns 按 JSON、JSONC、JSON5 与 VS Code 工作区文件覆盖顺序排列的 Flat Config 数组。
|
|
12
12
|
*/
|
|
13
|
-
declare const createJsonConfigs: () => ReturnType<typeof defineConfig>;
|
|
13
|
+
export declare const createJsonConfigs: () => ReturnType<typeof defineConfig>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { createJsonConfigs };
|
|
16
15
|
//# sourceMappingURL=json.d.mts.map
|
|
@@ -5,7 +5,7 @@ import { defineConfig } from "eslint/config";
|
|
|
5
5
|
*
|
|
6
6
|
* `"lodash"` 允许根入口及 `lodash/*` 子路径;`"lodash-unified"` 只允许统一入口。
|
|
7
7
|
*/
|
|
8
|
-
type LodashPreference = "lodash" | "lodash-unified";
|
|
8
|
+
export type LodashPreference = "lodash" | "lodash-unified";
|
|
9
9
|
/**
|
|
10
10
|
* 创建 Lodash 静态导入约束。
|
|
11
11
|
*
|
|
@@ -17,7 +17,6 @@ type LodashPreference = "lodash" | "lodash-unified";
|
|
|
17
17
|
* @param files - 应用导入约束的 ESLint glob 列表。
|
|
18
18
|
* @returns 包含对应 Lodash 导入限制规则的 Flat Config 数组。
|
|
19
19
|
*/
|
|
20
|
-
declare const createLodashConfigs: (preference: LodashPreference, files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
20
|
+
export declare const createLodashConfigs: (preference: LodashPreference, files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { LodashPreference, createLodashConfigs };
|
|
23
22
|
//# sourceMappingURL=lodash.d.mts.map
|
|
@@ -8,7 +8,6 @@ import { defineConfig } from "eslint/config";
|
|
|
8
8
|
*
|
|
9
9
|
* @returns 包含 `@eslint/markdown` 推荐预置的 Flat Config 数组。
|
|
10
10
|
*/
|
|
11
|
-
declare const createMarkdownConfigs: () => ReturnType<typeof defineConfig>;
|
|
11
|
+
export declare const createMarkdownConfigs: () => ReturnType<typeof defineConfig>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { createMarkdownConfigs };
|
|
14
13
|
//# sourceMappingURL=markdown.d.mts.map
|
|
@@ -9,7 +9,6 @@ import { defineConfig } from "eslint/config";
|
|
|
9
9
|
*
|
|
10
10
|
* @returns 包含命名后的 `eslint-config-prettier` Flat Config 数组。
|
|
11
11
|
*/
|
|
12
|
-
declare const createPrettierConfigs: () => ReturnType<typeof defineConfig>;
|
|
12
|
+
export declare const createPrettierConfigs: () => ReturnType<typeof defineConfig>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { createPrettierConfigs };
|
|
15
14
|
//# sourceMappingURL=prettier.d.mts.map
|
|
@@ -2,6 +2,7 @@ import { defineConfig } from "eslint/config";
|
|
|
2
2
|
import eslintConfigPrettierFlat from "eslint-config-prettier/flat";
|
|
3
3
|
//#region src/configs/prettier.ts
|
|
4
4
|
const prettierRules = { ...eslintConfigPrettierFlat.rules };
|
|
5
|
+
delete prettierRules.curly;
|
|
5
6
|
delete prettierRules["vue/html-closing-bracket-newline"];
|
|
6
7
|
/**
|
|
7
8
|
* 创建 Prettier 兼容层。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.mjs","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintConfigPrettierFlat from \"eslint-config-prettier/flat\";\n\n//
|
|
1
|
+
{"version":3,"file":"prettier.mjs","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintConfigPrettierFlat from \"eslint-config-prettier/flat\";\n\n// 这些规则与 Prettier 输出兼容,并承载项目约定,无需由兼容层关闭。\nconst prettierRules = { ...eslintConfigPrettierFlat.rules };\ndelete prettierRules.curly;\ndelete prettierRules[\"vue/html-closing-bracket-newline\"];\n\n/**\n * 创建 Prettier 兼容层。\n *\n * @remarks\n * 它只关闭与 Prettier 冲突的 ESLint 格式规则,不会在 ESLint 进程中执行 Prettier。\n * 工厂始终把它放在内置配置之后,使上游预置的格式规则能够被正确覆盖。\n *\n * @returns 包含命名后的 `eslint-config-prettier` Flat Config 数组。\n */\nexport const createPrettierConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\t...eslintConfigPrettierFlat,\n\t\t\tname: \"@fast-china/prettier\",\n\t\t\trules: prettierRules,\n\t\t},\n\t]);\n"],"mappings":";;;AAIA,MAAM,gBAAgB,EAAE,GAAG,yBAAyB,MAAM;AAC1D,OAAO,cAAc;AACrB,OAAO,cAAc;;;;;;;;;;AAWrB,MAAa,8BACZ,aAAa,CACZ;CACC,GAAG;CACH,MAAM;CACN,OAAO;AACR,CACD,CAAC"}
|
package/dist/configs/react.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ import { defineConfig } from "eslint/config";
|
|
|
11
11
|
* 这些字段只传给 ESLint 插件用于理解项目的 React 语义,不会改变 JSX 编译方式、自动
|
|
12
12
|
* 导入 React、设置打包器别名或安装兼容运行时。
|
|
13
13
|
*/
|
|
14
|
-
interface ReactConfigOptions {
|
|
14
|
+
export interface ReactConfigOptions {
|
|
15
15
|
/**
|
|
16
16
|
* 提供 React API 与 JSX 运行时的包入口名称。
|
|
17
17
|
*
|
|
@@ -50,7 +50,6 @@ interface ReactConfigOptions {
|
|
|
50
50
|
* @param options - React 版本、运行时导入来源与多态组件属性设置。
|
|
51
51
|
* @returns React JavaScript、类型感知 TypeScript 与 Hooks Flat Config 数组。
|
|
52
52
|
*/
|
|
53
|
-
declare const createReactConfigs: ({ importSource, polymorphicPropName, version }?: ReactConfigOptions) => ReturnType<typeof defineConfig>;
|
|
53
|
+
export declare const createReactConfigs: ({ importSource, polymorphicPropName, version }?: ReactConfigOptions) => ReturnType<typeof defineConfig>;
|
|
54
54
|
//#endregion
|
|
55
|
-
export { ReactConfigOptions, createReactConfigs };
|
|
56
55
|
//# sourceMappingURL=react.d.mts.map
|
|
@@ -9,7 +9,6 @@ import { defineConfig } from "eslint/config";
|
|
|
9
9
|
* @param files - 应用正则表达式规则的 ESLint glob 列表。
|
|
10
10
|
* @returns 包含正则插件及公共正则规则的 Flat Config 数组。
|
|
11
11
|
*/
|
|
12
|
-
declare const createRegexpConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
12
|
+
export declare const createRegexpConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { createRegexpConfigs };
|
|
15
14
|
//# sourceMappingURL=regexp.d.mts.map
|
|
@@ -9,7 +9,6 @@ import { defineConfig } from "eslint/config";
|
|
|
9
9
|
*
|
|
10
10
|
* @returns 仅匹配 `package.json` 的字段排序 Flat Config 数组。
|
|
11
11
|
*/
|
|
12
|
-
declare const createPackageJsonSortConfigs: () => ReturnType<typeof defineConfig>;
|
|
12
|
+
export declare const createPackageJsonSortConfigs: () => ReturnType<typeof defineConfig>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { createPackageJsonSortConfigs };
|
|
15
14
|
//# sourceMappingURL=sort-package.d.mts.map
|
|
@@ -9,7 +9,6 @@ import { defineConfig } from "eslint/config";
|
|
|
9
9
|
*
|
|
10
10
|
* @returns 匹配 `tsconfig.json` 与 `tsconfig.*.json` 的字段排序 Flat Config 数组。
|
|
11
11
|
*/
|
|
12
|
-
declare const createTsconfigSortConfigs: () => ReturnType<typeof defineConfig>;
|
|
12
|
+
export declare const createTsconfigSortConfigs: () => ReturnType<typeof defineConfig>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { createTsconfigSortConfigs };
|
|
15
14
|
//# sourceMappingURL=sort-tsconfig.d.mts.map
|
|
@@ -2,28 +2,31 @@ import { defineConfig } from "eslint/config";
|
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
3
|
//#region src/configs/typescript.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* 返回 typescript-eslint
|
|
5
|
+
* 返回 typescript-eslint 严格且类型感知的官方预置。
|
|
6
6
|
*
|
|
7
7
|
* @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。
|
|
8
8
|
*/
|
|
9
|
-
declare const getTypeScriptPresetConfigs: () => Linter.Config[];
|
|
9
|
+
export declare const getTypeScriptPresetConfigs: () => Linter.Config[];
|
|
10
10
|
/**
|
|
11
11
|
* 创建 TypeScript 解析器的 Project Service 选项。
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @remarks
|
|
14
|
+
* TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,
|
|
15
|
+
* TypeScript Server 会因扩展名集合变化而反复重载整个项目。
|
|
16
|
+
*
|
|
17
|
+
* @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。
|
|
14
18
|
*/
|
|
15
|
-
declare const createTypeScriptParserOptions: () => Linter.ParserOptions;
|
|
19
|
+
export declare const createTypeScriptParserOptions: () => Linter.ParserOptions;
|
|
16
20
|
/**
|
|
17
21
|
* 创建 TypeScript 配置。
|
|
18
22
|
*
|
|
19
23
|
* @remarks
|
|
20
|
-
* 始终采用 ESLint 与 typescript-eslint 的 `
|
|
24
|
+
* 始终采用 ESLint 与 typescript-eslint 的 `strictTypeChecked`、`stylisticTypeChecked` 预置并启动 Project Service。
|
|
21
25
|
* 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。
|
|
22
26
|
*
|
|
23
27
|
* @param files - 应用 TypeScript 配置的 ESLint glob 列表。
|
|
24
28
|
* @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。
|
|
25
29
|
*/
|
|
26
|
-
declare const createTypeScriptConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
30
|
+
export declare const createTypeScriptConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
27
31
|
//#endregion
|
|
28
|
-
export { createTypeScriptConfigs, createTypeScriptParserOptions, getTypeScriptPresetConfigs };
|
|
29
32
|
//# sourceMappingURL=typescript.d.mts.map
|
|
@@ -6,7 +6,7 @@ import eslint from "@eslint/js";
|
|
|
6
6
|
import tseslint from "typescript-eslint";
|
|
7
7
|
//#region src/configs/typescript.ts
|
|
8
8
|
/**
|
|
9
|
-
* 返回 typescript-eslint
|
|
9
|
+
* 返回 typescript-eslint 严格且类型感知的官方预置。
|
|
10
10
|
*
|
|
11
11
|
* @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。
|
|
12
12
|
*/
|
|
@@ -16,19 +16,27 @@ const getTypeScriptPresetConfigs = () => [
|
|
|
16
16
|
name: "@fast-china/typescript/javascript-rules",
|
|
17
17
|
rules: javascriptRules
|
|
18
18
|
},
|
|
19
|
-
...tseslint.configs.
|
|
19
|
+
...tseslint.configs.strictTypeChecked,
|
|
20
|
+
...tseslint.configs.stylisticTypeChecked
|
|
20
21
|
];
|
|
21
22
|
/**
|
|
22
23
|
* 创建 TypeScript 解析器的 Project Service 选项。
|
|
23
24
|
*
|
|
24
|
-
* @
|
|
25
|
+
* @remarks
|
|
26
|
+
* TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,
|
|
27
|
+
* TypeScript Server 会因扩展名集合变化而反复重载整个项目。
|
|
28
|
+
*
|
|
29
|
+
* @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。
|
|
25
30
|
*/
|
|
26
|
-
const createTypeScriptParserOptions = () => ({
|
|
31
|
+
const createTypeScriptParserOptions = () => ({
|
|
32
|
+
projectService: true,
|
|
33
|
+
extraFileExtensions: [".vue", ".nvue"]
|
|
34
|
+
});
|
|
27
35
|
/**
|
|
28
36
|
* 创建 TypeScript 配置。
|
|
29
37
|
*
|
|
30
38
|
* @remarks
|
|
31
|
-
* 始终采用 ESLint 与 typescript-eslint 的 `
|
|
39
|
+
* 始终采用 ESLint 与 typescript-eslint 的 `strictTypeChecked`、`stylisticTypeChecked` 预置并启动 Project Service。
|
|
32
40
|
* 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。
|
|
33
41
|
*
|
|
34
42
|
* @param files - 应用 TypeScript 配置的 ESLint glob 列表。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint
|
|
1
|
+
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint 严格且类型感知的官方预置。\n *\n * @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。\n */\nexport const getTypeScriptPresetConfigs = (): Linter.Config[] =>\n\t[\n\t\teslint.configs.recommended,\n\t\t{\n\t\t\tname: \"@fast-china/typescript/javascript-rules\",\n\t\t\trules: javascriptRules,\n\t\t},\n\t\t...tseslint.configs.strictTypeChecked,\n\t\t...tseslint.configs.stylisticTypeChecked,\n\t] as Linter.Config[];\n\n/**\n * 创建 TypeScript 解析器的 Project Service 选项。\n *\n * @remarks\n * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,\n * TypeScript Server 会因扩展名集合变化而反复重载整个项目。\n *\n * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。\n */\nexport const createTypeScriptParserOptions = (): Linter.ParserOptions => ({\n\tprojectService: true,\n\textraFileExtensions: [\".vue\", \".nvue\"],\n});\n\n/**\n * 创建 TypeScript 配置。\n *\n * @remarks\n * 始终采用 ESLint 与 typescript-eslint 的 `strictTypeChecked`、`stylisticTypeChecked` 预置并启动 Project Service。\n * 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。\n *\n * @param files - 应用 TypeScript 配置的 ESLint glob 列表。\n * @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。\n */\nexport const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/typescript/type-checked\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(),\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mCACZ;CACC,OAAO,QAAQ;CACf;EACC,MAAM;EACN,OAAO;CACR;CACA,GAAG,SAAS,QAAQ;CACpB,GAAG,SAAS,QAAQ;AACrB;;;;;;;;;;AAWD,MAAa,uCAA6D;CACzE,gBAAgB;CAChB,qBAAqB,CAAC,QAAQ,OAAO;AACtC;;;;;;;;;;;AAYA,MAAa,2BAA2B,QAA2B,qBAClE,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,SAAS,2BAA2B;CACpC,iBAAiB;EAChB,aAAa;EACb,eAAe,8BAA8B;CAC9C;CACA,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD,CACD,CAAC"}
|
|
@@ -11,7 +11,6 @@ import { defineConfig } from "eslint/config";
|
|
|
11
11
|
* @param files - 应用 UniApp 公共全局变量的代码文件 glob。
|
|
12
12
|
* @returns UniApp globals 与 JSON 注释兼容配置。
|
|
13
13
|
*/
|
|
14
|
-
declare const createUniAppConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
14
|
+
export declare const createUniAppConfigs: (files?: readonly string[]) => ReturnType<typeof defineConfig>;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { createUniAppConfigs };
|
|
17
16
|
//# sourceMappingURL=uniapp.d.mts.map
|
package/dist/configs/vue.d.mts
CHANGED
|
@@ -9,7 +9,6 @@ import { defineConfig } from "eslint/config";
|
|
|
9
9
|
*
|
|
10
10
|
* @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。
|
|
11
11
|
*/
|
|
12
|
-
declare const createVueConfigs: () => ReturnType<typeof defineConfig>;
|
|
12
|
+
export declare const createVueConfigs: () => ReturnType<typeof defineConfig>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { createVueConfigs };
|
|
15
14
|
//# sourceMappingURL=vue.d.mts.map
|
package/dist/configs/vue.mjs
CHANGED
|
@@ -25,17 +25,22 @@ const createVueConfigs = () => defineConfig([{
|
|
|
25
25
|
parser: vueEslintParser,
|
|
26
26
|
parserOptions: {
|
|
27
27
|
parser: tseslint.parser,
|
|
28
|
-
extraFileExtensions: [".vue", ".nvue"],
|
|
29
28
|
ecmaFeatures: { jsx: true },
|
|
30
29
|
sourceType: "module",
|
|
31
30
|
...createTypeScriptParserOptions()
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
33
|
rules: {
|
|
34
|
+
...tseslint.configs.strictTypeChecked[1]?.rules ?? {},
|
|
35
35
|
...typescriptRules,
|
|
36
36
|
...typescriptTypeCheckedRules,
|
|
37
|
-
...tseslint.configs.recommendedTypeChecked[1]?.rules ?? {},
|
|
38
37
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
38
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
39
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
40
|
+
args: "none",
|
|
41
|
+
caughtErrors: "none",
|
|
42
|
+
ignoreRestSiblings: true
|
|
43
|
+
}],
|
|
39
44
|
...vueRules
|
|
40
45
|
}
|
|
41
46
|
}]);
|
package/dist/configs/vue.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...eslintPluginVue.configs[\"flat/recommended\"]],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparser: vueEslintParser,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tparser: tseslint.parser,\n\t\t\t\t\
|
|
1
|
+
{"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...eslintPluginVue.configs[\"flat/recommended\"]],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparser: vueEslintParser,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tparser: tseslint.parser,\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\tjsx: true,\n\t\t\t\t\t},\n\t\t\t\t\tsourceType: \"module\",\n\t\t\t\t\t...createTypeScriptParserOptions(),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t// Vue SFC 需要显式接管 TypeScript 预置中的核心规则替换,再由本地策略做最终覆写。\n\t\t\t\t...(tseslint.configs.strictTypeChecked[1]?.rules ?? {}),\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t\t// SFC 以模板上下文和快速迭代为主,不强制补写函数返回类型或模块边界类型。\n\t\t\t\t\"@typescript-eslint/explicit-function-return-type\": \"off\",\n\t\t\t\t\"@typescript-eslint/explicit-module-boundary-types\": \"off\",\n\t\t\t\t// defineEmits 校验器和框架回调的形参可用于声明契约而不读取;普通未使用变量和导入仍然报错。\n\t\t\t\t\"@typescript-eslint/no-unused-vars\": [\"error\", { args: \"none\", caughtErrors: \"none\", ignoreRestSiblings: true }],\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBACZ,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,UAAU,SAAS;CAC3B,SAAS,CAAC,GAAG,2BAA2B,GAAG,GAAG,gBAAgB,QAAQ,mBAAmB;CACzF,iBAAiB;EAChB,aAAa;EACb,QAAQ;EACR,eAAe;GACd,QAAQ,SAAS;GACjB,cAAc,EACb,KAAK,KACN;GACA,YAAY;GACZ,GAAG,8BAA8B;EAClC;CACD;CACA,OAAO;EAEN,GAAI,SAAS,QAAQ,kBAAkB,EAAE,EAAE,SAAS,CAAC;EACrD,GAAG;EACH,GAAG;EAEH,oDAAoD;EACpD,qDAAqD;EAErD,qCAAqC,CAAC,SAAS;GAAE,MAAM;GAAQ,cAAc;GAAQ,oBAAoB;EAAK,CAAC;EAC/G,GAAG;CACJ;AACD,CACD,CAAC"}
|
|
@@ -9,29 +9,29 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
/** JavaScript 与 JSX 文件;扩展名列表与 Node.js ESM/CJS 约定保持一致。 */
|
|
12
|
-
declare const GLOBS_JAVASCRIPT: readonly ["**/*.{js,cjs,mjs,jsx}"];
|
|
12
|
+
export declare const GLOBS_JAVASCRIPT: readonly ["**/*.{js,cjs,mjs,jsx}"];
|
|
13
13
|
/** TypeScript 与 TSX 文件;包含 TypeScript 的 ESM/CJS 专用扩展名。 */
|
|
14
|
-
declare const GLOBS_TYPESCRIPT: readonly ["**/*.{ts,cts,mts,tsx}"];
|
|
14
|
+
export declare const GLOBS_TYPESCRIPT: readonly ["**/*.{ts,cts,mts,tsx}"];
|
|
15
15
|
/** Vue 3 单文件组件。 */
|
|
16
|
-
declare const GLOB_VUE = "**/*.vue";
|
|
16
|
+
export declare const GLOB_VUE = "**/*.vue";
|
|
17
17
|
/** UniApp 原生渲染页面使用的 Vue 单文件组件。 */
|
|
18
|
-
declare const GLOB_NVUE = "**/*.nvue";
|
|
18
|
+
export declare const GLOB_NVUE = "**/*.nvue";
|
|
19
19
|
/** Angular 组件、指令、服务等框架源码;Angular CLI 项目以 `.ts` 为标准源码扩展名。 */
|
|
20
|
-
declare const GLOB_ANGULAR_TYPESCRIPT = "**/*.ts";
|
|
20
|
+
export declare const GLOB_ANGULAR_TYPESCRIPT = "**/*.ts";
|
|
21
21
|
/** Angular 外部模板;内联模板由 Angular 处理器提取后复用同一模板配置。 */
|
|
22
|
-
declare const GLOB_ANGULAR_TEMPLATE = "**/*.html";
|
|
22
|
+
export declare const GLOB_ANGULAR_TEMPLATE = "**/*.html";
|
|
23
23
|
/** 严格 JSON 文件。 */
|
|
24
|
-
declare const GLOB_JSON = "**/*.json";
|
|
24
|
+
export declare const GLOB_JSON = "**/*.json";
|
|
25
25
|
/** 允许注释与尾随逗号的 JSONC 文件。 */
|
|
26
|
-
declare const GLOB_JSONC = "**/*.jsonc";
|
|
26
|
+
export declare const GLOB_JSONC = "**/*.jsonc";
|
|
27
27
|
/** 使用 JSON5 语法的配置文件。 */
|
|
28
|
-
declare const GLOB_JSON5 = "**/*.json5";
|
|
28
|
+
export declare const GLOB_JSON5 = "**/*.json5";
|
|
29
29
|
/** Markdown 文档。 */
|
|
30
|
-
declare const GLOB_MARKDOWN = "**/*.md";
|
|
30
|
+
export declare const GLOB_MARKDOWN = "**/*.md";
|
|
31
31
|
/** UniApp 项目允许使用注释的应用清单和页面路由配置。 */
|
|
32
|
-
declare const GLOBS_UNIAPP_JSON: readonly ["**/manifest.json", "**/pages.json"];
|
|
32
|
+
export declare const GLOBS_UNIAPP_JSON: readonly ["**/manifest.json", "**/pages.json"];
|
|
33
33
|
/** UniApp 跨端运行时提供的公共全局变量。 */
|
|
34
|
-
declare const UNIAPP_GLOBALS: {
|
|
34
|
+
export declare const UNIAPP_GLOBALS: {
|
|
35
35
|
readonly getApp: "readonly";
|
|
36
36
|
readonly getCurrentPages: "readonly";
|
|
37
37
|
readonly getCurrentSubNVue: "readonly";
|
|
@@ -45,7 +45,7 @@ declare const UNIAPP_GLOBALS: {
|
|
|
45
45
|
* ESLint 不执行 `#ifdef`/`#endif` 预处理,因此启用 UniApp 后统一声明这些对象。它们只解决
|
|
46
46
|
* 静态 `no-undef`,不会验证当前发行目标是否真的提供对应 API。
|
|
47
47
|
*/
|
|
48
|
-
declare const UNIAPP_CONDITIONAL_GLOBALS: {
|
|
48
|
+
export declare const UNIAPP_CONDITIONAL_GLOBALS: {
|
|
49
49
|
readonly dd: "readonly";
|
|
50
50
|
readonly jd: "readonly";
|
|
51
51
|
readonly ks: "readonly";
|
|
@@ -59,18 +59,17 @@ declare const UNIAPP_CONDITIONAL_GLOBALS: {
|
|
|
59
59
|
readonly wx: "readonly";
|
|
60
60
|
};
|
|
61
61
|
/** 默认由 JavaScript、TypeScript 和 Vue 规则处理的全部代码文件。 */
|
|
62
|
-
declare const GLOBS_CODE: readonly ["**/*.{js,cjs,mjs,jsx}", "**/*.{ts,cts,mts,tsx}", "**/*.vue"];
|
|
62
|
+
export declare const GLOBS_CODE: readonly ["**/*.{js,cjs,mjs,jsx}", "**/*.{ts,cts,mts,tsx}", "**/*.vue"];
|
|
63
63
|
/**
|
|
64
64
|
* 应额外获得 Node.js 全局变量的工程文件。
|
|
65
65
|
*
|
|
66
66
|
* 这些模式还会与当前已启用的 JavaScript/TypeScript 文件模式做 AND 匹配,
|
|
67
67
|
* 因而关闭 TypeScript 后不会意外让 ESLint 接管 `.ts` 文件。
|
|
68
68
|
*/
|
|
69
|
-
declare const GLOBS_NODE_TOOLING: readonly ["**/*.{config,setup}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/{scripts,bin}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/{test,tests}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/*.{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/cli.{js,cjs,mjs,ts,cts,mts}"];
|
|
69
|
+
export declare const GLOBS_NODE_TOOLING: readonly ["**/*.{config,setup}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/{scripts,bin}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/{test,tests}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/*.{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/cli.{js,cjs,mjs,ts,cts,mts}"];
|
|
70
70
|
/** TypeScript 配置文件;它们使用 JSONC 语法并允许注释。 */
|
|
71
|
-
declare const GLOBS_TSCONFIG: readonly ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
71
|
+
export declare const GLOBS_TSCONFIG: readonly ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
72
72
|
/** 不应交给 JSON/Markdown 解析器处理的包管理器锁文件。 */
|
|
73
|
-
declare const GLOBS_LOCKFILES: readonly ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/bun.lock", "**/bun.lockb", "**/deno.lock"];
|
|
73
|
+
export declare const GLOBS_LOCKFILES: readonly ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/bun.lock", "**/bun.lockb", "**/deno.lock"];
|
|
74
74
|
//#endregion
|
|
75
|
-
export { GLOBS_CODE, GLOBS_JAVASCRIPT, GLOBS_LOCKFILES, GLOBS_NODE_TOOLING, GLOBS_TSCONFIG, GLOBS_TYPESCRIPT, GLOBS_UNIAPP_JSON, GLOB_ANGULAR_TEMPLATE, GLOB_ANGULAR_TYPESCRIPT, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_MARKDOWN, GLOB_NVUE, GLOB_VUE, UNIAPP_CONDITIONAL_GLOBALS, UNIAPP_GLOBALS };
|
|
76
75
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ type RejectUnknownRuleNames<Rules extends RuleOptions> = Rules & Record<Exclude<
|
|
|
14
14
|
* @param rules - 需要进行规则名、严重级别和选项校验的 ESLint 规则记录。
|
|
15
15
|
* @returns 原始规则记录。返回值同时兼容 ESLint 的通用 `RulesRecord` 类型。
|
|
16
16
|
*/
|
|
17
|
-
declare const defineRules: <const Rules extends RuleOptions>(rules: RejectUnknownRuleNames<Rules>) => Rules & Linter.RulesRecord;
|
|
17
|
+
export declare const defineRules: <const Rules extends RuleOptions>(rules: RejectUnknownRuleNames<Rules>) => Rules & Linter.RulesRecord;
|
|
18
18
|
/**
|
|
19
19
|
* 根配置工厂唯一保留的项目选项。
|
|
20
20
|
*
|
|
@@ -24,7 +24,7 @@ declare const defineRules: <const Rules extends RuleOptions>(rules: RejectUnknow
|
|
|
24
24
|
* `fastConfig()` 的后置 Flat Config 参数声明。React、Angular、Markdown 与其他可选能力
|
|
25
25
|
* 应从 `@fast-china/eslint-config/configs` 显式组合。
|
|
26
26
|
*/
|
|
27
|
-
interface FastConfigOptions {
|
|
27
|
+
export interface FastConfigOptions {
|
|
28
28
|
/**
|
|
29
29
|
* 应用代码实际运行的环境。
|
|
30
30
|
*
|
|
@@ -48,13 +48,13 @@ interface FastConfigOptions {
|
|
|
48
48
|
* @param options - 应用代码的运行环境。
|
|
49
49
|
* @returns 可作为 React、Angular、Node.js 或 SDK 项目基础的 Flat Config 数组。
|
|
50
50
|
*/
|
|
51
|
-
declare const createBaseConfigs: ({ environment }?: FastConfigOptions) => Config[];
|
|
51
|
+
export declare const createBaseConfigs: ({ environment }?: FastConfigOptions) => Config[];
|
|
52
52
|
/**
|
|
53
53
|
* 创建固定的 Vue 3、TypeScript 与 UniApp ESLint Flat Config。
|
|
54
54
|
*
|
|
55
55
|
* @remarks
|
|
56
56
|
* 除运行环境外,根入口不提供能力启停开关。TypeScript 和 Vue 始终使用
|
|
57
|
-
* `
|
|
57
|
+
* `strictTypeChecked`、`stylisticTypeChecked` 与 Project Service;被检查文件必须属于可发现的 tsconfig。
|
|
58
58
|
* 额外配置会放在全部内置片段之后,因此可以覆盖项目规则、globals、ignores 或解析器选项。
|
|
59
59
|
*
|
|
60
60
|
* @param options - 应用代码的运行环境。
|
|
@@ -74,7 +74,7 @@ declare const createBaseConfigs: ({ environment }?: FastConfigOptions) => Config
|
|
|
74
74
|
* );
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
declare const fastConfig: ({ environment }?: FastConfigOptions, ...overrides: Config[]) => Config[];
|
|
77
|
+
export declare const fastConfig: ({ environment }?: FastConfigOptions, ...overrides: Config[]) => Config[];
|
|
78
78
|
/**
|
|
79
79
|
* 可直接导出或展开的默认 ESLint Flat Config。
|
|
80
80
|
*
|
|
@@ -84,5 +84,5 @@ declare const fastConfig: ({ environment }?: FastConfigOptions, ...overrides: Co
|
|
|
84
84
|
*/
|
|
85
85
|
declare const fastChina: Config[];
|
|
86
86
|
//#endregion
|
|
87
|
-
export {
|
|
87
|
+
export { type RuleOptions, fastChina as default };
|
|
88
88
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -72,7 +72,7 @@ const createVueProjectConfigs = ({ environment = "browser" } = {}) => createProj
|
|
|
72
72
|
*
|
|
73
73
|
* @remarks
|
|
74
74
|
* 除运行环境外,根入口不提供能力启停开关。TypeScript 和 Vue 始终使用
|
|
75
|
-
* `
|
|
75
|
+
* `strictTypeChecked`、`stylisticTypeChecked` 与 Project Service;被检查文件必须属于可发现的 tsconfig。
|
|
76
76
|
* 额外配置会放在全部内置片段之后,因此可以覆盖项目规则、globals、ignores 或解析器选项。
|
|
77
77
|
*
|
|
78
78
|
* @param options - 应用代码的运行环境。
|