Skip to content

Commit ddf6986

Browse files
chore: Update eslint config from alpha branch (#5632)
1 parent d0388a9 commit ddf6986

File tree

33 files changed

+960
-939
lines changed

33 files changed

+960
-939
lines changed

.eslintrc.cjs

+19-13
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,59 @@ const config = {
66
'plugin:@typescript-eslint/eslint-recommended',
77
'plugin:@typescript-eslint/recommended',
88
'plugin:import/typescript',
9-
'react-app',
109
'prettier',
1110
],
1211
env: {
13-
es6: true,
12+
browser: true,
13+
es2020: true,
1414
},
1515
parserOptions: {
16+
tsconfigRootDir: __dirname,
1617
project: './tsconfig.base.json',
1718
sourceType: 'module',
19+
ecmaVersion: 2020,
1820
},
1921
settings: {
2022
'import/parsers': {
2123
'@typescript-eslint/parser': ['.ts', '.tsx'],
2224
},
2325
'import/resolver': {
24-
node: true,
25-
typescript: {
26-
project: 'packages/*/tsconfig.json',
27-
},
26+
typescript: true,
2827
},
2928
react: {
3029
version: 'detect',
3130
},
3231
},
3332
rules: {
34-
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
3533
'@typescript-eslint/ban-types': 'off',
3634
'@typescript-eslint/ban-ts-comment': 'off',
37-
'@typescript-eslint/consistent-type-imports': 'error',
35+
'@typescript-eslint/consistent-type-imports': [
36+
'error',
37+
{ prefer: 'type-imports' },
38+
],
3839
'@typescript-eslint/explicit-module-boundary-types': 'off',
3940
'@typescript-eslint/no-empty-interface': 'off',
4041
'@typescript-eslint/no-explicit-any': 'off',
4142
'@typescript-eslint/no-non-null-assertion': 'off',
4243
'@typescript-eslint/no-unnecessary-condition': 'error',
4344
'@typescript-eslint/no-inferrable-types': [
4445
'error',
45-
{
46-
ignoreParameters: true,
47-
},
46+
{ ignoreParameters: true },
4847
],
49-
'no-shadow': 'error',
5048
'import/no-cycle': 'error',
5149
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
5250
'import/no-unused-modules': ['off', { unusedExports: true }],
5351
'no-redeclare': 'off',
54-
'react-hooks/exhaustive-deps': 'error',
52+
'no-shadow': 'error',
5553
},
54+
overrides: [
55+
{
56+
files: ['**/*.test.{ts,tsx}'],
57+
rules: {
58+
'@typescript-eslint/no-unnecessary-condition': 'off',
59+
},
60+
},
61+
],
5662
}
5763

5864
module.exports = config

examples/react/algolia/.eslintrc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"extends": ["react-app", "prettier", "plugin:@tanstack/eslint-plugin-query/recommended"],
3-
"rules": {
4-
"react/jsx-uses-react": "off",
5-
"react/react-in-jsx-scope": "off"
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended",
5+
"plugin:@tanstack/eslint-plugin-query/recommended"
6+
]
77
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}
+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": ["react-app", "prettier", "plugin:@tanstack/eslint-plugin-query/recommended"]
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended",
5+
"plugin:@tanstack/eslint-plugin-query/recommended"
6+
]
37
}

examples/react/basic-typescript/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"@types/react": "^17.0.3",
2222
"@types/react-dom": "^17.0.3",
2323
"@vitejs/plugin-react": "^2.0.0",
24-
"eslint": "7.x",
25-
"eslint-config-prettier": "^8.3.0",
24+
"eslint": "^8.34.0",
25+
"eslint-config-prettier": "^8.8.0",
2626
"typescript": "^4.2.3",
2727
"vite": "^3.0.0"
2828
},

examples/react/basic/.eslintrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": ["react-app", "prettier", "plugin:@tanstack/eslint-plugin-query/recommended"]
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended",
5+
"plugin:@tanstack/eslint-plugin-query/recommended"
6+
]
37
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/offline/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/playground/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/react-native/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
},
3838
"devDependencies": {
3939
"@babel/core": "^7.12.9",
40-
"@callstack/eslint-config": "^10.1.0",
40+
"@callstack/eslint-config": "^13.0.2",
4141
"@expo/config": "^3.3.27",
4242
"@types/react-native": "~0.64.3",
4343
"babel-plugin-module-resolver": "^4.1.0",
44-
"eslint": "^7.32.0",
44+
"eslint": "^8.34.0",
4545
"eslint-import-resolver-alias": "^1.1.2",
46+
"eslint-plugin-flowtype": "^8.0.3",
4647
"eslint-plugin-prettier": "^4.0.0",
4748
"prettier": "^2.3.2",
4849
"typescript": "~4.4.3"

examples/react/react-router/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/rick-morty/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/simple/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/star-wars/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}

examples/react/suspense/.eslintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"extends": ["react-app", "prettier"],
3-
"rules": {
4-
// "eqeqeq": 0,
5-
// "jsx-a11y/anchor-is-valid": 0
6-
}
2+
"extends": [
3+
"plugin:react/recommended",
4+
"plugin:react-hooks/recommended"
5+
]
76
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"parserOptions": {
3-
"project": "./tsconfig.json",
4-
"sourceType": "module"
5-
},
6-
"rules": {
7-
"react/react-in-jsx-scope": "off",
8-
"jsx-a11y/anchor-is-valid": "off"
3+
"project": "./tsconfig.json"
94
}
105
}
+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"parserOptions": {
3-
"project": "./tsconfig.json",
4-
"sourceType": "module"
5-
},
6-
"rules": {
7-
"react/react-in-jsx-scope": "off",
8-
"jsx-a11y/anchor-is-valid": "off"
3+
"project": "./tsconfig.json"
94
}
105
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"parserOptions": {
3-
"project": "./tsconfig.json",
4-
"sourceType": "module"
5-
},
6-
"rules": {
7-
"react/react-in-jsx-scope": "off",
8-
"jsx-a11y/anchor-is-valid": "off"
3+
"project": "./tsconfig.json"
94
}
105
}

examples/solid/simple/.eslintrc

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
"extends": ["plugin:@tanstack/eslint-plugin-query/recommended"],
33
"parserOptions": {
4-
"project": "./tsconfig.json",
5-
"sourceType": "module"
6-
},
7-
"rules": {
8-
"react/react-in-jsx-scope": "off",
9-
"jsx-a11y/accessible-emoji": "off"
4+
"project": "./tsconfig.json"
105
}
116
}

package.json

+7-15
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,13 @@
6565
"chalk": "^4.1.2",
6666
"concurrently": "^7.1.0",
6767
"current-git-branch": "^1.1.0",
68-
"eslint": "7.x",
69-
"eslint-config-prettier": "^6.11.0",
70-
"eslint-config-react-app": "^5.2.1",
71-
"eslint-config-standard": "^14.1.1",
72-
"eslint-config-standard-react": "^9.2.0",
73-
"eslint-import-resolver-typescript": "^2.7.1",
74-
"eslint-plugin-flowtype": "5.x",
75-
"eslint-plugin-import": "^2.22.1",
76-
"eslint-plugin-jsx-a11y": "6.x",
77-
"eslint-plugin-node": "^11.1.0",
78-
"eslint-plugin-prettier": "^3.1.3",
79-
"eslint-plugin-promise": "^4.2.1",
80-
"eslint-plugin-react": "7.20.0",
81-
"eslint-plugin-react-hooks": "^4.3.0",
82-
"eslint-plugin-standard": "^4.0.1",
68+
"eslint": "^8.34.0",
69+
"eslint-config-prettier": "^8.8.0",
70+
"eslint-import-resolver-typescript": "^3.5.5",
71+
"eslint-plugin-compat": "^4.1.4",
72+
"eslint-plugin-import": "^2.27.5",
73+
"eslint-plugin-react": "^7.32.2",
74+
"eslint-plugin-react-hooks": "^4.6.0",
8375
"git-log-parser": "^1.2.0",
8476
"jest": "^27.5.1",
8577
"jsonfile": "^6.1.0",

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const config = {
2-
parser: '@typescript-eslint/parser',
32
parserOptions: {
3+
tsconfigRootDir: __dirname,
44
project: './tsconfig.json',
5-
sourceType: 'module',
65
},
76
}
87

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
22
parserOptions: {
3+
tsconfigRootDir: __dirname,
34
project: './tsconfig.json',
4-
sourceType: 'module',
55
},
66
}
77

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
22
parserOptions: {
3+
tsconfigRootDir: __dirname,
34
project: './tsconfig.json',
4-
sourceType: 'module',
55
},
66
}
77

packages/query-core/.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
22
parserOptions: {
3+
tsconfigRootDir: __dirname,
34
project: './tsconfig.json',
4-
sourceType: 'module',
55
},
66
}
77

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
22
parserOptions: {
3+
tsconfigRootDir: __dirname,
34
project: './tsconfig.json',
4-
sourceType: 'module',
55
},
66
}
77

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
22
parserOptions: {
3+
tsconfigRootDir: __dirname,
34
project: './tsconfig.json',
4-
sourceType: 'module',
55
},
66
}
77

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
const config = {
2+
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
23
parserOptions: {
4+
tsconfigRootDir: __dirname,
35
project: './tsconfig.json',
4-
sourceType: 'module',
6+
},
7+
rules: {
8+
'react/display-name': 'off',
9+
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
10+
'react/prop-types': 'off',
11+
'react-hooks/exhaustive-deps': 'error',
512
},
613
}
714

0 commit comments

Comments
 (0)