blob: 3dc9c0161af3052da79cc93ab1748d473d0b5143 [file] [log] [blame]
Blink Reformat4c46d092018-04-07 15:32:371module.exports = {
Tim van der Lippe1d6e57a2019-09-30 11:55:342 'root': true,
Blink Reformat4c46d092018-04-07 15:32:373
Tim van der Lippe1d6e57a2019-09-30 11:55:344 'env': {'browser': true, 'es6': true},
Blink Reformat4c46d092018-04-07 15:32:375
Tim van der Lippe1d6e57a2019-09-30 11:55:346 'parserOptions': {'ecmaVersion': 9, 'sourceType': 'module'},
Blink Reformat4c46d092018-04-07 15:32:377
Tim van der Lippe1d6e57a2019-09-30 11:55:348 /**
Blink Reformat4c46d092018-04-07 15:32:379 * ESLint rules
10 *
11 * All available rules: http://eslint.org/docs/rules/
12 *
13 * Rules take the following form:
14 * "rule-name", [severity, { opts }]
15 * Severity: 2 == error, 1 == warning, 0 == off.
16 */
Tim van der Lippe1d6e57a2019-09-30 11:55:3417 'rules': {
18 /**
Blink Reformat4c46d092018-04-07 15:32:3719 * Enforced rules
20 */
21
22
Tim van der Lippe1d6e57a2019-09-30 11:55:3423 // syntax preferences
24 'quotes': [2, 'single', {'avoidEscape': true, 'allowTemplateLiterals': true}],
25 'semi': 2,
26 'no-extra-semi': 2,
27 'comma-style': [2, 'last'],
28 'wrap-iife': [2, 'inside'],
29 'spaced-comment': [2, 'always', {'markers': ['*']}],
30 'eqeqeq': [2],
31 'accessor-pairs': [2, {'getWithoutSet': false, 'setWithoutGet': false}],
32 'curly': 2,
33 'new-parens': 2,
34 'func-call-spacing': 2,
35 'arrow-parens': [2, 'as-needed'],
Blink Reformat4c46d092018-04-07 15:32:3736
Tim van der Lippe1d6e57a2019-09-30 11:55:3437 // anti-patterns
38 'no-with': 2,
39 'no-multi-str': 2,
40 'no-caller': 2,
41 'no-implied-eval': 2,
42 'no-labels': 2,
43 'no-new-object': 2,
44 'no-octal-escape': 2,
45 'no-self-compare': 2,
46 'no-shadow-restricted-names': 2,
47 'no-cond-assign': 2,
48 'no-debugger': 2,
49 'no-console': [2, {'allow': ['assert', 'context', 'error', 'timeStamp', 'time', 'timeEnd', 'warn']}],
50 'no-dupe-keys': 2,
51 'no-duplicate-case': 2,
52 'no-empty-character-class': 2,
53 'no-unreachable': 2,
54 'no-unsafe-negation': 2,
55 'radix': 2,
56 'valid-typeof': 2,
57 'no-var': 2,
58 'prefer-const': 2,
59 'no-unused-vars': [2, {'args': 'none', 'vars': 'local'}],
Blink Reformat4c46d092018-04-07 15:32:3760
Tim van der Lippe1d6e57a2019-09-30 11:55:3461 // es2015 features
62 'require-yield': 2,
63 'template-curly-spacing': [2, 'never'],
Blink Reformat4c46d092018-04-07 15:32:3764
Tim van der Lippe1d6e57a2019-09-30 11:55:3465 // spacing details
66 'space-infix-ops': 2,
67 'space-in-parens': [2, 'never'],
68 'space-before-function-paren': [2, {'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always'}],
69 'no-whitespace-before-property': 2,
70 'keyword-spacing': [
71 2, {
72 'overrides': {
73 'if': {'after': true},
74 'else': {'after': true},
75 'for': {'after': true},
76 'while': {'after': true},
77 'do': {'after': true},
78 'switch': {'after': true},
79 'return': {'after': true}
80 }
81 }
82 ],
83 'arrow-spacing': [2, {'after': true, 'before': true}],
Blink Reformat4c46d092018-04-07 15:32:3784
Tim van der Lippe1d6e57a2019-09-30 11:55:3485 // file whitespace
86 'no-multiple-empty-lines': [2, {'max': 2}],
87 'no-mixed-spaces-and-tabs': 2,
88 'no-trailing-spaces': 2,
89 'linebreak-style': [2, 'unix'],
Blink Reformat4c46d092018-04-07 15:32:3790
Tim van der Lippe1d6e57a2019-09-30 11:55:3491 /**
Blink Reformat4c46d092018-04-07 15:32:3792 * Disabled, aspirational rules
93 */
94
Tim van der Lippe1d6e57a2019-09-30 11:55:3495 'indent': [0, 2, {'SwitchCase': 1, 'CallExpression': {'arguments': 2}, 'MemberExpression': 2}],
Blink Reformat4c46d092018-04-07 15:32:3796
Tim van der Lippe1d6e57a2019-09-30 11:55:3497 // brace-style is disabled, as eslint cannot enforce 1tbs as default, but allman for functions
98 'brace-style': [0, 'allman', {'allowSingleLine': true}],
Blink Reformat4c46d092018-04-07 15:32:3799
Tim van der Lippe1d6e57a2019-09-30 11:55:34100 // key-spacing is disabled, as some objects use value-aligned spacing, some not.
101 'key-spacing': [0, {'beforeColon': false, 'afterColon': true, 'align': 'value'}],
102 // quote-props is diabled, as property quoting styles are too varied to enforce.
103 'quote-props': [0, 'as-needed'],
Blink Reformat4c46d092018-04-07 15:32:37104
Tim van der Lippe1d6e57a2019-09-30 11:55:34105 // no-implicit-globals will prevent accidental globals
106 'no-implicit-globals': [0]
107 }
Blink Reformat4c46d092018-04-07 15:32:37108};