Skip to content

Commit

Permalink
feat: vue2 support (#351)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
GerryWilko and antfu committed Dec 7, 2023
1 parent c45970b commit b1a37f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/configs/vue.ts
Expand Up @@ -10,6 +10,7 @@ export async function vue(
files = [GLOB_VUE],
overrides = {},
stylistic = true,
vueVersion = 3,
} = options

const sfcBlocks = options.sfcBlocks === true
Expand Down Expand Up @@ -68,9 +69,18 @@ export async function vue(
]),
rules: {
...pluginVue.configs.base.rules as any,
...pluginVue.configs['vue3-essential'].rules as any,
...pluginVue.configs['vue3-strongly-recommended'].rules as any,
...pluginVue.configs['vue3-recommended'].rules as any,

...vueVersion === 2
? {
...pluginVue.configs['vue-essential'].rules as any,
...pluginVue.configs['vue-strongly-recommended'].rules as any,
...pluginVue.configs['vue-recommended'].rules as any,
}
: {
...pluginVue.configs['vue3-essential'].rules as any,
...pluginVue.configs['vue3-strongly-recommended'].rules as any,
...pluginVue.configs['vue3-recommended'].rules as any,
},

'node/prefer-global/process': 'off',

Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Expand Up @@ -87,6 +87,13 @@ export interface OptionsVue {
* @default true
*/
sfcBlocks?: boolean | VueBlocksOptions

/**
* Vue version. Apply different rules set from `eslint-plugin-vue`.
*
* @default 3
*/
vueVersion?: 2 | 3
}

export interface OptionsFormatters {
Expand Down

0 comments on commit b1a37f9

Please sign in to comment.