Skip to content

Commit 7f13ab2

Browse files
authored
Fix strict config export, closes #1272 (#1273)
1 parent fa1d905 commit 7f13ab2

File tree

7 files changed

+44
-10
lines changed

7 files changed

+44
-10
lines changed

examples/next/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default defineConfig([
4242
{
4343
files: TSCONFIG.include,
4444
extends: [
45-
eslintReact.configs["strict-type-checked"],
45+
eslintReact.configs["strict-typescript"],
4646
eslintPluginReactRefresh.configs.recommended,
4747
eslintPluginReactHooks.configs.flat["recommended-latest"] ?? [],
4848
],

examples/react-dom-js/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default defineConfig([
5151
{
5252
files: JSCONFIG_APP.include,
5353
extends: [
54-
eslintReact.configs.recommended,
54+
eslintReact.configs.strict,
5555
eslintPluginReactHooks.configs.flat["recommended-latest"] ?? [],
5656
eslintPluginReactRefresh.configs.recommended,
5757
],

packages/plugins/eslint-plugin-react-x/src/configs/strict.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const rules = {
1515
"react-x/no-unstable-context-value": "warn",
1616
"react-x/no-unstable-default-props": "warn",
1717
"react-x/no-unused-class-component-members": "warn",
18-
"react-x/no-unused-props": "warn",
1918
"react-x/no-unused-state": "warn",
2019
"react-x/no-useless-fragment": "warn",
2120
"react-x/prefer-destructuring-assignment": "warn",
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,43 @@
1+
/* eslint-disable perfectionist/sort-objects */
12
import { getConfigAdapters } from "@eslint-react/shared";
23

34
import * as recommendedConfig from "./configs/recommended";
45
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
56
import * as recommendedTypeScriptConfig from "./configs/recommended-typescript";
7+
import * as strictConfig from "./configs/strict";
8+
import * as strictTypeCheckedConfig from "./configs/strict-type-checked";
9+
import * as strictTypeScriptConfig from "./configs/strict-typescript";
10+
611
import { plugin } from "./plugin";
712

813
const { toFlatConfig } = getConfigAdapters("react-x", plugin);
914

1015
export default {
1116
...plugin,
1217
configs: {
18+
/**
19+
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
20+
*/
1321
["recommended"]: toFlatConfig(recommendedConfig),
14-
["recommended-type-checked"]: toFlatConfig(recommendedTypeCheckedConfig),
22+
/**
23+
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
24+
*/
1525
["recommended-typescript"]: toFlatConfig(recommendedTypeScriptConfig),
26+
/**
27+
* Same as the `recommended-typescript` preset but enables additional rules that require type information
28+
*/
29+
["recommended-type-checked"]: toFlatConfig(recommendedTypeCheckedConfig),
30+
/**
31+
* More strict version of the `recommended` preset
32+
*/
33+
["strict"]: toFlatConfig(strictConfig),
34+
/**
35+
* Same as the `strict` preset but enables additional rules that require type information
36+
*/
37+
["strict-typescript"]: toFlatConfig(strictTypeScriptConfig),
38+
/**
39+
* Same as the `strict-typescript` preset but enables additional rules that require type information
40+
*/
41+
["strict-type-checked"]: toFlatConfig(strictTypeCheckedConfig),
1642
},
1743
};

packages/plugins/eslint-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ ESLint React is not affiliated with Meta Corporation or [facebook/react](https:/
183183

184184
Contributions are welcome!
185185

186-
Please follow our [contributing guidelines](https://github.com/Rel1cx/eslint-react/tree/main/.github/CONTRIBUTING.md).
186+
Please follow our [contributing guidelines](https://github.com/Rel1cx/eslint-react/tree/fix-strict-config-export/.github/CONTRIBUTING.md).
187187

188188
## License
189189

190-
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Rel1cx/eslint-react/tree/main/LICENSE) file for details.
190+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Rel1cx/eslint-react/tree/fix-strict-config-export/LICENSE) file for details.

packages/plugins/eslint-plugin/src/configs/strict.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const rules = {
1515
"@eslint-react/no-unnecessary-use-memo": "warn",
1616
"@eslint-react/no-unstable-context-value": "warn",
1717
"@eslint-react/no-unstable-default-props": "warn",
18-
"@eslint-react/no-unused-props": "warn",
1918
"@eslint-react/no-unused-state": "warn",
2019
"@eslint-react/no-useless-fragment": "warn",
2120
"@eslint-react/prefer-destructuring-assignment": "warn",

packages/plugins/eslint-plugin/src/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ import * as offConfig from "./configs/off";
2121
import * as recommendedConfig from "./configs/recommended";
2222
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
2323
import * as recommendedTypeScriptConfig from "./configs/recommended-typescript";
24+
import * as strictConfig from "./configs/strict";
2425
import * as strictTypeCheckedConfig from "./configs/strict-type-checked";
2526
import * as strictTypescriptConfig from "./configs/strict-typescript";
27+
import * as webApiConfig from "./configs/web-api";
2628
import * as xConfig from "./configs/x";
2729

2830
import { padKeysLeft } from "./utils";
@@ -46,7 +48,7 @@ export default {
4648
...plugin,
4749
configs: {
4850
/**
49-
* Enable all rules in this plugin
51+
* Enable all applicable rules from this plugin
5052
*/
5153
["all"]: allConfig,
5254
/**
@@ -100,13 +102,21 @@ export default {
100102
*/
101103
["recommended-typescript"]: recommendedTypeScriptConfig,
102104
/**
103-
* More strict version of the `recommended-type-checked` preset
105+
* More strict version of the `recommended` preset
106+
*/
107+
["strict"]: strictConfig,
108+
/**
109+
* Same as the `strict-typescript` preset but enables additional rules that require type information
104110
*/
105111
["strict-type-checked"]: strictTypeCheckedConfig,
106112
/**
107-
* More strict version of the `recommended-typescript` preset
113+
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
108114
*/
109115
["strict-typescript"]: strictTypescriptConfig,
116+
/**
117+
* Enable rules for interacting with Web APIs
118+
*/
119+
["web-api"]: webApiConfig,
110120
/**
111121
* Enable rules for `"react"`
112122
*/

0 commit comments

Comments
 (0)