Skip to content

Commit bed6abc

Browse files
committed
Use the shareable ESLint config
1 parent 27bebbb commit bed6abc

File tree

8 files changed

+43
-75
lines changed

8 files changed

+43
-75
lines changed

.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: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,7 @@
1-
module.exports = {
2-
extends: ['react-app', 'prettier'],
3-
parser: '@typescript-eslint/parser',
4-
rules: {
5-
'jsx-a11y/href-no-hash': 'off',
6-
'react/react-in-jsx-scope': 'off',
7-
// Taken care of by TypeScript's `noUnusedLocals` / `noUnusedParameters`
8-
'no-unused-vars': 'off',
9-
'@typescript-eslint/no-unused-vars': 'off',
10-
// Silence some bizarre "rule not found" TSLint error
11-
'@typescript-eslint/no-angle-bracket-type-assertion': 'off',
12-
'no-redeclare': 'off',
13-
// Silence some bizarre "rule not found" TSLint error
14-
'@typescript-eslint/no-redeclare': 'off',
15-
'no-use-before-define': 'off',
16-
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
17-
'@typescript-eslint/consistent-type-imports': [
18-
'error',
19-
{ prefer: 'type-imports', disallowTypeAnnotations: false },
20-
],
21-
'react-hooks/exhaustive-deps': [
22-
'warn',
23-
{
24-
additionalHooks: '(usePossiblyImmediateEffect)',
25-
},
26-
],
27-
},
28-
overrides: [
29-
// {
30-
// // only add after https://github.com/typescript-eslint/typescript-eslint/pull/3463 is merged
31-
// files: ['src/**/*.ts'],
32-
// excludedFiles: [
33-
// '**/tests/*.ts',
34-
// '**/tests/**/*.ts',
35-
// '**/tests/*.tsx',
36-
// '**/tests/**/*.tsx',
37-
// ],
38-
// parserOptions: {
39-
// project: './tsconfig.json',
40-
// },
41-
// rules: {
42-
// '@typescript-eslint/prefer-readonly-parameter-types': [
43-
// 'warn',
44-
// { arraysAndTuplesOnly: true },
45-
// ],
46-
// },
47-
// },
48-
{
49-
files: [
50-
'packages/toolkit/src/tests/*.ts',
51-
'packages/toolkit/src/**/tests/*.ts',
52-
'packages/toolkit/src/**/tests/*.tsx',
53-
],
54-
rules: {
55-
'@typescript-eslint/no-unused-expressions': 'off',
56-
'no-lone-blocks': 'off',
57-
'no-sequences': 'off',
58-
},
59-
},
60-
],
61-
}
1+
import { createESLintConfig } from '@reduxjs/eslint-config'
2+
import { configs } from 'typescript-eslint'
3+
4+
export default createESLintConfig([
5+
{ name: 'root-workspace/global-ignores', ignores: ['**/'] },
6+
configs.disableTypeChecked,
7+
])

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
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:^",
3536
"@types/react": "^18.2.77",
3637
"@types/react-dom": "^18.2.25",
3738
"eslint": "^9.10.0",
39+
"jiti": "^2.0.0-beta.3",
3840
"netlify-plugin-cache": "^1.0.3",
3941
"prettier": "^3.2.5",
4042
"react": "^18.2.0",
@@ -43,7 +45,8 @@
4345
"release-it": "^14.12.5",
4446
"serve": "^14.2.0",
4547
"ts-node": "^10.9.2",
46-
"typescript": "^5.5.4"
48+
"typescript": "^5.5.4",
49+
"typescript-eslint": "^8.6.0"
4750
},
4851
"resolutions": {
4952
"jest-snapshot": "29.3.1"
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{
2-
"env": { "node": true },
3-
"extends": ["eslint:recommended"],
4-
"ignorePatterns": ["node_modules"],
5-
"parserOptions": { "ecmaVersion": "latest" },
6-
"plugins": ["node"],
7-
"rules": {
8-
"no-unused-vars": [0],
9-
"eol-last": [0]
10-
}
11-
}
1+
import { createESLintConfig } from '@reduxjs/eslint-config'
2+
3+
export default createESLintConfig([
4+
{ ignores: ['**/__testfixtures__/'] },
5+
{ rules: { '@typescript-eslint/array-type': [0] } }
6+
])

packages/rtk-codemods/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
"typescript": "^5.3.3"
3333
},
3434
"devDependencies": {
35+
"@reduxjs/eslint-config": "workspace:^",
3536
"@reduxjs/prettier-config": "workspace:^",
3637
"@types/jscodeshift": "^0.11.11",
3738
"eslint": "^9.10.0",
39+
"jiti": "^2.0.0-beta.3",
3840
"prettier": "^3.2.5",
3941
"vitest": "^1.6.0"
4042
},

