@fast-china/eslint-config 2.0.0 → 2.0.1

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 CHANGED
@@ -6,6 +6,20 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 2.0.1 - 2026-07-26
10
+
11
+ ### Added
12
+
13
+ - Added first-class opt-in React support with JavaScript/TypeScript presets, official Hooks and React Compiler diagnostics, DOM safety rules, React-compatible JSX runtime settings, generated rule types, and runtime tests.
14
+ - Added first-class opt-in Angular support for framework TypeScript, external and inline templates, modern recommended rules, configurable template accessibility, generated rule types, and runtime tests.
15
+
16
+ ### Changed
17
+
18
+ - Changed the newly bundled React and Angular dependencies to caret ranges so compatible minor and patch releases can be installed without editing the manifest.
19
+ - Completed the TypeScript 6 migration with TypeScript 6.0.3, removed the deprecated compiler-option suppression, and replaced tsup with tsdown 0.22.14 for native `.mjs`, `.d.mts`, and source-map builds.
20
+ - Raised the verified runtime baselines to Node.js 22.18.0 and 24.11.0 to match the current tsdown toolchain.
21
+ - Updated the development baseline to ESLint 10.8.0, then upgraded `actions/checkout` plus `actions/setup-node` to their current v7 major releases.
22
+
9
23
  ## 2.0.0 - 2026-07-26
10
24
 
11
25
  ### Added
@@ -23,3 +37,4 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
23
37
  ### Changed
24
38
 
25
39
  - Raised the minimum supported Node.js version to 22.13.0 so the package, local development workflow, and pnpm 11 CI use one consistent runtime baseline.
40
+ - Upgraded `pnpm/action-setup` to v6 so GitHub Actions uses its Node.js 24 runtime without Node.js 20 deprecation warnings.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # @fast-china/eslint-config
4
4
 
