|
| 1 | +// http://eslint.org/docs/user-guide/configuring |
| 2 | + |
| 3 | +module.exports = { |
| 4 | + root : true, |
| 5 | + parser : 'babel-eslint', |
| 6 | + parserOptions: { |
| 7 | + sourceType: 'module', |
| 8 | + }, |
| 9 | + env : { |
| 10 | + es6 : true, |
| 11 | + browser: true, |
| 12 | + }, |
| 13 | + globals : { |
| 14 | + module : true, |
| 15 | + require: true, |
| 16 | + }, |
| 17 | + // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style |
| 18 | + // extends : 'standard', |
| 19 | + // required to lint *.vue files |
| 20 | + plugins : [ |
| 21 | + 'html', |
| 22 | + ], |
| 23 | + // add your custom rules here |
| 24 | + rules : { |
| 25 | + // Basic rules |
| 26 | + indent: "off", |
| 27 | + "indent-legacy" : [ |
| 28 | + "error", |
| 29 | + 4, |
| 30 | + { |
| 31 | + "SwitchCase" : 1, |
| 32 | + "VariableDeclarator" : { |
| 33 | + "var" : 1, |
| 34 | + "let" : 1, |
| 35 | + "const": 1, |
| 36 | + }, |
| 37 | + "outerIIFEBody" : 0, |
| 38 | + "MemberExpression" : 1, |
| 39 | + "FunctionDeclaration": { |
| 40 | + "parameters": "first", |
| 41 | + }, |
| 42 | + "FunctionExpression" : { |
| 43 | + "parameters": "first", |
| 44 | + }, |
| 45 | + "CallExpression" : { |
| 46 | + "arguments": "first", |
| 47 | + }, |
| 48 | + }, |
| 49 | + ], |
| 50 | + "keyword-spacing" : [ |
| 51 | + "error", |
| 52 | + { |
| 53 | + "before": true, |
| 54 | + "after" : true, |
| 55 | + }, |
| 56 | + ], |
| 57 | + "brace-style" : [ |
| 58 | + "error", |
| 59 | + "1tbs", |
| 60 | + { |
| 61 | + "allowSingleLine": true, |
| 62 | + }, |
| 63 | + ], |
| 64 | + // Do not use "space-infix-ops": "error", for ternary operators |
| 65 | + "arrow-spacing" : [ |
| 66 | + "error", |
| 67 | + { |
| 68 | + "before": true, |
| 69 | + "after" : true, |
| 70 | + }, |
| 71 | + ], |
| 72 | + "arrow-parens" : [ |
| 73 | + "error", |
| 74 | + "as-needed", |
| 75 | + ], |
| 76 | + "arrow-body-style" : [ |
| 77 | + "error", |
| 78 | + "as-needed", |
| 79 | + { |
| 80 | + requireReturnForObjectLiteral: false, |
| 81 | + }, |
| 82 | + ], |
| 83 | + "no-confusing-arrow" : [ |
| 84 | + "error", |
| 85 | + { |
| 86 | + "allowParens": true, |
| 87 | + }, |
| 88 | + ], |
| 89 | + "space-before-function-paren" : [ |
| 90 | + "error", |
| 91 | + { |
| 92 | + "anonymous" : "never", |
| 93 | + "named" : "never", |
| 94 | + "asyncArrow": "always", |
| 95 | + }, |
| 96 | + ], |
| 97 | + "space-before-blocks" : "error", |
| 98 | + "linebreak-style" : [ |
| 99 | + "error", |
| 100 | + "unix", |
| 101 | + ], |
| 102 | + "newline-per-chained-call" : [ |
| 103 | + "error", |
| 104 | + { |
| 105 | + "ignoreChainWithDepth": 2, |
| 106 | + } |
| 107 | + ], |
| 108 | + "object-curly-spacing" : [ |
| 109 | + "error", |
| 110 | + "always", |
| 111 | + ], |
| 112 | + "array-bracket-spacing" : [ |
| 113 | + "error", |
| 114 | + "never", |
| 115 | + ], |
| 116 | + "no-whitespace-before-property": "error", |
| 117 | + "padded-blocks" : [ |
| 118 | + "error", |
| 119 | + "never", |
| 120 | + ], |
| 121 | + "space-in-parens" : [ |
| 122 | + "error", |
| 123 | + "never", |
| 124 | + ], |
| 125 | + "camelcase" : [ |
| 126 | + "error", |
| 127 | + { |
| 128 | + properties: "always", |
| 129 | + } |
| 130 | + ], |
| 131 | + "new-cap" : "error", |
| 132 | + "no-underscore-dangle" : 0, |
| 133 | + "quotes" : [ |
| 134 | + "error", |
| 135 | + "single", // Backticks are allowed due to substitution |
| 136 | + { |
| 137 | + "allowTemplateLiterals": true, |
| 138 | + "avoidEscape" : true, |
| 139 | + }, |
| 140 | + ], |
| 141 | + "semi" : [ |
| 142 | + "error", |
| 143 | + "always", |
| 144 | + ], |
| 145 | + "semi-spacing" : "error", |
| 146 | + "curly" : [ |
| 147 | + "error", |
| 148 | + "multi-line", |
| 149 | + "consistent", |
| 150 | + ], |
| 151 | + "prefer-const" : "error", |
| 152 | + "no-const-assign" : "error", |
| 153 | + "no-var" : "error", |
| 154 | + "no-new-object" : "error", |
| 155 | + "object-shorthand" : "error", |
| 156 | + "quote-props" : [ |
| 157 | + "error", |
| 158 | + "as-needed", |
| 159 | + ], |
| 160 | + "no-array-constructor" : "error", |
| 161 | + "func-style" : [ |
| 162 | + "error", |
| 163 | + "declaration", |
| 164 | + { |
| 165 | + "allowArrowFunctions": true, |
| 166 | + }, |
| 167 | + ], |
| 168 | + "no-loop-func" : "error", |
| 169 | + "no-new-func" : "error", |
| 170 | + "prefer-spread" : "error", |
| 171 | + "prefer-arrow-callback" : "error", |
| 172 | + "no-useless-constructor" : "error", |
| 173 | + "no-dupe-class-members" : "error", |
| 174 | + "no-duplicate-imports" : [ |
| 175 | + "error", |
| 176 | + { |
| 177 | + "includeExports": true, |
| 178 | + }, |
| 179 | + ], |
| 180 | + "no-func-assign" : "error", |
| 181 | + "no-class-assign" : "error", |
| 182 | + "no-iterator" : "error", |
| 183 | + "dot-notation" : "error", |
| 184 | + "no-undef" : "error", |
| 185 | + "one-var" : [ |
| 186 | + "error", |
| 187 | + "never", |
| 188 | + ], |
| 189 | + "radix" : [ |
| 190 | + "error", |
| 191 | + "always", |
| 192 | + ], |
| 193 | + |
| 194 | + // Other misc rules |
| 195 | + "no-unneeded-ternary" : "error", |
| 196 | + "no-nested-ternary" : "error", |
| 197 | + "no-unreachable" : "error", |
| 198 | + "use-isnan" : "error", |
| 199 | + "no-unsafe-negation" : "error", |
| 200 | + "no-extra-semi" : "error", |
| 201 | + "no-sparse-arrays" : "error", |
| 202 | + "no-eq-null" : "error", |
| 203 | + "eqeqeq" : "error", |
| 204 | + "no-eval" : "error", |
| 205 | + "strict" : [ |
| 206 | + "error", |
| 207 | + "safe", |
| 208 | + ], |
| 209 | + "no-useless-escape" : "error", |
| 210 | + "prefer-rest-params" : "error", |
| 211 | + "generator-star-spacing": [ |
| 212 | + "error", |
| 213 | + { |
| 214 | + "before": false, |
| 215 | + "after" : true, |
| 216 | + } |
| 217 | + ], |
| 218 | + "no-case-declarations" : "error", |
| 219 | + "spaced-comment" : [ |
| 220 | + "error", |
| 221 | + "always", |
| 222 | + { |
| 223 | + "line" : { |
| 224 | + "markers" : ["/", "TODO", "FIXME", "DEBUG", "XXX"], |
| 225 | + "exceptions": ["-", "+", "TODO", "FIXME", "DEBUG", "XXX"], |
| 226 | + }, |
| 227 | + "block": { |
| 228 | + "markers" : ["!"], |
| 229 | + "exceptions": ["*"], |
| 230 | + "balanced" : true, |
| 231 | + } |
| 232 | + } |
| 233 | + ], |
| 234 | + "eol-last" : [ |
| 235 | + "error", |
| 236 | + "always", |
| 237 | + ], |
| 238 | + "comma-style" : [ |
| 239 | + "error", |
| 240 | + "last", |
| 241 | + ], |
| 242 | + "comma-dangle" : [ |
| 243 | + "error", |
| 244 | + "always-multiline", |
| 245 | + ], |
| 246 | + |
| 247 | + // allow debugger during development |
| 248 | + 'no-debugger': (process.env.NODE_ENV === 'production')?2:0, |
| 249 | + |
| 250 | + /*"valid-jsdoc": [ //FIXME uncomment |
| 251 | + "error", { |
| 252 | + "prefer" : { |
| 253 | + "arg" : "param", |
| 254 | + "argument": "param", |
| 255 | + "class" : "constructor", |
| 256 | + "return" : "returns", |
| 257 | + "virtual" : "abstract", |
| 258 | + }, |
| 259 | + "requireReturn" : false, |
| 260 | + "requireParamDescription" : false, //TODO Ideally, this should be set to true |
| 261 | + "requireReturnDescription": false, //TODO Ideally, this should be set to true |
| 262 | + } |
| 263 | + ],*/ |
| 264 | + //TODO This should really be enabled by default : |
| 265 | + // 'no-invalid-this': "error", |
| 266 | + /*"wrap-iife": [ |
| 267 | + "error", |
| 268 | + "inside" |
| 269 | + ],*/ |
| 270 | + /*"yoda": [ |
| 271 | + "error", |
| 272 | + "always", |
| 273 | + { |
| 274 | + "onlyEquality": true, |
| 275 | + }, |
| 276 | + ],*/ |
| 277 | + // "no-param-reassign" : "error", |
| 278 | + // "import/prefer-default-export" : "error", |
| 279 | + // "import/first" : "error", |
| 280 | + // "import/no-webpack-loader-syntax": "error", |
| 281 | + } |
| 282 | +}; |
0 commit comments