Linting is essential to writing good JavaScript, and ESLint is, for my money, the best JavaScript linter out there at the moment. It’s super flexible, and also has plugin support which allows for features like ReactJS linting. For those starting a new ReactJS project, or those who want to integrate ESLint into an existing one, here is an .eslintrc (configuration) file to get you started.

While I won’t go over every line in this file, there are a couple settings that may not suit everybody’s needs:

• There are no warnings. Everything is treated as an error.
• I use tab indentation, and require that case statements be indented one level deeper than their containing select statement.
• I use what I consider to be a reasonable subset of the possible React linting rules. For example, I don’t require that properties be in alphabetical order.
• I allow console statements.
• Although I really do not like jQuery I’ve set \$ as a global, readonly variable because it’s sometimes needed when working with Bootstrap components.

To actually use this in your project, all you need to do is include both ESLint and the React ESLint plugin in your project. If you’re using Babel, you’ll also want to include Babel ESLint and add the line parser: "babel-eslint" to the configuration to enable linting for all of Babel’s features.

This is by no means a be-all-end-all of .eslintrc files. Take it as a starting point and use the extensive ESLint documentation as well as that of the React ESLint plugin to customise it to suit your needs.