Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1606bae

Browse filesBrowse files
committed
Change legacy base config so that vue-eslint-parser is only used for .vue (#2668)
1 parent dceee34 commit 1606bae
Copy full SHA for 1606bae

File tree

3 files changed

+17
-8
lines changed
Filter options

3 files changed

+17
-8
lines changed

‎docs/user-guide/index.md

Copy file name to clipboardExpand all lines: docs/user-guide/index.md
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,12 @@ If you have issues with these, please also refer to the [FAQ](#does-not-work-wel
154154

155155
### Running ESLint from the command line
156156

157-
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.
157+
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.
158158

159159
Examples:
160160

161161
```bash
162-
eslint --ext .js,.vue src
163-
eslint "src/**/*.{js,vue}"
162+
eslint src
164163
```
165164

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

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

396-
- 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.
395+
- Make sure you are using the shareable config provided by `eslint-plugin-vue`.
397396
- If you are having issues with configuring editor, please read [editor integrations](#editor-integrations)
398397

399398
### Conflict with [Prettier]

‎lib/configs/base.js

Copy file name to clipboardExpand all lines: lib/configs/base.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* in order to update its content execute "npm run update"
55
*/
66
module.exports = {
7-
parser: require.resolve('vue-eslint-parser'),
87
parserOptions: {
98
ecmaVersion: 2020,
109
sourceType: 'module'
@@ -17,5 +16,11 @@ module.exports = {
1716
rules: {
1817
'vue/comment-directive': 'error',
1918
'vue/jsx-uses-vars': 'error'
20-
}
19+
},
20+
overrides: [
21+
{
22+
files: '*.vue',
23+
parser: require.resolve('vue-eslint-parser')
24+
}
25+
]
2126
}

‎tools/update-lib-configs.js

Copy file name to clipboardExpand all lines: tools/update-lib-configs.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function formatCategory(category) {
5656
* in order to update its content execute "npm run update"
5757
*/
5858
module.exports = {
59-
parser: require.resolve('vue-eslint-parser'),
6059
parserOptions: {
6160
ecmaVersion: 2020,
6261
sourceType: 'module'
@@ -68,7 +67,13 @@ module.exports = {
6867
plugins: [
6968
'vue'
7069
],
71-
rules: ${formatRules(category.rules, category.categoryId)}
70+
rules: ${formatRules(category.rules, category.categoryId)},
71+
overrides: [
72+
{
73+
files: '*.vue',
74+
parser: require.resolve('vue-eslint-parser')
75+
}
76+
]
7277
}
7378
`
7479
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.