diff --git a/packages/config/package.json b/packages/config/package.json index 541128d..88c9741 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -75,6 +75,7 @@ "rollup-plugin-preserve-directives": "^0.4.0", "semver": "^7.6.3", "simple-git": "^3.27.0", + "svelte-eslint-parser": "^0.43.0", "typedoc": "^0.27.5", "typedoc-plugin-frontmatter": "^1.1.2", "typedoc-plugin-markdown": "^4.3.3", @@ -82,7 +83,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..9d1fea1 100644 --- a/packages/config/src/eslint/index.js +++ b/packages/config/src/eslint/index.js @@ -1,4 +1,6 @@ import tseslint from 'typescript-eslint' +import vueparser from 'vue-eslint-parser' +import svelteparser from 'svelte-eslint-parser' import stylisticJs from '@stylistic/eslint-plugin-js' import pluginImport from 'eslint-plugin-import-x' import pluginNode from 'eslint-plugin-n' @@ -9,7 +11,9 @@ 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 SVELTE_GLOB_INCLUDE = ['**/*.svelte', '*.svelte'] const GLOB_EXCLUDE = [ '**/.nx/**', @@ -21,6 +25,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 +48,7 @@ export const tanstackConfig = [ }, { name: 'tanstack/setup', - files: GLOB_INCLUDE, + files: JS_GLOB_INCLUDE, languageOptions: { sourceType: 'module', ecmaVersion: 2020, @@ -37,28 +56,54 @@ 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, + // @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, + }, }, - rules: { - ...javascriptRules, - ...typescriptRules, - ...importRules, - ...nodeRules, - ...stylisticRules, + // @ts-expect-error + plugins: jsPlugins, + rules: jsRules, + }, + { + name: 'tanstack/svelte', + files: SVELTE_GLOB_INCLUDE, + languageOptions: { + parser: svelteparser, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020, + parser: tseslint.parser, + project: true, + extraFileExtensions: ['.svelte'], + }, + globals: { + ...globals.browser, + }, }, + // @ts-expect-error + plugins: jsPlugins, + rules: jsRules, }, ] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 807e1d2..2a40bbb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,6 +130,9 @@ importers: simple-git: specifier: ^3.27.0 version: 3.27.0 + svelte-eslint-parser: + specifier: ^0.43.0 + version: 0.43.0 typedoc: specifier: ^0.27.5 version: 0.27.5(typescript@5.7.2) @@ -154,6 +157,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 +1330,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 +1360,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'} @@ -2045,6 +2059,12 @@ packages: pkg-types@1.2.1: resolution: {integrity: sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==} + postcss-scss@4.0.9: + resolution: {integrity: sha512-AjKOeiwAitL/MXxQW2DliT28EKukvvbEWx3LBmJIRN8KfBGZbRTxNYW0kSqi1COiTZ57nZ9NW06S6ux//N1c9A==} + engines: {node: '>=12.0'} + peerDependencies: + postcss: ^8.4.29 + postcss@8.4.49: resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==} engines: {node: ^10 || ^12 || >=14} @@ -2312,6 +2332,15 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + svelte-eslint-parser@0.43.0: + resolution: {integrity: sha512-GpU52uPKKcVnh8tKN5P4UZpJ/fUDndmq7wfsvoVXsyP+aY0anol7Yqo01fyrlaWGMFfm4av5DyrjlaXdLRJvGA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + svelte: ^3.37.0 || ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + svelte: + optional: true + symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} @@ -2561,6 +2590,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 +3891,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 +3950,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: @@ -4609,6 +4655,10 @@ snapshots: mlly: 1.7.3 pathe: 1.1.2 + postcss-scss@4.0.9(postcss@8.4.49): + dependencies: + postcss: 8.4.49 + postcss@8.4.49: dependencies: nanoid: 3.3.8 @@ -4845,6 +4895,14 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + svelte-eslint-parser@0.43.0: + dependencies: + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + postcss: 8.4.49 + postcss-scss: 4.0.9(postcss@8.4.49) + symbol-tree@3.2.4: {} tapable@2.2.1: {} @@ -5071,6 +5129,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