|
| 1 | +{ |
| 2 | + "env": { |
| 3 | + "browser": true, |
| 4 | + "node": true |
| 5 | + }, |
| 6 | + |
| 7 | + "parser": "babel-eslint", |
| 8 | + |
| 9 | + "plugins": [ |
| 10 | + "react" |
| 11 | + ], |
| 12 | + |
| 13 | + "ecmaFeatures": { |
| 14 | + "jsx": true |
| 15 | + }, |
| 16 | + |
| 17 | + "rules": { |
| 18 | + // For a complete reference, check out http://eslint.org/docs/rules/ |
| 19 | + |
| 20 | + //------------------------------------------------------------------------- |
| 21 | + // Best practices |
| 22 | + //------------------------------------------------------------------------- |
| 23 | + |
| 24 | + // Prevent abbreviated blocks for clarity |
| 25 | + "curly": 2, |
| 26 | + |
| 27 | + // Enforce a reasonable cap on functions spiralling out of control |
| 28 | + // with many branches. |
| 29 | + "complexity": [2, 10], |
| 30 | + |
| 31 | + // Prefer foo.x over foo['x']; static properties are always preferable |
| 32 | + // to dynamic strings. |
| 33 | + "dot-notation": 2, |
| 34 | + |
| 35 | + "dot-location": [2, "property"], |
| 36 | + |
| 37 | + // enforce === and !== for comparisons |
| 38 | + "eqeqeq": [2, "smart"], |
| 39 | + |
| 40 | + "guard-for-in": 2, |
| 41 | + |
| 42 | + "no-floating-decimal": 2, |
| 43 | + |
| 44 | + // Avoid funny things with parseInt. |
| 45 | + // See: http://stackoverflow.com/questions/850341 |
| 46 | + "radix": 2, |
| 47 | + |
| 48 | + // Avoid pitfalls when trying to call a just-declared function. |
| 49 | + "wrap-iife": 2, |
| 50 | + |
| 51 | + // May the force be with you. |
| 52 | + "yoda": [0, "always"], |
| 53 | + |
| 54 | + //------------------------------------------------------------------------- |
| 55 | + // Strict Mode |
| 56 | + //------------------------------------------------------------------------- |
| 57 | + |
| 58 | + // Transpilers deal with the effects of strict, so ignore it. |
| 59 | + "strict": [2, "never"], |
| 60 | + |
| 61 | + //------------------------------------------------------------------------- |
| 62 | + // Variable declaration |
| 63 | + //------------------------------------------------------------------------- |
| 64 | + "no-use-before-define": 2, |
| 65 | + |
| 66 | + "no-undefined": 2, |
| 67 | + |
| 68 | + "no-unused-vars": 2, |
| 69 | + |
| 70 | + //------------------------------------------------------------------------- |
| 71 | + // Code style |
| 72 | + //------------------------------------------------------------------------- |
| 73 | + |
| 74 | + // The one true brace style. |
| 75 | + "brace-style": [2, "1tbs"], |
| 76 | + |
| 77 | + "camelcase": 0, |
| 78 | + |
| 79 | + "comma-spacing": [2, { "before": false, "after": true }], |
| 80 | + |
| 81 | + "consistent-this": [2, "_this"], |
| 82 | + |
| 83 | + "eol-last": 2, |
| 84 | + |
| 85 | + "indent": [2, 2], |
| 86 | + |
| 87 | + "key-spacing": [2, { "beforeColon": false, "afterColon": true }], |
| 88 | + |
| 89 | + "new-cap": 2, |
| 90 | + |
| 91 | + "no-lonely-if": 2, |
| 92 | + |
| 93 | + "no-mixed-spaces-and-tabs": [2, true], |
| 94 | + |
| 95 | + "no-multiple-empty-lines": 2, |
| 96 | + |
| 97 | + // Nested ternaries are just plain confusing. Avoiding them keeps the |
| 98 | + // code readable. |
| 99 | + "no-nested-ternary": 2, |
| 100 | + |
| 101 | + // There are no such thing as "private" properties. Use closure |
| 102 | + // variables if you really need isolation. |
| 103 | + "no-underscore-dangle": 0, |
| 104 | + |
| 105 | + "no-spaced-func": 2, |
| 106 | + |
| 107 | + // use one variable declaration for each variable you want to define |
| 108 | + "one-var": [2, "never"], |
| 109 | + |
| 110 | + // enforce double quotes |
| 111 | + "quotes": [2, "double"], |
| 112 | + |
| 113 | + // Enforce whitespace for visual clarity. |
| 114 | + "space-after-keywords": [2, "always"], |
| 115 | + "spaced-comment": [2, "always", { "exceptions": ["-"] }], |
| 116 | + |
| 117 | + //------------------------------------------------------------------------- |
| 118 | + // ECMAScript 6 |
| 119 | + //------------------------------------------------------------------------- |
| 120 | + |
| 121 | + // Enforce `const` and `let` to describe what's going on. |
| 122 | + "no-var": 2, |
| 123 | + |
| 124 | + //------------------------------------------------------------------------- |
| 125 | + // React |
| 126 | + //------------------------------------------------------------------------- |
| 127 | + "jsx-quotes": [2, "prefer-double"], |
| 128 | + "react/jsx-uses-vars": 2, |
| 129 | + "react/jsx-uses-react": 2, |
| 130 | + |
| 131 | + // Display name is not needed when using ES6-style components |
| 132 | + "react/display-name": 0, |
| 133 | + |
| 134 | + // Make things consistent and readable – prefer `x={true}` over `x` |
| 135 | + "react/jsx-boolean-value": 2, |
| 136 | + |
| 137 | + // Keep the quote style consistent with Javascript land |
| 138 | + "react/jsx-no-undef": 2, |
| 139 | + "react/jsx-sort-props": 0, |
| 140 | + "react/jsx-sort-prop-types": 0, |
| 141 | + "react/no-did-mount-set-state": 1, |
| 142 | + "react/no-did-update-set-state": 1, |
| 143 | + "react/no-multi-comp": 2, |
| 144 | + "react/no-unknown-property": 2, |
| 145 | + "react/react-in-jsx-scope": 1, |
| 146 | + "react/self-closing-comp": 2, |
| 147 | + "react/wrap-multilines": 2, |
| 148 | + |
| 149 | + // Potential issue in React ESLint package- receiving 'Can't add property |
| 150 | + // react, object is not extensible' when used with eslint-loader. |
| 151 | + "react/prop-types": 0 |
| 152 | + } |
| 153 | +} |
0 commit comments