-
-
Save febritecno/753fac9a59205c34d7aaec9022d62ccc to your computer and use it in GitHub Desktop.
eslint for react js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extends": [ | |
"plugin:react/recommended", | |
"plugin:jest/recommended" | |
], | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"commonjs": true, | |
"node": true, | |
"es6": true | |
}, | |
"parserOptions": { | |
"ecmaVersion": 6 | |
}, | |
"plugins": [ | |
"prettier", | |
], | |
"globals": { | |
"fetch": false, | |
"window": false, | |
"document": false | |
}, | |
"settings": { | |
"import/core-modules": [ // for your webpack alias import | |
"kao-config", | |
"kao-util", | |
"kao-server", | |
"kao-store", | |
"kao-redux", | |
"kao-redux/yax", | |
"kao-components", | |
"kao-client", | |
"kao-containers", | |
"kao-assets", | |
"kao-styles" | |
] | |
}, | |
"rules": { | |
"global-require": "off", | |
"react/jsx-indent-props": [2, 2], | |
"react/jsx-first-prop-new-line": [1, "multiline" ], | |
"react/jsx-closing-tag-location": 1, | |
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], | |
"react/prefer-stateless-function": [0, { "ignorePureComponents": true}], | |
"react/prop-types": 0, | |
"react/self-closing-comp": 1, | |
"react/wrap-multilines": 0, | |
"consistent-return": 0, // require return statements to either always or never specify values | |
"comma-dangle": [2, { // disallow trailing commas in object literals | |
"arrays": "ignore", | |
"objects": "ignore", | |
"imports": "ignore", | |
"exports": "ignore", | |
"functions": "never" | |
}], | |
"prettier/prettier": [2, "fb", "@format"], | |
"no-catch-shadow": 1, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) | |
"no-delete-var": 1, // disallow deletion of variables | |
"no-label-var": 1, // disallow labels that share a name with a variable | |
"no-shadow": 1, // disallow declaration of variables already declared in the outer scope | |
"no-shadow-restricted-names": 1, // disallow shadowing of names such as arguments | |
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block | |
"no-console": 1, // disallow use of console (off by default in the node environment) | |
"no-undefined": 0, // disallow use of undefined variable (off by default) | |
"no-undef-init": 1, // disallow use of undefined when initializing variables | |
"no-unused-vars": [1, {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code | |
"no-use-before-define": 0, // disallow use of variables before they are defined | |
"no-useless-return": 1, // disallow else after a return in an if (off by default) | |
"no-extra-semi": 1, // disallow unnecessary semicolons | |
// Stylistic Issues | |
// These rules are purely matters of style and are quite subjective. | |
"key-spacing": 0, | |
"keyword-spacing": 1, // enforce spacing before and after keywords | |
"jsx-quotes": [1, "prefer-double"], // enforces the usage of double quotes for all JSX attribute values which doesn’t contain a double quote | |
"comma-spacing": 0, | |
"no-multi-spaces": 0, | |
"brace-style": 1, // enforce one true brace style (off by default) | |
"camelcase": 0, // require camel case names | |
"consistent-this": 1, // enforces consistent naming when capturing the current execution context (off by default) | |
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines | |
"func-names": 0, // require function expressions to have a name (off by default) | |
"func-style": 0, // enforces use of function declarations or expressions (off by default) | |
"new-cap": 0, // require a capital letter for constructors | |
"new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments | |
"no-nested-ternary": 0, // disallow nested ternary expressions (off by default) | |
"no-array-constructor": 1, // disallow use of the Array constructor | |
'no-empty-character-class': 1, // disallow the use of empty character classes in regular expressions | |
"no-lonely-if": 0, // disallow if as the only statement in an else block (off by default) | |
"no-new-object": 1, // disallow use of the Object constructor | |
"no-spaced-func": 1, // disallow space between function identifier and application | |
"no-ternary": 0, // disallow the use of ternary operators (off by default) | |
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines | |
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers | |
"no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation | |
"quotes": [1, "single", "avoid-escape"], // specify whether double or single quotes should be used | |
"quote-props": 0, // require quotes around object literal property names (off by default) | |
"semi": 1, // require or disallow use of semicolons instead of ASI | |
"sort-vars": 0, // sort variables within the same declaration block (off by default) | |
"arrow-spacing": 2, | |
"space-before-blocks": 2, | |
"array-bracket-spacing": 2, // require or disallow spaces inside brackets (off by default) | |
"object-curly-spacing": [2, "always", { "objectsInObjects": false, "arraysInObjects": false }], | |
"space-in-parens": 2, // require or disallow spaces inside parentheses (off by default) | |
"space-infix-ops": 1, // require spaces around operators | |
"space-unary-ops": [1, { "words": true, "nonwords": false }], // require or disallow spaces before/after unary operators (words on by default, nonwords off by default) | |
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default) | |
"one-var": 0, // allow just one var statement per function (off by default) | |
"wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) | |
// Legacy | |
// The following rules are included for compatibility with JSHint and JSLint. While the names of the rules may not match up with the JSHint/JSLint counterpart, the functionality is the same. | |
"max-depth": 0, // specify the maximum depth that blocks can be nested (off by default) | |
"max-len": 0, // specify the maximum length of a line in your program (off by default) | |
"max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default) | |
"max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) | |
"no-bitwise": 1, // disallow use of bitwise operators (off by default) | |
"no-plusplus": 0, // disallow use of unary operators, ++ and -- (off by default) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment