Appearance
Setup eslint on React App
- Install
eslint
as devDependency - Install
eslint-plugin-react
as devDependency. This provides react specific rules. More here: https://github.com/yannickcr/eslint-plugin-react - Install
babel-eslint
as devDependency. This allows eslint to parse experimental ECMAScript features that are most likely used by react.
The result should look like this
js
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react'],
rules: {},
};