Skip to content

Commit a66c48f

Browse files
committed
Use the shareable ESLint config
1 parent 2533f51 commit a66c48f

File tree

15 files changed

+150
-784
lines changed

15 files changed

+150
-784
lines changed

.eslintrc.js

-61
This file was deleted.

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ typesversions
3131
.pnp.*
3232
*.tgz
3333

34-
tsconfig.vitest-temp.json
34+
tsconfig.vitest-temp.json
35+
.eslintcache

eslint.config.mts

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { createESLintConfig } from '@reduxjs/eslint-config'
2+
3+
const eslintConfig = createESLintConfig([
4+
{
5+
name: 'overrides/global-ignores',
6+
ignores: [
7+
'packages/rtk-codemods/transforms/*/__testfixtures__/',
8+
'packages/toolkit/.size-limit.cjs',
9+
'packages/rtk-query-codegen-openapi/test/config.example.js',
10+
'examples/publish-ci/',
11+
12+
// TODO: Remove this later.
13+
'examples/',
14+
],
15+
},
16+
17+
{
18+
name: 'overrides/no-require-imports',
19+
files: ['examples/query/react/graphql-codegen/src/mocks/schema.js'],
20+
languageOptions: {
21+
sourceType: 'commonjs',
22+
},
23+
rules: {
24+
'@typescript-eslint/no-require-imports': [
25+
2,
26+
{
27+
allow: ['ts-node', '\\./db(.c?[tj]s)?$'],
28+
allowAsImport: false,
29+
},
30+
],
31+
},
32+
},
33+
34+
{
35+
name: 'overrides/nodenext-cjs-type-portability-examples',
36+
files: ['examples/type-portability/nodenext-cjs/**/*.?(m|c)ts?(x)'],
37+
languageOptions: {
38+
sourceType: 'commonjs',
39+
},
40+
rules: {
41+
'@typescript-eslint/no-require-imports': [
42+
2,
43+
{
44+
allow: [],
45+
allowAsImport: true,
46+
},
47+
],
48+
'@typescript-eslint/no-namespace': [
49+
0,
50+
{
51+
allowDeclarations: false,
52+
allowDefinitionFiles: true,
53+
},
54+
],
55+
},
56+
},
57+
])
58+
59+
export default eslintConfig

examples/query/react/infinite-queries/.eslintrc.json

-35
This file was deleted.

