Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: rename vue.vueVersion to vue.version, and explain how to configure the Vue version in the document #445

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function vue(
files = [GLOB_VUE],
overrides = {},
stylistic = true,
vueVersion = 3,
version = 3,
} = options

const sfcBlocks = options.sfcBlocks === true
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface OptionsVue extends OptionsOverrides {
*
* @default 3
*/
vueVersion?: 2 | 3
version?: 2 | 3
}

export type OptionsTypescript =
Expand Down
Loading