@html-validate/eslint-config 6.16.0 → 6.17.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/dist/cli.mjs +7 -9
- package/dist/cli.mjs.map +3 -3
- package/index.mjs +154 -2
- package/package.json +6 -5
package/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import eslintPluginN from "eslint-plugin-n";
|
|
|
8
8
|
import eslintPluginPrettier from "eslint-plugin-prettier";
|
|
9
9
|
import eslintPluginSecurity from "eslint-plugin-security";
|
|
10
10
|
import eslintPluginSonarjs from "eslint-plugin-sonarjs";
|
|
11
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
11
12
|
import globals from "globals";
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -35,10 +36,10 @@ export default [
|
|
|
35
36
|
defineConfig({
|
|
36
37
|
name: "@html-validate/eslint-config/language-options",
|
|
37
38
|
languageOptions: {
|
|
38
|
-
ecmaVersion:
|
|
39
|
+
ecmaVersion: 2025,
|
|
39
40
|
sourceType: "module",
|
|
40
41
|
globals: {
|
|
41
|
-
...globals.
|
|
42
|
+
...globals.es2025,
|
|
42
43
|
...globals.node,
|
|
43
44
|
},
|
|
44
45
|
},
|
|
@@ -54,6 +55,7 @@ export default [
|
|
|
54
55
|
"array-func": eslintPluginArrayFunc,
|
|
55
56
|
security: eslintPluginSecurity,
|
|
56
57
|
sonarjs: eslintPluginSonarjs,
|
|
58
|
+
unicorn: eslintPluginUnicorn,
|
|
57
59
|
},
|
|
58
60
|
settings: {
|
|
59
61
|
"import/resolver": {
|
|
@@ -92,6 +94,145 @@ export default [
|
|
|
92
94
|
...eslintPluginSecurity.configs.recommended.rules,
|
|
93
95
|
...eslintPluginSonarjs.configs.recommended.rules,
|
|
94
96
|
|
|
97
|
+
/* enable eslint-plugin-unicorn */
|
|
98
|
+
...eslintPluginUnicorn.configs.recommended.rules,
|
|
99
|
+
"unicorn/better-regex": "error",
|
|
100
|
+
"unicorn/catch-error-name": "off",
|
|
101
|
+
"unicorn/consistent-assert": "off",
|
|
102
|
+
"unicorn/consistent-date-clone": "error",
|
|
103
|
+
"unicorn/consistent-empty-array-spread": "off",
|
|
104
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
105
|
+
"unicorn/consistent-function-scoping": "error",
|
|
106
|
+
"unicorn/custom-error-definition": "error",
|
|
107
|
+
"unicorn/error-message": "error",
|
|
108
|
+
"unicorn/escape-case": "off", // typically not useful for this organisation
|
|
109
|
+
"unicorn/expiring-todo-comments": "off", // could be useful later
|
|
110
|
+
"unicorn/explicit-length-check": ["error", { "non-zero": "greater-than" }],
|
|
111
|
+
"unicorn/filename-case": ["error", { case: "kebabCase" }], // enforce kebab-case in filenames
|
|
112
|
+
"unicorn/import-style": "off", // off for now
|
|
113
|
+
"unicorn/isolated-functions": "error",
|
|
114
|
+
"unicorn/new-for-builtins": "error",
|
|
115
|
+
"unicorn/no-abusive-eslint-disable": "off", // covered by eslint-plugin-eslint-comments
|
|
116
|
+
"unicorn/no-accessor-recursion": "error",
|
|
117
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
118
|
+
"unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part typescript will handle this)
|
|
119
|
+
"unicorn/no-array-for-each": "error",
|
|
120
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
121
|
+
"unicorn/no-array-reduce": "off", // allow usage of reduce()
|
|
122
|
+
"unicorn/no-array-reverse": "error", // prefer immutable .toReversed() (available in Node.js 20+)
|
|
123
|
+
"unicorn/no-array-sort": "error", // prefer immutable .toSorted() (available in Node.js 20+)
|
|
124
|
+
"unicorn/no-await-expression-member": "error",
|
|
125
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
126
|
+
"unicorn/no-console-spaces": "error",
|
|
127
|
+
"unicorn/no-document-cookie": "off", // typically not useful for this organisation
|
|
128
|
+
"unicorn/no-empty-file": "off",
|
|
129
|
+
"unicorn/no-for-loop": "error",
|
|
130
|
+
"unicorn/no-hex-escape": "error",
|
|
131
|
+
"unicorn/no-immediate-mutation": "off",
|
|
132
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
133
|
+
"unicorn/no-invalid-fetch-options": "off", // let typescript and tests handle this
|
|
134
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
135
|
+
"unicorn/no-magic-array-flat-depth": "error",
|
|
136
|
+
"unicorn/no-named-default": "off", // named default is useful for vue
|
|
137
|
+
"unicorn/no-negated-condition": "off", // mostly agree with the rule but sometimes its useful to have the common case first even if negated
|
|
138
|
+
"unicorn/no-negation-in-equality-check": "off",
|
|
139
|
+
"unicorn/no-new-array": "error",
|
|
140
|
+
"unicorn/no-new-buffer": "error",
|
|
141
|
+
"unicorn/no-null": "off", // prefer using null over undefined
|
|
142
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
143
|
+
"unicorn/no-process-exit": "off", // covered by n/no-process-exit (enabled by recommended-module preset)
|
|
144
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
145
|
+
"unicorn/no-static-only-class": "off",
|
|
146
|
+
"unicorn/no-thenable": "off",
|
|
147
|
+
"unicorn/no-this-assignment": "error",
|
|
148
|
+
"unicorn/no-typeof-undefined": "error",
|
|
149
|
+
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
150
|
+
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
151
|
+
"unicorn/no-unnecessary-await": "error",
|
|
152
|
+
"unicorn/no-unnecessary-polyfills": "off",
|
|
153
|
+
"unicorn/no-unnecessary-slice-end": "error",
|
|
154
|
+
"unicorn/no-unreadable-array-destructuring": "off",
|
|
155
|
+
"unicorn/no-unreadable-iife": "off",
|
|
156
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
157
|
+
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
158
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
159
|
+
"unicorn/no-useless-length-check": "error",
|
|
160
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
161
|
+
"unicorn/no-useless-spread": "error",
|
|
162
|
+
"unicorn/no-useless-switch-case": "off",
|
|
163
|
+
"unicorn/no-useless-undefined": "off", // opinionated, I prefer to explicitly pass undefined
|
|
164
|
+
"unicorn/no-zero-fractions": "error",
|
|
165
|
+
"unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
|
|
166
|
+
"unicorn/numeric-separators-style": "off",
|
|
167
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
168
|
+
"unicorn/prefer-array-find": "error",
|
|
169
|
+
"unicorn/prefer-array-flat": "error",
|
|
170
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
171
|
+
"unicorn/prefer-array-index-of": "error",
|
|
172
|
+
"unicorn/prefer-array-some": "error",
|
|
173
|
+
"unicorn/prefer-at": "error",
|
|
174
|
+
"unicorn/prefer-bigint-literals": "off",
|
|
175
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
176
|
+
"unicorn/prefer-class-fields": "error",
|
|
177
|
+
"unicorn/prefer-classlist-toggle": "off",
|
|
178
|
+
"unicorn/prefer-code-point": "error",
|
|
179
|
+
"unicorn/prefer-date-now": "error",
|
|
180
|
+
"unicorn/prefer-default-parameters": "error",
|
|
181
|
+
"unicorn/prefer-dom-node-append": "off",
|
|
182
|
+
"unicorn/prefer-dom-node-dataset": "off",
|
|
183
|
+
"unicorn/prefer-dom-node-remove": "off",
|
|
184
|
+
"unicorn/prefer-dom-node-text-content": "off",
|
|
185
|
+
"unicorn/prefer-event-target": "off",
|
|
186
|
+
"unicorn/prefer-export-from": "error",
|
|
187
|
+
"unicorn/prefer-global-this": "off",
|
|
188
|
+
"unicorn/prefer-import-meta-properties": "error",
|
|
189
|
+
"unicorn/prefer-includes": "error",
|
|
190
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
191
|
+
"unicorn/prefer-logical-operator-over-ternary": "off",
|
|
192
|
+
"unicorn/prefer-math-min-max": "error",
|
|
193
|
+
"unicorn/prefer-math-trunc": "error",
|
|
194
|
+
"unicorn/prefer-modern-dom-apis": "off",
|
|
195
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
196
|
+
"unicorn/prefer-module": "off",
|
|
197
|
+
"unicorn/prefer-native-coercion-functions": "off",
|
|
198
|
+
"unicorn/prefer-negative-index": "error",
|
|
199
|
+
"unicorn/prefer-number-properties": "error",
|
|
200
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
201
|
+
"unicorn/prefer-optional-catch-binding": "off", // covered by sonarjs/no-ignored-exceptions
|
|
202
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
203
|
+
"unicorn/prefer-query-selector": "error",
|
|
204
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
205
|
+
"unicorn/prefer-regexp-test": "error",
|
|
206
|
+
"unicorn/prefer-response-static-json": "off",
|
|
207
|
+
"unicorn/prefer-set-has": "error",
|
|
208
|
+
"unicorn/prefer-set-size": "error",
|
|
209
|
+
"unicorn/prefer-single-call": "off",
|
|
210
|
+
"unicorn/prefer-spread": "off", // for now
|
|
211
|
+
"unicorn/prefer-string-raw": "off", // for now
|
|
212
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
213
|
+
"unicorn/prefer-string-slice": "error",
|
|
214
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
215
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
216
|
+
"unicorn/prefer-structured-clone": "error",
|
|
217
|
+
"unicorn/prefer-switch": "error",
|
|
218
|
+
"unicorn/prefer-ternary": "off",
|
|
219
|
+
"unicorn/prefer-top-level-await": "error",
|
|
220
|
+
"unicorn/prefer-type-error": "error",
|
|
221
|
+
"unicorn/prevent-abbreviations": "off",
|
|
222
|
+
"unicorn/relative-url-style": "warn",
|
|
223
|
+
"unicorn/require-array-join-separator": "error",
|
|
224
|
+
"unicorn/require-module-attributes": "off",
|
|
225
|
+
"unicorn/require-module-specifiers": "off",
|
|
226
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
227
|
+
"unicorn/switch-case-braces": "off",
|
|
228
|
+
"unicorn/text-encoding-identifier-case": "off",
|
|
229
|
+
"unicorn/throw-new-error": "error",
|
|
230
|
+
...filterRules(eslintConfigPrettier.rules, (rule) => {
|
|
231
|
+
return rule.startsWith("unicorn/");
|
|
232
|
+
}),
|
|
233
|
+
|
|
234
|
+
/* rule adjustments */
|
|
235
|
+
"prefer-object-spread": "error",
|
|
95
236
|
camelcase: "error",
|
|
96
237
|
complexity: ["warn", 10],
|
|
97
238
|
"consistent-return": "error",
|
|
@@ -177,6 +318,7 @@ export default [
|
|
|
177
318
|
"sonarjs/argument-type": "off", // handled by typescript (and this rule is sometimes wrong)
|
|
178
319
|
"sonarjs/arguments-order": "off", // another slow rule, would be nice to have enabled thought
|
|
179
320
|
"sonarjs/cognitive-complexity": "off", // already covered by native complexity rule
|
|
321
|
+
"sonarjs/concise-regex": "off", // already covered by unicorn/better-regex
|
|
180
322
|
"sonarjs/deprecation": "off", // already covered by @typescript-eslint/no-deprecated
|
|
181
323
|
"sonarjs/function-return-type": "off", // overly broad and opinionated, let typescript deal with this
|
|
182
324
|
"sonarjs/no-commented-code": "off", // neat rule but is very very slow (over 50% of the total linting time)
|
|
@@ -233,6 +375,16 @@ export default [
|
|
|
233
375
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
234
376
|
}),
|
|
235
377
|
|
|
378
|
+
defineConfig({
|
|
379
|
+
/* disable rules requiring esm-only features */
|
|
380
|
+
name: "@html-validate/eslint-config/cjs",
|
|
381
|
+
files: ["**/*.cjs", "**/*.cts"],
|
|
382
|
+
rules: {
|
|
383
|
+
"unicorn/prefer-import-meta-properties": "off",
|
|
384
|
+
"unicorn/prefer-top-level-await": "off",
|
|
385
|
+
},
|
|
386
|
+
}),
|
|
387
|
+
|
|
236
388
|
defineConfig({
|
|
237
389
|
/* mjs requires file extension */
|
|
238
390
|
name: "@html-validate/eslint-config/esm",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/eslint-config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.17.0",
|
|
4
4
|
"description": "Eslint sharable config used by the various HTML-validate packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@eslint-community/eslint-plugin-eslint-comments": "4.6.0",
|
|
40
|
-
"@eslint/js": "9.39.
|
|
40
|
+
"@eslint/js": "9.39.3",
|
|
41
41
|
"argparse": "2.0.1",
|
|
42
|
-
"eslint": "9.39.
|
|
42
|
+
"eslint": "9.39.3",
|
|
43
43
|
"eslint-config-prettier": "10.1.8",
|
|
44
44
|
"eslint-formatter-gitlab": "7.0.1",
|
|
45
45
|
"eslint-import-resolver-node": "0.3.9",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"eslint-plugin-prettier": "5.5.5",
|
|
51
51
|
"eslint-plugin-security": "4.0.0",
|
|
52
52
|
"eslint-plugin-sonarjs": "4.0.0",
|
|
53
|
+
"eslint-plugin-unicorn": "63.0.0",
|
|
53
54
|
"find-up": "8.0.0",
|
|
54
55
|
"globals": "17.3.0",
|
|
55
56
|
"nunjucks": "3.2.4"
|
|
@@ -58,11 +59,11 @@
|
|
|
58
59
|
"prettier": "^3.0.0"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
|
-
"node": "^20.
|
|
62
|
+
"node": "^20.11.0 || >= 22.16.0",
|
|
62
63
|
"npm": ">= 7"
|
|
63
64
|
},
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "d649b633cedd3360959151dfd6f54b6126145d49"
|
|
68
69
|
}
|