From e6a0fdd89ee0cb98d7465fecd0767ac52a431eac Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:34:37 +1000 Subject: [PATCH] chore: Migrate to ESLint flat config (#7636) * chore: Migrate to ESLint flat config * Migrate more packages * angular and solid * svelte packages * Hopefully more fixes * react packages * vue packages * Fix typescript errors * Update Nx config --- .eslintrc.cjs | 142 --- eslint.config.js | 42 + nx.json | 5 +- package.json | 17 +- .../.eslintrc.cjs | 15 - .../eslint.config.js | 17 + .../package.json | 2 +- .../tsconfig.json | 2 +- .../angular-query-experimental/.eslintrc.cjs | 21 - .../eslint.config.js | 23 + .../angular-query-experimental/package.json | 2 +- .../angular-query-experimental/tsconfig.json | 2 +- packages/eslint-plugin-query/.eslintrc.cjs | 6 - packages/eslint-plugin-query/eslint.config.js | 5 + packages/eslint-plugin-query/package.json | 2 +- packages/eslint-plugin-query/tsconfig.json | 2 +- packages/eslint-plugin-query/vite.config.ts | 4 +- .../.eslintrc.cjs | 6 - .../eslint.config.js | 5 + .../package.json | 2 +- .../tsconfig.json | 2 +- .../.eslintrc.cjs | 6 - .../eslint.config.js | 5 + .../package.json | 2 +- .../tsconfig.json | 2 +- packages/query-codemods/.eslintrc.cjs | 18 - packages/query-codemods/eslint.config.js | 18 + packages/query-codemods/package.json | 4 +- packages/query-codemods/tsconfig.json | 2 +- packages/query-core/.eslintrc.cjs | 6 - packages/query-core/eslint.config.js | 5 + packages/query-core/package.json | 2 +- packages/query-core/tsconfig.json | 2 +- packages/query-devtools/.eslintrc.cjs | 6 - packages/query-devtools/eslint.config.js | 5 + packages/query-devtools/package.json | 2 +- packages/query-devtools/tsconfig.json | 2 +- .../query-persist-client-core/.eslintrc.cjs | 6 - .../eslint.config.js | 5 + .../query-persist-client-core/package.json | 2 +- .../query-persist-client-core/tsconfig.json | 2 +- .../.eslintrc.cjs | 6 - .../eslint.config.js | 5 + .../query-sync-storage-persister/package.json | 2 +- .../tsconfig.json | 2 +- packages/react-query-devtools/.eslintrc.cjs | 12 - .../react-query-devtools/eslint.config.js | 23 + packages/react-query-devtools/package.json | 2 +- packages/react-query-devtools/tsconfig.json | 2 +- .../.eslintrc.cjs | 12 - .../eslint.config.js | 24 + .../package.json | 2 +- .../tsconfig.json | 2 +- .../react-query-persist-client/.eslintrc.cjs | 12 - .../eslint.config.js | 23 + .../react-query-persist-client/package.json | 2 +- .../react-query-persist-client/tsconfig.json | 2 +- packages/react-query/.eslintrc.cjs | 22 - packages/react-query/eslint.config.js | 35 + packages/react-query/package.json | 2 +- packages/react-query/tsconfig.json | 2 +- packages/solid-query-devtools/.eslintrc.cjs | 6 - .../solid-query-devtools/eslint.config.js | 5 + packages/solid-query-devtools/package.json | 2 +- packages/solid-query-devtools/tsconfig.json | 2 +- .../solid-query-persist-client/.eslintrc.cjs | 6 - .../eslint.config.js | 5 + .../solid-query-persist-client/package.json | 2 +- .../solid-query-persist-client/tsconfig.json | 2 +- packages/solid-query/.eslintrc.cjs | 6 - packages/solid-query/eslint.config.js | 5 + packages/solid-query/package.json | 2 +- .../src/__tests__/createQuery.test.tsx | 1 + packages/solid-query/tsconfig.json | 2 +- packages/svelte-query-devtools/.eslintrc.cjs | 24 - .../svelte-query-devtools/eslint.config.js | 26 + packages/svelte-query-devtools/package.json | 5 +- packages/svelte-query-devtools/tsconfig.json | 2 +- .../svelte-query-persist-client/.eslintrc.cjs | 24 - .../eslint.config.js | 26 + .../svelte-query-persist-client/package.json | 5 +- .../svelte-query-persist-client/tsconfig.json | 2 +- packages/svelte-query/.eslintrc.cjs | 24 - packages/svelte-query/eslint.config.js | 26 + packages/svelte-query/package.json | 5 +- packages/svelte-query/tsconfig.json | 2 +- packages/vue-query-devtools/.eslintrc.cjs | 10 - packages/vue-query-devtools/eslint.config.js | 20 + packages/vue-query-devtools/package.json | 3 +- packages/vue-query-devtools/src/devtools.vue | 2 +- packages/vue-query-devtools/tsconfig.json | 7 +- packages/vue-query-devtools/vite.config.ts | 4 +- packages/vue-query/.eslintrc.cjs | 10 - packages/vue-query/eslint.config.js | 20 + packages/vue-query/package.json | 3 +- packages/vue-query/tsconfig.json | 2 +- pnpm-lock.yaml | 1125 +++++++++++------ tsconfig.json | 2 +- 98 files changed, 1210 insertions(+), 835 deletions(-) delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js delete mode 100644 packages/angular-query-devtools-experimental/.eslintrc.cjs create mode 100644 packages/angular-query-devtools-experimental/eslint.config.js delete mode 100644 packages/angular-query-experimental/.eslintrc.cjs create mode 100644 packages/angular-query-experimental/eslint.config.js delete mode 100644 packages/eslint-plugin-query/.eslintrc.cjs create mode 100644 packages/eslint-plugin-query/eslint.config.js delete mode 100644 packages/query-async-storage-persister/.eslintrc.cjs create mode 100644 packages/query-async-storage-persister/eslint.config.js delete mode 100644 packages/query-broadcast-client-experimental/.eslintrc.cjs create mode 100644 packages/query-broadcast-client-experimental/eslint.config.js delete mode 100644 packages/query-codemods/.eslintrc.cjs create mode 100644 packages/query-codemods/eslint.config.js delete mode 100644 packages/query-core/.eslintrc.cjs create mode 100644 packages/query-core/eslint.config.js delete mode 100644 packages/query-devtools/.eslintrc.cjs create mode 100644 packages/query-devtools/eslint.config.js delete mode 100644 packages/query-persist-client-core/.eslintrc.cjs create mode 100644 packages/query-persist-client-core/eslint.config.js delete mode 100644 packages/query-sync-storage-persister/.eslintrc.cjs create mode 100644 packages/query-sync-storage-persister/eslint.config.js delete mode 100644 packages/react-query-devtools/.eslintrc.cjs create mode 100644 packages/react-query-devtools/eslint.config.js delete mode 100644 packages/react-query-next-experimental/.eslintrc.cjs create mode 100644 packages/react-query-next-experimental/eslint.config.js delete mode 100644 packages/react-query-persist-client/.eslintrc.cjs create mode 100644 packages/react-query-persist-client/eslint.config.js delete mode 100644 packages/react-query/.eslintrc.cjs create mode 100644 packages/react-query/eslint.config.js delete mode 100644 packages/solid-query-devtools/.eslintrc.cjs create mode 100644 packages/solid-query-devtools/eslint.config.js delete mode 100644 packages/solid-query-persist-client/.eslintrc.cjs create mode 100644 packages/solid-query-persist-client/eslint.config.js delete mode 100644 packages/solid-query/.eslintrc.cjs create mode 100644 packages/solid-query/eslint.config.js delete mode 100644 packages/svelte-query-devtools/.eslintrc.cjs create mode 100644 packages/svelte-query-devtools/eslint.config.js delete mode 100644 packages/svelte-query-persist-client/.eslintrc.cjs create mode 100644 packages/svelte-query-persist-client/eslint.config.js delete mode 100644 packages/svelte-query/.eslintrc.cjs create mode 100644 packages/svelte-query/eslint.config.js delete mode 100644 packages/vue-query-devtools/.eslintrc.cjs create mode 100644 packages/vue-query-devtools/eslint.config.js delete mode 100644 packages/vue-query/.eslintrc.cjs create mode 100644 packages/vue-query/eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index e9bfccb9d0..0000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,142 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - root: true, - reportUnusedDisableDirectives: true, - ignorePatterns: ['**/build', '**/coverage', '**/dist'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'import'], - extends: [ - 'eslint:recommended', - 'plugin:@cspell/recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/stylistic', - 'plugin:import/recommended', - 'plugin:import/typescript', - 'prettier', - ], - env: { - browser: true, - es2020: true, - }, - parserOptions: { - tsconfigRootDir: __dirname, - project: true, - sourceType: 'module', - ecmaVersion: 2020, - }, - settings: { - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'], - }, - 'import/resolver': { - typescript: true, - }, - react: { - version: 'detect', - }, - }, - rules: { - '@cspell/spellchecker': [ - 'error', - { - cspell: { - words: [ - 'tanstack', // Our package scope - 'tsqd', // Our public interface (TanStack Query Devtools shorthand) - 'retryer', // Our public interface - 'Promisable', // Our public interface - 'extralight', // Our public interface - 'codemod', // We support our codemod - 'typecheck', // Field of vite.config.ts - 'TSES', // @typescript-eslint package's interface - 'tsup', // We use tsup as builder - 'solidjs', // Our target framework - 'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric - 'todos', // Too general word to be caught as error - 'vue-demi', // dependency of @tanstack/vue-query - ], - }, - }, - ], - '@typescript-eslint/array-type': [ - 'error', - { default: 'generic', readonly: 'generic' }, - ], - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/consistent-type-definitions': 'off', - '@typescript-eslint/consistent-type-imports': [ - 'error', - { prefer: 'type-imports' }, - ], - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/method-signature-style': ['error', 'property'], - '@typescript-eslint/naming-convention': [ - 'error', - { - selector: 'typeParameter', - format: ['PascalCase'], - leadingUnderscore: 'forbid', - trailingUnderscore: 'forbid', - custom: { - regex: '^(T|T[A-Z][A-Za-z]+)$', - match: true, - }, - }, - ], - '@typescript-eslint/no-empty-function': '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-unused-vars': 'off', - '@typescript-eslint/no-inferrable-types': [ - 'error', - { ignoreParameters: true }, - ], - 'import/default': 'off', - 'import/export': 'off', - 'import/namespace': 'off', - 'import/newline-after-import': 'error', - 'import/no-cycle': 'error', - 'import/no-duplicates': 'off', - 'import/no-named-as-default-member': 'off', - 'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }], - 'import/no-unused-modules': ['off', { unusedExports: true }], - 'import/order': [ - 'error', - { - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - 'sibling', - 'index', - 'object', - 'type', - ], - }, - ], - 'no-case-declarations': 'off', - 'no-empty': 'off', - 'no-prototype-builtins': 'off', - 'no-redeclare': 'off', - 'no-shadow': 'error', - 'no-undef': 'off', - 'sort-imports': ['error', { ignoreDeclarationSort: true }], - }, - overrides: [ - { - files: ['**/*.test.{ts,tsx}'], - rules: { - '@typescript-eslint/no-unnecessary-condition': 'off', - }, - }, - ], -} - -module.exports = config diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000000..2359ffe8f1 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,42 @@ +// @ts-check + +// @ts-ignore +import { rootConfig } from '@tanstack/config/eslint' +// @ts-ignore +import cspellConfigs from '@cspell/eslint-plugin/configs' + +export default [ + ...rootConfig, + cspellConfigs.recommended, + { + name: 'tanstack/temp', + rules: { + '@cspell/spellchecker': [ + 'error', + { + cspell: { + words: [ + 'codemod', // We support our codemod + 'extralight', // Our public interface + 'jscodeshift', + 'Promisable', // Our public interface + 'retryer', // Our public interface + 'solidjs', // Our target framework + 'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric + 'tanstack', // Our package scope + 'todos', // Too general word to be caught as error + 'TSES', // @typescript-eslint package's interface + 'tsqd', // Our public interface (TanStack Query Devtools shorthand) + 'tsup', // We use tsup as builder + 'typecheck', // Field of vite.config.ts + 'vue-demi', // dependency of @tanstack/vue-query + ], + }, + }, + ], + '@typescript-eslint/no-empty-function': 'off', + 'no-case-declarations': 'off', + 'no-prototype-builtins': 'off', + }, + }, +] diff --git a/nx.json b/nx.json index 5106488ba9..2e7b0163a0 100644 --- a/nx.json +++ b/nx.json @@ -6,8 +6,8 @@ "parallel": 5, "namedInputs": { "sharedGlobals": [ - "{workspaceRoot}/.eslintrc.cjs", "{workspaceRoot}/.nvmrc", + "{workspaceRoot}/eslint.config.js", "{workspaceRoot}/package.json", "{workspaceRoot}/scripts/getTsupConfig.js", "{workspaceRoot}/tsconfig.json" @@ -21,8 +21,7 @@ "default", "{projectRoot}/build", "{projectRoot}/dist", - "!{projectRoot}/.eslintrc.cjs", - "!{projectRoot}/tsconfig.eslint.json" + "!{projectRoot}/eslint.config.js" ] }, "targetDefaults": { diff --git a/package.json b/package.json index 801a65f1f7..b80e048960 100644 --- a/package.json +++ b/package.json @@ -44,24 +44,18 @@ "devDependencies": { "@arethetypeswrong/cli": "^0.15.3", "@cspell/eslint-plugin": "^8.9.1", + "@eslint-react/eslint-plugin": "^1.5.16", "@solidjs/testing-library": "^0.8.8", - "@tanstack/config": "^0.7.11", + "@tanstack/config": "^0.8.1", "@testing-library/jest-dom": "^6.4.5", "@testing-library/react": "^15.0.7", - "@types/eslint": "^8.56.10", "@types/node": "^20.12.12", "@types/react": "npm:types-react@rc", "@types/react-dom": "npm:types-react-dom@rc", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", "@vitest/coverage-istanbul": "^1.6.0", "cpy-cli": "^5.0.0", "esbuild-plugin-file-path-extensions": "^2.1.0", "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-react": "^7.34.3", "eslint-plugin-react-hooks": "^4.6.2", "husky": "^9.0.11", "jsdom": "^24.0.0", @@ -78,6 +72,7 @@ "solid-js": "^1.8.17", "tsup": "^8.0.2", "typescript": "5.3.3", + "typescript-eslint": "^7.14.1", "typescript47": "npm:typescript@4.7", "typescript48": "npm:typescript@4.8", "typescript49": "npm:typescript@4.9", @@ -89,11 +84,9 @@ }, "pnpm": { "overrides": { - "@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin", - "@typescript-eslint/parser": "$@typescript-eslint/parser", - "eslint": "$eslint", "@types/react": "npm:types-react@rc", - "@types/react-dom": "npm:types-react-dom@rc" + "@types/react-dom": "npm:types-react-dom@rc", + "eslint": "$eslint" } } } diff --git a/packages/angular-query-devtools-experimental/.eslintrc.cjs b/packages/angular-query-devtools-experimental/.eslintrc.cjs deleted file mode 100644 index 2e4bb703d2..0000000000 --- a/packages/angular-query-devtools-experimental/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - plugins: ['jsdoc'], - extends: ['plugin:jsdoc/recommended-typescript'], - rules: { - 'jsdoc/require-hyphen-before-param-description': 1, - 'jsdoc/sort-tags': 1, - 'jsdoc/require-throws': 1, - 'jsdoc/check-tag-names': ['warn'], - }, -} - -module.exports = config diff --git a/packages/angular-query-devtools-experimental/eslint.config.js b/packages/angular-query-devtools-experimental/eslint.config.js new file mode 100644 index 0000000000..c4d8028b6d --- /dev/null +++ b/packages/angular-query-devtools-experimental/eslint.config.js @@ -0,0 +1,17 @@ +// @ts-check + +import pluginJsdoc from 'eslint-plugin-jsdoc' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + pluginJsdoc.configs['flat/recommended-typescript'], + { + rules: { + 'jsdoc/require-hyphen-before-param-description': 1, + 'jsdoc/sort-tags': 1, + 'jsdoc/require-throws': 1, + 'jsdoc/check-tag-names': ['warn'], + }, + }, +] diff --git a/packages/angular-query-devtools-experimental/package.json b/packages/angular-query-devtools-experimental/package.json index dded50defa..98003252ac 100644 --- a/packages/angular-query-devtools-experimental/package.json +++ b/packages/angular-query-devtools-experimental/package.json @@ -21,7 +21,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", "test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js", diff --git a/packages/angular-query-devtools-experimental/tsconfig.json b/packages/angular-query-devtools-experimental/tsconfig.json index f4fb148c0a..c63b5b752d 100644 --- a/packages/angular-query-devtools-experimental/tsconfig.json +++ b/packages/angular-query-devtools-experimental/tsconfig.json @@ -11,5 +11,5 @@ "useDefineForClassFields": false, "target": "ES2022" }, - "include": ["src", ".eslintrc.cjs", "vite.config.ts"] + "include": ["src", "eslint.config.js", "vite.config.ts"] } diff --git a/packages/angular-query-experimental/.eslintrc.cjs b/packages/angular-query-experimental/.eslintrc.cjs deleted file mode 100644 index 5bb433048c..0000000000 --- a/packages/angular-query-experimental/.eslintrc.cjs +++ /dev/null @@ -1,21 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - plugins: ['jsdoc'], - extends: ['plugin:jsdoc/recommended-typescript'], - rules: { - 'jsdoc/require-hyphen-before-param-description': 1, - 'jsdoc/sort-tags': 1, - 'jsdoc/require-throws': 1, - 'jsdoc/check-tag-names': [ - 'warn', - { - // Not compatible with Api Extractor @public - typed: false, - }, - ], - }, -} - -module.exports = config diff --git a/packages/angular-query-experimental/eslint.config.js b/packages/angular-query-experimental/eslint.config.js new file mode 100644 index 0000000000..96ae79dca5 --- /dev/null +++ b/packages/angular-query-experimental/eslint.config.js @@ -0,0 +1,23 @@ +// @ts-check + +import pluginJsdoc from 'eslint-plugin-jsdoc' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + pluginJsdoc.configs['flat/recommended-typescript'], + { + rules: { + 'jsdoc/require-hyphen-before-param-description': 1, + 'jsdoc/sort-tags': 1, + 'jsdoc/require-throws': 1, + 'jsdoc/check-tag-names': [ + 'warn', + { + // Not compatible with Api Extractor @public + typed: false, + }, + ], + }, + }, +] diff --git a/packages/angular-query-experimental/package.json b/packages/angular-query-experimental/package.json index a603d42b20..a455afedf2 100644 --- a/packages/angular-query-experimental/package.json +++ b/packages/angular-query-experimental/package.json @@ -36,7 +36,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/angular-query-experimental/tsconfig.json b/packages/angular-query-experimental/tsconfig.json index e4db098afa..04a006aad9 100644 --- a/packages/angular-query-experimental/tsconfig.json +++ b/packages/angular-query-experimental/tsconfig.json @@ -12,5 +12,5 @@ "target": "ES2022", "types": ["vitest/globals"] }, - "include": ["src", ".eslintrc.cjs", "vite.config.ts"] + "include": ["src", "eslint.config.js", "vite.config.ts"] } diff --git a/packages/eslint-plugin-query/.eslintrc.cjs b/packages/eslint-plugin-query/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/eslint-plugin-query/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/eslint-plugin-query/eslint.config.js b/packages/eslint-plugin-query/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/eslint-plugin-query/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/eslint-plugin-query/package.json b/packages/eslint-plugin-query/package.json index 5357a2a18e..14bee05ea5 100644 --- a/packages/eslint-plugin-query/package.json +++ b/packages/eslint-plugin-query/package.json @@ -33,7 +33,7 @@ }, "scripts": { "clean": "rimraf ./dist && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/eslint-plugin-query/tsconfig.json b/packages/eslint-plugin-query/tsconfig.json index 4c5ba76c2e..cbceff3f8b 100644 --- a/packages/eslint-plugin-query/tsconfig.json +++ b/packages/eslint-plugin-query/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "vite.config.ts"] + "include": ["src", "eslint.config.js", "vite.config.ts"] } diff --git a/packages/eslint-plugin-query/vite.config.ts b/packages/eslint-plugin-query/vite.config.ts index 1aba28f89a..df51ec633d 100644 --- a/packages/eslint-plugin-query/vite.config.ts +++ b/packages/eslint-plugin-query/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig, mergeConfig } from 'vitest/config' -import { tanstackBuildConfig } from '@tanstack/config/build' +import { tanstackViteConfig } from '@tanstack/config/vite' import packageJson from './package.json' const config = defineConfig({ @@ -16,7 +16,7 @@ const config = defineConfig({ export default mergeConfig( config, - tanstackBuildConfig({ + tanstackViteConfig({ entry: './src/index.ts', srcDir: './src', exclude: ['./src/__tests__'], diff --git a/packages/query-async-storage-persister/.eslintrc.cjs b/packages/query-async-storage-persister/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-async-storage-persister/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-async-storage-persister/eslint.config.js b/packages/query-async-storage-persister/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-async-storage-persister/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-async-storage-persister/package.json b/packages/query-async-storage-persister/package.json index 94c6bc74c2..04c3144097 100644 --- a/packages/query-async-storage-persister/package.json +++ b/packages/query-async-storage-persister/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/query-async-storage-persister/tsconfig.json b/packages/query-async-storage-persister/tsconfig.json index cecbd8eb05..c65d041ca6 100644 --- a/packages/query-async-storage-persister/tsconfig.json +++ b/packages/query-async-storage-persister/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/query-broadcast-client-experimental/.eslintrc.cjs b/packages/query-broadcast-client-experimental/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-broadcast-client-experimental/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-broadcast-client-experimental/eslint.config.js b/packages/query-broadcast-client-experimental/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-broadcast-client-experimental/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-broadcast-client-experimental/package.json b/packages/query-broadcast-client-experimental/package.json index f55f2d7928..ab17b333f7 100644 --- a/packages/query-broadcast-client-experimental/package.json +++ b/packages/query-broadcast-client-experimental/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/query-broadcast-client-experimental/tsconfig.json b/packages/query-broadcast-client-experimental/tsconfig.json index 507e36b485..f0bd6f1a2f 100644 --- a/packages/query-broadcast-client-experimental/tsconfig.json +++ b/packages/query-broadcast-client-experimental/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js"] + "include": ["src", "eslint.config.js", "tsup.config.js"] } diff --git a/packages/query-codemods/.eslintrc.cjs b/packages/query-codemods/.eslintrc.cjs deleted file mode 100644 index 714d4773af..0000000000 --- a/packages/query-codemods/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - overrides: [ - { - files: ['**/__testfixtures__/*'], - rules: { - 'import/no-unresolved': 'off', - 'sort-imports': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-unnecessary-condition': 'off', - }, - }, - ], -} - -module.exports = config diff --git a/packages/query-codemods/eslint.config.js b/packages/query-codemods/eslint.config.js new file mode 100644 index 0000000000..faca05d79a --- /dev/null +++ b/packages/query-codemods/eslint.config.js @@ -0,0 +1,18 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + { + rules: { + '@cspell/spellchecker': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-unnecessary-condition': 'off', + 'import/no-unresolved': 'off', + 'import/order': 'off', + 'no-shadow': 'off', + 'sort-imports': 'off', + }, + }, +] diff --git a/packages/query-codemods/package.json b/packages/query-codemods/package.json index 605c105d12..49093be40e 100644 --- a/packages/query-codemods/package.json +++ b/packages/query-codemods/package.json @@ -10,13 +10,13 @@ "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, - "type": "commonjs", + "type": "module", "exports": { "./package.json": "./package.json" }, "sideEffects": false, "scripts": { - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:lib": "vitest", "test:lib:dev": "pnpm run test:lib --watch" }, diff --git a/packages/query-codemods/tsconfig.json b/packages/query-codemods/tsconfig.json index 4c5ba76c2e..cbceff3f8b 100644 --- a/packages/query-codemods/tsconfig.json +++ b/packages/query-codemods/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "vite.config.ts"] + "include": ["src", "eslint.config.js", "vite.config.ts"] } diff --git a/packages/query-core/.eslintrc.cjs b/packages/query-core/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-core/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-core/eslint.config.js b/packages/query-core/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-core/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-core/package.json b/packages/query-core/package.json index 5261886584..047c8ddbc0 100644 --- a/packages/query-core/package.json +++ b/packages/query-core/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts47": "node ../../node_modules/typescript47/lib/tsc.js -p tsconfig.legacy.json", "test:types:ts48": "node ../../node_modules/typescript48/lib/tsc.js -p tsconfig.legacy.json", diff --git a/packages/query-core/tsconfig.json b/packages/query-core/tsconfig.json index cecbd8eb05..c65d041ca6 100644 --- a/packages/query-core/tsconfig.json +++ b/packages/query-core/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/query-devtools/.eslintrc.cjs b/packages/query-devtools/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-devtools/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-devtools/eslint.config.js b/packages/query-devtools/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-devtools/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-devtools/package.json b/packages/query-devtools/package.json index 3d4b256d79..5b68dfb88a 100644 --- a/packages/query-devtools/package.json +++ b/packages/query-devtools/package.json @@ -35,7 +35,7 @@ }, "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/query-devtools/tsconfig.json b/packages/query-devtools/tsconfig.json index bcb804e6ff..71ebc897ff 100644 --- a/packages/query-devtools/tsconfig.json +++ b/packages/query-devtools/tsconfig.json @@ -5,5 +5,5 @@ "jsxImportSource": "solid-js", "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/query-persist-client-core/.eslintrc.cjs b/packages/query-persist-client-core/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-persist-client-core/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-persist-client-core/eslint.config.js b/packages/query-persist-client-core/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-persist-client-core/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-persist-client-core/package.json b/packages/query-persist-client-core/package.json index 6aa74bca3c..a5b94a77f0 100644 --- a/packages/query-persist-client-core/package.json +++ b/packages/query-persist-client-core/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/query-persist-client-core/tsconfig.json b/packages/query-persist-client-core/tsconfig.json index cecbd8eb05..c65d041ca6 100644 --- a/packages/query-persist-client-core/tsconfig.json +++ b/packages/query-persist-client-core/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/query-sync-storage-persister/.eslintrc.cjs b/packages/query-sync-storage-persister/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/query-sync-storage-persister/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/query-sync-storage-persister/eslint.config.js b/packages/query-sync-storage-persister/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/query-sync-storage-persister/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/query-sync-storage-persister/package.json b/packages/query-sync-storage-persister/package.json index 06bd04eea7..927352179f 100644 --- a/packages/query-sync-storage-persister/package.json +++ b/packages/query-sync-storage-persister/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/query-sync-storage-persister/tsconfig.json b/packages/query-sync-storage-persister/tsconfig.json index cecbd8eb05..c65d041ca6 100644 --- a/packages/query-sync-storage-persister/tsconfig.json +++ b/packages/query-sync-storage-persister/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/react-query-devtools/.eslintrc.cjs b/packages/react-query-devtools/.eslintrc.cjs deleted file mode 100644 index 0e9c18d80b..0000000000 --- a/packages/react-query-devtools/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'], - rules: { - 'react/jsx-key': ['error', { checkFragmentShorthand: true }], - 'react-hooks/exhaustive-deps': 'error', - }, -} - -module.exports = config diff --git a/packages/react-query-devtools/eslint.config.js b/packages/react-query-devtools/eslint.config.js new file mode 100644 index 0000000000..95cf4ac469 --- /dev/null +++ b/packages/react-query-devtools/eslint.config.js @@ -0,0 +1,23 @@ +// @ts-check + +import pluginReact from '@eslint-react/eslint-plugin' +// @ts-expect-error +import pluginReactHooks from 'eslint-plugin-react-hooks' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + { + files: ['**/*.{ts,tsx}'], + ...pluginReact.configs.recommended, + }, + { + plugins: { + 'react-hooks': pluginReactHooks, + }, + rules: { + 'react-hooks/exhaustive-deps': 'error', + 'react-hooks/rules-of-hooks': 'error', + }, + }, +] diff --git a/packages/react-query-devtools/package.json b/packages/react-query-devtools/package.json index 5db91038a2..1154c380c1 100644 --- a/packages/react-query-devtools/package.json +++ b/packages/react-query-devtools/package.json @@ -58,7 +58,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/react-query-devtools/tsconfig.json b/packages/react-query-devtools/tsconfig.json index efe7f2d3f8..b8911d6eff 100644 --- a/packages/react-query-devtools/tsconfig.json +++ b/packages/react-query-devtools/tsconfig.json @@ -6,7 +6,7 @@ }, "include": [ "src", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "tsup.config.js", "vite.config.ts" diff --git a/packages/react-query-next-experimental/.eslintrc.cjs b/packages/react-query-next-experimental/.eslintrc.cjs deleted file mode 100644 index 0e9c18d80b..0000000000 --- a/packages/react-query-next-experimental/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'], - rules: { - 'react/jsx-key': ['error', { checkFragmentShorthand: true }], - 'react-hooks/exhaustive-deps': 'error', - }, -} - -module.exports = config diff --git a/packages/react-query-next-experimental/eslint.config.js b/packages/react-query-next-experimental/eslint.config.js new file mode 100644 index 0000000000..a9e2c964df --- /dev/null +++ b/packages/react-query-next-experimental/eslint.config.js @@ -0,0 +1,24 @@ +// @ts-check + +import pluginReact from '@eslint-react/eslint-plugin' +// @ts-expect-error +import pluginReactHooks from 'eslint-plugin-react-hooks' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + { + files: ['**/*.{ts,tsx}'], + ...pluginReact.configs.recommended, + }, + { + plugins: { + 'react-hooks': pluginReactHooks, + }, + rules: { + '@eslint-react/no-unstable-context-value': 'off', + 'react-hooks/exhaustive-deps': 'error', + 'react-hooks/rules-of-hooks': 'error', + }, + }, +] diff --git a/packages/react-query-next-experimental/package.json b/packages/react-query-next-experimental/package.json index e399474e39..01a18c3d2b 100644 --- a/packages/react-query-next-experimental/package.json +++ b/packages/react-query-next-experimental/package.json @@ -34,7 +34,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/react-query-next-experimental/tsconfig.json b/packages/react-query-next-experimental/tsconfig.json index 01502df4d9..527085e1ba 100644 --- a/packages/react-query-next-experimental/tsconfig.json +++ b/packages/react-query-next-experimental/tsconfig.json @@ -4,5 +4,5 @@ "jsx": "react-jsx", "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/react-query-persist-client/.eslintrc.cjs b/packages/react-query-persist-client/.eslintrc.cjs deleted file mode 100644 index 0e9c18d80b..0000000000 --- a/packages/react-query-persist-client/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'], - rules: { - 'react/jsx-key': ['error', { checkFragmentShorthand: true }], - 'react-hooks/exhaustive-deps': 'error', - }, -} - -module.exports = config diff --git a/packages/react-query-persist-client/eslint.config.js b/packages/react-query-persist-client/eslint.config.js new file mode 100644 index 0000000000..95cf4ac469 --- /dev/null +++ b/packages/react-query-persist-client/eslint.config.js @@ -0,0 +1,23 @@ +// @ts-check + +import pluginReact from '@eslint-react/eslint-plugin' +// @ts-expect-error +import pluginReactHooks from 'eslint-plugin-react-hooks' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + { + files: ['**/*.{ts,tsx}'], + ...pluginReact.configs.recommended, + }, + { + plugins: { + 'react-hooks': pluginReactHooks, + }, + rules: { + 'react-hooks/exhaustive-deps': 'error', + 'react-hooks/rules-of-hooks': 'error', + }, + }, +] diff --git a/packages/react-query-persist-client/package.json b/packages/react-query-persist-client/package.json index 087d7f9581..56b8998bbf 100644 --- a/packages/react-query-persist-client/package.json +++ b/packages/react-query-persist-client/package.json @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/react-query-persist-client/tsconfig.json b/packages/react-query-persist-client/tsconfig.json index efe7f2d3f8..b8911d6eff 100644 --- a/packages/react-query-persist-client/tsconfig.json +++ b/packages/react-query-persist-client/tsconfig.json @@ -6,7 +6,7 @@ }, "include": [ "src", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "tsup.config.js", "vite.config.ts" diff --git a/packages/react-query/.eslintrc.cjs b/packages/react-query/.eslintrc.cjs deleted file mode 100644 index 337263a6fe..0000000000 --- a/packages/react-query/.eslintrc.cjs +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'], - plugins: ['react-compiler'], - rules: { - 'react-compiler/react-compiler': 'error', - 'react/jsx-key': ['error', { checkFragmentShorthand: true }], - 'react-hooks/exhaustive-deps': 'error', - }, - overrides: [ - { - files: ['**/__tests__/**'], - rules: { - 'react-compiler/react-compiler': 'off', - }, - }, - ], -} - -module.exports = config diff --git a/packages/react-query/eslint.config.js b/packages/react-query/eslint.config.js new file mode 100644 index 0000000000..a648870ebe --- /dev/null +++ b/packages/react-query/eslint.config.js @@ -0,0 +1,35 @@ +// @ts-check + +import pluginReact from '@eslint-react/eslint-plugin' +// @ts-expect-error +import pluginReactCompiler from 'eslint-plugin-react-compiler' +// @ts-expect-error +import pluginReactHooks from 'eslint-plugin-react-hooks' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + { + files: ['**/*.{ts,tsx}'], + ...pluginReact.configs.recommended, + }, + { + plugins: { + 'react-hooks': pluginReactHooks, + 'react-compiler': pluginReactCompiler, + }, + rules: { + '@eslint-react/dom/no-missing-button-type': 'off', + 'react-compiler/react-compiler': 'error', + 'react-hooks/exhaustive-deps': 'error', + 'react-hooks/rules-of-hooks': 'error', + }, + }, + { + files: ['**/__tests__/**'], + rules: { + '@typescript-eslint/no-unnecessary-condition': 'off', + 'react-compiler/react-compiler': 'off', + }, + }, +] diff --git a/packages/react-query/package.json b/packages/react-query/package.json index 059591335c..0d4c2d13ef 100644 --- a/packages/react-query/package.json +++ b/packages/react-query/package.json @@ -34,7 +34,7 @@ "sideEffects": false, "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts47": "node ../../node_modules/typescript47/lib/tsc.js -p tsconfig.legacy.json", "test:types:ts48": "node ../../node_modules/typescript48/lib/tsc.js -p tsconfig.legacy.json", diff --git a/packages/react-query/tsconfig.json b/packages/react-query/tsconfig.json index efe7f2d3f8..b8911d6eff 100644 --- a/packages/react-query/tsconfig.json +++ b/packages/react-query/tsconfig.json @@ -6,7 +6,7 @@ }, "include": [ "src", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "tsup.config.js", "vite.config.ts" diff --git a/packages/solid-query-devtools/.eslintrc.cjs b/packages/solid-query-devtools/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/solid-query-devtools/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/solid-query-devtools/eslint.config.js b/packages/solid-query-devtools/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/solid-query-devtools/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/solid-query-devtools/package.json b/packages/solid-query-devtools/package.json index 014539408f..a9c406c852 100644 --- a/packages/solid-query-devtools/package.json +++ b/packages/solid-query-devtools/package.json @@ -35,7 +35,7 @@ }, "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/solid-query-devtools/tsconfig.json b/packages/solid-query-devtools/tsconfig.json index bcb804e6ff..71ebc897ff 100644 --- a/packages/solid-query-devtools/tsconfig.json +++ b/packages/solid-query-devtools/tsconfig.json @@ -5,5 +5,5 @@ "jsxImportSource": "solid-js", "moduleResolution": "Bundler" }, - "include": ["src", ".eslintrc.cjs", "tsup.config.js", "vite.config.ts"] + "include": ["src", "eslint.config.js", "tsup.config.js", "vite.config.ts"] } diff --git a/packages/solid-query-persist-client/.eslintrc.cjs b/packages/solid-query-persist-client/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/solid-query-persist-client/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/solid-query-persist-client/eslint.config.js b/packages/solid-query-persist-client/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/solid-query-persist-client/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/solid-query-persist-client/package.json b/packages/solid-query-persist-client/package.json index b6af1195da..6d051a79ec 100644 --- a/packages/solid-query-persist-client/package.json +++ b/packages/solid-query-persist-client/package.json @@ -45,7 +45,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js", "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js", diff --git a/packages/solid-query-persist-client/tsconfig.json b/packages/solid-query-persist-client/tsconfig.json index 9137b8e8a8..20aea306cd 100644 --- a/packages/solid-query-persist-client/tsconfig.json +++ b/packages/solid-query-persist-client/tsconfig.json @@ -7,7 +7,7 @@ }, "include": [ "src", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "tsup.config.js", "vite.config.ts" diff --git a/packages/solid-query/.eslintrc.cjs b/packages/solid-query/.eslintrc.cjs deleted file mode 100644 index cca134ce16..0000000000 --- a/packages/solid-query/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = {} - -module.exports = config diff --git a/packages/solid-query/eslint.config.js b/packages/solid-query/eslint.config.js new file mode 100644 index 0000000000..8ce6ad05fc --- /dev/null +++ b/packages/solid-query/eslint.config.js @@ -0,0 +1,5 @@ +// @ts-check + +import rootConfig from '../../eslint.config.js' + +export default [...rootConfig] diff --git a/packages/solid-query/package.json b/packages/solid-query/package.json index e41c6db756..29422f64bf 100644 --- a/packages/solid-query/package.json +++ b/packages/solid-query/package.json @@ -41,7 +41,7 @@ }, "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", "test:types:ts49": "node ../../node_modules/typescript49/lib/tsc.js -p tsconfig.legacy.json", "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js -p tsconfig.legacy.json", diff --git a/packages/solid-query/src/__tests__/createQuery.test.tsx b/packages/solid-query/src/__tests__/createQuery.test.tsx index bbe4d15e06..0e06b118bc 100644 --- a/packages/solid-query/src/__tests__/createQuery.test.tsx +++ b/packages/solid-query/src/__tests__/createQuery.test.tsx @@ -4435,6 +4435,7 @@ describe('createQuery', () => { readonly [typeof key, number] > = async (ctx) => { const [, limit] = ctx.queryKey + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition const value = limit % 2 && ctx.signal ? 'abort' : `data ${limit}` await sleep(25) return value diff --git a/packages/solid-query/tsconfig.json b/packages/solid-query/tsconfig.json index 9137b8e8a8..20aea306cd 100644 --- a/packages/solid-query/tsconfig.json +++ b/packages/solid-query/tsconfig.json @@ -7,7 +7,7 @@ }, "include": [ "src", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "tsup.config.js", "vite.config.ts" diff --git a/packages/svelte-query-devtools/.eslintrc.cjs b/packages/svelte-query-devtools/.eslintrc.cjs deleted file mode 100644 index c872b57665..0000000000 --- a/packages/svelte-query-devtools/.eslintrc.cjs +++ /dev/null @@ -1,24 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:svelte/recommended'], - parserOptions: { - extraFileExtensions: ['.svelte'], - }, - ignorePatterns: ['*.config.*', '*.setup.*', '**/dist/*'], - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser', - }, - }, - ], - rules: { - 'svelte/no-svelte-internal': 'error', - }, -} - -module.exports = config diff --git a/packages/svelte-query-devtools/eslint.config.js b/packages/svelte-query-devtools/eslint.config.js new file mode 100644 index 0000000000..6ed66be34b --- /dev/null +++ b/packages/svelte-query-devtools/eslint.config.js @@ -0,0 +1,26 @@ +// @ts-check + +import tseslint from 'typescript-eslint' +import pluginSvelte from 'eslint-plugin-svelte' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + ...pluginSvelte.configs['flat/recommended'], + { + files: ['**/*.svelte'], + languageOptions: { + parserOptions: { + extraFileExtensions: ['.svelte'], + parser: tseslint.parser, + }, + }, + }, + { + rules: { + 'svelte/block-lang': ['error', { script: ['ts'] }], + 'svelte/no-svelte-internal': 'error', + 'svelte/valid-compile': 'off', + }, + }, +] diff --git a/packages/svelte-query-devtools/package.json b/packages/svelte-query-devtools/package.json index 631b03bfaa..d827b008e1 100644 --- a/packages/svelte-query-devtools/package.json +++ b/packages/svelte-query-devtools/package.json @@ -29,7 +29,7 @@ "scripts": { "clean": "rimraf ./dist && rimraf ./coverage", "test:types": "svelte-check --tsconfig ./tsconfig.json", - "test:eslint": "eslint --ext .svelte,.ts ./src", + "test:eslint": "eslint ./src", "test:build": "publint --strict", "test:attw": "attw --pack", "build": "svelte-package --input ./src --output ./dist" @@ -44,8 +44,7 @@ "@tanstack/svelte-query": "workspace:*", "eslint-plugin-svelte": "^2.40.0", "svelte": "^4.2.17", - "svelte-check": "^3.7.1", - "svelte-eslint-parser": "^0.39.1" + "svelte-check": "^3.7.1" }, "peerDependencies": { "@tanstack/svelte-query": "workspace:^", diff --git a/packages/svelte-query-devtools/tsconfig.json b/packages/svelte-query-devtools/tsconfig.json index fe2eac28c7..e1268ed76c 100644 --- a/packages/svelte-query-devtools/tsconfig.json +++ b/packages/svelte-query-devtools/tsconfig.json @@ -7,7 +7,7 @@ "src/**/*.js", "src/**/*.ts", "src/**/*.svelte", - ".eslintrc.cjs", + "eslint.config.js", "vite.config.ts" ] } diff --git a/packages/svelte-query-persist-client/.eslintrc.cjs b/packages/svelte-query-persist-client/.eslintrc.cjs deleted file mode 100644 index c872b57665..0000000000 --- a/packages/svelte-query-persist-client/.eslintrc.cjs +++ /dev/null @@ -1,24 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:svelte/recommended'], - parserOptions: { - extraFileExtensions: ['.svelte'], - }, - ignorePatterns: ['*.config.*', '*.setup.*', '**/dist/*'], - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser', - }, - }, - ], - rules: { - 'svelte/no-svelte-internal': 'error', - }, -} - -module.exports = config diff --git a/packages/svelte-query-persist-client/eslint.config.js b/packages/svelte-query-persist-client/eslint.config.js new file mode 100644 index 0000000000..6ed66be34b --- /dev/null +++ b/packages/svelte-query-persist-client/eslint.config.js @@ -0,0 +1,26 @@ +// @ts-check + +import tseslint from 'typescript-eslint' +import pluginSvelte from 'eslint-plugin-svelte' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + ...pluginSvelte.configs['flat/recommended'], + { + files: ['**/*.svelte'], + languageOptions: { + parserOptions: { + extraFileExtensions: ['.svelte'], + parser: tseslint.parser, + }, + }, + }, + { + rules: { + 'svelte/block-lang': ['error', { script: ['ts'] }], + 'svelte/no-svelte-internal': 'error', + 'svelte/valid-compile': 'off', + }, + }, +] diff --git a/packages/svelte-query-persist-client/package.json b/packages/svelte-query-persist-client/package.json index d08e50de7d..59db1f1ad0 100644 --- a/packages/svelte-query-persist-client/package.json +++ b/packages/svelte-query-persist-client/package.json @@ -29,7 +29,7 @@ "scripts": { "clean": "rimraf ./dist && rimraf ./coverage", "test:types": "svelte-check --tsconfig ./tsconfig.json", - "test:eslint": "eslint --ext .svelte,.ts ./src", + "test:eslint": "eslint ./src", "test:lib": "vitest", "test:lib:dev": "pnpm run test:lib --watch", "test:build": "publint --strict", @@ -46,8 +46,7 @@ "@testing-library/svelte": "^5.1.0", "eslint-plugin-svelte": "^2.40.0", "svelte": "^4.2.17", - "svelte-check": "^3.7.1", - "svelte-eslint-parser": "^0.39.1" + "svelte-check": "^3.7.1" }, "peerDependencies": { "@tanstack/svelte-query": "workspace:^", diff --git a/packages/svelte-query-persist-client/tsconfig.json b/packages/svelte-query-persist-client/tsconfig.json index 7c4465627a..16c88320f5 100644 --- a/packages/svelte-query-persist-client/tsconfig.json +++ b/packages/svelte-query-persist-client/tsconfig.json @@ -7,7 +7,7 @@ "src/**/*.js", "src/**/*.ts", "src/**/*.svelte", - ".eslintrc.cjs", + "eslint.config.js", "test-setup.ts", "vite.config.ts" ] diff --git a/packages/svelte-query/.eslintrc.cjs b/packages/svelte-query/.eslintrc.cjs deleted file mode 100644 index c872b57665..0000000000 --- a/packages/svelte-query/.eslintrc.cjs +++ /dev/null @@ -1,24 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - extends: ['plugin:svelte/recommended'], - parserOptions: { - extraFileExtensions: ['.svelte'], - }, - ignorePatterns: ['*.config.*', '*.setup.*', '**/dist/*'], - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser', - }, - }, - ], - rules: { - 'svelte/no-svelte-internal': 'error', - }, -} - -module.exports = config diff --git a/packages/svelte-query/eslint.config.js b/packages/svelte-query/eslint.config.js new file mode 100644 index 0000000000..6ed66be34b --- /dev/null +++ b/packages/svelte-query/eslint.config.js @@ -0,0 +1,26 @@ +// @ts-check + +import tseslint from 'typescript-eslint' +import pluginSvelte from 'eslint-plugin-svelte' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + ...pluginSvelte.configs['flat/recommended'], + { + files: ['**/*.svelte'], + languageOptions: { + parserOptions: { + extraFileExtensions: ['.svelte'], + parser: tseslint.parser, + }, + }, + }, + { + rules: { + 'svelte/block-lang': ['error', { script: ['ts'] }], + 'svelte/no-svelte-internal': 'error', + 'svelte/valid-compile': 'off', + }, + }, +] diff --git a/packages/svelte-query/package.json b/packages/svelte-query/package.json index ebb3390052..a89d5eaafa 100644 --- a/packages/svelte-query/package.json +++ b/packages/svelte-query/package.json @@ -33,7 +33,7 @@ "scripts": { "clean": "rimraf ./dist && rimraf ./coverage", "test:types": "svelte-check --tsconfig ./tsconfig.json", - "test:eslint": "eslint --ext .svelte,.ts ./src", + "test:eslint": "eslint ./src", "test:lib": "vitest", "test:lib:dev": "pnpm run test:lib --watch", "test:build": "publint --strict", @@ -49,8 +49,7 @@ "@testing-library/svelte": "^5.1.0", "eslint-plugin-svelte": "^2.40.0", "svelte": "^4.2.17", - "svelte-check": "^3.7.1", - "svelte-eslint-parser": "^0.39.1" + "svelte-check": "^3.7.1" }, "peerDependencies": { "svelte": "^3.54.0 || ^4.0.0 || ^5.0.0-next.0" diff --git a/packages/svelte-query/tsconfig.json b/packages/svelte-query/tsconfig.json index 16fff9b5c9..08e71c0aaa 100644 --- a/packages/svelte-query/tsconfig.json +++ b/packages/svelte-query/tsconfig.json @@ -10,7 +10,7 @@ "tests/**/*.js", "tests/**/*.ts", "tests/**/*.svelte", - ".eslintrc.cjs", + "eslint.config.js", "vite.config.ts" ] } diff --git a/packages/vue-query-devtools/.eslintrc.cjs b/packages/vue-query-devtools/.eslintrc.cjs deleted file mode 100644 index 739a3b4480..0000000000 --- a/packages/vue-query-devtools/.eslintrc.cjs +++ /dev/null @@ -1,10 +0,0 @@ -// @ts-check - -/** @type {import('eslint').Linter.Config} */ -const config = { - parserOptions: { - extraFileExtensions: ['.vue'], - }, -} - -module.exports = config diff --git a/packages/vue-query-devtools/eslint.config.js b/packages/vue-query-devtools/eslint.config.js new file mode 100644 index 0000000000..8ac8dd40ab --- /dev/null +++ b/packages/vue-query-devtools/eslint.config.js @@ -0,0 +1,20 @@ +// @ts-check + +import tseslint from 'typescript-eslint' +// @ts-expect-error +import pluginVue from 'eslint-plugin-vue' +import rootConfig from '../../eslint.config.js' + +export default [ + ...rootConfig, + ...pluginVue.configs['flat/base'], + { + files: ['**/*.vue'], + languageOptions: { + parserOptions: { + extraFileExtensions: ['.vue'], + parser: tseslint.parser, + }, + }, + }, +] diff --git a/packages/vue-query-devtools/package.json b/packages/vue-query-devtools/package.json index c2aafc5400..1aa7fcebf1 100644 --- a/packages/vue-query-devtools/package.json +++ b/packages/vue-query-devtools/package.json @@ -40,7 +40,7 @@ ], "scripts": { "clean": "rimraf ./build && rimraf ./coverage", - "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:eslint": "eslint ./src", "test:types": "vue-tsc", "test:build": "publint --strict", "test:attw": "attw --pack", @@ -52,6 +52,7 @@ "devDependencies": { "@tanstack/vue-query": "workspace:*", "@vitejs/plugin-vue": "^5.0.4", + "eslint-plugin-vue": "^9.26.0", "vite": "^5.2.11", "vue": "^3.4.27", "vue-tsc": "^1.8.26" diff --git a/packages/vue-query-devtools/src/devtools.vue b/packages/vue-query-devtools/src/devtools.vue index 8e575b88b4..a652bc9650 100644 --- a/packages/vue-query-devtools/src/devtools.vue +++ b/packages/vue-query-devtools/src/devtools.vue @@ -1,5 +1,5 @@