Skip to content

Commit 300a389

Browse files
committed
Use the shareable ESLint config
1 parent fb2c445 commit 300a389

File tree

15 files changed

+148
-784
lines changed

15 files changed

+148
-784
lines changed

.eslintrc.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
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

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

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

Lines changed: 0 additions & 35 deletions
This file was deleted.

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

Lines changed: 5 additions & 2 deletions
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.24.0",
39+
"jiti": "^2.4.2",
3740
"jsdom": "^23.2.0",
3841
"msw": "^2.6.6",
3942
"prettier": "^3.5.3",

package.json

Lines changed: 8 additions & 12 deletions
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.24.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.29.1"
5751
},
5852
"scripts": {
5953
"build": "yarn build:packages",
6054
"test": "yarn test:packages",
6155
"format-check": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --ignore-path=$PROJECT_CWD/.gitignore --config=$PROJECT_CWD/prettier.config.mjs --check $INIT_CWD",
6256
"format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --ignore-path=$PROJECT_CWD/.gitignore --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
"postinstall": "yarn build-configs",
6460
"build-configs": "yarn workspaces foreach -Atip --include='packages/configs/*' 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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"main": "./base/tsconfig.json",
4444
"scripts": {
4545
"check-exports": "attw --pack $INIT_CWD",
46-
"check-package-json": "publint --strict $INIT_CWD"
46+
"check-package-json": "publint --strict $INIT_CWD",
47+
"lint-fix": "yarn run -T lint-fix",
48+
"lint": "yarn run -T lint"
4749
},
4850
"devDependencies": {
4951
"@arethetypeswrong/cli": "^0.17.4",

packages/configs/vitest/package.json

Lines changed: 2 additions & 0 deletions
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
},

0 commit comments

Comments
 (0)