examples/query/react/infinite-queries/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"test": "vitest run",
1212
"format-check": "yarn run -T format-check",
1313
"format": "yarn run -T format",
14-
"lint": "eslint .",
15-
"lint:fix": "eslint --fix .",
14+
"lint-fix": "yarn run -T lint-fix",
15+
"lint": "yarn run -T lint",
1616
"type-check": "tsc --noEmit"
1717
},
1818
"dependencies": {
@@ -25,6 +25,7 @@
2525
"react-router": "^7.0.1"
2626
},
2727
"devDependencies": {
28+
"@reduxjs/eslint-config": "workspace:^",
2829
"@reduxjs/prettier-config": "workspace:^",
2930
"@testing-library/dom": "^9.3.4",
3031
"@testing-library/jest-dom": "^6.2.0",
@@ -34,6 +35,8 @@
3435
"@types/react-dom": "18.3.1",
3536
"@types/react-native-web": "^0.19",
3637
"@vitejs/plugin-react": "^4.2.1",
38+
"eslint": "^9.23.0",
39+
"jiti": "^2.4.2",
3740
"jsdom": "^23.2.0",
3841
"msw": "^2.6.6",
3942
"prettier": "^3.5.3",

package.json

+8-12
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,13 @@
3131
"@babel/helper-compilation-targets": "^7.23.6",
3232
"@babel/traverse": "^7.24.1",
3333
"@babel/types": "^7.24.0",
34+
"@reduxjs/eslint-config": "workspace:^",
3435
"@reduxjs/prettier-config": "workspace:^",
36+
"@reduxjs/tsconfig": "workspace:^",
3537
"@types/react": "^19.0.1",
3638
"@types/react-dom": "^19.0.1",
37-
"@typescript-eslint/eslint-plugin": "6.12.0",
38-
"@typescript-eslint/parser": "6.12.0",
39-
"eslint": "^7.25.0",
40-
"eslint-config-prettier": "^9.1.0",
41-
"eslint-config-react-app": "^7.0.1",
42-
"eslint-plugin-flowtype": "^5.7.2",
43-
"eslint-plugin-import": "^2.22.1",
44-
"eslint-plugin-jsx-a11y": "^6.4.1",
45-
"eslint-plugin-prettier": "^5.1.3",
46-
"eslint-plugin-react": "^7.23.2",
47-
"eslint-plugin-react-hooks": "^4.2.0",
39+
"eslint": "^9.23.0",
40+
"jiti": "^2.4.2",
4841
"netlify-plugin-cache": "^1.0.3",
4942
"prettier": "^3.5.3",
5043
"react": "^19.0.0",
@@ -53,13 +46,16 @@
5346
"release-it": "^14.12.5",
5447
"serve": "^14.2.0",
5548
"ts-node": "^10.9.2",
56-
"typescript": "^5.8.2"
49+
"typescript": "^5.8.2",
50+
"typescript-eslint": "^8.28.0"
5751
},
5852
"scripts": {
5953
"build": "yarn build:packages",
6054
"test": "yarn test:packages",
6155
"format-check": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/prettier.config.mjs --check $INIT_CWD",
6256
"format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/prettier.config.mjs --write $INIT_CWD",
57+
"lint-fix": "eslint --config=$PROJECT_CWD/eslint.config.mts --no-error-on-unmatched-pattern --fix $INIT_CWD",
58+
"lint": "eslint --config=$PROJECT_CWD/eslint.config.mts --no-error-on-unmatched-pattern $INIT_CWD",
6359
"install": "yarn build-configs",
6460
"build-configs": "yarn workspaces foreach -Atip --include '@reduxjs/*config' run build",
6561
"build:examples": "yarn workspaces foreach -A --include '@reduxjs/*' --include '@examples-query-react/*' --include '@examples-action-listener/*' -vtp run build",

packages/configs/eslint/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
"check-exports": "attw --pack $INIT_CWD",
6060
"check-package-json": "publint --strict $INIT_CWD",
6161
"clean": "rimraf $INIT_CWD/dist/",
62+
"lint-fix": "yarn run -T lint-fix",
63+
"lint": "yarn run -T lint",
6264
"prepack": "yarn clean && yarn build",
6365
"test-types": "tsc -p $INIT_CWD/tsconfig.json"
6466
},

packages/configs/prettier/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
"check-exports": "attw --pack $INIT_CWD",
6060
"check-package-json": "publint --strict $INIT_CWD",
6161
"clean": "rimraf $INIT_CWD/dist/",
62+
"lint-fix": "yarn run -T lint-fix",
63+
"lint": "yarn run -T lint",
6264
"prepack": "yarn clean && yarn build",
6365
"test-types": "tsc -p $INIT_CWD/tsconfig.json"
6466
},

packages/configs/typescript/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"main": "base/tsconfig.json",
3737
"scripts": {
3838
"check-exports": "attw --pack $INIT_CWD",
39-
"check-package-json": "publint --strict $INIT_CWD"
39+
"check-package-json": "publint --strict $INIT_CWD",
40+
"lint-fix": "yarn run -T lint-fix",
41+
"lint": "yarn run -T lint"
4042
},
4143
"devDependencies": {
4244
"@arethetypeswrong/cli": "^0.17.4",

packages/configs/vitest/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
"check-exports": "attw --pack $INIT_CWD",
6161
"check-package-json": "publint --strict $INIT_CWD",
6262
"clean": "rimraf $INIT_CWD/dist/",
63+
"lint-fix": "yarn run -T lint-fix",
64+
"lint": "yarn run -T lint",
6365
"prepack": "yarn clean && yarn build",
6466
"test-types": "tsc -p $INIT_CWD/tsconfig.json"
6567
},

