Skip to content

Commit

Permalink
chore: Clean-up eslint config (#5481)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed May 28, 2023
1 parent 28e0e28 commit f9dce35
Show file tree
Hide file tree
Showing 25 changed files with 140 additions and 118 deletions.
65 changes: 0 additions & 65 deletions .eslintrc

This file was deleted.

63 changes: 63 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'prettier',
],
env: {
browser: true,
},
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.base.json',
sourceType: 'module',
ecmaVersion: 2020,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: true,
},
react: {
version: 'detect',
},
},
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': [
'error', { prefer: 'type-imports' }
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-inferrable-types': [
'error', { ignoreParameters: true },
],
'import/no-cycle': 'error',
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
'import/no-unused-modules': ['off', { unusedExports: true }],
'no-redeclare': 'off',
'no-shadow': 'error',
},
overrides: [
{
files: ['**/*.test.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unnecessary-condition': 'off',
},
},
],
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:types": "nx affected --target=build:types --parallel=5",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"pnpm run build:types --watch\"",
"dev": "pnpm run watch",
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,ts,tsx,json,vue,svelte}\"",
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,cjs,ts,tsx,json,vue,svelte}\"",
"prettier:write": "pnpm run prettier --write",
"cipublish": "ts-node scripts/publish.ts",
"validatePackages": "ts-node scripts/validate-packages.ts"
Expand Down
3 changes: 2 additions & 1 deletion packages/codemods/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
overrides: [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-query/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
parser: '@typescript-eslint/parser',
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
}

Expand Down
3 changes: 2 additions & 1 deletion packages/query-async-storage-persister/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
}

Expand Down
6 changes: 0 additions & 6 deletions packages/query-broadcast-client-experimental/.eslintrc

This file was deleted.

13 changes: 13 additions & 0 deletions packages/query-broadcast-client-experimental/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
},
}

module.exports = config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
}
3 changes: 2 additions & 1 deletion packages/query-core/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
}

Expand Down
8 changes: 2 additions & 6 deletions packages/query-devtools/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'off',
'react/jsx-key': 'off',
},
}

Expand Down
3 changes: 2 additions & 1 deletion packages/query-persist-client-core/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
}

Expand Down
3 changes: 2 additions & 1 deletion packages/query-sync-storage-persister/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
}

Expand Down
7 changes: 6 additions & 1 deletion packages/react-query-devtools/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs', 'react-app',],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react-hooks/exhaustive-deps': 'error',
}
}

module.exports = config
7 changes: 6 additions & 1 deletion packages/react-query-persist-client/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs', 'react-app',],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react-hooks/exhaustive-deps': 'error',
}
}

module.exports = config
7 changes: 6 additions & 1 deletion packages/react-query/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs', 'react-app',],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react-hooks/exhaustive-deps': 'error',
}
}

module.exports = config
7 changes: 2 additions & 5 deletions packages/solid-query/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: ['../../.eslintrc.cjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'off',
},
}

Expand Down
10 changes: 4 additions & 6 deletions packages/svelte-query-devtools/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
const config = {
parser: '@typescript-eslint/parser',
root: true,
extends: ['../../.eslintrc.cjs', 'plugin:svelte/recommended'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
sourceType: 'module',
extraFileExtensions: ['.svelte'],
},
rules: {
'react-hooks/rules-of-hooks': 'off',
},
extends: ['plugin:svelte/recommended', '../../.eslintrc'],
ignorePatterns: ['*.config.*', '*.setup.*', '**/build/*'],
overrides: [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/svelte-query-devtools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["esnext", "DOM", "DOM.Iterable"],
"lib": ["DOM", "DOM.Iterable", "ES2020"],
"module": "ES2020",
"moduleResolution": "bundler",
"module": "esnext",
"noEmit": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
Expand All @@ -19,7 +19,7 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "esnext"
"target": "ES2020"
},
"include": ["src/**/*.js", "src/**/*.ts", "src/**/*.svelte", ".eslintrc.cjs", "vite.config.ts"]
}
10 changes: 4 additions & 6 deletions packages/svelte-query/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
const config = {
parser: '@typescript-eslint/parser',
root: true,
extends: ['../../.eslintrc.cjs', 'plugin:svelte/recommended'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
sourceType: 'module',
extraFileExtensions: ['.svelte'],
},
rules: {
'react-hooks/rules-of-hooks': 'off',
},
extends: ['plugin:svelte/recommended', '../../.eslintrc'],
ignorePatterns: ['*.config.*', '*.setup.*', '**/build/*'],
overrides: [
{
Expand Down
Loading

0 comments on commit f9dce35

Please sign in to comment.