Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to turn off ESLint? #73

Closed
SystemZ opened this issue Apr 8, 2016 · 41 comments
Closed

How to turn off ESLint? #73

SystemZ opened this issue Apr 8, 2016 · 41 comments

Comments

@SystemZ
Copy link

@SystemZ SystemZ commented Apr 8, 2016

Hello, I just need to sketch simple app, debugging style errors are more time consuming than I can afford.
Is there any switch to turn it off temporarily? It's nice feature but not when you have only few minutes to make something :)

@SystemZ

This comment has been minimized.

Copy link
Author

@SystemZ SystemZ commented Apr 8, 2016

Commenting out this block in build/webpack.base.conf.js seems to work. It there any other way?

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

This comment has been minimized.

Copy link
Contributor

@chrisvfritz chrisvfritz commented Apr 8, 2016

@SystemZ That's what I would do. 🙂 We're planning on eventually making features such as linting optional when generating a new project, so that should help in the future!

@chrisvfritz chrisvfritz closed this Apr 8, 2016
@petervojtek

This comment has been minimized.

Copy link

@petervojtek petervojtek commented Feb 23, 2017

in vue 2.8.1 there is no preLoaders section in build/webpack.base.conf.js, I had to remove this content to get rid of eslint terror:

      {
        test: /\.(js|vue)$/,
        loader: 'eslint-loader',
        enforce: "pre",
        include: [resolve('src'), resolve('test')],
        options: {
          formatter: require('eslint-friendly-formatter')
        }
      },
@eric-burel

This comment has been minimized.

Copy link

@eric-burel eric-burel commented Jun 14, 2017

Shouldn't eslint linting on build be turned off by default ?
Not because it's a bad idea, but because eslint is still too buggy and hard to integrate to a text-editor, especially when working with other 3rd party solutions like Flow (some packages are not found etc.).

I don't want to be unable to launch the app in develop mode because my Atom linting package just updated with a minor bug and my code is indentend with 4 spaces instead of 2...

@sschadwick

This comment has been minimized.

Copy link

@sschadwick sschadwick commented Jun 19, 2017

I don't want to be unable to launch the app in develop mode because my Atom linting package just updated with a minor bug and my code is indentend with 4 spaces instead of 2...

I second this. Would love to see more control over eslint. I hate when vue crashes in dev because I forgot a semicolon, however this would be acceptable (if not desired) behavior when building for production.

@YavorK

This comment has been minimized.

Copy link

@YavorK YavorK commented Jul 5, 2017

This is how to stop it in current Nuxt.js. A bit offtopic but was searching and google and the only thing I found was this thread. Hope it helps someone other searching for the same.
see extend()
image

@veratechnz

This comment has been minimized.

Copy link

@veratechnz veratechnz commented Aug 3, 2017

I trawled Google and eslint docs & established this eslint options setup. Place it in your .eslint.js file within the vue project root dir.

Man, that tab and space restriction is brutal.....

'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
"no-mixed-spaces-and-tabs": [0],
"no-tabs": 0,
"skipBlankLines": 0,
"ignoreComments": 0,
"no-trailing-spaces": [2, { "skipBlankLines": true }]

The Road To Customization:

1. List of eslint rules and how to turn them off:
Link Here
Using the link above to apply new settings on the rootDir/.eslint.js file should meet most of your needs.

