[go: nahoru, domu]

blob: 5282ddbecb60524d2250027fc008b1b29a74e3a6 [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 Lippe399a9562020-01-16 10:53:286 'parser': '@typescript-eslint/parser',
7
8 'plugins': [
9 '@typescript-eslint',
Jack Franklin8b9aa2f2020-02-12 16:35:1510 'mocha',
Tim van der Lippe399a9562020-01-16 10:53:2811 ],
12
Tim van der Lippe1d6e57a2019-09-30 11:55:3413 'parserOptions': {'ecmaVersion': 9, 'sourceType': 'module'},
Blink Reformat4c46d092018-04-07 15:32:3714
Tim van der Lippe1d6e57a2019-09-30 11:55:3415 /**
Blink Reformat4c46d092018-04-07 15:32:3716 * ESLint rules
17 *
18 * All available rules: http://eslint.org/docs/rules/
19 *
20 * Rules take the following form:
21 * "rule-name", [severity, { opts }]
22 * Severity: 2 == error, 1 == warning, 0 == off.
23 */
Tim van der Lippe1d6e57a2019-09-30 11:55:3424 'rules': {
25 /**
Blink Reformat4c46d092018-04-07 15:32:3726 * Enforced rules
27 */
28
29
Tim van der Lippe1d6e57a2019-09-30 11:55:3430 // syntax preferences
31 'quotes': [2, 'single', {'avoidEscape': true, 'allowTemplateLiterals': true}],
32 'semi': 2,
33 'no-extra-semi': 2,
34 'comma-style': [2, 'last'],
35 'wrap-iife': [2, 'inside'],
36 'spaced-comment': [2, 'always', {'markers': ['*']}],
37 'eqeqeq': [2],
38 'accessor-pairs': [2, {'getWithoutSet': false, 'setWithoutGet': false}],
39 'curly': 2,
40 'new-parens': 2,
41 'func-call-spacing': 2,
42 'arrow-parens': [2, 'as-needed'],
Tim van der Lippe20b29c22019-11-04 14:36:1543 'eol-last': 2,
Blink Reformat4c46d092018-04-07 15:32:3744
Tim van der Lippe1d6e57a2019-09-30 11:55:3445 // anti-patterns
Tim van der Lippe1d6e57a2019-09-30 11:55:3446 'no-caller': 2,
Mathias Bynensf06e8c02020-02-28 13:58:2847 'no-cond-assign': 2,
48 'no-console': [2, {'allow': ['assert', 'context', 'error', 'timeStamp', 'time', 'timeEnd', 'warn']}],
49 'no-debugger': 2,
50 'no-dupe-keys': 2,
51 'no-duplicate-case': 2,
52 'no-else-return': [2, {'allowElseIf': false}],
53 'no-empty-character-class': 2,
Tim van der Lippe1d6e57a2019-09-30 11:55:3454 'no-implied-eval': 2,
55 'no-labels': 2,
Mathias Bynensf06e8c02020-02-28 13:58:2856 'no-multi-str': 2,
Tim van der Lippe1d6e57a2019-09-30 11:55:3457 'no-new-object': 2,
58 'no-octal-escape': 2,
59 'no-self-compare': 2,
60 'no-shadow-restricted-names': 2,
Tim van der Lippe1d6e57a2019-09-30 11:55:3461 'no-unreachable': 2,
62 'no-unsafe-negation': 2,
Mathias Bynensf06e8c02020-02-28 13:58:2863 'no-unused-vars': [2, {'args': 'none', 'vars': 'local'}],
64 'no-var': 2,
65 'no-with': 2,
66 'prefer-const': 2,
Tim van der Lippe1d6e57a2019-09-30 11:55:3467 'radix': 2,
68 'valid-typeof': 2,
Blink Reformat4c46d092018-04-07 15:32:3769
Tim van der Lippe1d6e57a2019-09-30 11:55:3470 // es2015 features
71 'require-yield': 2,
72 'template-curly-spacing': [2, 'never'],
Blink Reformat4c46d092018-04-07 15:32:3773
Tim van der Lippe1d6e57a2019-09-30 11:55:3474 // spacing details
75 'space-infix-ops': 2,
76 'space-in-parens': [2, 'never'],
77 'space-before-function-paren': [2, {'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always'}],
78 'no-whitespace-before-property': 2,
79 'keyword-spacing': [
80 2, {
81 'overrides': {
82 'if': {'after': true},
83 'else': {'after': true},
84 'for': {'after': true},
85 'while': {'after': true},
86 'do': {'after': true},
87 'switch': {'after': true},
88 'return': {'after': true}
89 }
90 }
91 ],
92 'arrow-spacing': [2, {'after': true, 'before': true}],
Blink Reformat4c46d092018-04-07 15:32:3793
Tim van der Lippe1d6e57a2019-09-30 11:55:3494 // file whitespace
95 'no-multiple-empty-lines': [2, {'max': 2}],
96 'no-mixed-spaces-and-tabs': 2,
97 'no-trailing-spaces': 2,
98 'linebreak-style': [2, 'unix'],
Blink Reformat4c46d092018-04-07 15:32:3799
Tim van der Lippe1d6e57a2019-09-30 11:55:34100 /**
Blink Reformat4c46d092018-04-07 15:32:37101 * Disabled, aspirational rules
102 */
103
Tim van der Lippe1d6e57a2019-09-30 11:55:34104 'indent': [0, 2, {'SwitchCase': 1, 'CallExpression': {'arguments': 2}, 'MemberExpression': 2}],
Blink Reformat4c46d092018-04-07 15:32:37105
Tim van der Lippe1d6e57a2019-09-30 11:55:34106 // brace-style is disabled, as eslint cannot enforce 1tbs as default, but allman for functions
107 'brace-style': [0, 'allman', {'allowSingleLine': true}],
Blink Reformat4c46d092018-04-07 15:32:37108
Tim van der Lippe1d6e57a2019-09-30 11:55:34109 // key-spacing is disabled, as some objects use value-aligned spacing, some not.
110 'key-spacing': [0, {'beforeColon': false, 'afterColon': true, 'align': 'value'}],
111 // quote-props is diabled, as property quoting styles are too varied to enforce.
112 'quote-props': [0, 'as-needed'],
Blink Reformat4c46d092018-04-07 15:32:37113
Tim van der Lippe1d6e57a2019-09-30 11:55:34114 // no-implicit-globals will prevent accidental globals
Tim van der Lippe399a9562020-01-16 10:53:28115 'no-implicit-globals': [0],
116
117 '@typescript-eslint/interface-name-prefix': [2, {'prefixWithI': 'never'}],
118 '@typescript-eslint/explicit-member-accessibility': [0],
Jack Franklin8b9aa2f2020-02-12 16:35:15119
120 // errors on it('test') with no body
121 'mocha/no-pending-tests': 2,
122 // errors on {describe, it}.only
123 'mocha/no-exclusive-tests': 2,
Tim van der Lippe399a9562020-01-16 10:53:28124 },
125 'overrides': [{
126 'files': ['*.ts'],
127 'rules': {
128 '@typescript-eslint/explicit-member-accessibility': [2, {'accessibility': 'no-public'}],
129 'comma-dangle': [2, 'always-multiline'],
130 '@typescript-eslint/no-unused-vars': [2],
131 }
132 }]
Blink Reformat4c46d092018-04-07 15:32:37133};