1
votes

I created a vue-cli project and turned on linting, which is great. But it extends rules from airbnb-base, then @vue/airbnb, then various vue configs, then our custom rules.

Is there a command line command to display the final extended rule or rules?

What I've Tried: If it's in the documentation for vue-cli or @vue/cli-plugin-eslint, I'm missing it. The docs at [eslint](https://eslint.org/docs/user-guide/command-line-interface make it look like I should be able to use eslint --print-config file.js but eslint, 'vue-cli-service lint, and vue lint are unknown commands or commands not found.

2

2 Answers

2
votes

This seemed to work for me today. I was getting an error on 'vue/require-v-for-key' and a second error when I defined a key and did not use the key. So, I attempted to disable ESLint entirely. This was not well documented in ESLint config use of environment globals.

I added a comment in my vue cli 3 installed main.js to define the environment for my app.

main.js

/* eslint-env node */

When installing my project, I told Vue to install config in separate .js files so vue cli created .eslintrc.js instead of storing the config in package.json. I changed the env setting in that file from true to false.

.eslintrc.js

module.exports = {
  root: true,
  env: {
    node: false
},

Important!! I had to restart my local dev server (npm run serve) command to get it to take the new .eslintrc.js settings.

You can also disable a single rule using the rules section of the eslintrc.js file. Don't forget to restart you dev server after editing.

.eslintrc.js

'vue/require-v-for-key' : 'off'
1
votes

I just had the same problem and was trying to understand the final merged configuration after extending all those separate configurations.

It turns out eslint --print-config .eslintrc.js (or whatever your config file is named) works as expected.

Only problem you might have encountered is, that you don't have eslint installed globally with npm, so you need to either install it or run it like this npx eslint --print-config .\.eslintrc.js. npx is a tool that comes with npm to run local or not installed scripts from packages directly.