Skip to content

Commit 94e3081

Browse files
authored
feat: add Vue template support (#190)
1 parent ba37e6c commit 94e3081

File tree

3 files changed

+84
-19
lines changed

3 files changed

+84
-19
lines changed

packages/config/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"v8flags": "^4.0.1",
8383
"vite-plugin-dts": "4.0.3",
8484
"vite-plugin-externalize-deps": "^0.8.0",
85-
"vite-tsconfig-paths": "^5.1.4"
85+
"vite-tsconfig-paths": "^5.1.4",
86+
"vue-eslint-parser": "^9.4.3"
8687
},
8788
"devDependencies": {
8889
"@types/current-git-branch": "^1.1.6",
Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import tseslint from 'typescript-eslint'
2+
import vueparser from 'vue-eslint-parser'
23
import stylisticJs from '@stylistic/eslint-plugin-js'
34
import pluginImport from 'eslint-plugin-import-x'
45
import pluginNode from 'eslint-plugin-n'
@@ -9,7 +10,8 @@ import { typescriptRules } from './typescript.js'
910
import { nodeRules } from './node.js'
1011
import { stylisticRules } from './stylistic.js'
1112

12-
const GLOB_INCLUDE = ['**/*.{js,svelte,ts,tsx,vue}']
13+
const JS_GLOB_INCLUDE = ['**/*.{js,ts,tsx}']
14+
const VUE_GLOB_INCLUDE = ['**/*.vue']
1315

1416
const GLOB_EXCLUDE = [
1517
'**/.nx/**',
@@ -21,6 +23,21 @@ const GLOB_EXCLUDE = [
2123
'**/vite.config.*.timestamp-*.*',
2224
]
2325

26+
const jsRules = {
27+
...javascriptRules,
28+
...typescriptRules,
29+
...importRules,
30+
...nodeRules,
31+
...stylisticRules,
32+
}
33+
34+
const jsPlugins = {
35+
'@stylistic/js': stylisticJs,
36+
'@typescript-eslint': tseslint.plugin,
37+
import: pluginImport,
38+
node: pluginNode,
39+
}
40+
2441
/** @type {import('eslint').Linter.Config[]} */
2542
export const tanstackConfig = [
2643
{
@@ -29,36 +46,42 @@ export const tanstackConfig = [
2946
},
3047
{
3148
name: 'tanstack/setup',
32-
files: GLOB_INCLUDE,
49+
files: JS_GLOB_INCLUDE,
3350
languageOptions: {
3451
sourceType: 'module',
3552
ecmaVersion: 2020,
3653
// @ts-expect-error
3754
parser: tseslint.parser,
3855
parserOptions: {
3956
project: true,
40-
extraFileExtensions: ['.svelte', '.vue'],
4157
parser: tseslint.parser,
4258
},
4359
globals: {
4460
...globals.browser,
4561
},
4662
},
47-
plugins: {
48-
// @ts-expect-error
49-
'@stylistic/js': stylisticJs,
50-
// @ts-expect-error
51-
'@typescript-eslint': tseslint.plugin,
52-
// @ts-expect-error
53-
import: pluginImport,
54-
node: pluginNode,
55-
},
56-
rules: {
57-
...javascriptRules,
58-
...typescriptRules,
59-
...importRules,
60-
...nodeRules,
61-
...stylisticRules,
63+
// @ts-expect-error
64+
plugins: jsPlugins,
65+
rules: jsRules,
66+
},
67+
{
68+
name: 'tanstack/vue',
69+
files: VUE_GLOB_INCLUDE,
70+
languageOptions: {
71+
parser: vueparser,
72+
parserOptions: {
73+
sourceType: 'module',
74+
ecmaVersion: 2020,
75+
parser: tseslint.parser,
76+
project: true,
77+
extraFileExtensions: ['.vue'],
78+
},
79+
globals: {
80+
...globals.browser,
81+
},
6282
},
83+
// @ts-expect-error
84+
plugins: jsPlugins,
85+
rules: jsRules,
6386
},
6487
]

pnpm-lock.yaml

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)