packages/rtk-codemods/.eslintrc.json

-11
This file was deleted.

packages/rtk-codemods/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"scripts": {
55
"format-check": "yarn run -T format-check",
66
"format": "yarn run -T format",
7-
"lint": "eslint .",
7+
"lint-fix": "yarn run -T lint-fix",
8+
"lint": "yarn run -T lint",
89
"test": "vitest --run",
910
"test:watch": "vitest --watch",
1011
"test:coverage": "vitest --coverage"
@@ -31,13 +32,11 @@
3132
"typescript": "^5.8.2"
3233
},
3334
"devDependencies": {
35+
"@reduxjs/eslint-config": "workspace:^",
3436
"@reduxjs/prettier-config": "workspace:^",
3537
"@types/jscodeshift": "^0.11.11",
36-
"@typescript-eslint/parser": "^6.19.1",
37-
"eslint": "^8.56.0",
38-
"eslint-config-prettier": "^9.1.0",
39-
"eslint-plugin-node": "^11.1.0",
40-
"eslint-plugin-prettier": "^5.1.3",
38+
"eslint": "^9.23.0",
39+
"jiti": "^2.4.2",
4140
"prettier": "^3.5.3",
4241
"vitest": "^1.6.0"
4342
},

packages/toolkit/package.json

+5-12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@babel/helper-module-imports": "^7.24.7",
5555
"@microsoft/api-extractor": "^7.13.2",
5656
"@phryneas/ts-version": "^1.0.2",
57+
"@reduxjs/eslint-config": "workspace:^",
5758
"@reduxjs/prettier-config": "workspace:^",
5859
"@size-limit/file": "^11.0.1",
5960
"@size-limit/webpack": "^11.0.1",
@@ -70,22 +71,13 @@
7071
"@types/react": "^19.0.1",
7172
"@types/react-dom": "^19.0.1",
7273
"@types/yargs": "^16.0.1",
73-
"@typescript-eslint/eslint-plugin": "^6",
74-
"@typescript-eslint/parser": "^6",
7574
"axios": "^0.19.2",
7675
"esbuild": "^0.25.1",
7776
"esbuild-extra": "^0.4.0",
78-
"eslint": "^7.25.0",
79-
"eslint-config-prettier": "^9.1.0",
80-
"eslint-config-react-app": "^7.0.1",
81-
"eslint-plugin-flowtype": "^5.7.2",
82-
"eslint-plugin-import": "^2.22.1",
83-
"eslint-plugin-jsx-a11y": "^6.4.1",
84-
"eslint-plugin-prettier": "^5.1.3",
85-
"eslint-plugin-react": "^7.23.2",
86-
"eslint-plugin-react-hooks": "^4.2.0",
77+
"eslint": "^9.23.0",
8778
"fs-extra": "^9.1.0",
8879
"invariant": "^2.2.4",
80+
"jiti": "^2.4.2",
8981
"jsdom": "^25.0.1",
9082
"json-stringify-safe": "^5.0.1",
9183
"msw": "^2.1.4",
@@ -111,7 +103,8 @@
111103
"build-only": "yarn clean && yarn run-build",
112104
"format-check": "yarn run -T format-check",
113105
"format": "yarn run -T format",
114-
"lint": "eslint src examples",
106+
"lint-fix": "yarn run -T lint-fix",
107+
"lint": "yarn run -T lint",
115108
"test": "vitest --typecheck --run ",
116109
"test:watch": "vitest --watch",
117110
"type-tests": "yarn tsc -p tsconfig.test.json --noEmit",

tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "@reduxjs/tsconfig",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"rootDir": "./",
7+
"outDir": "./dist",
8+
"noEmit": true
9+
},
10+
"exclude": [
11+
"dist",
12+
"examples/publish-ci",
13+
"**/dist",
14+
"**/lib",
15+
"**/__testfixtures__"
16+
]
17+
}

0 commit comments

Comments
 (0)