Random UTF-8 characters


03 Dec 2015 in reactjavascriptlinteslint

Are you linting yet?

If you aren't you should be! If you are like me, you have a love and hate relationship with Javascript. It's used to do so much, but it's loose rule set makes it a potential nightmare.

At work we already were using Checkstyle and FindBugs for our Java code, so why not apply the same idea to our Javascript and React code?

There a few options, but we chose to go with eslint. It has a large number of plugins and support for React.

Setup was dead simple. Create a .eslintrc file in the project root. Then add gulp-eslint to the gulp build chain.

We decided to follow the airbnb style. We did make some small alterations.

Now what happened next was not as simple:

Clean up was pretty easy. Most of those errors and warnings were the use of var or small style violations. After a couple of hours we now have a much cleaner, consistent and more maintainable Javascript and React code.