How to disable ESLint in vue-cli?

151,082

Solution 1

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 2

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 3

As of 2019, March :

In the vue.config.js :

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

Solution 4

in package.json change the build step:

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

Solution 5

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

useEslint: false, 

in config/index.js

Share:
151,082

Related videos on Youtube

Mahmud Adam
Author by

Mahmud Adam

Updated on July 08, 2022

Comments

  • Mahmud Adam
    Mahmud Adam almost 2 years

    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?

    • Himmet Avsar
      Himmet Avsar over 7 years
      Which template are you using? Simple webpack?
    • Mahmud Adam
      Mahmud Adam over 7 years
      full-featured Webpack
    • ceejayoz
      ceejayoz over 7 years
      Look at the {{#lint}} blocks in github.com/vuejs-templates/webpack/blob/… - can probably drop the entire preLoaders block?
    • ceejayoz
      ceejayoz over 7 years
      @HectorLorenzo Moved it.
  • Bill Criswell
    Bill Criswell over 7 years
    Also, a cheap fix in case OP wants to easily enable and disable it is to add paths to the .eslintignore file.
  • Asqan
    Asqan about 7 years
    src/*.js didn't help to disable eslint for src file ... may be needed to take some extra steps? @BillCriswell
  • Karl Pokus
    Karl Pokus about 7 years
    Yup. Blocking out this part works.
  • antoine
    antoine almost 7 years
    @Asqan you might want to use src/**/*.js and src/**/*.vue to ignore files recursively
  • Mathews Sunny
    Mathews Sunny over 5 years
    Add some description
  • sznowicki
    sznowicki over 4 years
    Of course it's not working since root only tells ESLint that all the rules from parent folder should be dismissed.
  • Anthony Kal
    Anthony Kal over 4 years
    you will need to do npm run dev again after doing changes to config
  • db2
    db2 over 4 years
    Since the original question is 3 years old, this should definitely be marked as the correct answer.
  • sudoqux
    sudoqux over 4 years
    This works well if you want your IDE to handle linting based on .eslintrc.js, but have linting disabled when using the dev or watch npm-scripts.
  • Robin Nelson
    Robin Nelson over 4 years
    I'm assuming this is how to disable before using the "vue create..." command? How do we disable eslint after creating a project?
  • Marius
    Marius almost 4 years
    npm remove is better. cli.vuejs.org/config/#pages says This value is respected only when @vue/cli-plugin-eslint is installed.
  • Rocky Kev
    Rocky Kev over 3 years
    This works! Answers prior to 2020 want you to add configs to files that no longer are part of the vue-cli template.
  • Sam
    Sam over 3 years
    This works great, just note that if you pass in other arguments, you'll need to do this first. Example: vue-cli-service --skip-plugins @vue/cli-plugin-eslint electron:build
  • Simon
    Simon over 3 years
    no, that stops eslint running in webstorm — I don't get red squiggles.
  • AmirRezaM75
    AmirRezaM75 over 3 years
    you can comment parser property in parserOptions
  • TetraDev
    TetraDev over 3 years
    This is only correct if you want to fully remove linting. If you just want to removing linting "ON SAVE" then use the solution provided by Aakass hand Radbyx.
  • Amir Asyraf
    Amir Asyraf about 3 years
    setEslint or useEslint?
  • W. Murphy
    W. Murphy almost 3 years
    Despite the name, this setting really does disable lintOnBuild. Unlike other answer of uninstalling the cli plugin, this answer lets you still use the vue-cli-service lint command when you want it.
  • Ashwani Garg
    Ashwani Garg over 2 years
    Solution works and prevents from unnecessary stress
  • itinance
    itinance over 2 years
    Thanks a lot! I am back to work and can finally focus on programming instead of removing helpful spaces and empty lines :)
  • light24bulbs
    light24bulbs over 2 years
    This didn't work for me, and this option is no longer documented in the vue cli docs. What did work for me was simply deleting the @vue/cli-plugin-eslint module from my project
  • trusktr
    trusktr over 2 years
    I removed @vue/cli-plugin-eslint and now the command vue-cli-service serve says Error: Cannot find module '@vue/cli-plugin-eslint'. What else is needed?