We ramble about code, technology and life. Sometimes we actually code...


ESLint best practice .eslintrc file

by Cornelius Weidmann on 27 September 20152 min read

JavaScript code can very quickly become unmaintainable... Few developers will say of themselves that they have produced unmaintainable code. As developers we tend to get very attached to our code.

We pride ourselves on producing high quality and maintainable code. And there is absolutely nothing wrong with that! I would like to challenge developers though to let go of their egos and create "ego-less" coding environments.

Linters are tools which can help achieve such environments. Ego-less coding environments thrive on making better coders out of everyone on the team and will encourage team members to focus on learning and implementing best practices and standards whenever and wherever possible.

Lately I have come across ESLint and fallen in love with it. I use Atom (previously used Sublime) and the eslint plugin is amazing. At first, dealing with errors and warnings was a pain. Now it is becoming a pleasure to work with.

Very quickly I became obsessed with strict standards and best practices. I searched online... unsuccessful. It was hard to find an eslintrc file which adhered to fairly strict standards and best practices while not covering the screen in a bloodbath of linting errors. (Yes, I know I said ego-less earlier, but red is just a painful colour to look at all day :D - rather make it orange :P)

Anyways, I said to myself, "Go through all the rules and make your own .eslintrc file." Brilliant idea! Basically took me 8 hours to go through all the rules and I didn't even read all of them properly! I have great respect for Nicholas C. Zakas, don't know how he does it.

Meanwhile, back at the ranch, after a hard day's work and some more days testing on code I had lying around the rc file is ready for distribution. Goldilocks would be satisfied!

Take it or leave it. Also, thanks to fellow coders it is now dubbed the "C-Dawg linter", because code ain't been linted until it has been c-dawg linted!