Skip to content

Commit 274ffbd

Browse files
committed
refactor(examples): update ESLint configurations and remove unused plugins
1 parent de1732b commit 274ffbd

File tree

8 files changed

+109
-108
lines changed

8 files changed

+109
-108
lines changed

examples/next-app/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const GLOB_APP = ["app/**/*.{js,ts,jsx,tsx}"];
1616
const GLOB_CONFIG = ["**/*.config.{js,mjs,ts,tsx}"];
1717

1818
export default tseslint.config(
19-
js.configs.recommended,
2019
{
2120
files: GLOB_TS,
2221
extends: [
22+
js.configs.recommended,
2323
tseslint.configs.recommended,
2424
],
2525
},

examples/tsup-lib/eslint.config.mjs

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import react from "@eslint-react/eslint-plugin";
44
import js from "@eslint/js";
55
import reactHooks from "eslint-plugin-react-hooks";
6-
import reactRefresh from "eslint-plugin-react-refresh";
76
import tseslint from "typescript-eslint";
87

98
import TSCONFIG from "./tsconfig.json" with { type: "json" };
@@ -12,13 +11,14 @@ import TSCONFIG_NODE from "./tsconfig.node.json" with { type: "json" };
1211
const GLOB_TS = ["**/*.ts", "**/*.tsx"];
1312

1413
export default tseslint.config(
15-
js.configs.recommended,
1614
{
1715
files: GLOB_TS,
1816
extends: [
17+
js.configs.recommended,
1918
tseslint.configs.recommended,
2019
],
2120
},
21+
// base configuration for browser environment source files
2222
{
2323
files: TSCONFIG.include,
2424
extends: [
@@ -32,28 +32,7 @@ export default tseslint.config(
3232
},
3333
},
3434
},
35-
{
36-
files: TSCONFIG.include,
37-
...react.configs["recommended-type-checked"],
38-
},
39-
{
40-
files: TSCONFIG.include,
41-
plugins: {
42-
// @ts-expect-error - Missing types
43-
"react-hooks": reactHooks,
44-
},
45-
// @ts-ignore - Missing types
46-
rules: reactHooks.configs.recommended.rules,
47-
},
48-
{
49-
files: TSCONFIG.include,
50-
plugins: {
51-
"react-refresh": reactRefresh,
52-
},
53-
rules: {
54-
"react-refresh/only-export-components": "warn",
55-
},
56-
},
35+
// base configuration for node environment source files (*.config.ts, etc.)
5736
{
5837
files: TSCONFIG_NODE.include,
5938
ignores: TSCONFIG_NODE.exclude,
@@ -68,13 +47,19 @@ export default tseslint.config(
6847
"no-console": "off",
6948
},
7049
},
50+
// React configuration
7151
{
72-
ignores: [
73-
"node_modules",
74-
"dist",
75-
"benchmark",
76-
"eslint.config.mjs",
77-
"eslint.config.d.ts",
78-
],
52+
files: TSCONFIG.include,
53+
...react.configs["recommended-type-checked"],
54+
},
55+
// React Hooks configuration
56+
{
57+
files: TSCONFIG.include,
58+
plugins: {
59+
// @ts-expect-error - Missing types
60+
"react-hooks": reactHooks,
61+
},
62+
// @ts-ignore - Missing types
63+
rules: reactHooks.configs.recommended.rules,
7964
},
8065
);

examples/tsup-lib/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@types/react": "^19.0.2",
4040
"eslint": "^9.17.0",
4141
"eslint-plugin-react-hooks": "5.1.0",
42-
"eslint-plugin-react-refresh": "0.4.16",
4342
"eslint-plugin-vitest": "0.5.4",
4443
"react": "^19.0.0",
4544
"tsup": "^8.3.5",

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

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import TSCONFIG_NODE from "./tsconfig.node.json" with { type: "json" };
1212
const GLOB_TS = ["**/*.ts", "**/*.tsx"];
1313

1414
export default tseslint.config(
15-
js.configs.recommended,
1615
{
1716
files: GLOB_TS,
1817
extends: [
18+
js.configs.recommended,
1919
tseslint.configs.recommended,
2020
],
2121
},
22+
// base configuration for browser environment source files
2223
{
2324
files: TSCONFIG.include,
2425
extends: [
@@ -32,10 +33,27 @@ export default tseslint.config(
3233
},
3334
},
3435
},
36+
// base configuration for node environment source files (*.config.ts, etc.)
37+
{
38+
files: TSCONFIG_NODE.include,
39+
ignores: TSCONFIG_NODE.exclude,
40+
languageOptions: {
41+
parserOptions: {
42+
project: "./tsconfig.node.json",
43+
projectService: false,
44+
},
45+
},
46+
rules: {
47+
...tseslint.configs.disableTypeChecked.rules,
48+
"no-console": "off",
49+
},
50+
},
51+
// React configuration
3552
{
3653
files: TSCONFIG.include,
3754
...react.configs["recommended-type-checked"],
3855
},
56+
// React Hooks configuration
3957
{
4058
files: TSCONFIG.include,
4159
plugins: {
@@ -45,6 +63,7 @@ export default tseslint.config(
4563
// @ts-ignore - Missing types
4664
rules: reactHooks.configs.recommended.rules,
4765
},
66+
// React Refresh configuration
4867
{
4968
files: TSCONFIG.include,
5069
plugins: {
@@ -54,27 +73,4 @@ export default tseslint.config(
5473
"react-refresh/only-export-components": "warn",
5574
},
5675
},
57-
{
58-
files: TSCONFIG_NODE.include,
59-
ignores: TSCONFIG_NODE.exclude,
60-
languageOptions: {
61-
parserOptions: {
62-
project: "./tsconfig.node.json",
63-
projectService: false,
64-
},
65-
},
66-
rules: {
67-
...tseslint.configs.disableTypeChecked.rules,
68-
"no-console": "off",
69-
},
70-
},
71-
{
72-
ignores: [
73-
"node_modules",
74-
"dist",
75-
"benchmark",
76-
"eslint.config.js",
77-
"eslint.config.d.ts",
78-
],
79-
},
8076
);

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import JSCONFIG from "./jsconfig.json" with { type: "json" };
88
import JSCONFIG_NODE from "./jsconfig.node.json" with { type: "json" };
99

1010
export default [
11+
// base configuration for browser environment source files
1112
{
1213
files: JSCONFIG.include,
1314
languageOptions: {
@@ -20,18 +21,38 @@ export default [
2021
},
2122
},
2223
},
24+
rules: {
25+
...js.configs.recommended.rules,
26+
},
2327
},
28+
// base configuration for node environment source files (*.config.js, etc.)
29+
{
30+
files: JSCONFIG_NODE.include,
31+
ignores: JSCONFIG_NODE.exclude,
32+
languageOptions: {
33+
globals: {
34+
...globals.node,
35+
},
36+
},
37+
rules: {
38+
...js.configs.recommended.rules,
39+
"no-console": "off",
40+
},
41+
},
42+
// React configuration
2443
{
2544
files: JSCONFIG.include,
2645
...react.configs.recommended,
2746
},
47+
// React Hooks configuration
2848
{
2949
files: JSCONFIG.include,
3050
plugins: {
3151
"react-hooks": reactHooks,
3252
},
3353
rules: reactHooks.configs.recommended.rules,
3454
},
55+
// React Refresh configuration
3556
{
3657
files: JSCONFIG.include,
3758
plugins: {
@@ -41,17 +62,4 @@ export default [
4162
"react-refresh/only-export-components": "warn",
4263
},
4364
},
44-
{
45-
files: JSCONFIG_NODE.include,
46-
ignores: JSCONFIG_NODE.exclude,
47-
languageOptions: {
48-
globals: {
49-
...globals.node,
50-
},
51-
},
52-
rules: {
53-
...js.configs.recommended.rules,
54-
"no-console": "off",
55-
},
56-
},
5765
];

examples/vite-react-dom-js-app/src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function App() {
1515
</a>
1616
</div>
1717
<div className="card">
18-
<button type="button" onClick={() => setCount((count) => count + 1n)}>
18+
<button disabled={true} type="button" onClick={() => setCount((count) => count + 1n)}>
1919
count is {count.toString()}
2020
</button>
2121
</div>

examples/vite-react-dom-js-with-babel-app/eslint.config.js

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import JSCONFIG from "./jsconfig.json" with { type: "json" };
99
import JSCONFIG_NODE from "./jsconfig.node.json" with { type: "json" };
1010

1111
export default [
12+
// base configuration for browser environment source files
1213
{
1314
files: JSCONFIG.include,
1415
languageOptions: {
@@ -25,18 +26,47 @@ export default [
2526
},
2627
},
2728
},
29+
rules: {
30+
...js.configs.recommended.rules,
31+
},
2832
},
33+
// base configuration for node environment source files (*.config.js, etc.)
34+
{
35+
files: JSCONFIG_NODE.include,
36+
ignores: JSCONFIG_NODE.exclude,
37+
languageOptions: {
38+
globals: {
39+
...globals.node,
40+
},
41+
parser,
42+
parserOptions: {
43+
requireConfigFile: false,
44+
babelOptions: {
45+
babelrc: false,
46+
configFile: false,
47+
presets: ["@babel/preset-env"],
48+
},
49+
},
50+
},
51+
rules: {
52+
...js.configs.recommended.rules,
53+
"no-console": "off",
54+
},
55+
},
56+
// React configuration
2957
{
3058
files: JSCONFIG.include,
3159
...react.configs.recommended,
3260
},
61+
// React Hooks configuration
3362
{
3463
files: JSCONFIG.include,
3564
plugins: {
3665
"react-hooks": reactHooks,
3766
},
3867
rules: reactHooks.configs.recommended.rules,
3968
},
69+
// React Refresh configuration
4070
{
4171
files: JSCONFIG.include,
4272
plugins: {
@@ -46,17 +76,4 @@ export default [
4676
"react-refresh/only-export-components": "warn",
4777
},
4878
},
49-
{
50-
files: JSCONFIG_NODE.include,
51-
ignores: JSCONFIG_NODE.exclude,
52-
languageOptions: {
53-
globals: {
54-
...globals.node,
55-
},
56-
},
57-
rules: {
58-
...js.configs.recommended.rules,
59-
"no-console": "off",
60-
},
61-
},
6279
];

0 commit comments

Comments
 (0)