Skip to content

Instantly share code, notes, and snippets.

@sryze
Created January 5, 2022 12:11
Show Gist options
  • Save sryze/e06a9df531bef45e7e6e7b9fa669f6eb to your computer and use it in GitHub Desktop.
Save sryze/e06a9df531bef45e7e6e7b9fa669f6eb to your computer and use it in GitHub Desktop.
Base ESLint config
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": false
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"react"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"rules": {
"indent": ["warn", 4, {"SwitchCase": 1}],
"brace-style": ["warn", "1tbs"],
"semi": ["error", "always"],
"curly": ["warn", "all"],
"arrow-parens": ["warn", "as-needed"],
"comma-dangle": ["warn", "only-multiline"],
"space-before-blocks": ["warn", "always"],
"space-before-function-paren": ["warn", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"arrow-spacing": ["warn", {
"before": true,
"after": true
}],
"keyword-spacing": ["warn", {
"before": true,
"after": true
}],
"constructor-super": "warn",
"valid-typeof": "warn",
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "error",
"no-undefined": "error",
"no-undef-init": "error",
"no-unreachable": "warn",
"no-unused-vars": ["error", { "vars": "all", "args": "none"}],
"no-invalid-regexp": "error",
"no-multi-spaces": "warn",
"no-multiple-empty-lines": ["warn", {"max": 1}],
"react/prop-types": ["error", {"ignore": ["children"]}],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/button-has-type": "warn",
"react/no-typos": "error",
"react/no-array-index-key": "warn",
"react/no-unused-state": "warn",
"react/no-unused-prop-types": "warn",
"react/self-closing-comp": "warn",
"react/sort-comp": ["warn", {
"order": [
"static-methods",
"instance-variables",
"lifecycle",
"everything-else",
"render"
]
}],
"react/void-dom-elements-no-children": "error",
"react/jsx-pascal-case": "warn",
"react/jsx-props-no-multi-spaces": "warn",
"react/jsx-tag-spacing": ["warn", {
"closingSlash": "never",
"beforeSelfClosing": "never",
"afterOpening": "never",
"beforeClosing": "allow"
}],
"react/jsx-no-target-blank": "warn"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment