Install the required dependencies

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

  1. Create the .eslintrc.js file in your project root.

  2. 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',
      },
    };
    

Automatic lint

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.

Fixing silly issues

If after completing the process, ESLint is bothering you with nonsense issues, please restart your code editor and try again.