Skip to content

Instantly share code, notes, and snippets.

@AshUK
Last active April 1, 2019 10:14
Show Gist options
  • Save AshUK/218a56399aa32ea08e9d5332ef83218b to your computer and use it in GitHub Desktop.
Save AshUK/218a56399aa32ea08e9d5332ef83218b to your computer and use it in GitHub Desktop.
eslint for js and react
{
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"indent": [
"error",
"tab"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": [
"error"
],
"no-alert": [
"error"
],
"no-restricted-syntax": [
"error",
"FunctionExpression",
"ClassBody",
"ClassDeclaration",
"ClassExpression"
],
"no-extra-bind": [
"error"
],
"react/void-dom-elements-no-children": [
"error"
],
"react/style-prop-object": [
"error"
],
"react/sort-comp": [
"error"
],
"react/self-closing-comp": [
"error"
],
"react/require-default-props": [
"error",
{
"forbidDefaultForRequired": true
}
],
"react/prefer-es6-class": [
"error",
"always"
],
"react/default-props-match-prop-types": [
"error"
],
"react/destructuring-assignment": [
"error",
"always"
],
"react/no-access-state-in-setstate": [
"error"
],
"react/no-array-index-key": [
"error"
],
"react/no-danger": [
"error"
],
"react/no-did-update-set-state": [
"error"
],
"react/no-did-mount-set-state": [
"error"
],
"react/no-direct-mutation-state": [
"error"
],
"react/no-redundant-should-component-update": [
"error"
],
"react/no-typos": [
"error"
],
"react/no-string-refs": [
"error"
],
"react/no-this-in-sfc": [
"error"
],
"react/no-unsafe": [
"error"
],
"react/no-unused-state": [
"error"
],
"react/no-unused-prop-types": [
"error"
],
"react/jsx-boolean-value": [
"error"
],
"react/jsx-closing-bracket-location": [
"error",
{
"nonEmpty": "after-props",
"selfClosing": "line-aligned"
}
],
"react/jsx-equals-spacing": [
"error",
"never"
],
"react/jsx-first-prop-new-line": [
"error"
],
"react/jsx-filename-extension": [
"error"
],
"react/jsx-handler-names": [
"error"
],
"react/jsx-max-depth": [
"error",
{
"max": 4
}
],
"react/jsx-max-props-per-line": [
"error",
{ "maximum": 1, "when": "multiline" }
],
"react/jsx-one-expression-per-line": [
"error",
{
"allow": "single-child"
}
],
"react/jsx-fragments": [
"error"
],
"react/jsx-pascal-case": [
"error"
],
"react/jsx-props-no-multi-spaces": [
"error"
],
"react/jsx-tag-spacing": [
"error",
{
"closingSlash": "never",
"beforeSelfClosing": "always",
"afterOpening": "never",
"beforeClosing": "allow"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment