Skip to content

Commit f9dce35

Browse files
chore: Clean-up eslint config (#5481)
1 parent 28e0e28 commit f9dce35

File tree

25 files changed

+140
-118
lines changed

25 files changed

+140
-118
lines changed

.eslintrc

-65
This file was deleted.

.eslintrc.cjs

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// @ts-check
2+
3+
/** @type {import('eslint').Linter.Config} */
4+
module.exports = {
5+
root: true,
6+
parser: '@typescript-eslint/parser',
7+
plugins: ['@typescript-eslint', 'import'],
8+
extends: [
9+
'plugin:@typescript-eslint/eslint-recommended',
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:import/typescript',
12+
'prettier',
13+
],
14+
env: {
15+
browser: true,
16+
},
17+
parserOptions: {
18+
tsconfigRootDir: __dirname,
19+
project: './tsconfig.base.json',
20+
sourceType: 'module',
21+
ecmaVersion: 2020,
22+
},
23+
settings: {
24+
'import/parsers': {
25+
'@typescript-eslint/parser': ['.ts', '.tsx'],
26+
},
27+
'import/resolver': {
28+
typescript: true,
29+
},
30+
react: {
31+
version: 'detect',
32+
},
33+
},
34+
rules: {
35+
'@typescript-eslint/ban-types': 'off',
36+
'@typescript-eslint/ban-ts-comment': 'off',
37+
'@typescript-eslint/consistent-type-imports': [
38+
'error', { prefer: 'type-imports' }
39+
],
40+
'@typescript-eslint/explicit-module-boundary-types': 'off',
41+
'@typescript-eslint/no-empty-interface': 'off',
42+
'@typescript-eslint/no-explicit-any': 'off',
43+
'@typescript-eslint/no-non-null-assertion': 'off',
44+
'@typescript-eslint/no-unnecessary-condition': 'error',
45+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
46+
'@typescript-eslint/no-inferrable-types': [
47+
'error', { ignoreParameters: true },
48+
],
49+
'import/no-cycle': 'error',
50+
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
51+
'import/no-unused-modules': ['off', { unusedExports: true }],
52+
'no-redeclare': 'off',
53+
'no-shadow': 'error',
54+
},
55+
overrides: [
56+
{
57+
files: ['**/*.test.{ts,tsx}'],
58+
rules: {
59+
'@typescript-eslint/no-unnecessary-condition': 'off',
60+
},
61+
},
62+
],
63+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"build:types": "nx affected --target=build:types --parallel=5",
1919
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"pnpm run build:types --watch\"",
2020
"dev": "pnpm run watch",
21-
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,ts,tsx,json,vue,svelte}\"",
21+
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,cjs,ts,tsx,json,vue,svelte}\"",
2222
"prettier:write": "pnpm run prettier --write",
2323
"cipublish": "ts-node scripts/publish.ts",
2424
"validatePackages": "ts-node scripts/validate-packages.ts"

packages/codemods/.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
1011
overrides: [
1112
{

packages/eslint-plugin-query/.eslintrc.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5-
parser: '@typescript-eslint/parser',
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
67
parserOptions: {
78
tsconfigRootDir: __dirname,
89
project: './tsconfig.eslint.json',
9-
sourceType: 'module',
1010
},
1111
}
1212

packages/query-async-storage-persister/.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
1011
}
1112

packages/query-broadcast-client-experimental/.eslintrc

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// @ts-check
2+
3+
/** @type {import('eslint').Linter.Config} */
4+
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
7+
parserOptions: {
8+
tsconfigRootDir: __dirname,
9+
project: './tsconfig.eslint.json',
10+
},
11+
}
12+
13+
module.exports = config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true
5+
},
6+
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
7+
}

packages/query-core/.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
1011
}
1112

packages/query-devtools/.eslintrc.cjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
9-
},
10-
rules: {
11-
'react/react-in-jsx-scope': 'off',
12-
'react-hooks/rules-of-hooks': 'off',
13-
'react/jsx-key': 'off',
1410
},
1511
}
1612

