DEV Community

ESLint seems useless to me. Should I use it?

Nathan Sebhastian on September 22, 2018

No offense bro, but to me, it seems ESLint isn't a big deal. My production code has been running for 2 years without linting at all. Why should I...
Collapse
 
bgadrian profile image
Adrian B.G. • Edited

I had to admit, JS is the language I never had the patience and time to setup a linter. After a few hours I have to disable it because of numerous problems (from babel to IDE to a different plugin or option), including the fact that most NPM packages throw warnings and errors basically crippling my linter and bash. And ofc each person has its own JS style because why not. But wait, where do you put the settings? Oh here, so 10 more minutes wasted.

There are so many settings, linters, popular configs, each of them has to come trough a different NPM and each IDE has 20 settings on how to link them, and everything is soooo complicated. In the end I get hundred of warnings from 3rd party plugins, and the guess what, you have to add other options in the config to ignore those folders. God forbid to to output a message in your nodeJS app to log, the mighty linter will think you forgot it, because guess what, devs are debuging JS apps with console.log.

Sorry but life is too short. I got spoiled by Go where most of the linting is done by the compiler and builtin tools.

PS: sorry for my rant, your article is great

Collapse
 
nathansebhastian profile image
Nathan Sebhastian

Hello Adrian, yeah I totally get how you feel about NPM third party warnings and those configuration settings. Makes you want to pull your hair out!!

Collapse
 
super_lambda profile image
Super Lambda

LMAO totally agreed! JS 3rd party is too complicated

Collapse
 
peter profile image
Peter Kim Frank

I really enjoyed the format of this article, thanks for sharing. The back-and-forth "conversational" style really helps draw out the benefits of using a linter.

Collapse
 
vekzdran profile image
Vedran Mandić

I second that, good and succinct, explained well. Also a fan of ESLint + prettier.

Collapse
 
nathansebhastian profile image
Nathan Sebhastian

Thanks Peter! It's actually inspired by a real talk I had with a colleague.. I think why not make a post out of it haha

Collapse
 
thomasjunkos profile image
Thomas Junkツ

»Oh, and if you are lazy like me, you are pretty-quick to make your code look prettier« ;)

Collapse
 
nathansebhastian profile image
Nathan Sebhastian

Definitely for formatting.. You'd still need error checking and fix though

Collapse
 
guid75 profile image
Guid75

Is it me or I see nothing wrong about the for loop? I even executed it on my browser javascript console and it displays 5 times "The number is [x]"

Collapse
 
nathansebhastian profile image
Nathan Sebhastian • Edited

Ah my bad! I've changed the code so please be ready to kill your browser console before trying again. Thanks for pointing it out :)

Collapse
 
stereobooster profile image
stereobooster

I suggest to use prettier for formatting and eslint for error detection, like unused varaibles etc. Check out this eslint config npmjs.com/package/eslint-config-re...

Collapse
 
nathansebhastian profile image
Nathan Sebhastian

Yeah that seems to be the best of both worlds these days. ESLint can also fix errors using --fix option