Skip to content

Change legacy base config so that vue-eslint-parser is only used for .vue #2668

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

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 3 additions & 4 deletions docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,12 @@ If you have issues with these, please also refer to the [FAQ](#does-not-work-wel

### Running ESLint from the command line

If you want to run `eslint` from the command line, make sure you include the `.vue` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-target-files-to-lint) or a glob pattern, because ESLint targets only `.js` files by default.
If you want to run `eslint` from the command line, ESLint will automatically check for the `.vue` extension if you use the config provided by the plugin.

Examples:

```bash
eslint --ext .js,.vue src
eslint "src/**/*.{js,vue}"
eslint src
```

::: tip
Expand Down Expand Up @@ -393,7 +392,7 @@ See also: "[How to use a custom parser?](#how-to-use-a-custom-parser)" section.

1. Make sure your tool is set to lint `.vue` files.

- CLI targets only `.js` files by default. You have to specify additional extensions with the `--ext` option or glob patterns. E.g. `eslint "src/**/*.{js,vue}"` or `eslint src --ext .vue`. If you use `@vue/cli-plugin-eslint` and the `vue-cli-service lint` command - you don't have to worry about it.
- Make sure you are using the shareable config provided by `eslint-plugin-vue`.
- If you are having issues with configuring editor, please read [editor integrations](#editor-integrations)

### Conflict with [Prettier]
Expand Down
9 changes: 7 additions & 2 deletions lib/configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* in order to update its content execute "npm run update"
*/
module.exports = {
parser: require.resolve('vue-eslint-parser'),
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
Expand All @@ -17,5 +16,11 @@ module.exports = {
rules: {
'vue/comment-directive': 'error',
'vue/jsx-uses-vars': 'error'
}
},
overrides: [
{
files: '*.vue',
parser: require.resolve('vue-eslint-parser')
}
]
}
Loading