|
| 1 | +{ |
| 2 | + "parserOptions": { |
| 3 | + "ecmaVersion": 6, |
| 4 | + "sourceType": "module" |
| 5 | + }, |
| 6 | + /* |
| 7 | + * ENVIRONMENTS |
| 8 | + * ================= |
| 9 | + */ |
| 10 | + "env": { |
| 11 | + |
| 12 | + // Define globals exposed by modern browsers. |
| 13 | + "browser": true, |
| 14 | + |
| 15 | + // Allow CommonJS writing |
| 16 | + "node": true, |
| 17 | + |
| 18 | + // es2015 |
| 19 | + "es6":true, |
| 20 | + |
| 21 | + // mocha test framework |
| 22 | + "mocha":true |
| 23 | + }, |
| 24 | + |
| 25 | + "globals": { |
| 26 | + |
| 27 | + }, |
| 28 | + |
| 29 | + "rules": { |
| 30 | + |
| 31 | + /* |
| 32 | + * ENFORCING OPTIONS |
| 33 | + * ================= |
| 34 | + */ |
| 35 | + |
| 36 | + // Prohibits use of == and != in favor of === and !==. |
| 37 | + "eqeqeq": 2, |
| 38 | + |
| 39 | + // Requires all for in loops to filter object's items. |
| 40 | + "guard-for-in": 2, |
| 41 | + |
| 42 | + // Prohibits overwriting prototypes of native objects such as Array, Date and so on. |
| 43 | + "no-extend-native": 2, |
| 44 | + |
| 45 | + // Prohibits use of a variable before it is defined. |
| 46 | + "no-use-before-define": 2, |
| 47 | + |
| 48 | + // Prohibits the use of arguments.caller and arguments.callee. |
| 49 | + "no-caller": 2, |
| 50 | + |
| 51 | + // Prohibits the use of the comma operator. |
| 52 | + "no-sequences": 2, |
| 53 | + |
| 54 | + // Warns about "non-breaking whitespace" characters. |
| 55 | + "no-irregular-whitespace": 2, |
| 56 | + |
| 57 | + // Prohibits the use of constructor functions for side-effects. |
| 58 | + "no-new": 2, |
| 59 | + |
| 60 | + // Nope, thanks to strict-loader for webpack & use-strict module for node |
| 61 | + "strict": 0, |
| 62 | + |
| 63 | + // Prohibits use of explicitly undeclared variables. |
| 64 | + "no-undef": 2, |
| 65 | + |
| 66 | + // Warns when variables are defined but never used. |
| 67 | + "no-unused-vars": 2, |
| 68 | + |
| 69 | + // requireCurlyBraces |
| 70 | + "curly": [ |
| 71 | + 2, |
| 72 | + "multi-line", |
| 73 | + "consistent" |
| 74 | + ], |
| 75 | + |
| 76 | + "keyword-spacing": [ |
| 77 | + 2, |
| 78 | + { |
| 79 | + "before": true, |
| 80 | + //requireSpaceAfterKeywords |
| 81 | + "after": true |
| 82 | + } |
| 83 | + ], |
| 84 | + |
| 85 | + //requireSpaceBeforeBlockStatements |
| 86 | + "space-before-blocks": [ |
| 87 | + 2, |
| 88 | + { |
| 89 | + //requireSpacesInFunctionExpression |
| 90 | + //requireSpacesInAnonymousFunctionExpression |
| 91 | + "functions": "always", |
| 92 | + "keywords": "always", |
| 93 | + "classes": "always" |
| 94 | + } |
| 95 | + ], |
| 96 | + |
| 97 | + //requireParenthesesAroundIIFE |
| 98 | + "wrap-iife": 2, |
| 99 | + |
| 100 | + "space-before-function-paren": [ |
| 101 | + 2, |
| 102 | + { |
| 103 | + //disallowSpacesInAnonymousFunctionExpression |
| 104 | + "anonymous": "never", |
| 105 | + |
| 106 | + //disallowSpacesInFunctionExpression |
| 107 | + "named": "never" |
| 108 | + } |
| 109 | + ], |
| 110 | + |
| 111 | + //disallowEmptyBlocks |
| 112 | + "no-empty": 2, |
| 113 | + |
| 114 | + //disallowSpacesInsideArrayBrackets |
| 115 | + "array-bracket-spacing": [ |
| 116 | + 2, |
| 117 | + "never" |
| 118 | + ], |
| 119 | + |
| 120 | + //disallowSpacesInsideParentheses |
| 121 | + "space-in-parens": [ |
| 122 | + 2, |
| 123 | + "never" |
| 124 | + ], |
| 125 | + |
| 126 | + //disallowQuotedKeysInObjects |
| 127 | + "quote-props": [ |
| 128 | + 2, |
| 129 | + "as-needed", |
| 130 | + { |
| 131 | + "keywords": true |
| 132 | + } |
| 133 | + ], |
| 134 | + |
| 135 | + //disallowSpaceAfterObjectKeys |
| 136 | + "key-spacing": [ |
| 137 | + 2, |
| 138 | + { |
| 139 | + "beforeColon": false, |
| 140 | + "afterColon": true |
| 141 | + } |
| 142 | + ], |
| 143 | + |
| 144 | + //requireCommaBeforeLineBreak |
| 145 | + "comma-style": [ |
| 146 | + 2, |
| 147 | + "last" |
| 148 | + ], |
| 149 | + |
| 150 | + //requireOperatorBeforeLineBreak |
| 151 | + "operator-linebreak": [ |
| 152 | + 2, |
| 153 | + "after" |
| 154 | + ], |
| 155 | + |
| 156 | + //disallowSpaceBeforePostfixUnaryOperators |
| 157 | + "space-unary-ops": [ |
| 158 | + 2, |
| 159 | + { |
| 160 | + "words": false, |
| 161 | + "nonwords": false, |
| 162 | + |
| 163 | + //requireSpaceBeforeBinaryOperators |
| 164 | + //requireSpaceAfterBinaryOperators |
| 165 | + "overrides" :{ |
| 166 | + "=":true, |
| 167 | + "==":true, |
| 168 | + "===":true, |
| 169 | + "!=":true, |
| 170 | + "!==":true, |
| 171 | + "||":true, |
| 172 | + "&&":true |
| 173 | + } |
| 174 | + } |
| 175 | + ], |
| 176 | + |
| 177 | + //requireSpaceAfterBinaryOperators "," |
| 178 | + "comma-spacing":[ |
| 179 | + 2, |
| 180 | + { |
| 181 | + "before": false, |
| 182 | + "after": true |
| 183 | + } |
| 184 | + ], |
| 185 | + |
| 186 | + //requireSpacesInConditionalExpression |
| 187 | + "space-infix-ops": 2, |
| 188 | + |
| 189 | + //requireCamelCaseOrUpperCaseIdentifiers |
| 190 | + "camelcase": [ |
| 191 | + 2, |
| 192 | + { |
| 193 | + "properties": "always" |
| 194 | + } |
| 195 | + ], |
| 196 | + |
| 197 | + //disallowKeywords |
| 198 | + "no-with": 2, |
| 199 | + |
| 200 | + //disallowMultipleLineStrings |
| 201 | + "no-multi-str": 2, |
| 202 | + |
| 203 | + //validateQuoteMarks |
| 204 | + "quotes": [ |
| 205 | + 2, |
| 206 | + "single", |
| 207 | + "avoid-escape" |
| 208 | + ], |
| 209 | + |
| 210 | + //validateIndentation |
| 211 | + "indent": [ |
| 212 | + 2, |
| 213 | + 4, |
| 214 | + { |
| 215 | + "SwitchCase": 1, |
| 216 | + "VariableDeclarator": 1 |
| 217 | + } |
| 218 | + ], |
| 219 | + |
| 220 | + //disallowMixedSpacesAndTabs |
| 221 | + "no-mixed-spaces-and-tabs": 2, |
| 222 | + |
| 223 | + //disallowTrailingWhitespace |
| 224 | + "no-trailing-spaces": 2, |
| 225 | + |
| 226 | + //disallowTrailingComma |
| 227 | + "comma-dangle": [ |
| 228 | + 2, |
| 229 | + "never" |
| 230 | + ], |
| 231 | + |
| 232 | + //disallowKeywordsOnNewLine |
| 233 | + "brace-style": 2, |
| 234 | + |
| 235 | + //requireCapitalizedConstructors |
| 236 | + "new-cap": 2, |
| 237 | + |
| 238 | + //safeContextKeyword |
| 239 | + "consistent-this": [ |
| 240 | + 2, |
| 241 | + "that" |
| 242 | + ], |
| 243 | + |
| 244 | + //requireDotNotation |
| 245 | + "dot-notation": 2, |
| 246 | + |
| 247 | + //jsDoc |
| 248 | + "valid-jsdoc": 2, |
| 249 | + |
| 250 | + //requireSpaceAfterLineComment |
| 251 | + "spaced-comment": [ |
| 252 | + 2, |
| 253 | + "always" |
| 254 | + ], |
| 255 | + |
| 256 | + //requireLineFeedAtFileEnd |
| 257 | + "eol-last": 2 |
| 258 | + } |
| 259 | +} |
0 commit comments