packages/toolkit/eslint.config.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createESLintConfig } from '@reduxjs/eslint-config'
2+
3+
export default createESLintConfig()

packages/toolkit/package.json

Lines changed: 2 additions & 0 deletions
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",
@@ -75,6 +76,7 @@
7576
"eslint": "^9.10.0",
7677
"fs-extra": "^9.1.0",
7778
"invariant": "^2.2.4",
79+
"jiti": "^2.0.0-beta.3",
7880
"jsdom": "^21.0.0",
7981
"json-stringify-safe": "^5.0.1",
8082
"msw": "^2.1.4",

yarn.lock

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6281,7 +6281,7 @@ __metadata:
62816281
languageName: node
62826282
linkType: hard
62836283

6284-
"@reduxjs/eslint-config@workspace:packages/configs/eslint":
6284+
"@reduxjs/eslint-config@workspace:^, @reduxjs/eslint-config@workspace:packages/configs/eslint":
62856285
version: 0.0.0-use.local
62866286
resolution: "@reduxjs/eslint-config@workspace:packages/configs/eslint"
62876287
dependencies:
@@ -6327,11 +6327,13 @@ __metadata:
63276327
version: 0.0.0-use.local
63286328
resolution: "@reduxjs/rtk-codemods@workspace:packages/rtk-codemods"
63296329
dependencies:
6330+
"@reduxjs/eslint-config": "workspace:^"
63306331
"@reduxjs/prettier-config": "workspace:^"
63316332
"@types/jscodeshift": "npm:^0.11.11"
63326333
eslint: "npm:^9.10.0"
63336334
execa: "npm:^8.0.1"
63346335
globby: "npm:^14.0.0"
6336+
jiti: "npm:^2.0.0-beta.3"
63356337
jscodeshift: "npm:^0.15.1"
63366338
prettier: "npm:^3.2.5"
63376339
ts-node: "npm:^10.9.2"
@@ -6411,6 +6413,7 @@ __metadata:
64116413
"@babel/helper-module-imports": "npm:^7.24.7"
64126414
"@microsoft/api-extractor": "npm:^7.13.2"
64136415
"@phryneas/ts-version": "npm:^1.0.2"
6416+
"@reduxjs/eslint-config": "workspace:^"
64146417
"@reduxjs/prettier-config": "workspace:^"
64156418
"@size-limit/file": "npm:^11.0.1"
64166419
"@size-limit/webpack": "npm:^11.0.1"
@@ -6433,6 +6436,7 @@ __metadata:
64336436
fs-extra: "npm:^9.1.0"
64346437
immer: "npm:^10.0.3"
64356438
invariant: "npm:^2.2.4"
6439+
jiti: "npm:^2.0.0-beta.3"
64366440
jsdom: "npm:^21.0.0"
64376441
json-stringify-safe: "npm:^5.0.1"
64386442
msw: "npm:^2.1.4"
@@ -17543,6 +17547,15 @@ __metadata:
1754317547
languageName: node
1754417548
linkType: hard
1754517549

17550+
"jiti@npm:^2.0.0-beta.3":
17551+
version: 2.0.0-beta.3
17552+
resolution: "jiti@npm:2.0.0-beta.3"
17553+
bin:
17554+
jiti: lib/jiti-cli.mjs
17555+
checksum: 10/912a4d11aa2e5ec2ab0244f15c3fbd4c6516ed935cc146bbf20bcc0d3f7a4d546deab04de98a14e1501338cd3d37a7c087551dd718912faa8701facd09705d09
17556+
languageName: node
17557+
linkType: hard
17558+
1754617559
"jju@npm:~1.4.0":
1754717560
version: 1.4.0
1754817561
resolution: "jju@npm:1.4.0"
@@ -23795,10 +23808,12 @@ __metadata:
2379523808
"@babel/helper-compilation-targets": "npm:^7.23.6"
2379623809
"@babel/traverse": "npm:^7.24.1"
2379723810
"@babel/types": "npm:^7.24.0"
23811+
"@reduxjs/eslint-config": "workspace:^"
2379823812
"@reduxjs/prettier-config": "workspace:^"
2379923813
"@types/react": "npm:^18.2.77"
2380023814
"@types/react-dom": "npm:^18.2.25"
2380123815
eslint: "npm:^9.10.0"
23816+
jiti: "npm:^2.0.0-beta.3"
2380223817
netlify-plugin-cache: "npm:^1.0.3"
2380323818
prettier: "npm:^3.2.5"
2380423819
react: "npm:^18.2.0"
@@ -23808,6 +23823,7 @@ __metadata:
2380823823
serve: "npm:^14.2.0"
2380923824
ts-node: "npm:^10.9.2"
2381023825
typescript: "npm:^5.5.4"
23826+
typescript-eslint: "npm:^8.6.0"
2381123827
languageName: unknown
2381223828
linkType: soft
2381323829

0 commit comments

Comments
 (0)