|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -module.exports = { |
4 |
| - env: { |
5 |
| - es6: true, |
6 |
| - node: true, |
7 |
| - }, |
8 |
| - extends: ['plugin:vue/base'], |
9 |
| - overrides: [ |
10 |
| - { |
11 |
| - files: '*.ts', |
12 |
| - extends: [ |
13 |
| - 'plugin:@typescript-eslint/eslint-recommended', |
14 |
| - 'plugin:@typescript-eslint/recommended', |
15 |
| - 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
16 |
| - ], |
17 |
| - parser: '@typescript-eslint/parser', |
18 |
| - parserOptions: { |
19 |
| - project: 'tsconfig.json', |
20 |
| - tsconfigRootDir: '.', |
21 |
| - }, |
22 |
| - plugins: ['@typescript-eslint'], |
23 |
| - rules: { |
24 |
| - '@typescript-eslint/no-floating-promises': 'off', |
25 |
| - }, |
26 |
| - }, |
27 |
| - { |
28 |
| - files: '*.js', |
29 |
| - extends: ['eslint:recommended'], |
30 |
| - parserOptions: { |
31 |
| - ecmaVersion: '2017', |
32 |
| - }, |
33 |
| - rules: { |
34 |
| - strict: ['error', 'global'], |
35 |
| - |
36 |
| - 'jsdoc/no-undefined-types': 'warn', |
37 |
| - }, |
38 |
| - }, |
39 |
| - ], |
40 |
| - plugins: ['jsdoc', 'vue'], |
41 |
| - rules: { |
42 |
| - /* |
43 |
| - * Possible errors |
44 |
| - */ |
45 |
| - |
46 |
| - // Enforce "for" loop update clause moving the counter |
47 |
| - // in the right direction |
48 |
| - 'for-direction': 'error', |
49 |
| - |
50 |
| - // Allow unnecessary parentheses |
51 |
| - 'no-extra-parens': 'off', |
52 |
| - |
53 |
| - // Disallow template literal placeholder syntax in regular string |
54 |
| - 'no-template-curly-in-string': 'error', |
55 |
| - |
56 |
| - /* |
57 |
| - * Best practices |
58 |
| - */ |
59 |
| - |
60 |
| - // Enforce consistent brace style for all control statements |
61 |
| - curly: 'error', |
62 |
| - |
63 |
| - // Require the use of === and !== |
64 |
| - eqeqeq: 'error', |
65 |
| - |
66 |
| - // Disallow `else` blocks after `return` statements in `if` statements |
67 |
| - 'no-else-return': 'error', |
68 |
| - |
69 |
| - // Disallow empty functions |
70 |
| - 'no-empty-function': 'error', |
71 |
| - |
72 |
| - // Disallow function declarations and expressions inside loop statements |
73 |
| - 'no-loop-func': 'error', |
74 |
| - |
75 |
| - // Disallow new operators with the String, Number, and Boolean objects |
76 |
| - 'no-new-wrappers': 'error', |
77 |
| - |
78 |
| - // Disallow reassigning function parameters |
79 |
| - 'no-param-reassign': 'error', |
80 |
| - |
81 |
| - // Disallow unnecessary concatenation of strings |
82 |
| - 'no-useless-concat': 'error', |
83 |
| - |
84 |
| - // Disallow redundant return statements |
85 |
| - 'no-useless-return': 'error', |
86 |
| - |
87 |
| - /* |
88 |
| - * Stylistic issues |
89 |
| - */ |
90 |
| - |
91 |
| - // Require 'one true brace style', in which the opening brace |
92 |
| - // of a block is placed on the same line as its corresponding |
93 |
| - // statement or declaration |
94 |
| - 'brace-style': ['error', '1tbs'], |
95 |
| - |
96 |
| - // Disallow spaces inside of brackets |
97 |
| - 'array-bracket-spacing': ['error', 'never'], |
98 |
| - |
99 |
| - // Require CamelCase |
100 |
| - camelcase: ['error', { properties: 'never' }], |
101 |
| - |
102 |
| - // Require or disallow trailing commas |
103 |
| - 'comma-dangle': [ |
104 |
| - 'error', |
105 |
| - { |
106 |
| - arrays: 'always-multiline', |
107 |
| - objects: 'always-multiline', |
108 |
| - imports: 'always-multiline', |
109 |
| - exports: 'never', |
110 |
| - functions: 'never', |
111 |
| - }, |
112 |
| - ], |
113 |
| - |
114 |
| - // Require space after comma |
115 |
| - 'comma-spacing': ['error', { after: true }], |
116 |
| - |
117 |
| - // Require newline at the end of files |
118 |
| - 'eol-last': ['error', 'always'], |
119 |
| - |
120 |
| - // Disallow spacing between function identifiers and their invocations |
121 |
| - 'func-call-spacing': 'error', |
122 |
| - |
123 |
| - // Use tabs as indentation |
124 |
| - // Enforce indentation level for case clauses in switch statements |
125 |
| - indent: ['error', 'tab', { SwitchCase: 1 }], |
126 |
| - |
127 |
| - // Require space after colon in object literal properties |
128 |
| - 'key-spacing': ['error', { afterColon: true }], |
129 |
| - |
130 |
| - // Require space before and after keywords |
131 |
| - 'keyword-spacing': 'error', |
132 |
| - |
133 |
| - // Require Unix line endings |
134 |
| - 'linebreak-style': ['error', 'unix'], |
| 3 | +const { baseRules, jsRules } = require('./rules'); |
135 | 4 |
|
136 |
| - // Disallow empty block statements |
137 |
| - 'no-empty': ['error', { allowEmptyCatch: true }], |
138 |
| - |
139 |
| - // Disallow `if` statements as the only statement in `else` blocks |
140 |
| - 'no-lonely-if': 'error', |
141 |
| - |
142 |
| - // Disallow multiple spaces |
143 |
| - 'no-multi-spaces': 'error', |
144 |
| - |
145 |
| - // Disallow nested ternary expressions |
146 |
| - 'no-nested-ternary': 'error', |
147 |
| - |
148 |
| - // Disallow trailing whitespace at the end of lines |
149 |
| - 'no-trailing-spaces': 'error', |
150 |
| - |
151 |
| - // Disallow ternary operators when simpler alternatives exist |
152 |
| - 'no-unneeded-ternary': 'error', |
153 |
| - |
154 |
| - // Disallow whitespace before properties |
155 |
| - 'no-whitespace-before-property': 'error', |
156 |
| - |
157 |
| - 'one-var': ['error', 'never'], |
158 |
| - |
159 |
| - // Require spaces inside curly braces |
160 |
| - 'object-curly-spacing': ['error', 'always'], |
161 |
| - |
162 |
| - // Require single quotes |
163 |
| - quotes: [ |
164 |
| - 'error', |
165 |
| - 'single', |
166 |
| - { |
167 |
| - avoidEscape: true, |
168 |
| - }, |
169 |
| - ], |
170 |
| - |
171 |
| - // Require space before blocks |
172 |
| - 'space-before-blocks': ['error', 'always'], |
173 |
| - |
174 |
| - // Disallow a space before function parenthesis |
175 |
| - 'space-before-function-paren': [ |
176 |
| - 'error', |
177 |
| - { |
178 |
| - named: 'never', |
179 |
| - anonymous: 'never', |
180 |
| - asyncArrow: 'always', |
181 |
| - }, |
182 |
| - ], |
183 |
| - |
184 |
| - // Disallow spaces inside of parentheses |
185 |
| - 'space-in-parens': 'error', |
186 |
| - |
187 |
| - // Require spacing around infix operators |
188 |
| - 'space-infix-ops': 'error', |
189 |
| - |
190 |
| - // Enforce consistent spacing after the // or /* in a comment |
191 |
| - 'spaced-comment': 'error', |
192 |
| - |
193 |
| - // Require semicolon at the end of statement |
194 |
| - semi: ['error', 'always'], |
195 |
| - |
196 |
| - // Enforce spacing around colons of switch statements |
197 |
| - 'switch-colon-spacing': ['error', { after: true, before: false }], |
198 |
| - |
199 |
| - /* |
200 |
| - * ECMAScript 6 |
201 |
| - */ |
202 |
| - |
203 |
| - // Require parentheses around arrow function arguments |
204 |
| - 'arrow-parens': 'error', |
205 |
| - 'arrow-spacing': 'error', |
206 |
| - |
207 |
| - // Require let or const instead of var |
208 |
| - 'no-var': 'error', |
209 |
| - |
210 |
| - // Require method and property shorthand syntax for object literals |
211 |
| - 'object-shorthand': ['error', 'always'], |
212 |
| - |
213 |
| - // Require `const` declarations for variables |
214 |
| - // that are never reassigned after declared |
215 |
| - 'prefer-const': ['error', { destructuring: 'all' }], |
216 |
| - |
217 |
| - // Require template literals instead of string concatenation |
218 |
| - 'prefer-template': 'error', |
219 |
| - |
220 |
| - // Disallow spacing around embedded expressions of template strings |
221 |
| - 'template-curly-spacing': 'error', |
222 |
| - |
223 |
| - /* |
224 |
| - * JSDoc plugin |
225 |
| - */ |
226 |
| - |
227 |
| - 'jsdoc/check-param-names': 'warn', |
228 |
| - 'jsdoc/check-syntax': 'warn', |
229 |
| - 'jsdoc/check-tag-names': 'warn', |
230 |
| - 'jsdoc/check-types': ['warn', { noDefaults: true }], |
231 |
| - 'jsdoc/require-param': 'warn', |
232 |
| - 'jsdoc/require-param-description': 'warn', |
233 |
| - 'jsdoc/require-param-name': 'warn', |
234 |
| - 'jsdoc/require-param-type': 'warn', |
235 |
| - 'jsdoc/require-returns-check': 'warn', |
236 |
| - 'jsdoc/require-returns-description': 'warn', |
237 |
| - 'jsdoc/require-returns-type': 'warn', |
238 |
| - 'jsdoc/valid-types': 'warn', |
239 |
| - }, |
240 |
| - settings: { |
241 |
| - jsdoc: { |
242 |
| - tagNamePreference: { |
243 |
| - class: 'constructor', |
244 |
| - returns: 'return', |
245 |
| - }, |
246 |
| - }, |
247 |
| - }, |
| 5 | +module.exports = { |
| 6 | + ...baseRules, |
| 7 | + overrides: [jsRules], |
248 | 8 | };
|
0 commit comments