Created
January 15, 2017 08:47
-
-
Save meze/72d44ee1eacef426bdb36b9d58968ac5 to your computer and use it in GitHub Desktop.
ES/React rules
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
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"extends": [ | |
"standard" | |
], | |
"plugins": ["react", "import", "babel", "promise"], | |
"globals": { | |
"__DEV__" : false, | |
"__TEST__" : false, | |
"__PROD__" : false, | |
"__COVERAGE__" : false | |
}, | |
"rules": { | |
// | |
// Possible Errors | |
// | |
"no-console": 1, // disallow use of console (off by default in the node environment) | |
"no-empty": 2, // disallow empty statements | |
"no-extra-semi": 2, // disallow unnecessary semicolons | |
"valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default) | |
// | |
// Best Practices | |
// | |
"consistent-return": 2, // require return statements to either always or never specify values | |
"default-case": 2, // require default case in switch statements (off by default) | |
"dot-notation": 2, // encourages use of dot notation whenever possible | |
"guard-for-in": 2, // make sure for-in loops have an if statement (off by default) | |
"no-alert": 2, // disallow the use of alert, confirm, and prompt | |
"no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default) | |
"no-else-return": 2, // disallow else after a return in an if (off by default) | |
"no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default) | |
"no-loop-func": 2, // disallow creation of functions within loops | |
"no-param-reassign": 2, // disallow reassignment of function parameters (off by default) | |
"no-script-url": 2, // disallow use of javascript: urls. | |
"no-unused-expressions": 2, // disallow usage of expressions in statement position | |
"no-void": 2, // disallow use of void operator (off by default) | |
"radix": 2, // require use of the second argument for parseInt() (off by default) | |
"array-callback-return": 2, | |
// | |
// Strict Mode | |
// | |
"strict": 0, // controls location of Use Strict Directives. 0: required by `babel-eslint` | |
// | |
// Variables | |
// | |
"no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) | |
"no-shadow": 2, // disallow declaration of variables already declared in the outer scope | |
"no-use-before-define": 2, // disallow use of variables before they are defined | |
// | |
// Stylistic Issues | |
// | |
"comma-style": [1, "last"], // enforce one true comma style (off by default) | |
"consistent-this": [1, "_this"], // enforces consistent naming when capturing the current execution context (off by default) | |
"max-nested-callbacks": [1, 3], // specify the maximum depth callbacks can be nested (off by default) | |
"no-inline-comments": 1, // disallow comments inline after code (off by default) | |
"no-lonely-if": 1, // disallow if as the only statement in an else block (off by default) | |
"no-nested-ternary": 1, // disallow nested ternary expressions (off by default) | |
"no-spaced-func": 1, // disallow space between function identifier and application | |
"operator-assignment": [1, "never"], // require assignment operator shorthand where possible or prohibit it entirely (off by default) | |
"quote-props": [1, "as-needed"], // require quotes around object literal property names (off by default) | |
"object-curly-spacing": [1, "always"], // require or disallow spaces inside brackets (off by default) | |
"array-bracket-spacing": 1, // require or disallow spaces inside brackets (off by default) | |
"arrow-parens": 1, | |
"computed-property-spacing": 1, | |
"newline-before-return": 1, | |
"space-before-function-paren": [1, "never"], | |
"semi": [1, "always"], | |
// | |
// ECMAScript 6 | |
// | |
"no-var": 2, // require let or const instead of var (off by default) | |
"generator-star-spacing": [2, "before"], // enforce the spacing around the * in generator functions (off by default) | |
"prefer-arrow-callback": 2, | |
"prefer-const": 2, | |
"prefer-rest-params": 2, | |
"no-const-assign": 2, | |
// | |
// Legacy | |
// | |
"max-depth": [2, 3], // specify the maximum depth that blocks can be nested (off by default) | |
"max-len": [2, 255, 2], // specify the maximum length of a line in your program (off by default) | |
"max-params": [2, 5], // limits the number of parameters that can be used in the function declaration. (off by default) | |
"no-plusplus": 2, // disallow use of unary operators, ++ and -- (off by default) | |
// | |
// eslint-plugin-react | |
// | |
"jsx-quotes": [2, "prefer-double"], // Enforce quote style for JSX attributes | |
"react/jsx-no-undef": 2, // Disallow undeclared variables in JSX | |
"react/jsx-uses-react": 2, // Prevent React to be incorrectly marked as unused | |
"react/jsx-uses-vars": 2, // Prevent variables used in JSX to be incorrectly marked as unused | |
"react/no-did-update-set-state": 2, // Prevent usage of setState in componentDidUpdate | |
"react/no-unknown-property": 2, // Prevent usage of unknown DOM property | |
"react/prop-types": 2, // Prevent missing props validation in a React component definition | |
"react/react-in-jsx-scope": 2, // Prevent missing React when using JSX | |
"react/self-closing-comp": 2, // Prevent extra closing tags for components without children | |
"react/jsx-wrap-multilines": 2, // Prevent missing parentheses around multilines JSX, | |
"react/jsx-boolean-value": [2, "always"], | |
"react/jsx-closing-bracket-location": 2, | |
"react/no-direct-mutation-state": 2, | |
"react/jsx-no-duplicate-props": 2, | |
"react/jsx-curly-spacing": 2, | |
"react/jsx-indent-props": [2, 2], | |
"react/jsx-indent": [2, 2], | |
"react/no-did-mount-set-state": 2, | |
"react/jsx-equals-spacing": [2, "never"], | |
"react/sort-comp": 2, | |
"react/sort-prop-types": 2, | |
"react/jsx-space-before-closing": 2, | |
"react/jsx-pascal-case": 2, | |
"react/no-string-refs": 2, | |
"react/require-render-return": 2, | |
"react/prefer-es6-class": 2, | |
// | |
// eslint-plugin-import | |
// | |
"import/export": 2, | |
"import/newline-after-import": 2, | |
"import/first": 2, | |
"import/named": 2, | |
"import/no-absolute-path": 2, | |
"import/no-amd": 2, | |
"import/no-extraneous-dependencies": 2, | |
"import/no-named-as-default-member": 2, | |
"import/no-named-as-default": 2, | |
"import/no-nodejs-modules": 2, | |
"import/no-webpack-loader-syntax": 2, | |
"import/order": 2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment