Skip to content

Instantly share code, notes, and snippets.

@ethan605
Last active January 18, 2018 08:58
Show Gist options
  • Save ethan605/4097d5e633397d14ad51b2e7c9810780 to your computer and use it in GitHub Desktop.
Save ethan605/4097d5e633397d14ad51b2e7c9810780 to your computer and use it in GitHub Desktop.
ESLint config file following Airbnb Javascript Style Guide
{
"env": {
"browser": true,
"es6": true,
"jest": true,
"node": true
},
"extends": "eslint:recommended",
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"import",
"react",
"react-native"
],
"rules": {
"array-bracket-spacing": [
"error",
"never",
{
"arraysInArrays": false,
"objectsInArrays": false,
"singleValue": false
}
],
"array-callback-return": "error",
"arrow-body-style": [
"error",
"as-needed"
],
"arrow-parens": [
"error",
"as-needed"
],
"arrow-spacing": "error",
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": [
"error",
{
"properties": "never"
}
],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-style": [
"error",
"last"
],
"dot-notation": [
"error",
{
"allowKeywords": false
}
],
"eol-last": "error",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"func-style": [
"error",
"declaration",
{
"allowArrowFunctions": true
}
],
"generator-star-spacing": [
"error",
"after"
],
"id-length": [
"error",
{
"exceptions": [
"$",
"_"
],
"properties": "never"
}
],
"import/first": "error",
"import/no-mutable-exports": "error",
"import/no-unresolved": "error",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
]
}
],
"import/prefer-default-export": "warn",
"indent": [
"error",
2,
{
"FunctionExpression": {
"body": 1,
"parameters": 1
},
"SwitchCase": 1
}
],
"jsx-quotes": [
"error",
"prefer-double"
],
"keyword-spacing": [
"error",
{
"after": true,
"before": true
}
],
"max-len": [
"warn",
120
],
"new-cap": [
"error",
{
"capIsNew": false,
"newIsCap": true
}
],
"newline-per-chained-call": "error",
"no-array-constructor": "error",
"no-case-declarations": "error",
"no-confusing-arrow": [
"error",
{
"allowParens": true
}
],
"no-console": [
"error",
{
"allow": [
"error",
"warn"
]
}
],
"no-const-assign": "error",
"no-dupe-class-members": "error",
"no-duplicate-imports": [
"error",
{
"includeExports": true
}
],
"no-iterator": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-nested-ternary": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-param-reassign": "error",
"no-plusplus": "error",
"no-restricted-syntax": [
"error",
"WithStatement"
],
"no-undef": "error",
"no-underscore-dangle": [
"warn",
{
"allow": [
"_persist"
],
"allowAfterSuper": true
}
],
"no-unneeded-ternary": [
"error",
{
"defaultAssignment": false
}
],
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": [
"error",
"always",
{
"arraysInObjects": true,
"objectsInObjects": true
}
],
"object-shorthand": "error",
"one-var": [
"error",
"never"
],
"padded-blocks": [
"error",
"never"
],
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": [
"error",
"as-needed"
],
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": false,
"avoidEscape": true
}
],
"radix": [
"error",
"as-needed"
],
"react-native/no-inline-styles": "error",
"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "error",
"react/jsx-boolean-value": [
"error",
"never"
],
"react/jsx-closing-bracket-location": "error",
"react/jsx-curly-spacing": [
"error",
"never"
],
"react/jsx-first-prop-new-line": [
"error",
"multiline"
],
"react/jsx-indent": [
"error",
2
],
"react/jsx-indent-props": [
"error",
2
],
"react/jsx-key": "error",
"react/jsx-no-bind": [
"error",
{
"allowArrowFunctions": true
}
],
"react/jsx-no-literals": "error",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": [
"error",
{
"allowAllCaps": false
}
],
"react/jsx-sort-props": "error",
"react/jsx-tag-spacing": [
"error",
{
"afterOpening": "never",
"beforeSelfClosing": "always",
"closingSlash": "never"
}
],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/jsx-wrap-multilines": "error",
"react/no-array-index-key": "error",
"react/no-children-prop": "error",
"react/no-deprecated": "error",
"react/no-is-mounted": "error",
"react/no-multi-comp": [
"error",
{
"ignoreStateless": true
}
],
"react/no-string-refs": "error",
"react/prefer-es6-class": [
"error",
"always"
],
"react/prefer-stateless-function": "error",
"react/prop-types": "error",
"react/require-default-props": "error",
"react/require-render-return": "error",
"react/self-closing-comp": "error",
"react/sort-comp": "error",
"react/sort-prop-types": "error",
"semi": [
"error",
"always"
],
"space-before-blocks": "error",
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"asyncArrow": "ignore",
"named": "never"
}
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": "error",
"spaced-comment": [
"error",
"always"
],
"template-curly-spacing": [
"error",
"never"
],
"wrap-iife": [
"error",
"inside",
{
"functionPrototypeMethods": true
}
]
},
"settings": {
"import/resolve": {
"paths": [
"."
]
}
}
}
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"eslint": "^4.15.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-react-native": "^3.2.1",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment