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

Lines changed: 19 additions & 13 deletions
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

Lines changed: 5 additions & 5 deletions
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
}
Lines changed: 4 additions & 5 deletions
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
}
Lines changed: 5 additions & 1 deletion
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

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

Lines changed: 5 additions & 1 deletion
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
}
Lines changed: 4 additions & 5 deletions
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

Lines changed: 4 additions & 5 deletions
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
}
Lines changed: 4 additions & 5 deletions
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

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

0 commit comments

Comments
 (0)