|
| 1 | +module.exports = { |
| 2 | + "parser": "@babel/eslint-parser", // https://github.com/babel/babel/tree/main/eslint/babel-eslint-parser |
| 3 | + "parserOptions": { |
| 4 | + "babelOptions": { |
| 5 | + "configFile": "./.babelrc.json" |
| 6 | + } |
| 7 | + }, |
| 8 | + "plugins": [ |
| 9 | + "react" // https://github.com/yannickcr/eslint-plugin-react |
| 10 | + ], |
| 11 | + "extends": [ |
| 12 | + "eslint:recommended", |
| 13 | + "plugin:react/recommended" |
| 14 | + ], |
| 15 | + "env": { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments |
| 16 | + "es6": true, |
| 17 | + "browser": true, // browser global variables |
| 18 | + "node": true // Node.js global variables and Node.js-specific rules |
| 19 | + }, |
| 20 | + "globals" : { |
| 21 | + /* MOCHA */ |
| 22 | + "describe" : false, |
| 23 | + "it" : false, |
| 24 | + "before" : false, |
| 25 | + "beforeEach" : false, |
| 26 | + "after" : false, |
| 27 | + "afterEach" : false, |
| 28 | + "__DEVTOOLS__": false |
| 29 | + }, |
| 30 | + "ecmaFeatures": { |
| 31 | + "arrowFunctions": true, |
| 32 | + "blockBindings": true, |
| 33 | + "classes": true, |
| 34 | + "defaultParams": true, |
| 35 | + "destructuring": true, |
| 36 | + "forOf": true, |
| 37 | + "generators": false, |
| 38 | + "modules": true, |
| 39 | + "objectLiteralComputedProperties": true, |
| 40 | + "objectLiteralDuplicateProperties": false, |
| 41 | + "objectLiteralShorthandMethods": true, |
| 42 | + "objectLiteralShorthandProperties": true, |
| 43 | + "spread": true, |
| 44 | + "superInFunctions": true, |
| 45 | + "templateStrings": true, |
| 46 | + "jsx": true |
| 47 | + }, |
| 48 | + "rules": { |
| 49 | +/** |
| 50 | + * Strict mode |
| 51 | + */ |
| 52 | + // babel inserts "use strict"; for us |
| 53 | + "strict": [2, "never"], // http://eslint.org/docs/rules/strict |
| 54 | + |
| 55 | +/** |
| 56 | + * ES6 |
| 57 | + */ |
| 58 | + "no-var": 2, // http://eslint.org/docs/rules/no-var |
| 59 | + "prefer-const": 2, // http://eslint.org/docs/rules/prefer-const |
| 60 | + |
| 61 | +/** |
| 62 | + * Variables |
| 63 | + */ |
| 64 | + "no-shadow": 2, // http://eslint.org/docs/rules/no-shadow |
| 65 | + "no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names |
| 66 | + "no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars |
| 67 | + "vars": "local", |
| 68 | + "args": "after-used" |
| 69 | + }], |
| 70 | + "no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define |
| 71 | + |
| 72 | +/** |
| 73 | + * Possible errors |
| 74 | + */ |
| 75 | + "comma-dangle": [2, "never"], // http://eslint.org/docs/rules/comma-dangle |
| 76 | + "no-console": 1, // http://eslint.org/docs/rules/no-console |
| 77 | + "no-alert": 1, // http://eslint.org/docs/rules/no-alert |
| 78 | + "quote-props": [2, "consistent-as-needed"], // https://eslint.org/docs/rules/quote-props |
| 79 | + "block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var |
| 80 | + |
| 81 | + |
| 82 | +/** |
| 83 | + * Best practices |
| 84 | + */ |
| 85 | + "consistent-return": 2, // http://eslint.org/docs/rules/consistent-return |
| 86 | + "curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly |
| 87 | + "default-case": 2, // http://eslint.org/docs/rules/default-case |
| 88 | + "dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation |
| 89 | + "allowKeywords": true |
| 90 | + }], |
| 91 | + "eqeqeq": 2, // http://eslint.org/docs/rules/eqeqeq |
| 92 | + "guard-for-in": 2, // http://eslint.org/docs/rules/guard-for-in |
| 93 | + "no-caller": 2, // http://eslint.org/docs/rules/no-caller |
| 94 | + "no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null |
| 95 | + "no-eval": 2, // http://eslint.org/docs/rules/no-eval |
| 96 | + "no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native |
| 97 | + "no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind |
| 98 | + "no-extra-semi": "warn", |
| 99 | + "no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal |
| 100 | + "no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval |
| 101 | + "no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks |
| 102 | + "no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func |
| 103 | + "no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str |
| 104 | + "no-global-assign": 2, // http://eslint.org/docs/rules/no-global-assign |
| 105 | + "no-new": 2, // http://eslint.org/docs/rules/no-new |
| 106 | + "no-new-func": 2, // http://eslint.org/docs/rules/no-new-func |
| 107 | + "no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers |
| 108 | + "no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape |
| 109 | + "no-proto": 2, // http://eslint.org/docs/rules/no-proto |
| 110 | + "no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign |
| 111 | + "no-script-url": 2, // http://eslint.org/docs/rules/no-script-url |
| 112 | + "no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare |
| 113 | + "no-sequences": 2, // http://eslint.org/docs/rules/no-sequences |
| 114 | + "no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal |
| 115 | + "radix": 2, // http://eslint.org/docs/rules/radix |
| 116 | + "vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top |
| 117 | + "wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife |
| 118 | + "yoda": 2, // http://eslint.org/docs/rules/yoda |
| 119 | + |
| 120 | +/** |
| 121 | + * Style |
| 122 | + */ |
| 123 | + "indent": [2, 4], // http://eslint.org/docs/rules/indent |
| 124 | + "brace-style": [2, // http://eslint.org/docs/rules/brace-style |
| 125 | + "1tbs", { |
| 126 | + "allowSingleLine": true |
| 127 | + }], |
| 128 | + "quotes": [ |
| 129 | + 0, "single", "avoid-escape" // http://eslint.org/docs/rules/quotes |
| 130 | + ], |
| 131 | + "camelcase": [2, { // http://eslint.org/docs/rules/camelcase |
| 132 | + "properties": "never" |
| 133 | + }], |
| 134 | + "comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing |
| 135 | + "before": false, |
| 136 | + "after": true |
| 137 | + }], |
| 138 | + "comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style |
| 139 | + "eol-last": 2, // http://eslint.org/docs/rules/eol-last |
| 140 | + "func-names": 0, // http://eslint.org/docs/rules/func-names |
| 141 | + "key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing |
| 142 | + "beforeColon": false, |
| 143 | + "afterColon": true |
| 144 | + }], |
| 145 | + "new-cap": [2, { // http://eslint.org/docs/rules/new-cap |
| 146 | + "newIsCap": true |
| 147 | + }], |
| 148 | + "no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines |
| 149 | + "max": 2 |
| 150 | + }], |
| 151 | + "no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary |
| 152 | + "no-new-object": 2, // http://eslint.org/docs/rules/no-new-object |
| 153 | + "no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func |
| 154 | + "no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces |
| 155 | + "no-undef": 2, // https://eslint.org/docs/rules/no-undef |
| 156 | + "no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle |
| 157 | + "one-var": [2, "never"], // http://eslint.org/docs/rules/one-var |
| 158 | + "padded-blocks": [0, "never"], // http://eslint.org/docs/rules/padded-blocks |
| 159 | + "semi": [2, "always"], // http://eslint.org/docs/rules/semi |
| 160 | + "semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing |
| 161 | + "before": false, |
| 162 | + "after": true |
| 163 | + }], |
| 164 | + "keyword-spacing": 2, // http://eslint.org/docs/rules/keyword-spacing |
| 165 | + "space-before-blocks": 2, // http://eslint.org/docs/rules/space-before-blocks |
| 166 | + "space-before-function-paren": [2, "never"], // http://eslint.org/docs/rules/space-before-function-paren |
| 167 | + "space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops |
| 168 | + "spaced-comment": 2, // http://eslint.org/docs/rules/spaced-comment |
| 169 | + |
| 170 | +/** |
| 171 | + * JSX style |
| 172 | + */ |
| 173 | + "react/jsx-boolean-value": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md |
| 174 | + "react/jsx-sort-props": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md |
| 175 | + "react/sort-prop-types": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md |
| 176 | + "react/no-did-mount-set-state": [2, "disallow-in-func"], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md |
| 177 | + "react/self-closing-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md |
| 178 | + "react/jsx-wrap-multilines": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md |
| 179 | + "react/no-access-state-in-setstate": "error" |
| 180 | + } |
| 181 | +} |
0 commit comments