-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Fix documentation on default linted files #6199
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
Conversation
The documentation mentions all files in the `src` and `tests` directories are linted by default. Upon inspection of the [sourcecode](https://github.com/vuejs/vue-cli/blob/3eaef4d388c52ea1d698991e7e96497164f90a04/packages/%40vue/cli-plugin-eslint/lint.js#L55) however, it seems that also Javascript files in the root directory are being linted by default. I stumbled upon this when trying to figure out why my `.eslintrc.js` file itself was being linted by running `vue-cli-service lint` without passing any args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.*.js
like .eslintrc.js
will be linted only if there is no .eslintignore
in project according to
if (!fs.existsSync(api.resolve('.eslintignore')) && !config.ignorePattern) { |
If .eslintignore
exists and we want to lint .eslintrc.js
, !.*.js
should be added to .eslintignore
I wasn't aware dot-files were not being linted by default by ESLint. I also wasn't aware that the default behaviour of Perhaps it's best to mention both behaviours then? Something along the lines of:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer not to describe the default behavior of ESlint, which may change. ESlint@7 no longer ignores .eslintrc.js
,
:::tip
`vue-cli-service lint` will lint dotfiles `.*.js` by default. If you want to follow ESLint's default behavior instead, consider adding a `.eslintignore` file in your project.
:::
Add a tip to make users aware of `@vue/cli-plugin-eslint` overriding default ESLint behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information:
The documentation mentions all files in the
src
andtests
directories are linted by default. Upon inspection of the sourcecode however, it seems that also Javascript files in the root directory are being linted by default.I stumbled upon this when trying to figure out why my
.eslintrc.js
file itself was being linted by runningvue-cli-service lint
without passing any args.