diff --git a/README.md b/README.md index f4a2934d0c..4ee27d3322 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ - Auto fix for formatting (aimed to be used standalone **without** Prettier) - Sorted imports, dangling commas - Reasonable defaults, best practices, only one line of config -- Designed to work with TypeScript, JSX, Vue out-of-box +- Designed to work with TypeScript, JSX, Vue 2 & 3 out-of-box - Lints also for json, yaml, toml, markdown - Opinionated, but [very customizable](#customization) - [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily! @@ -356,6 +356,19 @@ export default antfu({ }) ``` +### Vue version + +The default Vue version is 3, if you're using Vue 2: + +```js +// eslint.config.js +import antfu from '@antfu/eslint-config' + +export default antfu({ + vue: { version: 2 }, +}) +``` + ### Pipeline Since v2.10.0, the factory function `antfu()` returns a [pipeline object from `eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils#pipe) where you can chain the methods to compose the config even more flexibly. diff --git a/src/configs/vue.ts b/src/configs/vue.ts index c24c340965..80a292b4fa 100644 --- a/src/configs/vue.ts +++ b/src/configs/vue.ts @@ -10,7 +10,7 @@ export async function vue( files = [GLOB_VUE], overrides = {}, stylistic = true, - vueVersion = 3, + version = 3, } = options const sfcBlocks = options.sfcBlocks === true @@ -90,7 +90,7 @@ export async function vue( rules: { ...pluginVue.configs.base.rules as any, - ...vueVersion === 2 + ...version === 2 ? { ...pluginVue.configs.essential.rules as any, ...pluginVue.configs['strongly-recommended'].rules as any, diff --git a/src/types.ts b/src/types.ts index fc2cedd12b..219a17a0dc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -51,7 +51,7 @@ export interface OptionsVue extends OptionsOverrides { * * @default 3 */ - vueVersion?: 2 | 3 + version?: 2 | 3 } export type OptionsTypescript =