@html-validate/eslint-config 9.4.6 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -34,6 +34,20 @@ function filterRules(rules, predicate) {
34
34
  }
35
35
 
36
36
  export default [
37
+ defineConfig({
38
+ name: "@html-validate/eslint-config/global-ignore",
39
+ ignores: [
40
+ "**/.vscode-test/**", // @vscode/test-electron
41
+ "**/coverage/**",
42
+ "**/dist/**",
43
+ "**/node_modules/**",
44
+ "**/out/**", // vscode-html-validate
45
+ "**/public/assets/**",
46
+ "**/temp/**",
47
+ "**/public/*.hot-update.js", // webpack
48
+ ],
49
+ }),
50
+
37
51
  defineConfig({
38
52
  name: "@html-validate/eslint-config/language-options",
39
53
  languageOptions: {
@@ -96,9 +110,11 @@ export default [
96
110
 
97
111
  /* enable eslint-plugin-unicorn */
98
112
  ...eslintPluginUnicorn.configs.recommended.rules,
99
- "unicorn/better-dom-traversing": "error",
100
113
  "unicorn/catch-error-name": "off",
114
+ "unicorn/comment-content": "error",
101
115
  "unicorn/consistent-assert": "off",
116
+ "unicorn/consistent-boolean-name": "off", // while i would like this for variables I prefer not to force it on parameters, etc
117
+ "unicorn/consistent-class-member-order": "off",
102
118
  "unicorn/consistent-compound-words": [
103
119
  "error",
104
120
  {
@@ -109,20 +125,14 @@ export default [
109
125
  },
110
126
  },
111
127
  ],
112
- "unicorn/consistent-date-clone": "error",
113
128
  "unicorn/consistent-empty-array-spread": "off",
114
- "unicorn/consistent-existence-index-check": "error",
115
- "unicorn/consistent-function-scoping": "error",
116
- "unicorn/consistent-json-file-read": "error",
117
- "unicorn/consistent-template-literal-escape": "error",
118
129
  "unicorn/custom-error-definition": "error",
119
130
  "unicorn/dom-node-dataset": "off",
120
- "unicorn/error-message": "error",
121
131
  "unicorn/escape-case": "off", // typically not useful for this organisation
122
132
  "unicorn/expiring-todo-comments": "off", // could be useful later
123
133
  "unicorn/explicit-length-check": ["error", { "non-zero": "greater-than" }],
124
134
  "unicorn/filename-case": [
125
- // enforce kebab-case in filenames
135
+ /* enforce kebab-case in filenames */
126
136
  "error",
127
137
  {
128
138
  case: "kebabCase",
@@ -130,157 +140,62 @@ export default [
130
140
  },
131
141
  ],
132
142
  "unicorn/import-style": "off", // off for now
133
- "unicorn/isolated-functions": "error",
134
- "unicorn/new-for-builtins": "error",
135
143
  "unicorn/no-abusive-eslint-disable": "off", // covered by eslint-plugin-eslint-comments
136
- "unicorn/no-accessor-recursion": "error",
137
- "unicorn/no-anonymous-default-export": "error",
138
- "unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part typescript will handle this)
139
- "unicorn/no-array-fill-with-reference-type": "error",
140
- "unicorn/no-array-for-each": "error",
141
- "unicorn/no-array-from-fill": "error",
142
- "unicorn/no-array-method-this-argument": "error",
144
+ "unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part TypeScript will handle this)
143
145
  "unicorn/no-array-reduce": "off", // allow usage of reduce()
144
- "unicorn/no-array-reverse": "error", // prefer immutable .toReversed() (available in Node.js 20+)
145
- "unicorn/no-array-sort": "error", // prefer immutable .toSorted() (available in Node.js 20+)
146
- "unicorn/no-await-expression-member": "error",
147
- "unicorn/no-await-in-promise-methods": "error",
148
- "unicorn/no-blob-to-file": "error",
149
146
  "unicorn/no-canvas-to-image": "off", // not really relevant for the html-validate projects
150
- "unicorn/no-confusing-array-splice": "error",
151
- "unicorn/no-console-spaces": "error",
152
147
  "unicorn/no-document-cookie": "off", // typically not useful for this organisation
153
- "unicorn/no-duplicate-set-values": "error",
154
148
  "unicorn/no-empty-file": "off",
155
- "unicorn/no-exports-in-scripts": "error",
156
- "unicorn/no-for-loop": "error",
157
- "unicorn/no-hex-escape": "error",
158
149
  "unicorn/no-immediate-mutation": "off",
159
- "unicorn/no-incorrect-query-selector": "error",
160
- "unicorn/no-instanceof-builtins": "error",
161
- "unicorn/no-invalid-fetch-options": "off", // let typescript and tests handle this
162
- "unicorn/no-invalid-file-input-accept": "off",
163
- "unicorn/no-invalid-remove-event-listener": "error",
164
- "unicorn/no-late-current-target-access": "error",
165
- "unicorn/no-magic-array-flat-depth": "error",
166
- "unicorn/no-manually-wrapped-comments": "off",
167
- "unicorn/no-named-default": "off", // named default is useful for vue
150
+ "unicorn/no-invalid-argument-count": "off", // does not respect optional parameters (e.g. jsdoc [param])
151
+ "unicorn/no-invalid-fetch-options": "off", // let TypeScript and tests handle this
152
+ "unicorn/no-named-default": "off", // named default is useful for Vue.js
168
153
  "unicorn/no-negated-condition": "off", // mostly agree with the rule but sometimes its useful to have the common case first even if negated
169
154
  "unicorn/no-negation-in-equality-check": "off",
170
- "unicorn/no-new-array": "error",
171
- "unicorn/no-new-buffer": "error",
172
155
  "unicorn/no-null": "off", // prefer using null over undefined
173
- "unicorn/no-object-as-default-parameter": "error",
174
156
  "unicorn/no-process-exit": "off", // covered by n/no-process-exit (enabled by recommended-module preset)
175
157
  "unicorn/no-single-promise-in-promise-methods": "warn",
176
158
  "unicorn/no-static-only-class": "off",
177
159
  "unicorn/no-thenable": "off",
178
- "unicorn/no-this-assignment": "error",
179
160
  "unicorn/no-this-outside-of-class": "off", // disagree somewhat with the rule, flags stateful objects
180
- "unicorn/no-typeof-undefined": "error",
181
- "unicorn/no-unnecessary-array-flat-depth": "error",
182
- "unicorn/no-unnecessary-array-splice-count": "error",
183
- "unicorn/no-unnecessary-await": "error",
184
- "unicorn/no-unnecessary-nested-ternary": "error",
185
161
  "unicorn/no-unnecessary-polyfills": "off",
186
- "unicorn/no-unnecessary-slice-end": "error",
187
162
  "unicorn/no-unreadable-array-destructuring": "off",
188
163
  "unicorn/no-unreadable-iife": "off",
189
- "unicorn/no-unused-array-method-return": "error",
190
- "unicorn/no-useless-collection-argument": "error",
191
- "unicorn/no-useless-error-capture-stack-trace": "error",
192
- "unicorn/no-useless-fallback-in-spread": "error",
193
- "unicorn/no-useless-iterator-to-array": "error",
194
- "unicorn/no-useless-length-check": "error",
195
- "unicorn/no-useless-promise-resolve-reject": "error",
196
- "unicorn/no-useless-spread": "error",
197
164
  "unicorn/no-useless-switch-case": "off",
198
165
  "unicorn/no-useless-undefined": "off", // opinionated, I prefer to explicitly pass undefined
199
- "unicorn/no-zero-fractions": "error",
200
166
  "unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
201
167
  "unicorn/numeric-separators-style": "off",
202
- "unicorn/prefer-add-event-listener": "error",
203
- "unicorn/prefer-array-find": "error",
204
- "unicorn/prefer-array-flat": "error",
205
- "unicorn/prefer-array-flat-map": "error",
206
- "unicorn/prefer-array-index-of": "error",
207
- "unicorn/prefer-array-last-methods": "error",
208
- "unicorn/prefer-array-some": "error",
209
- "unicorn/prefer-at": "error",
210
168
  "unicorn/prefer-bigint-literals": "off",
211
- "unicorn/prefer-blob-reading-methods": "error",
212
- "unicorn/prefer-class-fields": "error",
213
169
  "unicorn/prefer-classlist-toggle": "off",
214
- "unicorn/prefer-code-point": "error",
215
- "unicorn/prefer-date-now": "error",
216
- "unicorn/prefer-default-parameters": "error",
217
170
  "unicorn/prefer-dom-node-append": "off",
218
171
  "unicorn/prefer-dom-node-remove": "off",
219
172
  "unicorn/prefer-dom-node-text-content": "off",
220
173
  "unicorn/prefer-event-target": "off",
221
- "unicorn/prefer-export-from": "error",
222
- "unicorn/prefer-get-or-insert-computed": "error",
223
174
  "unicorn/prefer-global-this": "off",
224
- "unicorn/prefer-https": "error",
225
175
  "unicorn/prefer-import-meta-properties": "error",
226
- "unicorn/prefer-includes": "error",
227
- "unicorn/prefer-includes-over-repeated-comparisons": "error",
228
- "unicorn/prefer-iterator-concat": "off",
229
- "unicorn/prefer-iterator-to-array-at-end": "error",
230
- "unicorn/prefer-keyboard-event-key": "error",
231
176
  "unicorn/prefer-logical-operator-over-ternary": "off",
232
- "unicorn/prefer-math-abs": "error",
233
- "unicorn/prefer-math-min-max": "error",
234
- "unicorn/prefer-math-trunc": "error",
235
177
  "unicorn/prefer-modern-dom-apis": "off",
236
- "unicorn/prefer-modern-math-apis": "error",
237
178
  "unicorn/prefer-module": "off",
238
179
  "unicorn/prefer-native-coercion-functions": "off",
239
- "unicorn/prefer-negative-index": "error",
240
- "unicorn/prefer-number-properties": "error",
241
- "unicorn/prefer-object-from-entries": "error",
242
180
  "unicorn/prefer-optional-catch-binding": "off", // covered by sonarjs/no-ignored-exceptions
243
- "unicorn/prefer-prototype-methods": "error",
244
- "unicorn/prefer-query-selector": "error",
245
181
  "unicorn/prefer-queue-microtask": [
246
182
  "error",
247
183
  { checkSetImmediate: true, checkSetTimeout: true },
248
184
  ],
249
- "unicorn/prefer-reflect-apply": "error",
250
- "unicorn/prefer-regexp-test": "error",
251
185
  "unicorn/prefer-response-static-json": "off",
252
- "unicorn/prefer-set-has": "error",
253
- "unicorn/prefer-set-size": "error",
254
- "unicorn/prefer-simple-condition-first": "error",
186
+ "unicorn/prefer-scoped-selector": "off",
187
+ "unicorn/prefer-short-arrow-method": "off",
255
188
  "unicorn/prefer-single-call": "off",
256
- "unicorn/prefer-split-limit": "error",
257
189
  "unicorn/prefer-spread": "off", // for now
258
- "unicorn/prefer-string-match-all": "error",
259
- "unicorn/prefer-string-pad-start-end": "error",
260
190
  "unicorn/prefer-string-raw": "off", // for now
261
- "unicorn/prefer-string-repeat": "error",
262
- "unicorn/prefer-string-replace-all": "error",
263
- "unicorn/prefer-string-slice": "error",
264
- "unicorn/prefer-string-starts-ends-with": "error",
265
- "unicorn/prefer-string-trim-start-end": "error",
266
- "unicorn/prefer-structured-clone": "error",
267
- "unicorn/prefer-switch": "error",
268
191
  "unicorn/prefer-ternary": "off",
269
- "unicorn/prefer-top-level-await": "error",
270
- "unicorn/prefer-type-error": "error",
271
192
  "unicorn/prevent-abbreviations": "off",
272
193
  "unicorn/relative-url-style": "warn",
273
- "unicorn/require-array-join-separator": "error",
274
194
  "unicorn/require-css-escape": "off", // would be useful but we dont have CSS.escape()
275
195
  "unicorn/require-module-attributes": "off",
276
196
  "unicorn/require-module-specifiers": "off",
277
- "unicorn/require-number-to-fixed-digits-argument": "error",
278
- "unicorn/require-passive-events": "error",
279
197
  "unicorn/switch-case-braces": "off",
280
- "unicorn/switch-case-break-position": "error",
281
198
  "unicorn/text-encoding-identifier-case": "off",
282
- "unicorn/throw-new-error": "error",
283
- "unicorn/try-complexity": "off",
284
199
  ...filterRules(eslintConfigPrettier.rules, (rule) => {
285
200
  return rule.startsWith("unicorn/");
286
201
  }),
@@ -355,7 +270,7 @@ export default [
355
270
  "import-x/no-duplicates": "error",
356
271
 
357
272
  /* this is checked by compiler and without additional configuration does not
358
- * work with typescript */
273
+ * work with TypeScript */
359
274
  "n/no-missing-import": "off",
360
275
  "n/no-missing-require": "off",
361
276
 
@@ -369,20 +284,22 @@ export default [
369
284
  "security/detect-object-injection": "off", // produces more noise than useful errors
370
285
  "security/detect-unsafe-regex": "error",
371
286
 
372
- "sonarjs/argument-type": "off", // handled by typescript (and this rule is sometimes wrong)
287
+ "sonarjs/argument-type": "off", // handled by TypeScript (and this rule is sometimes wrong)
373
288
  "sonarjs/arguments-order": "off", // another slow rule, would be nice to have enabled thought
289
+ "sonarjs/assertions-in-tests": "off", // could be useful but yields lots of false positives (e.g. node:test isn't recognized)
374
290
  "sonarjs/cognitive-complexity": "off", // already covered by native complexity rule
375
291
  "sonarjs/concise-regex": "off", // already covered by unicorn/better-regex
376
292
  "sonarjs/deprecation": "off", // already covered by @typescript-eslint/no-deprecated
377
- "sonarjs/function-return-type": "off", // overly broad and opinionated, let typescript deal with this
293
+ "sonarjs/function-return-type": "off", // overly broad and opinionated, let TypeScript deal with this
378
294
  "sonarjs/no-commented-code": "off", // neat rule but is very very slow (over 50% of the total linting time)
379
295
  "sonarjs/no-control-regex": "off", // already covered by no-control-regexp
380
296
  "sonarjs/no-empty-test-file": "off", // could be useful but it does not handle it.each or similar constructs thus yields more false positives than its worth */
381
297
  "sonarjs/no-redundant-optional": "off", // flags "foo?: string | undefined" as redundant even if `exactOptionalPropertyTypes` tsconfig is enabled */
382
298
  "sonarjs/no-skipped-tests": "off", // covered by jest/no-disabled-tests and mocha/no-pending-tests
383
299
  "sonarjs/no-small-switch": "off", // prefer to use small switches when the intention is to all more cases later
300
+ "sonarjs/no-trivial-assertions": "off", // produces a bit too much noise
384
301
  "sonarjs/no-unused-vars": "off", // already coveredby @typescript-eslint/no-unused-vars
385
- "sonarjs/prefer-nullish-coalescing": "off", // requires typescript and strictNullChecks, which is sane, but we also use @typescript-eslint/prefer-nullish-coalescing so this becomes redundant
302
+ "sonarjs/prefer-nullish-coalescing": "off", // requires TypeScript and strictNullChecks, which is sane, but we also use @typescript-eslint/prefer-nullish-coalescing so this becomes redundant
386
303
  "sonarjs/prefer-regexp-exec": "off", // prefer @typescript-eslint/prefer-regexp-exec
387
304
  "sonarjs/prefer-single-boolean-return": "off", // prefer to use multiple returns even for booleans (looks better and can yield performance increase
388
305
  "sonarjs/redundant-type-aliases": "off", // "redundant" type aliases helps with self-documenting code
@@ -392,7 +309,7 @@ export default [
392
309
  "sonarjs/use-type-alias": "off", // overly broad, lets leave this to the discretion of the author
393
310
  "sonarjs/void-use": "off", // used to silence warnings about unawaited promises
394
311
 
395
- /* disable sonarjs aws related rules as we dont use aws */
312
+ /* disable sonarjs AWS related rules as we dont use AWS */
396
313
  "sonarjs/aws-apigateway-public-api": "off",
397
314
  "sonarjs/aws-ec2-rds-dms-public": "off",
398
315
  "sonarjs/aws-ec2-unencrypted-ebs-volume": "off",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/eslint-config",
3
- "version": "9.4.6",
3
+ "version": "9.6.0",
4
4
  "description": "Eslint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "eslint"
@@ -49,8 +49,8 @@
49
49
  "eslint-plugin-prettier": "5.5.6",
50
50
  "eslint-plugin-regexp": "3.1.0",
51
51
  "eslint-plugin-security": "4.0.1",
52
- "eslint-plugin-sonarjs": "4.0.3",
53
- "eslint-plugin-unicorn": "65.0.1",
52
+ "eslint-plugin-sonarjs": "4.1.0",
53
+ "eslint-plugin-unicorn": "67.0.0",
54
54
  "find-up": "8.0.0",
55
55
  "globals": "17.3.0",
56
56
  "nunjucks": "3.2.4"
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "f0f0c8079b25c34f7ad7e96247b6b303ce4e1ca5"
68
+ "gitHead": "c70650aefb15e854e7de2837f52979a06d779da7"
69
69
  }
@@ -25,18 +25,6 @@ import vueConfig from "@html-validate/eslint-config-vue";
25
25
  {% endif %}
26
26
 
27
27
  export default [
28
- {
29
- name: "Ignored files",
30
- ignores: [
31
- "**/coverage/**",
32
- "**/dist/**",
33
- "**/node_modules/**",
34
- "**/out/**",
35
- "**/public/assets/**",
36
- "**/temp/**"
37
- ],
38
- },
39
-
40
28
  ...defaultConfig,
41
29
  {% if typescript %}
42
30