Skip to content

Commit a0760f2

Browse files
committed
Add strict presets and reorganize config files
The commit adds new strict presets for both regular and TypeScript configurations while cleaning up the config file organization and naming.
1 parent 6d5bba5 commit a0760f2

File tree

10 files changed

+57
-20
lines changed

10 files changed

+57
-20
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ export default defineConfig([
127127
Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects.\
128128
_This preset includes the `x`, `dom`, and `web-api` presets._
129129

130+
- `strict`\
131+
Same as the `recommended` preset but enables additional strict rules.
132+
130133
### TypeScript Specialized
131134

132135
- `recommended-typescript`\
@@ -135,6 +138,12 @@ export default defineConfig([
135138
- `recommended-type-checked`\
136139
Same as the `recommended-typescript` preset but enables additional rules that require type information.
137140

141+
- `strict-typescript`\
142+
Same as the `strict` preset but disables rules that can be enforced by TypeScript.
143+
144+
- `strict-type-checked`\
145+
Same as the `strict-typescript` preset but enables additional rules that require type information.
146+
138147
### Other
139148

140149
- `disable-dom`\

apps/website/content/docs/presets.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ The following presets are available in `@eslint-react/eslint-plugin`:
1919
Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects.\
2020
_This preset includes the `x`, `dom`, and `web-api` presets._
2121

22+
- `strict`\
23+
Same as the `recommended` preset but enables additional strict rules.
24+
2225
## TypeScript Specialized
2326

2427
- `recommended-typescript`\
@@ -27,6 +30,12 @@ The following presets are available in `@eslint-react/eslint-plugin`:
2730
- `recommended-type-checked`\
2831
Same as the `recommended-typescript` preset but enables additional rules that require type information.
2932

33+
- `strict-typescript`\
34+
Same as the `strict` preset but disables rules that can be enforced by TypeScript.
35+
36+
- `strict-type-checked`\
37+
Same as the `strict-typescript` preset but enables additional rules that require type information.
38+
3039
### Combined (beta)
3140

3241
- `no-deprecated`\

packages/plugins/eslint-plugin/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ export default defineConfig([
127127
Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects.\
128128
_This preset includes the `x`, `dom`, and `web-api` presets._
129129

130+
- `strict`\
131+
Same as the `recommended` preset but enables additional strict rules.
132+
130133
### TypeScript Specialized
131134

132135
- `recommended-typescript`\
@@ -135,6 +138,12 @@ export default defineConfig([
135138
- `recommended-type-checked`\
136139
Same as the `recommended-typescript` preset but enables additional rules that require type information.
137140

141+
- `strict-typescript`\
142+
Same as the `strict` preset but disables rules that can be enforced by TypeScript.
143+
144+
- `strict-type-checked`\
145+
Same as the `strict-typescript` preset but enables additional rules that require type information.
146+
138147
### Other
139148

140149
- `disable-dom`\
@@ -174,8 +183,8 @@ ESLint React is not affiliated with Meta Corporation or [facebook/react](https:/
174183

175184
Contributions are welcome!
176185

177-
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/add-strict-presets/.github/CONTRIBUTING.md).
178187

179188
## License
180189

181-
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/add-strict-presets/LICENSE) file for details.

packages/plugins/eslint-plugin/src/configs/_type-checked.ts renamed to packages/plugins/eslint-plugin/src/configs/_tc.ts

File renamed without changes.
File renamed without changes.

packages/plugins/eslint-plugin/src/configs/recommended-type-checked.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { RuleConfig } from "@eslint-react/kit";
22

3+
import * as tc from "./_tc";
34
import * as recommendedTypeScript from "./recommended-typescript";
45

56
export const name = "@eslint-react/recommended-type-checked";
67

78
export const rules = {
89
...recommendedTypeScript.rules,
9-
"@eslint-react/no-leaked-conditional-rendering": "warn",
10-
"@eslint-react/no-unused-props": "warn",
10+
...tc.rules,
1111
} as const satisfies Record<string, RuleConfig>;
1212

1313
export const plugins = {

packages/plugins/eslint-plugin/src/configs/recommended-typescript.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import type { RuleConfig } from "@eslint-react/kit";
22

3+
import * as ts from "./_ts";
34
import * as recommended from "./recommended";
45

56
export const name = "@eslint-react/recommended-typescript";
67

78
export const rules = {
89
...recommended.rules,
9-
"@eslint-react/dom/no-string-style-prop": "off",
10-
"@eslint-react/dom/no-unknown-property": "off",
11-
"@eslint-react/jsx-no-duplicate-props": "off",
12-
"@eslint-react/jsx-uses-react": "off",
13-
"@eslint-react/jsx-uses-vars": "off",
10+
...ts.rules,
1411
} as const satisfies Record<string, RuleConfig>;
1512

1613
export const plugins = {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import type { RuleConfig } from "@eslint-react/kit";
22

3-
import * as typeChecked from "./_type-checked";
4-
import * as strictTypescript from "./strict-typescript";
3+
import * as tc from "./_tc";
4+
import * as strictTypeScript from "./strict-typescript";
55

66
export const name = "@eslint-react/strict-type-checked";
77

88
export const rules = {
9-
...strictTypescript.rules,
10-
...typeChecked.rules,
9+
...strictTypeScript.rules,
10+
...tc.rules,
1111
} as const satisfies Record<string, RuleConfig>;
1212

1313
export const plugins = {
14-
...strictTypescript.plugins,
14+
...strictTypeScript.plugins,
1515
};
1616

1717
export const settings = {
18-
...strictTypescript.settings,
18+
...strictTypeScript.settings,
1919
};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import type { RuleConfig } from "@eslint-react/kit";
22

3-
import * as strict from "./_strict";
4-
import * as recommendedTypescript from "./recommended-typescript";
3+
import * as ts from "./recommended-typescript";
4+
import * as strict from "./strict";
55

66
export const name = "@eslint-react/strict-typescript";
77

88
export const rules = {
9-
...recommendedTypescript.rules,
109
...strict.rules,
10+
...ts.rules,
1111
} as const satisfies Record<string, RuleConfig>;
1212

1313
export const plugins = {
14-
...recommendedTypescript.plugins,
14+
...strict.plugins,
1515
};
1616

1717
export const settings = {
18-
...recommendedTypescript.settings,
18+
...strict.settings,
1919
};

packages/plugins/eslint-plugin/src/configs/_strict.ts renamed to packages/plugins/eslint-plugin/src/configs/strict.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { RuleConfig } from "@eslint-react/kit";
22

3+
import * as recommended from "./recommended";
4+
5+
export const name = "@eslint-react/strict";
6+
37
export const rules = {
8+
...recommended.rules,
49
"@eslint-react/jsx-no-iife": "error",
510
"@eslint-react/jsx-no-undef": "error",
611
"@eslint-react/no-children-prop": "warn",
@@ -20,3 +25,11 @@ export const rules = {
2025
"@eslint-react/dom/no-missing-iframe-sandbox": "warn",
2126
"@eslint-react/dom/no-unsafe-target-blank": "warn",
2227
} as const satisfies Record<string, RuleConfig>;
28+
29+
export const plugins = {
30+
...recommended.plugins,
31+
};
32+
33+
export const settings = {
34+
...recommended.settings,
35+
};

0 commit comments

Comments
 (0)