diff --git a/packages/config/package.json b/packages/config/package.json index 541128d..3c7d69f 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -82,7 +82,8 @@ "v8flags": "^4.0.1", "vite-plugin-dts": "4.0.3", "vite-plugin-externalize-deps": "^0.8.0", - "vite-tsconfig-paths": "^5.1.4" + "vite-tsconfig-paths": "^5.1.4", + "vue-eslint-parser": "^9.4.3" }, "devDependencies": { "@types/current-git-branch": "^1.1.6", diff --git a/packages/config/src/eslint/index.js b/packages/config/src/eslint/index.js index cc7ce4b..3c5057b 100644 --- a/packages/config/src/eslint/index.js +++ b/packages/config/src/eslint/index.js @@ -1,4 +1,5 @@ import tseslint from 'typescript-eslint' +import vueparser from 'vue-eslint-parser' import stylisticJs from '@stylistic/eslint-plugin-js' import pluginImport from 'eslint-plugin-import-x' import pluginNode from 'eslint-plugin-n' @@ -9,7 +10,8 @@ import { typescriptRules } from './typescript.js' import { nodeRules } from './node.js' import { stylisticRules } from './stylistic.js' -const GLOB_INCLUDE = ['**/*.{js,svelte,ts,tsx,vue}'] +const JS_GLOB_INCLUDE = ['**/*.{js,ts,tsx}'] +const VUE_GLOB_INCLUDE = ['**/*.vue'] const GLOB_EXCLUDE = [ '**/.nx/**', @@ -21,6 +23,21 @@ const GLOB_EXCLUDE = [ '**/vite.config.*.timestamp-*.*', ] +const jsRules = { + ...javascriptRules, + ...typescriptRules, + ...importRules, + ...nodeRules, + ...stylisticRules, +} + +const jsPlugins = { + '@stylistic/js': stylisticJs, + '@typescript-eslint': tseslint.plugin, + import: pluginImport, + node: pluginNode, +} + /** @type {import('eslint').Linter.Config[]} */ export const tanstackConfig = [ { @@ -29,7 +46,7 @@ export const tanstackConfig = [ }, { name: 'tanstack/setup', - files: GLOB_INCLUDE, + files: JS_GLOB_INCLUDE, languageOptions: { sourceType: 'module', ecmaVersion: 2020, @@ -37,28 +54,34 @@ export const tanstackConfig = [ parser: tseslint.parser, parserOptions: { project: true, - extraFileExtensions: ['.svelte', '.vue'], parser: tseslint.parser, }, globals: { ...globals.browser, }, }, - plugins: { - // @ts-expect-error - '@stylistic/js': stylisticJs, - // @ts-expect-error - '@typescript-eslint': tseslint.plugin, - // @ts-expect-error - import: pluginImport, - node: pluginNode, - }, - rules: { - ...javascriptRules, - ...typescriptRules, - ...importRules, - ...nodeRules, - ...stylisticRules, + // @ts-expect-error + plugins: jsPlugins, + rules: jsRules, + }, + { + name: 'tanstack/vue', + files: VUE_GLOB_INCLUDE, + languageOptions: { + parser: vueparser, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020, + parser: tseslint.parser, + project: true, + extraFileExtensions: ['.vue'], + }, + globals: { + ...globals.browser, + }, }, + // @ts-expect-error + plugins: jsPlugins, + rules: jsRules, }, ] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 807e1d2..70bdd3c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -154,6 +154,9 @@ importers: vite-tsconfig-paths: specifier: ^5.1.4 version: 5.1.4(typescript@5.7.2)(vite@5.4.11(@types/node@22.10.1)) + vue-eslint-parser: + specifier: ^9.4.3 + version: 9.4.3(eslint@9.17.0) devDependencies: '@types/current-git-branch': specifier: ^1.1.6 @@ -1324,6 +1327,10 @@ packages: peerDependencies: eslint: '>=8.23.0' + eslint-scope@7.2.2: + resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.2.0: resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1350,6 +1357,10 @@ packages: resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + espree@9.6.1: + resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} @@ -2561,6 +2572,12 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} + vue-eslint-parser@9.4.3: + resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} + engines: {node: ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '>=6.0.0' + vue-tsc@2.0.29: resolution: {integrity: sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q==} hasBin: true @@ -3856,6 +3873,11 @@ snapshots: minimatch: 9.0.5 semver: 7.6.3 + eslint-scope@7.2.2: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + eslint-scope@8.2.0: dependencies: esrecurse: 4.3.0 @@ -3910,6 +3932,12 @@ snapshots: acorn-jsx: 5.3.2(acorn@8.14.0) eslint-visitor-keys: 4.2.0 + espree@9.6.1: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 3.4.3 + esprima@4.0.1: {} esquery@1.6.0: @@ -5071,6 +5099,19 @@ snapshots: vscode-uri@3.0.8: {} + vue-eslint-parser@9.4.3(eslint@9.17.0): + dependencies: + debug: 4.3.7 + eslint: 9.17.0 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.6.0 + lodash: 4.17.21 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + vue-tsc@2.0.29(typescript@5.7.2): dependencies: '@volar/typescript': 2.4.10