Skip to content

Commit

Permalink
feat: add Vue template support (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn authored Dec 23, 2024
1 parent ba37e6c commit 94e3081
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 19 deletions.
3 changes: 2 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
59 changes: 41 additions & 18 deletions packages/config/src/eslint/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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/**',
Expand All @@ -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 = [
{
Expand All @@ -29,36 +46,42 @@ export const tanstackConfig = [
},
{
name: 'tanstack/setup',
files: GLOB_INCLUDE,
files: JS_GLOB_INCLUDE,
languageOptions: {
sourceType: 'module',
ecmaVersion: 2020,
// @ts-expect-error
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,
},
]
41 changes: 41 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 94e3081

Please sign in to comment.