|
1 | 1 | { |
2 | 2 | "root": true, |
| 3 | + "extends": "@domenic", |
3 | 4 | "env": { |
4 | | - "node": true, |
5 | | - "es6": true |
6 | | - }, |
7 | | - "parserOptions": { |
8 | | - "ecmaVersion": 2019 |
| 5 | + "node": true |
9 | 6 | }, |
10 | 7 | "plugins": [ |
11 | 8 | "jsdom-internal" |
12 | 9 | ], |
13 | 10 | "rules": { |
14 | | - // Possible errors |
15 | | - "for-direction": "error", |
16 | | - "getter-return": "error", |
17 | | - "no-await-in-loop": "error", |
18 | | - "no-compare-neg-zero": "error", |
19 | | - "no-cond-assign": ["error", "except-parens"], |
20 | | - "no-console": "error", |
21 | | - "no-constant-condition": ["error", { "checkLoops": false }], |
22 | | - "no-control-regex": "off", |
23 | | - "no-debugger": "error", |
24 | | - "no-dupe-args": "error", |
25 | | - "no-dupe-keys": "error", |
26 | | - "no-duplicate-case": "error", |
27 | | - "no-empty": "error", |
28 | | - "no-empty-character-class": "error", |
29 | | - "no-ex-assign": "error", |
30 | | - "no-extra-boolean-cast": "error", |
31 | | - "no-extra-parens": [ |
32 | | - "error", |
33 | | - "all", |
34 | | - { "conditionalAssign": false, "nestedBinaryExpressions": false, "returnAssign": false, "enforceForNewInMemberExpressions": false } |
35 | | - ], |
36 | | - "no-extra-semi": "error", |
37 | | - "no-func-assign": "error", |
38 | | - "no-inner-declarations": "off", |
39 | | - "no-invalid-regexp": "error", |
40 | | - "no-irregular-whitespace": "error", |
41 | | - "no-obj-calls": "error", |
42 | | - "no-prototype-builtins": "error", |
43 | | - "no-regex-spaces": "error", |
44 | | - "no-sparse-arrays": "error", |
45 | | - "no-template-curly-in-string": "error", |
46 | | - "no-unexpected-multiline": "error", |
47 | | - "no-unreachable": "error", |
48 | | - "no-unsafe-finally": "off", |
49 | | - "no-unsafe-negation": "error", |
50 | | - "use-isnan": "error", |
51 | | - "valid-jsdoc": "off", |
52 | | - "valid-typeof": "error", |
53 | | - |
54 | | - // Best practices |
55 | | - "accessor-pairs": "error", |
56 | | - "array-callback-return": "error", |
57 | | - "block-scoped-var": "off", |
58 | | - "class-methods-use-this": "off", |
59 | | - "complexity": "off", |
60 | | - "consistent-return": "error", |
61 | | - "curly": ["error", "all"], |
62 | | - "default-case": "off", |
63 | | - "dot-location": ["error", "property"], |
64 | | - "dot-notation": "error", |
65 | | - "eqeqeq": "error", |
66 | | - "guard-for-in": "off", |
67 | | - "no-alert": "error", |
68 | | - "no-caller": "error", |
69 | | - "no-case-declarations": "error", |
70 | | - "no-div-regex": "off", |
71 | | - "no-else-return": "error", |
72 | | - "no-empty-function": "off", |
73 | | - "no-empty-pattern": "error", |
74 | | - "no-eq-null": "error", |
75 | | - "no-eval": "error", |
76 | | - "no-extend-native": "error", |
77 | | - "no-extra-bind": "error", |
78 | | - "no-extra-label": "error", |
79 | | - "no-fallthrough": "error", |
80 | | - "no-floating-decimal": "error", |
81 | | - "no-global-assign": "error", |
82 | | - "no-implicit-coercion": "error", |
83 | | - "no-implicit-globals": "error", |
| 11 | + // Overrides for jsdom |
| 12 | + "array-element-newline": "off", |
84 | 13 | "no-implied-eval": "off", |
85 | | - "no-invalid-this": "off", // meh |
86 | | - "no-iterator": "error", |
87 | | - "no-labels": ["error", { "allowLoop": true }], |
88 | | - "no-lone-blocks": "error", |
89 | | - "no-loop-func": "off", |
90 | | - "no-magic-numbers": "off", |
91 | | - "no-multi-spaces": "error", |
92 | | - "no-multi-str": "error", |
93 | | - "no-new": "error", |
94 | | - "no-new-func": "error", |
95 | | - "no-new-wrappers": "error", |
96 | | - "no-octal": "error", |
97 | | - "no-octal-escape": "error", |
98 | | - "no-param-reassign": "off", |
99 | | - "no-process-env": "error", |
100 | | - "no-proto": "error", |
101 | | - "no-redeclare": "error", |
102 | | - "no-restricted-properties": "off", |
103 | | - "no-return-assign": ["error", "except-parens"], |
104 | | - "no-return-await": "error", |
105 | | - "no-script-url": "off", |
106 | | - "no-self-assign": "error", |
107 | | - "no-self-compare": "error", |
108 | | - "no-sequences": "error", |
109 | | - "no-throw-literal": "error", |
110 | | - "no-unmodified-loop-condition": "error", |
111 | | - "no-unused-expressions": "error", |
112 | | - "no-unused-labels": "error", |
113 | | - "no-useless-call": "error", |
114 | | - "no-useless-concat": "error", |
115 | | - "no-useless-escape": "error", |
116 | | - "no-useless-return": "error", |
117 | | - "no-void": "error", |
118 | | - "no-warning-comments": "off", |
119 | | - "no-with": "error", |
120 | | - "prefer-promise-reject-errors": "error", |
121 | | - "radix": ["error", "as-needed"], |
122 | | - "require-await": "error", |
123 | | - "vars-on-top": "off", |
124 | | - "wrap-iife": ["error", "outside"], |
125 | | - "yoda": ["error", "never"], |
126 | | - |
127 | | - // Strict Mode |
128 | | - "strict": ["error", "global"], |
129 | | - |
130 | | - // Variables |
131 | | - "init-declarations": "off", |
132 | | - "no-catch-shadow": "error", |
133 | | - "no-delete-var": "error", |
134 | | - "no-label-var": "error", |
135 | | - "no-restricted-globals": "off", |
136 | | - "no-shadow": "error", |
137 | | - "no-shadow-restricted-names": "error", |
138 | | - "no-undef": "error", |
139 | | - "no-undef-init": "error", |
140 | | - "no-undefined": "off", |
141 | | - "no-unused-vars": "error", |
142 | | - "no-use-before-define": ["error", "nofunc"], |
143 | | - |
144 | | - // Node.js and CommonJS |
145 | | - "callback-return": "off", |
146 | | - "global-require": "error", |
147 | | - "handle-callback-err": "error", |
148 | | - "no-buffer-constructor": "error", |
149 | | - "no-mixed-requires": ["error", true], |
150 | | - "no-new-require": "error", |
151 | | - "no-path-concat": "error", |
152 | | - "no-process-exit": "error", |
153 | | - "no-restricted-modules": "off", |
154 | | - "no-sync": "off", |
155 | | - |
156 | | - // Stylistic Issues |
157 | | - "array-bracket-newline": ["error", { "multiline": true }], |
158 | | - "array-bracket-spacing": ["error", "never"], |
159 | | - "array-element-newline": ["off"], |
160 | | - "block-spacing": ["error", "always"], |
161 | | - "brace-style": ["error", "1tbs", { "allowSingleLine": false }], |
162 | | - "camelcase": ["error", { "properties": "always" }], |
163 | | - "capitalized-comments": "off", |
164 | | - "comma-dangle": ["error", "never"], |
165 | | - "comma-spacing": ["error", { "before": false, "after": true }], |
166 | | - "comma-style": ["error", "last"], |
167 | | - "computed-property-spacing": ["error", "never"], |
168 | | - "consistent-this": "off", |
169 | | - "eol-last": "error", |
170 | | - "func-call-spacing": ["error", "never"], |
171 | | - "func-name-matching": ["error"], |
172 | | - "func-names": "off", |
173 | | - "func-style": ["error", "declaration"], |
174 | | - "function-paren-newline": ["error", "multiline"], |
175 | | - "id-blacklist": "off", |
176 | | - "id-length": "off", |
177 | | - "id-match": "off", |
178 | | - "indent": ["error", 2, { "SwitchCase": 1, "CallExpression": {"arguments": "first"}, "FunctionExpression": {"parameters": "first"}, "ignoredNodes": ["ConditionalExpression"] }], |
179 | | - "jsx-quotes": "off", |
180 | | - "key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }], |
181 | | - "keyword-spacing": ["error", { "before": true, "after": true }], |
182 | | - "line-comment-position": "off", |
183 | | - "linebreak-style": ["error", "unix"], |
184 | | - "lines-around-comment": "off", |
185 | | - "max-depth": "off", |
186 | | - "max-len": ["error", 120, { "ignoreUrls": true }], |
187 | | - "max-lines": "off", |
188 | | - "max-nested-callbacks": "off", |
189 | | - "max-params": "off", |
190 | | - "max-statements": "off", |
191 | | - "max-statements-per-line": ["error", { "max": 1 }], |
192 | | - "multiline-ternary": ["error", "always-multiline"], |
193 | | - "new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }], |
194 | | - "new-parens": "error", |
195 | | - "newline-per-chained-call": "off", |
196 | | - "no-array-constructor": "error", |
197 | | - "no-bitwise": "off", |
198 | | - "no-continue": "off", |
199 | | - "no-inline-comments": "off", |
200 | | - "no-lonely-if": "error", |
201 | | - "no-mixed-operators": [ |
202 | | - "error", |
203 | | - { |
204 | | - "groups": [ |
205 | | - ["&", "|", "^", "~", "<<", ">>", ">>>"], |
206 | | - ["==", "!=", "===", "!==", ">", ">=", "<", "<="], |
207 | | - ["&&", "||"], |
208 | | - ["in", "instanceof"] |
209 | | - ] |
210 | | - } |
211 | | - ], |
212 | | - "no-mixed-spaces-and-tabs": "error", |
213 | | - "no-multi-assign": "off", |
214 | | - "no-multiple-empty-lines": "error", |
215 | | - "no-negated-condition": "off", |
216 | | - "no-nested-ternary": "error", |
217 | | - "no-new-object": "error", |
218 | | - "no-plusplus": "off", |
219 | | - "no-restricted-syntax": "off", |
220 | | - "no-tabs": "error", |
221 | | - "no-ternary": "off", |
222 | | - "no-trailing-spaces": "error", |
223 | | - "no-underscore-dangle": "off", |
224 | | - "no-unneeded-ternary": "error", |
225 | | - "no-whitespace-before-property": "error", |
226 | | - "nonblock-statement-body-position": "error", |
227 | | - "object-curly-newline": ["error", { "consistent": true }], |
228 | | - "object-curly-spacing": ["error", "always"], |
229 | | - "object-property-newline": "off", |
230 | | - "one-var": ["error", "never"], |
231 | | - "one-var-declaration-per-line": ["error", "initializations"], |
232 | | - "operator-assignment": ["error", "always"], |
233 | | - "operator-linebreak": ["error", "after"], |
234 | | - "padded-blocks": ["error", "never"], |
235 | | - "padding-line-between-statements": "off", |
236 | | - "quote-props": ["error", "as-needed"], |
237 | | - "quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], |
238 | | - "require-jsdoc": "off", |
239 | | - "semi": ["error", "always"], |
240 | | - "semi-spacing": "error", |
241 | | - "semi-style": "error", |
242 | | - "sort-keys": "off", |
243 | | - "sort-vars": "off", |
244 | | - "space-before-blocks": ["error", "always"], |
245 | | - "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }], |
246 | | - "space-in-parens": ["error", "never"], |
247 | | - "space-infix-ops": "error", |
248 | | - "space-unary-ops": ["error", { "words": true, "nonwords": false }], |
249 | | - "spaced-comment": ["error", "always", { "markers": ["///"] }], |
250 | | - "switch-colon-spacing": "error", |
251 | | - "template-tag-spacing": "error", |
252 | | - "unicode-bom": "error", |
253 | | - "wrap-regex": "off", |
254 | | - |
255 | | - // ECMAScript 6 |
256 | | - "arrow-body-style": "off", // meh |
257 | | - "arrow-parens": ["error", "as-needed"], |
258 | | - "arrow-spacing": "error", |
259 | | - "constructor-super": "error", |
260 | | - "generator-star-spacing": ["error", "after"], |
261 | | - "no-class-assign": "error", |
262 | | - "no-confusing-arrow": "off", |
263 | | - "no-const-assign": "error", |
264 | | - "no-dupe-class-members": "error", |
265 | | - "no-duplicate-imports": "error", |
266 | | - "no-new-symbol": "error", |
267 | | - "no-restricted-imports": "off", |
268 | | - "no-this-before-super": "error", |
269 | | - "no-useless-computed-key": "error", |
270 | | - "no-useless-constructor": "error", |
271 | | - "no-useless-rename": "error", |
272 | | - "no-var": "error", |
273 | | - "object-shorthand": "error", |
274 | | - "prefer-arrow-callback": "error", |
275 | | - "prefer-const": ["error", { "ignoreReadBeforeAssign": true }], |
276 | | - "prefer-destructuring": ["error", { "VariableDeclarator": { "array": false, "object": true }, "AssignmentExpression": { "array": false, "object": false } }, { "enforceForRenamedProperties": false }], |
277 | | - "prefer-numeric-literals": "error", |
278 | | - "prefer-rest-params": "off", |
279 | | - "prefer-spread": "error", |
| 14 | + "no-invalid-this": "off", |
| 15 | + "require-unicode-regexp": "off", |
280 | 16 | "prefer-template": "off", |
281 | | - "require-yield": "error", |
282 | | - "rest-spread-spacing": "error", |
283 | | - "sort-imports": "off", |
284 | | - "symbol-description": "error", |
285 | | - "template-curly-spacing": ["error", "never"], |
286 | | - "yield-star-spacing": ["error", "after"], |
| 17 | + "new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }], |
287 | 18 |
|
288 | 19 | // Custom rules |
289 | 20 | "jsdom-internal/hook-super-invocation": ["error", |
|
309 | 40 | { "property": "toggleAttribute", "message": "Use 'setAttributeNS' and 'removeAttributeNS' with null as the namespace to access attributes within jsdom" } |
310 | 41 | ] |
311 | 42 | } |
| 43 | + }, |
| 44 | + { |
| 45 | + "files": ["test/api/**"], |
| 46 | + "rules": { |
| 47 | + "no-loop-func": "off" // interacts poorly with Mocha's before() and tests generated using loops |
| 48 | + } |
312 | 49 | } |
313 | 50 | ] |
314 | 51 | } |
0 commit comments