@pawover/kit-eslint-rules 0.2.0-alpha.0 → 0.2.0-alpha.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/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -161,6 +161,7 @@ interface ReactOptions extends RulesOverrideOptions {
|
|
|
161
161
|
*
|
|
162
162
|
* react 组启用时默认开启(`true` 等价 `"recommended"`):将 10 条与 `@eslint-react` 重叠的
|
|
163
163
|
* Compiler 规则切换为 `eslint-plugin-react-hooks` 官方实现,并关闭 `@eslint-react` 等价规则;
|
|
164
|
+
* 同时关闭 `react/no-unstable-context-value`(React Compiler 会自动记忆化 Context value);
|
|
164
165
|
* 传 `false` 回退到 `@eslint-react` 实现,传 `"latest"` 额外启用实验性 `react-hooks/void-use-memo`。
|
|
165
166
|
*
|
|
166
167
|
* 仅控制这 10 条重叠规则;官方独有的 `config` / `gating` / `incompatible-library` /
|
package/dist/index.js
CHANGED
|
@@ -4211,6 +4211,12 @@ const REACT_COMPILER_RULE_MAP = {
|
|
|
4211
4211
|
"unsupported-syntax": "unsupported-syntax",
|
|
4212
4212
|
"use-memo": "use-memo"
|
|
4213
4213
|
};
|
|
4214
|
+
/**
|
|
4215
|
+
* React Compiler 开启时需要额外关闭的 `@eslint-react` 规则
|
|
4216
|
+
*
|
|
4217
|
+
* React Compiler 会自动记忆化 Context value,`no-unstable-context-value` 的告警不再适用。
|
|
4218
|
+
*/
|
|
4219
|
+
const REACT_COMPILER_DISABLED_REACT_RULES = ["no-unstable-context-value"];
|
|
4214
4220
|
/** 仅官方 `recommended-latest` 预设包含的实验性 Compiler 规则。 */
|
|
4215
4221
|
const REACT_COMPILER_LATEST_ONLY_RULES = ["void-use-memo"];
|
|
4216
4222
|
/** 官方 flat config 预设名。 */
|
|
@@ -4250,6 +4256,7 @@ function getReactCompilerRuleMap(preset) {
|
|
|
4250
4256
|
off[`react/${eslintReactRule}`] = 0;
|
|
4251
4257
|
on[ruleId] = normalizeRuleLevel(level);
|
|
4252
4258
|
}
|
|
4259
|
+
for (const rule of REACT_COMPILER_DISABLED_REACT_RULES) off[`react/${rule}`] = 0;
|
|
4253
4260
|
if (preset === "latest") for (const rule of REACT_COMPILER_LATEST_ONLY_RULES) {
|
|
4254
4261
|
const ruleId = `react-hooks/${rule}`;
|
|
4255
4262
|
const level = presetRules[ruleId];
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/pawover"
|
|
7
7
|
},
|
|
8
8
|
"description": "Self-contained ESLint flat config preset: javascript, typescript, react, vue, stylistic, antfu and import rules, with pinned bundled plugins",
|
|
9
|
-
"version": "0.2.0-alpha.
|
|
9
|
+
"version": "0.2.0-alpha.1",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"pawover",
|