packages/query-persist-client-core/.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
1011
}
1112

packages/query-sync-storage-persister/.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
1011
}
1112

packages/react-query-devtools/.eslintrc.cjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs', 'react-app',],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
11+
rules: {
12+
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
13+
'react-hooks/exhaustive-deps': 'error',
14+
}
1015
}
1116

1217
module.exports = config

packages/react-query-persist-client/.eslintrc.cjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs', 'react-app',],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
11+
rules: {
12+
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
13+
'react-hooks/exhaustive-deps': 'error',
14+
}
1015
}
1116

1217
module.exports = config

packages/react-query/.eslintrc.cjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs', 'react-app',],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
910
},
11+
rules: {
12+
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
13+
'react-hooks/exhaustive-deps': 'error',
14+
}
1015
}
1116

1217
module.exports = config

packages/solid-query/.eslintrc.cjs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5+
root: true,
6+
extends: ['../../.eslintrc.cjs'],
57
parserOptions: {
68
tsconfigRootDir: __dirname,
79
project: './tsconfig.eslint.json',
8-
sourceType: 'module',
9-
},
10-
rules: {
11-
'react/react-in-jsx-scope': 'off',
12-
'react-hooks/rules-of-hooks': 'off',
1310
},
1411
}
1512

packages/svelte-query-devtools/.eslintrc.cjs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
// @ts-check
2+
13
/** @type {import('eslint').Linter.Config} */
24
const config = {
3-
parser: '@typescript-eslint/parser',
5+
root: true,
6+
extends: ['../../.eslintrc.cjs', 'plugin:svelte/recommended'],
47
parserOptions: {
58
tsconfigRootDir: __dirname,
69
project: './tsconfig.json',
7-
sourceType: 'module',
810
extraFileExtensions: ['.svelte'],
911
},
10-
rules: {
11-
'react-hooks/rules-of-hooks': 'off',
12-
},
13-
extends: ['plugin:svelte/recommended', '../../.eslintrc'],
1412
ignorePatterns: ['*.config.*', '*.setup.*', '**/build/*'],
1513
overrides: [
1614
{

packages/svelte-query-devtools/tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"esModuleInterop": true,
88
"forceConsistentCasingInFileNames": true,
99
"isolatedModules": true,
10-
"lib": ["esnext", "DOM", "DOM.Iterable"],
10+
"lib": ["DOM", "DOM.Iterable", "ES2020"],
11+
"module": "ES2020",
1112
"moduleResolution": "bundler",
12-
"module": "esnext",
1313
"noEmit": true,
1414
"noImplicitReturns": true,
1515
"noUncheckedIndexedAccess": true,
@@ -19,7 +19,7 @@
1919
"skipLibCheck": true,
2020
"sourceMap": true,
2121
"strict": true,
22-
"target": "esnext"
22+
"target": "ES2020"
2323
},
2424
"include": ["src/**/*.js", "src/**/*.ts", "src/**/*.svelte", ".eslintrc.cjs", "vite.config.ts"]
2525
}

packages/svelte-query/.eslintrc.cjs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
// @ts-check
2+
13
/** @type {import('eslint').Linter.Config} */
24
const config = {
3-
parser: '@typescript-eslint/parser',
5+
root: true,
6+
extends: ['../../.eslintrc.cjs', 'plugin:svelte/recommended'],
47
parserOptions: {
58
tsconfigRootDir: __dirname,
69
project: './tsconfig.json',
7-
sourceType: 'module',
810
extraFileExtensions: ['.svelte'],
911
},
10-
rules: {
11-
'react-hooks/rules-of-hooks': 'off',
12-
},
13-
extends: ['plugin:svelte/recommended', '../../.eslintrc'],
1412
ignorePatterns: ['*.config.*', '*.setup.*', '**/build/*'],
1513
overrides: [
1614
{

0 commit comments

Comments
 (0)