1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | const path = require('path');
|
8 | const rulesDirPlugin = require('eslint-plugin-rulesdir');
|
9 | rulesDirPlugin.RULES_DIR = path.join(__dirname, 'scripts', 'eslint_rules', 'lib');
|
10 |
|
11 | module.exports = {
|
12 | 'root': true,
|
13 |
|
14 | 'env': {'browser': true, 'es6': true},
|
15 |
|
16 | 'parser': '@typescript-eslint/parser',
|
17 |
|
18 | 'plugins': [
|
19 | '@typescript-eslint',
|
20 | 'mocha',
|
21 | 'rulesdir',
|
22 | 'import',
|
23 | 'jsdoc',
|
24 | ],
|
25 |
|
26 | 'parserOptions': {'ecmaVersion': 9, 'sourceType': 'module'},
|
27 |
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | 'rules': {
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 | 'quotes': [2, 'single', {'avoidEscape': true, 'allowTemplateLiterals': false}],
|
44 | 'semi': 2,
|
45 | 'no-extra-semi': 2,
|
46 | 'comma-style': [2, 'last'],
|
47 | 'wrap-iife': [2, 'inside'],
|
48 | 'spaced-comment': [2, 'always', {'markers': ['*']}],
|
49 | 'eqeqeq': [2],
|
50 | 'accessor-pairs': [2, {'getWithoutSet': false, 'setWithoutGet': false}],
|
51 | 'curly': 2,
|
52 | 'new-parens': 2,
|
53 | 'func-call-spacing': 2,
|
54 | 'arrow-parens': [2, 'as-needed'],
|
55 | 'eol-last': 2,
|
56 |
|
57 |
|
58 | 'no-caller': 2,
|
59 | 'no-case-declarations': 2,
|
60 | 'no-cond-assign': 2,
|
61 | 'no-console': [2, {'allow': ['assert', 'context', 'error', 'timeStamp', 'time', 'timeEnd', 'warn']}],
|
62 | 'no-debugger': 2,
|
63 | 'no-dupe-keys': 2,
|
64 | 'no-duplicate-case': 2,
|
65 | 'no-else-return': [2, {'allowElseIf': false}],
|
66 | 'no-empty-character-class': 2,
|
67 | 'no-global-assign': 2,
|
68 | 'no-implied-eval': 2,
|
69 | 'no-labels': 2,
|
70 | 'no-multi-str': 2,
|
71 | 'no-new-object': 2,
|
72 | 'no-octal-escape': 2,
|
73 | 'no-self-compare': 2,
|
74 | 'no-shadow-restricted-names': 2,
|
75 | 'no-unreachable': 2,
|
76 | 'no-unsafe-negation': 2,
|
77 | 'no-unused-vars': [2, {'args': 'none', 'vars': 'local'}],
|
78 | 'no-var': 2,
|
79 | 'no-with': 2,
|
80 | 'prefer-const': 2,
|
81 | 'radix': 2,
|
82 | 'valid-typeof': 2,
|
83 | 'no-return-assign': [2, 'always'],
|
84 | 'no-implicit-coercion': 2,
|
85 |
|
86 |
|
87 | 'require-yield': 2,
|
88 | 'template-curly-spacing': [2, 'never'],
|
89 |
|
90 |
|
91 | 'no-multiple-empty-lines': [2, {'max': 1}],
|
92 | 'no-mixed-spaces-and-tabs': 2,
|
93 | 'no-trailing-spaces': 2,
|
94 | 'linebreak-style': [2, 'unix'],
|
95 |
|
96 | |
97 |
|
98 |
|
99 |
|
100 | 'indent': [0, 2, {'SwitchCase': 1, 'CallExpression': {'arguments': 2}, 'MemberExpression': 2}],
|
101 |
|
102 |
|
103 | 'brace-style': [0, 'allman', {'allowSingleLine': true}],
|
104 |
|
105 |
|
106 | 'key-spacing': [0, {'beforeColon': false, 'afterColon': true, 'align': 'value'}],
|
107 |
|
108 | 'quote-props': [0, 'as-needed'],
|
109 |
|
110 |
|
111 | 'no-implicit-globals': [0],
|
112 | 'no-unused-private-class-members': 2,
|
113 |
|
114 |
|
115 | '@typescript-eslint/naming-convention':
|
116 | [2, {'selector': 'interface', 'format': ['PascalCase'], 'custom': {'regex': '^I[A-Z]', 'match': false}}],
|
117 | '@typescript-eslint/explicit-member-accessibility': [0],
|
118 | '@typescript-eslint/no-explicit-any': 2,
|
119 |
|
120 |
|
121 | 'import/no-default-export': 2,
|
122 |
|
123 |
|
124 | 'rulesdir/commented_out_console': 2,
|
125 |
|
126 |
|
127 | 'rulesdir/commented_out_import': 2,
|
128 |
|
129 |
|
130 | 'rulesdir/es_modules_import': 2,
|
131 | 'rulesdir/check_license_header': 2,
|
132 | |
133 |
|
134 |
|
135 |
|
136 | 'jsdoc/check-alignment': 2,
|
137 | },
|
138 | 'overrides': [{
|
139 | 'files': ['*.ts'],
|
140 | 'parserOptions': {
|
141 | 'allowAutomaticSingleRunInference': true,
|
142 | 'project': path.join(__dirname, 'config', 'typescript', 'tsconfig.eslint.json'),
|
143 | },
|
144 | 'rules': {
|
145 | '@typescript-eslint/explicit-member-accessibility': [2, {'accessibility': 'no-public'}],
|
146 | 'comma-dangle': 'off',
|
147 | '@typescript-eslint/comma-dangle': [2, 'always-multiline'],
|
148 |
|
149 |
|
150 | 'no-unused-vars': 0,
|
151 | '@typescript-eslint/no-unused-vars': [2, {'argsIgnorePattern': '^_'}],
|
152 |
|
153 | 'semi': 0,
|
154 | '@typescript-eslint/semi': ['error'],
|
155 | '@typescript-eslint/member-delimiter-style': [
|
156 | 'error', {
|
157 | 'multiline': {'delimiter': 'semi', 'requireLast': true},
|
158 | 'singleline': {'delimiter': 'comma', 'requireLast': false},
|
159 | 'overrides': {
|
160 | 'interface': {
|
161 | 'singleline': {'delimiter': 'semi', 'requireLast': false},
|
162 | 'multiline': {'delimiter': 'semi', 'requireLast': true}
|
163 | },
|
164 | 'typeLiteral': {
|
165 | 'singleline': {'delimiter': 'comma', 'requireLast': false},
|
166 | 'multiline': {'delimiter': 'comma', 'requireLast': true}
|
167 | }
|
168 | }
|
169 | }
|
170 | ],
|
171 | '@typescript-eslint/no-floating-promises': [2, {ignoreVoid: true}],
|
172 |
|
173 | 'func-call-spacing': 0,
|
174 | '@typescript-eslint/func-call-spacing': 2,
|
175 |
|
176 | |
177 |
|
178 |
|
179 |
|
180 | '@typescript-eslint/prefer-enum-initializers': 2,
|
181 | |
182 |
|
183 |
|
184 |
|
185 | '@typescript-eslint/no-non-null-assertion': 2,
|
186 | '@typescript-eslint/consistent-type-imports': 2,
|
187 | 'rulesdir/const_enum': 2,
|
188 | 'rulesdir/no_underscored_properties': 2,
|
189 | 'rulesdir/prefer_readonly_keyword': 2,
|
190 | 'rulesdir/inline_type_imports': 2,
|
191 | }
|
192 | }]
|
193 | };
|
194 |
|
195 |
|