5
- A practical, typed ESLint Flat Config for Vue 3, Vite, TypeScript, and JavaScript projects.
5
+ A practical, typed ESLint Flat Config for Vue 3, React, Angular, Vite, TypeScript, and JavaScript projects.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@fast-china/eslint-config?color=orange)](https://www.npmjs.com/package/@fast-china/eslint-config)
8
8
  [![license](https://img.shields.io/npm/l/@fast-china/eslint-config)](./LICENSE)
@@ -10,8 +10,8 @@ A practical, typed ESLint Flat Config for Vue 3, Vite, TypeScript, and JavaScrip
10
10
  ## Highlights
11
11
 
12
12
  - Built for ESLint 10 and the native Flat Config format.
13
- - Vue 3 + TypeScript + Vite defaults, with type-aware linting and language integrations controlled explicitly.
14
- - First-class JavaScript, TypeScript, Vue SFC, JSON, JSONC, JSON5, Markdown, RegExp, and import rules.
13
+ - Vue 3 + TypeScript + Vite defaults; React and Angular are first-class opt-in integrations, so existing Vue projects do not activate unrelated rules.
14
+ - First-class JavaScript, TypeScript, Vue SFC, JSX/TSX, Angular TypeScript and templates, JSON dialects, Markdown, RegExp, and import rules.
15
15
  - One focused `fastConfig()` factory with a compact public API and no project-file reads at module import time.
16
16
  - Schema-generated rule types provide exact rule-name and rule-option completion.
17
17
  - Plugins and parsers are regular package dependencies, so consumers do not need to assemble the plugin graph.
@@ -21,9 +21,9 @@ A practical, typed ESLint Flat Config for Vue 3, Vite, TypeScript, and JavaScrip
21
21
 
22
22
  ## Requirements
23
23
 
24
- - Node.js `^22.13.0` or `^24.0.0`
24
+ - Node.js `^22.18.0` or `>=24.11.0`
25
25
  - ESLint `^10.0.0`
26
- - TypeScript `>=5.3.0 <6.1.0`
26
+ - TypeScript `>=6.0.0 <6.1.0`
27
27
 
28
28
  These versions follow the runtime requirements of ESLint 10 and the included language plugins.
29
29
 
@@ -51,6 +51,44 @@ The default enables Vue 3, TypeScript, JavaScript, JSON dialects, Markdown, impo
51
51
 
52
52
  Use the default `fastConfig()` factory to keep only what a project needs.
53
53
 
54
+ ### React + Vite
55
+
56
+ ```js
57
+ import fastChina from "@fast-china/eslint-config";
58
+
59
+ export default fastChina({
60
+ react: true,
61
+ vue: false,
62
+ });
63
+ ```
64
+
65
+ React support applies the modern `@eslint-react` JavaScript/TypeScript preset, the official React Hooks Flat Config, and additional DOM safety checks. JSX and TSX are parsed by the existing JavaScript and TypeScript integrations. For a React-compatible JSX runtime such as Preact, set `react: { importSource: "preact" }`.
66
+
67
+ ### Angular
68
+
69
+ ```js
70
+ import fastChina from "@fast-china/eslint-config";
71
+
72
+ export default fastChina({
73
+ angular: true,
74
+ vue: false,
75
+ });
76
+ ```
77
+
78
+ Angular support checks framework TypeScript, external `.html` templates, and inline component templates. Template accessibility and inline-template extraction are enabled by default:
79
+
80
+ ```js
81
+ export default fastChina({
82
+ angular: {
83
+ inlineTemplates: true,
84
+ templateAccessibility: true,
85
+ },
86
+ vue: false,
87
+ });
88
+ ```
89
+
90
+ Angular requires the TypeScript integration; `angular: true` together with `typescript: false` fails early with a clear configuration error.
91
+
54
92
  ### Node.js + TypeScript
55
93
 
56
94
  ```js
@@ -93,24 +131,32 @@ Type-aware linting uses the typescript-eslint Project Service. Project files mus
93
131
 
94
132
  ## Options
95
133
 
96
- | Option | Default | Purpose |
97
- | ----------------- | ----------- | ------------------------------------------------------------------- |
98
- | `environment` | `"browser"` | Use `"browser"`, `"node"`, or `"universal"` globals. |
99
- | `globals` | none | Add globals supplied by a host platform or test runner. |
100
- | `gitignore` | `true` | Read ignore patterns from the project `.gitignore`. |
101
- | `ignores` | `[]` | Append project-specific global ignore patterns. |
102
- | `imports` | `true` | Enable import-x correctness and ordering rules. |
103
- | `javascript` | `true` | Process JavaScript and JSX files. |
104
- | `json` | `true` | Enable recommended JSON, JSONC, and JSON5 rules. |
105
- | `lodash` | `false` | Select `"lodash"` or `"lodash-unified"` for static imports. |
106
- | `markdown` | `true` | Enable the official Markdown language rules. |
107
- | `prettier` | `true` | Disable ESLint rules that conflict with Prettier. |
108
- | `regexp` | `true` | Enable recommended RegExp rules. |
109
- | `rules` | none | Add exactly typed project rules to every enabled code file. |
110
- | `sortPackageJson` | `false` | Sort safe package.json keys without entering conditional `exports`. |
111
- | `sortTsconfig` | `false` | Sort `tsconfig*.json` by TypeScript documentation topics. |
112
- | `typescript` | `true` | Disable it or pass `{ typeChecked: true, tsconfigRootDir }`. |
113
- | `vue` | `true` | Enable Vue 3 single-file components. |
134
+ | Option | Default | Purpose |
135
+ | ----------------- | ----------- | -------------------------------------------------------------------------- |
136
+ | `angular` | `false` | Enable Angular TypeScript and templates, or pass Angular-specific options. |
137
+ | `environment` | `"browser"` | Use `"browser"`, `"node"`, or `"universal"` globals. |
138
+ | `globals` | none | Add globals supplied by a host platform or test runner. |
139
+ | `gitignore` | `true` | Read ignore patterns from the project `.gitignore`. |
140
+ | `ignores` | `[]` | Append project-specific global ignore patterns. |
141
+ | `imports` | `true` | Enable import-x correctness and ordering rules. |
142
+ | `javascript` | `true` | Process JavaScript and JSX files. |
143
+ | `json` | `true` | Enable recommended JSON, JSONC, and JSON5 rules. |
144
+ | `lodash` | `false` | Select `"lodash"` or `"lodash-unified"` for static imports. |
145
+ | `markdown` | `true` | Enable the official Markdown language rules. |
146
+ | `prettier` | `true` | Disable ESLint rules that conflict with Prettier. |
147
+ | `react` | `false` | Enable React/JSX/Hooks, or pass runtime and React-version settings. |
148
+ | `regexp` | `true` | Enable recommended RegExp rules. |
149
+ | `rules` | none | Add exactly typed project rules to every enabled code file. |
150
+ | `sortPackageJson` | `false` | Sort safe package.json keys without entering conditional `exports`. |
151
+ | `sortTsconfig` | `false` | Sort `tsconfig*.json` by TypeScript documentation topics. |
152
+ | `typescript` | `true` | Disable it or pass `{ typeChecked: true, tsconfigRootDir }`. |
153
+ | `vue` | `true` | Enable Vue 3 single-file components. |
154
+
155
+ ## Framework coverage
156
+
157
+ Vue 3, React, and Angular have dedicated parsers or processors, presets, options, generated rule types, and integration tests. Nuxt can use the Vue base; Next.js and Remix can use the React base, then append their framework-specific Flat Config after `fastConfig()` when needed. React-compatible JSX runtimes can use `react.importSource`.
158
+
159
+ Svelte, Astro, and Solid use different template or compiler semantics and are not presented as first-class integrations yet. Their official Flat Config can already be appended as a trailing override, but first-class switches should only be added together with the correct parser, processor, rule schemas, documentation, and runtime fixtures.
114
160
 
115
161
  ## Lodash import policy
116
162
 
@@ -159,8 +205,11 @@ The package generates `RuleOptions` from the JSON Schemas published by ESLint co
159
205
  import fastChina, { defineRules } from "@fast-china/eslint-config";
160
206
 
161
207
  const projectRules = defineRules({
208
+ "@angular-eslint/template/alt-text": "error",
209
+ "@eslint-react/dom-no-missing-button-type": "error",
162
210
  "@typescript-eslint/no-unused-vars": ["error", { args: "after-used" }],
163
211
  "import-x/order": ["error", { "newlines-between": "always" }],
212
+ "react-hooks/exhaustive-deps": "warn",
164
213
  "vue/attributes-order": ["error", { order: ["DEFINITION", "EVENTS", "CONTENT"] }],
165
214
  });
166
215
 
@@ -188,7 +237,7 @@ The generated set covers ESLint core and plugins bundled by this package. Rules
188
237
 
189
238
  ## Rule risk and maintenance
190
239
 
191
- The default includes a small set of high-impact rules. They can block particular patterns or require a review of import side effects, type-only imports, and public component events. Manifest sorting is also high-impact but is disabled by default. Source comments mark these decisions as `[高影响]`, `[可自动修复]`, or `[安全关注]`.
240
+ The default includes a small set of high-impact rules. They can block particular patterns or require a review of import side effects, type-only imports, and public component events. React and Angular are disabled globally by default, but enabling them also enables their documented modern-framework and accessibility policies. Manifest sorting is high-impact and disabled by default. Source comments mark these decisions as `[高影响]`, `[可自动修复]`, `[安全关注]`, or `[按需启用]`.
192
241
 
193
242
  See the [default-rule and risk guide](./docs/rules-risk.md) for inherited presets, the high-impact inventory, scoped override examples, and the maintenance contract. Run a read-only lint before `eslint --fix`, apply fixes in an isolated commit, and review imports, `package.json`, component events, and build output.
194
243
 
package/README.zh.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # @fast-china/eslint-config
4
4
 
5
- 面向 Vue 3、Vite、TypeScript 与 JavaScript 项目的实用型 ESLint Flat Config 规则库。
5
+ 面向 Vue 3、React、Angular、Vite、TypeScript 与 JavaScript 项目的实用型 ESLint Flat Config 规则库。
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@fast-china/eslint-config?color=orange)](https://www.npmjs.com/package/@fast-china/eslint-config)
8
8
  [![license](https://img.shields.io/npm/l/@fast-china/eslint-config)](./LICENSE)
@@ -10,8 +10,8 @@
10
10
  ## 特性
11
11
 
12
12
  - 基于 ESLint 10,仅提供原生 Flat Config。
13
- - 默认针对 Vue 3 + TypeScript + Vite,可显式开启类型感知规则或关闭不需要的语言能力。
14
- - 完整覆盖 JavaScript、TypeScript、Vue SFC、JSON、JSONC、JSON5、Markdown、正则表达式与导入规则。
13
+ - 默认针对 Vue 3 + TypeScript + Vite;React 与 Angular 是完整但按需启用的框架集成,Vue 项目不会意外接管无关文件。
14
+ - 完整覆盖 JavaScript、TypeScript、Vue SFC、JSX/TSX、Angular TypeScript 与模板、JSON 各方言、Markdown、正则表达式与导入规则。
15
15
  - 默认导出单一 `fastConfig()` 工厂,公共 API 清晰,并且不会在导入模块时读取项目文件。
16
16
  - 根据 ESLint 与内置插件的规则 schema 生成精确类型,提供规则名和规则选项自动补全。
17
17
  - 插件与解析器均由本包直接声明依赖,使用者不需要手工拼装插件依赖树。
@@ -21,9 +21,9 @@
21
21
 
22
22
  ## 环境要求
23
23
 
24
- - Node.js `^22.13.0` 或 `^24.0.0`
24
+ - Node.js `^22.18.0` 或 `>=24.11.0`
25
25
  - ESLint `^10.0.0`
26
- - TypeScript `>=5.3.0 <6.1.0`
26
+ - TypeScript `>=6.0.0 <6.1.0`
27
27
 
28
28
  这些版本范围与 ESLint 10 及内置语言插件的运行要求保持一致。
29
29
 
@@ -51,6 +51,44 @@ export default fastChina();
51
51
 
52
52
  通过默认导出的 `fastConfig()` 只保留项目真正需要的能力。
53
53
 
54
+ ### React + Vite
55
+
56
+ ```js
57
+ import fastChina from "@fast-china/eslint-config";
58
+
59
+ export default fastChina({
60
+ react: true,
61
+ vue: false,
62
+ });
63
+ ```
64
+
65
+ React 集成会应用现代 `@eslint-react` JavaScript/TypeScript 预置、React 官方 Hooks Flat Config,以及额外的 DOM 安全检查。JSX 与 TSX 分别复用现有 JavaScript、TypeScript 解析能力。Preact 等兼容 React 的 JSX 运行时可设置 `react: { importSource: "preact" }`。
66
+
67
+ ### Angular
68
+
69
+ ```js
70
+ import fastChina from "@fast-china/eslint-config";
71
+
72
+ export default fastChina({
73
+ angular: true,
74
+ vue: false,
75
+ });
76
+ ```
77
+
78
+ Angular 集成会检查框架 TypeScript、外部 `.html` 模板和组件内联模板。模板无障碍规则与内联模板提取默认开启,也可以显式配置:
79
+
80
+ ```js
81
+ export default fastChina({
82
+ angular: {
83
+ inlineTemplates: true,
84
+ templateAccessibility: true,
85
+ },
86
+ vue: false,
87
+ });
88
+ ```
89
+
90
+ Angular 依赖 TypeScript 集成;同时设置 `angular: true` 与 `typescript: false` 时会立即抛出清晰的配置错误。
91
+
54
92
  ### Node.js + TypeScript
55
93
 
56
94
  ```js
@@ -95,6 +133,7 @@ export default fastChina({
95
133
 
96
134
  | 选项 | 默认值 | 作用 |
97
135
  | ----------------- | ----------- | -------------------------------------------------------------- |
136
+ | `angular` | `false` | 启用 Angular TypeScript 与模板,或传入 Angular 专用选项。 |
98
137
  | `environment` | `"browser"` | 可选 `"browser"`、`"node"` 或 `"universal"` 全局变量。 |
99
138
  | `globals` | 无 | 增加项目宿主、测试运行器等提供的全局变量。 |
100
139
  | `gitignore` | `true` | 读取项目根目录的 `.gitignore`。 |
@@ -105,6 +144,7 @@ export default fastChina({
105
144
  | `lodash` | `false` | 可选 `"lodash"` 或 `"lodash-unified"`,统一静态导入来源。 |
106
145
  | `markdown` | `true` | 启用官方 Markdown 语言规则。 |
107
146
  | `prettier` | `true` | 关闭与 Prettier 冲突的 ESLint 规则。 |
147
+ | `react` | `false` | 启用 React、JSX 与 Hooks,或传入运行时和 React 版本设置。 |
108
148
  | `regexp` | `true` | 启用推荐的正则表达式规则。 |
109
149
  | `rules` | 无 | 对所有已启用代码文件追加具有精确类型的项目规则。 |
110
150
  | `sortPackageJson` | `false` | 按安全白名单排序 `package.json`,不会进入 `exports` 条件对象。 |
@@ -112,6 +152,12 @@ export default fastChina({
112
152
  | `typescript` | `true` | 可关闭,或传入 `{ typeChecked: true, tsconfigRootDir }`。 |
113
153
  | `vue` | `true` | 启用 Vue 3 单文件组件支持。 |
114
154
 
155
+ ## 框架覆盖范围
156
+
157
+ Vue 3、React 与 Angular 都有专用解析器或处理器、推荐规则、配置选项、生成规则类型与集成测试。Nuxt 可使用 Vue 基础配置;Next.js 与 Remix 可使用 React 基础配置,并在 `fastConfig()` 后追加各自的框架 Flat Config。兼容 React 的 JSX 运行时可以使用 `react.importSource`。
158
+
159
+ Svelte、Astro 与 Solid 具有不同的模板或编译器语义,目前不会被包装成名义上的“一键支持”。项目已经可以把它们的官方 Flat Config 作为末尾覆写传入;将来只有在解析器、处理器、规则 schema、文档和真实运行时 fixture 一并完成时,才会增加对应的一等开关。
160
+
115
161
  ## Lodash 导入策略
116
162
 
117
163
  默认值 `lodash: false` 不限制项目选择。需要统一依赖入口时,可选择以下任一策略:
@@ -159,8 +205,11 @@ export default fastChina({ lodash: "lodash" });
159
205
  import fastChina, { defineRules } from "@fast-china/eslint-config";
160
206
 
161
207
  const projectRules = defineRules({
208
+ "@angular-eslint/template/alt-text": "error",
209
+ "@eslint-react/dom-no-missing-button-type": "error",
162
210
  "@typescript-eslint/no-unused-vars": ["error", { args: "after-used" }],
163
211
  "import-x/order": ["error", { "newlines-between": "always" }],
212
+ "react-hooks/exhaustive-deps": "warn",
164
213
  "vue/attributes-order": ["error", { order: ["DEFINITION", "EVENTS", "CONTENT"] }],
165
214
  });
166
215
 
@@ -188,7 +237,7 @@ const rules = {
188
237
 
189
238
  ## 规则风险与维护
190
239
 
191
- 默认配置包含少量高影响规则:它们可能阻断特定写法,或要求复核 import 副作用、类型导入和组件公共事件。清单排序同样属于高影响能力,但默认关闭。源码使用 `[高影响]`、`[可自动修复]` 与 `[安全关注]` 标记这类规则。
240
+ 默认配置包含少量高影响规则:它们可能阻断特定写法,或要求复核 import 副作用、类型导入和组件公共事件。React 与 Angular 在全局默认关闭,但启用框架后也会启用文档中列出的现代框架约束和无障碍规则。清单排序同样属于高影响能力,但默认关闭。源码使用 `[高影响]`、`[可自动修复]`、`[安全关注]` 与 `[按需启用]` 标记这类规则。
192
241
 
193
242
  完整的默认预置来源、高影响规则清单、关闭示例和维护约定见 [默认规则与风险指南](./docs/rules-risk.zh.md)。运行 `eslint --fix` 前建议先只检查,在独立提交中应用修复,并审查 import、`package.json`、组件事件和构建产物。
194
243