Published 10/9/2015
How to write quality JavaScript code?


How to ensure JavaScript quality?

ESLint is the answer! (still valid in 2017)

Of course it does not fix bad archietcture, but at least shows, or automaticallly eliminate many developer bad habits, or mistakes.

But why ESLint?

There are many quality/standards checkers for JavaScript (eg. JSHint, JSLint) but most of them are really hard to configure to match your rules set. One of most recent is ESLint - it's creator also worked on mentioned linters. More about his story is well written in following article:

Note: The “ES” in “ESLint” stands for “ECMAScript”, the name for the core of the JavaScript language. This term has become more popular thanks to ECMAScript 6.

There is another outstanding issue and it's how to configure ESLint to be linting your files when you are making changes to them.

Answer is quite simple.

Use one of building libraries in NodeJs - for example Webpack, or Grunt with bunch of plugins:

There are few more excellent task runners which you can use - we talked a little about Grunt, but there is also Gulp, Broccoli or npm/yarn itself.

And that's it. This toolset can eliminate many common mistakes while writing code.

Additional check for code can be checking code style. Go to to learn more. With this tool you can ensure every developer in team is writing in same style habits.

Update: JSCS has merged with ESLint! So that with ESLint uou can also check code style.

ESLint usage

Useful links how to use linter:


Important part of development process is testing. Unit Tests and also Integration Tests. So do not forget about those and spend some effort to cover application.

Unit or integration tests are big topic so I may create another article later. There is also one specific methodology and it's Test Driven Development - just try it.