ESLint Config Semistandard React
An advanced configuration for writing clean ES7+ React (with semicolons).
The plugin and parser required for this config must be installed manually as peer dependencies.
This is required for the config to work globally (see Configuring Plugins).
npm install -D eslint babel-eslint eslint-config-semistandard-react eslint-plugin-semistandard-react
yarn add -D eslint babel-eslint eslint-config-semistandard-react eslint-plugin-semistandard-react
npm install --global ... or
yarn global add ...
.eslintrc in your project's root folder (local installation) or your computer's $HOME
directory (global installation) and paste the following snippet:
You may also override any rules by creating a
rules object after the
extends array. For example,
if you want to enforce trailing commas (aka comma dangle), simply add the following rule:
This is a unified ESLint shared configuration combining all of the rules from:
The Babel parser also allows you to use Flow type annotations without throwing a parsing error.
To lint your Flow type annotations, simply install eslint-plugin-flowtype,
and change your
.eslintrc like so:
I primary use ESLint to fix errors in-editor before compiling/running. Webstorm has built-in support for ESLint and allows you to fix an entire file with one click.
Here are links to the ESLint plugins for the other popular text editors:
To lint your code during a Webpack compilation, use
and add this to your Webpack configuration:
moduleexports =// ...module:rules:test: /\.jsx?$/enforce: 'pre'loader: 'eslint-loader'exclude: /node_modules/options:parser: 'babel-eslint'baseConfig:extends: 'semistandard-react';