Skip to content

Instantly share code, notes, and snippets.

@xeptore
Last active May 7, 2019 10:03
Show Gist options
  • Save xeptore/72f41da73b4513c127deaf2342c0fedc to your computer and use it in GitHub Desktop.
Save xeptore/72f41da73b4513c127deaf2342c0fedc to your computer and use it in GitHub Desktop.
eslint configurations for React apps
env:
browser: true
commonjs: true
es6: true
node: true
extends:
- eslint:recommended
- airbnb
- plugin:react/recommended
- plugin:import/errors
- plugin:import/warnings
- plugin:jsx-a11y/recommended
- plugin:compat/recommended
settings:
import/resolver:
node:
extensions:
- .js
- .jsx
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 2015
sourceType: module
parser: babel-eslint
plugins:
- babel
- react
- react-hooks
- import
- jsx-a11y
rules:
jsx-quotes:
- 2
- prefer-double
react/jsx-uses-vars: 2
keyword-spacing: 2
no-trailing-spaces: 2
no-multiple-empty-lines: 2
eol-last: 2
no-tabs: 2
no-nested-ternary: 2
no-extra-semi: 2
constructor-super: 2
no-var: 2
max-len:
- 1
-
code: 85
tabWidth: 2
no-func-assign: 2
consistent-return: 2
curly:
- 2
- all
default-case: 2
eqeqeq:
- 2
- always
no-multi-spaces: 2
array-bracket-newline:
- 2
- consistent
comma-dangle: 2
comma-spacing: 2
no-console: 0
indent:
- error
- 2
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
react/prop-types:
- 2
react/jsx-closing-bracket-location:
- 2
react/jsx-tag-spacing:
- 2
-
beforeSelfClosing: never
react/jsx-closing-tag-location:
- 2
react/jsx-handler-names:
- 2
react/jsx-key:
- 2
react/no-access-state-in-setstate:
- 2
react/no-did-mount-set-state:
- 2
react/no-did-update-set-state:
- 2
react/no-direct-mutation-state:
- 2
react/jsx-equals-spacing:
- 2
- never
react/jsx-curly-spacing:
- 2
-
when: never
children: true
allowMultiline: true
spacing:
objectLiterals: never
react/boolean-prop-naming:
- 2
react/jsx-boolean-value:
- 2
react-hooks/rules-of-hooks:
- 2
react-hooks/exhaustive-deps:
- 1
react/react-in-jsx-scope: 0
react/button-has-type: 2
react/default-props-match-prop-types: 2
react/destructuring-assignment: 0
react/display-name: 0
react/forbid-component-props: 2
react/forbid-dom-props: 0
react/forbid-elements: 0
react/forbid-foreign-prop-types: 0
react/forbid-prop-types: 0
react/jsx-child-element-spacing: 0
react/jsx-first-prop-new-line:
- 2
- multiline-multiprop
react/jsx-indent:
- 2
- 2
react/jsx-indent-props:
- 2
- 2
react/jsx-max-props-per-line:
- 2
-
maximum: 3
when: multiline
react/jsx-no-bind:
- 2
-
allowArrowFunctions: false
allowBind: false
ignoreRefs: true
react/jsx-no-comment-textnodes: 2
react/jsx-no-duplicate-props: 2
react/jsx-no-literals: 0
react/jsx-no-target-blank: 2
react/jsx-no-undef: 2
react/jsx-one-expression-per-line: 2
react/jsx-pascal-case: 2
react/jsx-props-no-multi-spaces: 2
react/jsx-sort-default-props: 2
react/jsx-sort-props: 2
react/jsx-uses-react: 1
react/jsx-wrap-multilines: 0
react/no-array-index-key: 2
react/no-children-prop: 2
react/no-danger: 2
react/no-danger-with-children: 2
react/no-deprecated: 2
react/no-find-dom-node: 2
react/no-is-mounted: 2
react/no-multi-comp: 2
react/no-redundant-should-component-update: 2
react/no-set-state: 2
react/no-string-refs: 2
react/no-this-in-sfc: 2
react/no-typos: 2
react/no-unescaped-entities: 2
react/no-unknown-property: 2
react/no-unsafe: 2
react/no-unused-prop-types: 2
react/no-unused-state: 2
react/no-will-update-set-state: 2
react/prefer-es6-class: 2
react/prefer-stateless-function:
- 2
- ignorePureComponents: true
react/require-default-props: 2
react/require-render-return: 2
react/self-closing-comp: 2
react/sort-comp: 2
react/sort-prop-types: 2
react/style-prop-object: 2
react/void-dom-elements-no-children: 2
import/no-named-default: 2
import/newline-after-import: 2
import/order:
- 2
-
newlines-between: always
import/no-duplicates: 2
import/exports-last: 2
import/first: 2
import/named: 2
@xeptore
Copy link
Author

xeptore commented Apr 19, 2019

installing dependencies:

yarn add --dev \
  eslint \
  babel-eslint \
  eslint-plugin-babel \
  eslint-plugin-import \
  eslint-plugin-react \
  eslint-plugin-react-hooks \
  eslint-plugin-jsx-a11y \
  eslint-plugin-compat \
  eslint-config-airbnb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment