Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame^] | 1 | module.exports = { |
| 2 | "root": true, |
| 3 | |
| 4 | "env": { |
| 5 | "browser": true, |
| 6 | "es6": true |
| 7 | }, |
| 8 | |
| 9 | "parserOptions": { |
| 10 | "ecmaVersion": 8 |
| 11 | }, |
| 12 | |
| 13 | /** |
| 14 | * ESLint rules |
| 15 | * |
| 16 | * All available rules: http://eslint.org/docs/rules/ |
| 17 | * |
| 18 | * Rules take the following form: |
| 19 | * "rule-name", [severity, { opts }] |
| 20 | * Severity: 2 == error, 1 == warning, 0 == off. |
| 21 | */ |
| 22 | "rules": { |
| 23 | /** |
| 24 | * Enforced rules |
| 25 | */ |
| 26 | |
| 27 | |
| 28 | // syntax preferences |
| 29 | "quotes": [2, "single", { |
| 30 | "avoidEscape": true, |
| 31 | "allowTemplateLiterals": true |
| 32 | }], |
| 33 | "semi": 2, |
| 34 | "no-extra-semi": 2, |
| 35 | "comma-style": [2, "last"], |
| 36 | "wrap-iife": [2, "inside"], |
| 37 | "spaced-comment": [2, "always", { |
| 38 | "markers": ["*"] |
| 39 | }], |
| 40 | "eqeqeq": [2], |
| 41 | "accessor-pairs": [2, { |
| 42 | "getWithoutSet": false, |
| 43 | "setWithoutGet": false |
| 44 | }], |
| 45 | "curly": [2, "multi-or-nest", "consistent"], |
| 46 | "new-parens": 2, |
| 47 | "func-call-spacing": 2, |
| 48 | "arrow-parens": [2, "as-needed"], |
| 49 | |
| 50 | // anti-patterns |
| 51 | "no-with": 2, |
| 52 | "no-multi-str": 2, |
| 53 | "no-caller": 2, |
| 54 | "no-implied-eval": 2, |
| 55 | "no-labels": 2, |
| 56 | "no-new-object": 2, |
| 57 | "no-octal-escape": 2, |
| 58 | "no-self-compare": 2, |
| 59 | "no-shadow-restricted-names": 2, |
| 60 | "no-cond-assign": 2, |
| 61 | "no-debugger": 2, |
| 62 | "no-console": [2, { "allow": ["assert", "context", "error", "timeStamp", "time", "timeEnd", "warn"] }], |
| 63 | "no-dupe-keys": 2, |
| 64 | "no-duplicate-case": 2, |
| 65 | "no-empty-character-class": 2, |
| 66 | "no-unreachable": 2, |
| 67 | "no-unsafe-negation": 2, |
| 68 | "radix": 2, |
| 69 | "valid-typeof": 2, |
| 70 | "no-var": 2, |
| 71 | "prefer-const": 2, |
| 72 | "no-unused-vars": [2, { "args": "none", "vars": "local" }], |
| 73 | |
| 74 | // es2015 features |
| 75 | "require-yield": 2, |
| 76 | "template-curly-spacing": [2, "never"], |
| 77 | |
| 78 | // spacing details |
| 79 | "space-infix-ops": 2, |
| 80 | "space-in-parens": [2, "never"], |
| 81 | "space-before-function-paren": [2, { |
| 82 | "anonymous": "never", |
| 83 | "named": "never", |
| 84 | "asyncArrow": "always" |
| 85 | }], |
| 86 | "no-whitespace-before-property": 2, |
| 87 | "keyword-spacing": [2, { |
| 88 | "overrides": { |
| 89 | "if": {"after": true}, |
| 90 | "else": {"after": true}, |
| 91 | "for": {"after": true}, |
| 92 | "while": {"after": true}, |
| 93 | "do": {"after": true}, |
| 94 | "switch": {"after": true}, |
| 95 | "return": {"after": true} |
| 96 | } |
| 97 | }], |
| 98 | "arrow-spacing": [2, { |
| 99 | "after": true, |
| 100 | "before": true |
| 101 | }], |
| 102 | |
| 103 | // file whitespace |
| 104 | "no-multiple-empty-lines": [2, {"max": 2}], |
| 105 | "no-mixed-spaces-and-tabs": 2, |
| 106 | "no-trailing-spaces": 2, |
| 107 | "linebreak-style": [ 2, "unix" ], |
| 108 | |
| 109 | /** |
| 110 | * Disabled, aspirational rules |
| 111 | */ |
| 112 | |
| 113 | "indent": [0, 2, { "SwitchCase": 1, "CallExpression": {"arguments": 2}, "MemberExpression": 2 }], |
| 114 | |
| 115 | // brace-style is disabled, as eslint cannot enforce 1tbs as default, but allman for functions |
| 116 | "brace-style": [0, "allman", { "allowSingleLine": true }], |
| 117 | |
| 118 | // key-spacing is disabled, as some objects use value-aligned spacing, some not. |
| 119 | "key-spacing": [0, { |
| 120 | "beforeColon": false, |
| 121 | "afterColon": true, |
| 122 | "align": "value" |
| 123 | }], |
| 124 | // quote-props is diabled, as property quoting styles are too varied to enforce. |
| 125 | "quote-props": [0, "as-needed"], |
| 126 | |
| 127 | // no-implicit-globals will prevent accidental globals |
| 128 | "no-implicit-globals": [0] |
| 129 | } |
| 130 | }; |