npm install --save-dev babel-eslint [email protected] eslint-config-airbnb-base eslint-plugin-import eslint-plugin-vue @vue/[email protected] @vue/cli-plugin-eslint
Create the .eslintrc.js file in your project root.
Add the following code:
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
'@vue/airbnb',
],
parserOptions: {
parser: 'babel-eslint',
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
},
};
Add the following script to your package.json scripts section.
"scripts": {
...
"lint": "vue-cli-service lint ./dev ./src"
}
You can execute npm run lint to automatically fix lint issues inside your src and dev directories.
If after completing the process, ESLint is bothering you with nonsense issues, please restart your code editor and try again.