.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
casestatements be indented one level deeper than their containing
- 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
- 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.