|
1 | 1 | # Rule Feature System |
2 | 2 |
|
3 | | -Every rule declares a `RULE_FEATURES` constant. This typed metadata drives preset generation, documentation badges, and rule categorization. |
| 3 | +Every rule declares a `RULE_FEATURES` constant. This typed metadata drives documentation badges and rule categorization in the rules index. |
4 | 4 |
|
5 | 5 | ## Feature Flags |
6 | 6 |
|
@@ -48,35 +48,40 @@ const RULE_FEATURES = ["EXP"]; // static-components: experimental detection |
48 | 48 |
|
49 | 49 | ## How Features Drive Presets |
50 | 50 |
|
51 | | -Feature metadata is the source of truth for badges and categorization, but the preset files themselves are maintained manually. The `scripts/20-check-rules.ts` script (run via `nub run check:rules`) verifies config consistency—registered rules are accounted for, config keys are valid, and preset hierarchies hold—but it does not check `RULE_FEATURES` flags. Keeping `disable-type-checked` and `disable-experimental` aligned with `RULE_FEATURES` is currently a manual step. |
| 51 | +Feature metadata is the source of truth for badges and categorization, but the preset files themselves are maintained manually. The `scripts/20-check-rules.ts` script (run via `nub run check:rules`) verifies config consistency—registered rules are accounted for, config keys are valid, and preset hierarchies hold. It also checks that the feature badges in each rule's `.mdx` docs and the rules index match its `RULE_FEATURES`. What it does not check is the alignment between `RULE_FEATURES` and the `disable-type-checked` / `disable-experimental` presets; keeping those aligned is currently a manual step. |
52 | 52 |
|
53 | 53 | Rules marked `TSC` are disabled in `disable-type-checked.ts`: |
54 | 54 |
|
55 | 55 | ```ts |
56 | 56 | export const rules: Linter.RulesRecord = { |
57 | | - "react-x/no-implicit-children": "off", |
58 | | - "react-x/no-implicit-key": "off", |
59 | | - "react-x/no-implicit-ref": "off", |
60 | | - "react-x/no-leaked-conditional-rendering": "off", |
61 | | - "react-x/no-unused-props": "off", |
| 57 | + "@eslint-react/no-implicit-children": "off", |
| 58 | + "@eslint-react/no-implicit-key": "off", |
| 59 | + "@eslint-react/no-implicit-ref": "off", |
| 60 | + "@eslint-react/no-leaked-conditional-rendering": "off", |
| 61 | + "@eslint-react/no-unused-props": "off", |
62 | 62 | }; |
63 | 63 | ``` |
64 | 64 |
|
65 | 65 | Rules marked `EXP` are disabled in `disable-experimental.ts`: |
66 | 66 |
|
67 | 67 | ```ts |
68 | 68 | export const rules: Linter.RulesRecord = { |
69 | | - "react-x/globals": "off", |
70 | | - "react-x/immutability": "off", |
71 | | - "react-x/no-duplicate-key": "off", |
72 | | - "react-x/no-implicit-children": "off", |
73 | | - "react-x/no-implicit-key": "off", |
74 | | - "react-x/no-implicit-ref": "off", |
75 | | - "react-x/no-misused-capture-owner-stack": "off", |
76 | | - "react-x/no-unused-props": "off", |
77 | | - "react-x/no-unused-state": "off", |
78 | | - "react-x/refs": "off", |
79 | | - "react-x/set-state-in-render": "off", |
| 69 | + "@eslint-react/globals": "off", |
| 70 | + "@eslint-react/immutability": "off", |
| 71 | + "@eslint-react/no-duplicate-key": "off", |
| 72 | + "@eslint-react/no-implicit-children": "off", |
| 73 | + "@eslint-react/no-implicit-key": "off", |
| 74 | + "@eslint-react/no-implicit-ref": "off", |
| 75 | + "@eslint-react/no-misused-capture-owner-stack": "off", |
| 76 | + "@eslint-react/no-unused-props": "off", |
| 77 | + "@eslint-react/no-unused-state": "off", |
| 78 | + "@eslint-react/refs": "off", |
| 79 | + "@eslint-react/set-state-in-render": "off", |
| 80 | + "@eslint-react/static-components": "off", |
| 81 | + |
| 82 | + "@eslint-react/rsc-function-definition": "off", |
| 83 | + |
| 84 | + "@eslint-react/web-api-no-leaked-fetch": "off", |
80 | 85 | }; |
81 | 86 | ``` |
82 | 87 |
|
|
0 commit comments