How to disable ESLint in vue-cli?

JavascriptWebpackvue.jsVue Cli

Javascript Problem Overview


How do I go about disabling ESlint in project generated with vue-cli?

preLoaders: [
  {
    test: /\.vue$/,
    loader: 'eslint',
    include: projectRoot,
    exclude: /node_modules/
  },
  {
    test: /\.js$/,
    loader: 'eslint',
    include: projectRoot,
    exclude: /node_modules/
  }
]

If I remove the loader: 'eslint' line it won't compile, same with setting it to an empty string. I know I can opt out of ESLint during the initialization phase, but how can I disable it after my project has been created?

Javascript Solutions


Solution 1 - Javascript

There are some out-of-date answers here.

Because vue-cli 3 is using a zero configuration approach, the way to disable it is to just uninstall the module:

npm remove @vue/cli-plugin-eslint

Solution 2 - Javascript

As of 2019, March :

In the vue.config.js :

module.exports = {
  ...
  lintOnSave: false
  ...
}

Solution 3 - Javascript

in package.json change the build step:

...
"scripts": {
    "build": "vue-cli-service build --skip-plugins @vue/cli-plugin-eslint",
    ...
},

Solution 4 - Javascript

As of the current version (^3.0?) you can just set:

useEslint: false, 

in config/index.js

Solution 5 - Javascript

Vue's starter projects are themselves built with a templating language.

Looking at the templates (the {{#lint}} bits) it appears you can remove the entire preLoaders block.

Solution 6 - Javascript

In the latest version, open the ".eslintrc.js" file, and set "root: false".enter image description here

Solution 7 - Javascript

There's a hell lot of solutions here: https://github.com/vuejs-templates/webpack/issues/73

However the best one is :
To add a line of **/* to .eslintignore, which will ignore all files. And then re-run, if it's a web app!

Solution 8 - Javascript

One of the most simple way is just setting an .eslintignore file with you want to disabled folders & files.

> demo

/build/
/config/
/dist/
/*.js
/test/unit/coverage/

/000-xyz/

Ref: https://github.com/vuejs-templates/webpack/issues/73#issuecomment-355149342

Solution 9 - Javascript

At first you need to create a file name of

> vue.config.js

then write bellow line

module.exports = {
  ...
  lintOnSave: false
  ...
}

This process worked for me. Thanks

Solution 10 - Javascript

Go inside file "tslint.json" and exclude all files in linterOptions. Default settings only excludes folder node_modules. You may also set "strict": false, inside tsconfig.json

  "linterOptions": {
    "exclude": [
      "*/**"
    ]
  },

instead of

  "linterOptions": {
    "exclude": [
      "node_modules/**"
    ]
  },

Solution 11 - Javascript

For Vue cli v4 and project created with eslint feature selected, there's a eslintConfig property in package.json:

"eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },

extends specifies some rule presets and default is plugin:vue/vue3-essential and eslint:recommended. Common rules like unused variables or unused imports are in eslint:recommended. If you want to disable such rules, just remove eslint:recommended in eslintConfig and restart the project, but don't remove plugin:vue/vue3-essential otherwise linter will not be able to recognise .vue files.

Solution 12 - Javascript

Set useEslint: false, in config/index.js

see this image

Solution 13 - Javascript

setEslint: false work for me!

module.exports = {
  dev: {
     ...
    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: false,
    ...
  },
}

Solution 14 - Javascript

Go to .eslintrc.js and add this:

dev: {
   useEslint: false
},

Solution 15 - Javascript

For vue3 users, just comment out the parserOptions in the eslintrc.js file. it works for me cos sometimes linting can become frustrating

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/vue3-essential',
    'eslint:recommended'
  ],
  // parserOptions: {
  //   parser: 'babel-eslint'
  // },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
  }
}

Solution 16 - Javascript

in vueCli go to package json remove eslint from dependencies at end your package json must like this

{
  "name": "vuecompesation",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"

  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "babel-eslint": "^10.1.0"
  
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

Solution 17 - Javascript

This should work

in vue.config.js add this

module.exports = {
    lintOnSave: false
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMahmud AdamView Question on Stackoverflow
Solution 1 - JavascriptWossnameView Answer on Stackoverflow
Solution 2 - JavascriptAakashView Answer on Stackoverflow
Solution 3 - JavascriptsfuerteView Answer on Stackoverflow
Solution 4 - JavascriptEric GrotkeView Answer on Stackoverflow
Solution 5 - JavascriptceejayozView Answer on Stackoverflow
Solution 6 - JavascriptFelix JrView Answer on Stackoverflow
Solution 7 - Javascriptreverie_ssView Answer on Stackoverflow
Solution 8 - JavascriptxgqfrmsView Answer on Stackoverflow
Solution 9 - JavascriptEahiyaView Answer on Stackoverflow
Solution 10 - JavascriptPanayiotis HiripisView Answer on Stackoverflow
Solution 11 - JavascriptCDTView Answer on Stackoverflow
Solution 12 - JavascriptSantosh PView Answer on Stackoverflow
Solution 13 - JavascriptZWHmepsyView Answer on Stackoverflow
Solution 14 - JavascriptNick VasilakopoulosView Answer on Stackoverflow
Solution 15 - Javascripti-wizardView Answer on Stackoverflow
Solution 16 - Javascriptkiarash shamaiiView Answer on Stackoverflow
Solution 17 - JavascriptMD SHAYONView Answer on Stackoverflow