2. Single file comments inside your javascript syntax to modify eslint config/behaviour (Didn't try but was within the eslint docs and looks handy):
At the top of one of your js files place this comment to say........ turn of undefined variable linting:
/* eslint no-undef: 0 */
also a scoped format:

/* eslint-disable no-alert, no-console */

alert('foo');
console.log('bar');

/* eslint-enable no-alert */

This was sourced from: Link Here

3. Ignore files via eslintignore:
You can simply ignore entire files or dir's from linting. Not ideal on those late night benders ;)

build/*.js
config/*.js
build/*
// The line below means to include this one file in eslint from the above instruction to ignore the entire dir: 
!build/index.js

4. Possible helpful info at eslint
General Config Info
List of Rules

I am using es6 imports and have lots of variables and functions that are declared on one file then invoked on another. Was thinking of applying eslint to the bundled app.js file only, but didn't get that far. If anyone can help or has gone a similar route, would be great to hear from you.

@samayo

This comment has been minimized.

Copy link

@samayo samayo commented Aug 24, 2017

ESLINT is the worst thing to have ever happened since WW2, I think there should be an option to wipe it out entirely. I spent more time counting spaces and tabs than coding. Peter's answer finally did the trick.

@Frondor

This comment has been minimized.

Copy link

@Frondor Frondor commented Aug 31, 2017

Eslint is fine, what really sucks here is the dumbass who came out with all these stupid rules, like no spaces before function parenthesis and trailing comas EVERYWHERE. FFS!

@jaxondu

This comment has been minimized.

Copy link

@jaxondu jaxondu commented Sep 5, 2017

One quick way is to add a line of "**/*" to .eslintignore. Which will ignore all files. Or "**/*.js" and "**/*.vue".

@snarlynarwhal

This comment has been minimized.

Copy link

@snarlynarwhal snarlynarwhal commented Sep 7, 2017

If I wanted to use CoffeeScript for some .vue files and JavaScript in others, can I somehow keep ESLint on, but have it ignore templates that use CoffeeScript?

@FrancescoMussi

This comment has been minimized.

Copy link

@FrancescoMussi FrancescoMussi commented Sep 18, 2017

-- So what do you do for living?
-- I count spaces, position parenthesis and check for trailing commas all day long

@gangsthub

This comment has been minimized.

Copy link

@gangsthub gangsthub commented Oct 9, 2017

Please use ESLINT. Edit the rules if you please. It's totally configurable. I also don't like some of them. And as @jaxondu commented, .eslintignore is your friend in case you need to add some third-party script or exclude some files...

@SmashedBird

This comment has been minimized.

Copy link

@SmashedBird SmashedBird commented Oct 23, 2017

@gangsthub ESLINT is totally useless; WAY TOO NITPEAKY. I spend my time adding spaces, making sure my lines are less than 100 characters long.... Removing it all together is the best thing to do.

@LinusBorg

This comment has been minimized.

Copy link
Contributor

@LinusBorg LinusBorg commented Oct 23, 2017

If you want it to be less nitpicky, create your own, smaller set of rules.

Writing code that doesnT follow a clear style is counterproductive in teams, it increases the cognitive load necessary to navigate other people's code.

If you work alone, that's not a big deal, but it's not good general advice

@veratechnz

This comment has been minimized.

Copy link

@veratechnz veratechnz commented Oct 23, 2017

Totally agree @LinusBorg

Just make an effort to modify and then work with lint. I think the vue cli is a nice platform to work off.

@gangsthub

This comment has been minimized.

Copy link

@gangsthub gangsthub commented Oct 25, 2017

Use ESLINT or use any other technique to format your code and keep it clean. But I disagree.

is totally useless

Sorry, sir, but, it ain't that way. ESLINT does its job. And you should keep your code clean. IMHO.

I agree with @LinusBorg.

@Frondor

This comment has been minimized.

Copy link

@Frondor Frondor commented Oct 25, 2017

You can always use some Style CI services to format the code for you and your team. So you don't waste tons of time linting, when you should be spending every second on coding.

Don't go full fanboy mode, please. Evangelism is counterproductive.

@janzheng

This comment has been minimized.

Copy link

@janzheng janzheng commented Jan 3, 2018

never used Vue before; using a tutorial but eslint crashes on <Template> which I assume is a basic Vue thing? Is it broken out of the box?

@LinusBorg

This comment has been minimized.

Copy link
Contributor

@LinusBorg LinusBorg commented Jan 3, 2018

No, not to my knowledge (I'm the main maintainer atm).

A bit more detail would be helpful. Could you open a fresh issue?

@janzheng

This comment has been minimized.

Copy link

@janzheng janzheng commented Jan 3, 2018

Ok thanks @LinusBorg, I'll play with it a bit more.

Since I'm just learning Vue, I decided "turned off" ESLint temporarily by adding an exception rule * to the .eslintignore file — figured this would be simplest "non-destructive" way of temporarily deactivating ESLint — so the file now looks like:

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

This comment has been minimized.

Copy link

@gnulnx gnulnx commented Jan 24, 2018

@janzheng Thank you!

I understand people wanting code to be formatted a certain way, but I'm kinda tired of 'others' alway's determining what that should be. My back end is in python and django and I'd like my JS formatted the same way as my python code as it's way less cognitive load to not see things formatted differently.

What I find strange is that I wasn't having any of these lint issues when I first started this project.. now today mysteriously every other line is barking about semicolons, or single quotes instead of double quotes or the number of spaces.. WTF? maddening to say the least. @janzheng method was exactly what I was looking for.

if I joined another team that had different styles I'd conform in a heartbeat, but on projects were it's just me I'd rather linting stay out of the way and let me write code how I want.

@PhilMDev

This comment has been minimized.

Copy link

@PhilMDev PhilMDev commented Feb 2, 2018

When using the latest version of vue-cli it appears the easiest way to handle this is in config/index.js. You'll see the following:

// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.

Default is true. Just set to false. BTW, I also dislike ESLint.

@shreeve

This comment has been minimized.

Copy link

@shreeve shreeve commented Mar 31, 2018

Here's a lame hack to eslint-plugin-vue that "skips over" coffeescript in *.vue files. This is clearly not a suggested approach, but perhaps we could eventually have a user configurable way to elide <script> tags with a lang such as "coffeescript".

https://github.com/vuejs/eslint-plugin-vue/pull/446/files

@anoop-ananthan

This comment has been minimized.

Copy link

@anoop-ananthan anoop-ananthan commented Jul 3, 2018

What is the big deal? Use if you want. Dont use if you don't want! Personally, I find it useful when team size is kind of more than 4 and each one working from different part of Globe.

@kyuubi09

This comment has been minimized.

Copy link

@kyuubi09 kyuubi09 commented Jul 12, 2018

Also there's one more way.....you can add the files which give error in your .eslintignore file in the project.
Like for all .vue files just add /*.vue.

@paparyku

This comment has been minimized.

Copy link

@paparyku paparyku commented Jul 19, 2018

my fix for the vue webpack

webpack.base.conf.js

comment out these lines
LINE 43: // ...(config.dev.useEslint ? [createLintingRule()] : []),

LINE (11 - 20):

// const createLintingRule = () => ({
//   test: /\.(js|vue)$/,
//   loader: 'eslint-loader',
//   enforce: 'pre',
//   include: [resolve('src'), resolve('test')],
//   options: {
//     formatter: require('eslint-friendly-formatter'),
//     emitWarning: !config.dev.showEslintErrorsInOverlay
//   }
// })
@RoelRoel

This comment has been minimized.

Copy link

@RoelRoel RoelRoel commented Jul 27, 2018

How to turn all the errors into warnings? I too want to keep my code clean, but some rules are made up by rediculous authistics and make coding in dev mode very impoductive.

@chriskasza

This comment has been minimized.

Copy link

@chriskasza chriskasza commented Jul 27, 2018

@RoelRoel you can override the severity of the rules in your .eslintrc.js file.

  rules: {
    'vue/max-attributes-per-line': 'warn'
  }

You just need to know the rule names you're overriding. If you're using the vue/essential style guide, the list of rules can be found here: https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/configs/essential.js.

@eovensehi

This comment has been minimized.

Copy link

@eovensehi eovensehi commented Oct 27, 2018

If vue-cli was used to initiate the project, go to config/index.js and change an attribute in the dev object;
useEslint: false,
Or In build/webpack.base.conf change rules in the module to stop using the createLintingRule function.
rules: [ ...(config.dev.useEslint ? [] : []), /* ...(config.dev.useEslint ? [createLintingRule()] : []),*/ { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }

@EdwinBetanc0urt

This comment has been minimized.

Copy link

@EdwinBetanc0urt EdwinBetanc0urt commented Nov 27, 2018

your_project/config/index.js

change the value of useEslint from true to false, from line 26, inside:


module.exports: {
    dev: {
        useEslint: false
    }
}

note: I use the vue webpack template, the version of the template is 1.3.1

@paulsimongb

This comment has been minimized.

Copy link

@paulsimongb paulsimongb commented Mar 20, 2019

Hi tried all of the above and it is still linting. Any other suggestions?

@paulsimongb

This comment has been minimized.

Copy link

@paulsimongb paulsimongb commented Mar 20, 2019

This finally seemed to do it
In .eslintrc.js at the top of the rules:{ section put in
'': 'off' ,
'*': 'off',

I won't be using esLint every. Its rules are in my view actually bad layout, and I don't have several days to spend changing the configuration.

@Mumbere7

This comment has been minimized.

Copy link

@Mumbere7 Mumbere7 commented Mar 21, 2019

I think eslint on it own has no issues but the rules are what turn people off as a vuejs dev we should just remove it completely from the boilerplate code Quick fix is inside
.eslintignore just add
*
At the bottom of the file

@xgqfrms

This comment has been minimized.

Copy link

@xgqfrms xgqfrms commented Jun 3, 2019

ESLint exclude not work at all?

vue-cli

    "eslintConfig": {
        "root": true,
        "env": {
            "node": true
        },
        "exclude":[
            "./000-xyz/*"
        ],
        "extends": [
            "plugin:vue/essential",
            "eslint:recommended"
        ],
        "rules": {},
        "parserOptions": {
            "parser": "babel-eslint"
        }
    },
@GoodGameHUSC

This comment has been minimized.

Copy link

@GoodGameHUSC GoodGameHUSC commented Jun 17, 2019

One quick way is to add a line of "**/*" to .eslintignore. Which will ignore all files. Or "**/*.js" and "**/*.vue".

Great ! That saved me.

@douglasg14b

This comment has been minimized.

Copy link

@douglasg14b douglasg14b commented Sep 13, 2019

I don't want to disable eslint entirely, I just don't want it in the build output. It's damn near impossible to find a build error as the build output overflows most build logs. Especially vue ui...

Can I disable it for the build output only?

@silent-human

This comment has been minimized.

Copy link

@silent-human silent-human commented Oct 15, 2019

The easiest way to work around eslint is to use // eslint-disable-next-line to ignore the next line of your code and/or
use /* eslint-disable */ to ignore all warnings in a file.

🟢 Place the comment/s in the script section of your Vue component/s or any JS file/s where you do not want linting to occur.

📌 The above special comments have been referenced from the hint provided by the Vue cli in the terminal. There is no need to touch any config file whatsoever.

I hope the above may help.

@douglasg14b

This comment has been minimized.

Copy link

@douglasg14b douglasg14b commented Oct 15, 2019

@silent-human The issue isn't necessarily that eslint is on, it's that it clogs up the build log. Using ESLint in my editor or IDE is great, but having a tens of thousands of lines long build log full of ESLint warnings is a bloody chore.

@paulmil1

This comment has been minimized.

Copy link

@paulmil1 paulmil1 commented Oct 28, 2019

thanks @EdwinBetanc0urt

the thing that this config is hidden when creating project by default is Fking horrible
f***
s***

@dxc-jbeck

This comment has been minimized.

Copy link

@dxc-jbeck dxc-jbeck commented Nov 19, 2019

This worked for me, but the wording is bad. "lintOnSave" made me think when "I save" which doesn't clue me that it will work during build.

module.exports = {
  lintOnSave: process.env.NODE_ENV !== 'production'
}

Bottom of page:
https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.