@html-validate/eslint-config 9.6.3 → 9.7.1
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 +6 -2
- package/dist/cli.mjs.map +2 -2
- package/index.mjs +355 -343
- package/package.json +3 -3
- package/template/eslint.config.mjs.njk +2 -2
package/index.mjs
CHANGED
|
@@ -33,366 +33,378 @@ function filterRules(rules, predicate) {
|
|
|
33
33
|
return Object.fromEntries(Object.entries(rules).filter(([key]) => predicate(key)));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
/**
|
|
37
|
+
* @param {{type: "module" | "commonjs" }} options
|
|
38
|
+
*/
|
|
39
|
+
export default function defaultConfig(options) {
|
|
40
|
+
const moduleExtensions = options.type === "module" ? ["js", "mjs", "mts"] : ["mjs", "mts"];
|
|
41
|
+
|
|
42
|
+
const configs = [
|
|
43
|
+
defineConfig({
|
|
44
|
+
name: "@html-validate/eslint-config/global-ignore",
|
|
45
|
+
ignores: [
|
|
46
|
+
"**/.vscode-test/**", // @vscode/test-electron
|
|
47
|
+
"**/coverage/**",
|
|
48
|
+
"**/dist/**",
|
|
49
|
+
"**/node_modules/**",
|
|
50
|
+
"**/out/**", // vscode-html-validate
|
|
51
|
+
"**/public/assets/**",
|
|
52
|
+
"**/temp/**",
|
|
53
|
+
"**/public/*.hot-update.js", // webpack
|
|
54
|
+
],
|
|
55
|
+
}),
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
defineConfig({
|
|
58
|
+
name: "@html-validate/eslint-config/language-options",
|
|
59
|
+
languageOptions: {
|
|
60
|
+
ecmaVersion: 2025,
|
|
61
|
+
sourceType: "module",
|
|
62
|
+
globals: {
|
|
63
|
+
...globals.es2025,
|
|
64
|
+
...globals.node,
|
|
65
|
+
},
|
|
59
66
|
},
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
67
|
+
}),
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
69
|
+
defineConfig({
|
|
70
|
+
name: "@html-validate/eslint-config/base",
|
|
71
|
+
plugins: {
|
|
72
|
+
"@eslint-community/eslint-comments": eslintPluginEslintComments,
|
|
73
|
+
prettier: eslintPluginPrettier,
|
|
74
|
+
"import-x": importX,
|
|
75
|
+
n: eslintPluginN,
|
|
76
|
+
"array-func": eslintPluginArrayFunc,
|
|
77
|
+
regexp: eslintPluginRegexp,
|
|
78
|
+
security: eslintPluginSecurity,
|
|
79
|
+
sonarjs: eslintPluginSonarjs,
|
|
80
|
+
unicorn: eslintPluginUnicorn,
|
|
81
|
+
},
|
|
82
|
+
settings: {
|
|
83
|
+
"import-x/resolver-next": [createNodeResolver(), createTypeScriptImportResolver()],
|
|
84
|
+
},
|
|
85
|
+
rules: {
|
|
86
|
+
...js.configs.recommended.rules,
|
|
87
|
+
...eslintPluginEslintComments.configs.recommended.rules,
|
|
88
|
+
...filterRules(eslintConfigPrettier.rules, (rule) => {
|
|
89
|
+
if (rule.startsWith("@stylistic/")) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (rule.startsWith("@babel/") || rule.startsWith("babel/")) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (rule.startsWith("flowtype/")) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
if (rule.startsWith("react/")) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (rule.startsWith("standard/")) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
if (rule.startsWith("unicorn/")) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}),
|
|
109
|
+
...eslintPluginPrettier.configs.recommended.rules,
|
|
110
|
+
...importX.flatConfigs.errors.rules,
|
|
111
|
+
...eslintPluginN.configs["recommended-module"].rules,
|
|
112
|
+
...eslintPluginArrayFunc.configs.recommended.rules,
|
|
113
|
+
...eslintPluginRegexp.configs.recommended.rules, // eslint-disable-line import-x/no-named-as-default-member -- to match other plugins here
|
|
114
|
+
...eslintPluginSecurity.configs.recommended.rules,
|
|
115
|
+
...eslintPluginSonarjs.configs.recommended.rules,
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
/* enable eslint-plugin-unicorn */
|
|
118
|
+
...eslintPluginUnicorn.configs.recommended.rules,
|
|
119
|
+
"unicorn/catch-error-name": "off",
|
|
120
|
+
"unicorn/comment-content": "error",
|
|
121
|
+
"unicorn/consistent-assert": "off",
|
|
122
|
+
"unicorn/consistent-boolean-name": "off", // while i would like this for variables I prefer not to force it on parameters, etc
|
|
123
|
+
"unicorn/consistent-class-member-order": "off",
|
|
124
|
+
"unicorn/consistent-compound-words": [
|
|
125
|
+
"error",
|
|
126
|
+
{
|
|
127
|
+
allowList: {
|
|
128
|
+
/* widely used in the html-validate projects */
|
|
129
|
+
MetaData: true,
|
|
130
|
+
MetaDataTable: true,
|
|
131
|
+
},
|
|
125
132
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}),
|
|
133
|
+
],
|
|
134
|
+
"unicorn/consistent-empty-array-spread": "off",
|
|
135
|
+
"unicorn/custom-error-definition": "error",
|
|
136
|
+
"unicorn/dom-node-dataset": "off",
|
|
137
|
+
"unicorn/escape-case": "off", // typically not useful for this organisation
|
|
138
|
+
"unicorn/expiring-todo-comments": "off", // could be useful later
|
|
139
|
+
"unicorn/explicit-length-check": ["error", { "non-zero": "greater-than" }],
|
|
140
|
+
"unicorn/filename-case": [
|
|
141
|
+
/* enforce kebab-case in filenames */
|
|
142
|
+
"error",
|
|
143
|
+
{
|
|
144
|
+
case: "kebabCase",
|
|
145
|
+
ignore: ["^__(fixtures|mocks|snapshots|tests)__$", "^Gruntfile.js$"],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
"unicorn/prefer-minimal-ternary": "off", // situational, i dont think `foo[expr ? "x": "y"].bar` is more readable than `expr ? foo.x.bar : foo.y.bar`.
|
|
149
|
+
"unicorn/import-style": "off", // off for now
|
|
150
|
+
"unicorn/no-abusive-eslint-disable": "off", // covered by eslint-plugin-eslint-comments
|
|
151
|
+
"unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part TypeScript will handle this)
|
|
152
|
+
"unicorn/no-array-reduce": "off", // allow usage of reduce()
|
|
153
|
+
"unicorn/no-canvas-to-image": "off", // not really relevant for the html-validate projects
|
|
154
|
+
"unicorn/no-document-cookie": "off", // typically not useful for this organisation
|
|
155
|
+
"unicorn/no-empty-file": "off",
|
|
156
|
+
"unicorn/no-immediate-mutation": "off",
|
|
157
|
+
"unicorn/no-invalid-argument-count": "off", // does not respect optional parameters (e.g. jsdoc [param])
|
|
158
|
+
"unicorn/no-invalid-fetch-options": "off", // let TypeScript and tests handle this
|
|
159
|
+
"unicorn/no-named-default": "off", // named default is useful for Vue.js
|
|
160
|
+
"unicorn/no-negated-condition": "off", // mostly agree with the rule but sometimes its useful to have the common case first even if negated
|
|
161
|
+
"unicorn/no-negation-in-equality-check": "off",
|
|
162
|
+
"unicorn/no-null": "off", // prefer using null over undefined
|
|
163
|
+
"unicorn/no-process-exit": "off", // covered by n/no-process-exit (enabled by recommended-module preset)
|
|
164
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
165
|
+
"unicorn/no-static-only-class": "off",
|
|
166
|
+
"unicorn/no-thenable": "off",
|
|
167
|
+
"unicorn/no-this-outside-of-class": "off", // disagree somewhat with the rule, flags stateful objects
|
|
168
|
+
"unicorn/no-unnecessary-polyfills": "off",
|
|
169
|
+
"unicorn/no-unreadable-array-destructuring": "off",
|
|
170
|
+
"unicorn/no-unreadable-iife": "off",
|
|
171
|
+
"unicorn/no-useless-switch-case": "off",
|
|
172
|
+
"unicorn/no-useless-undefined": "off", // opinionated, I prefer to explicitly pass undefined
|
|
173
|
+
"unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
|
|
174
|
+
"unicorn/numeric-separators-style": "off",
|
|
175
|
+
"unicorn/prefer-bigint-literals": "off",
|
|
176
|
+
"unicorn/prefer-classlist-toggle": "off",
|
|
177
|
+
"unicorn/prefer-dom-node-append": "off",
|
|
178
|
+
"unicorn/prefer-dom-node-remove": "off",
|
|
179
|
+
"unicorn/prefer-dom-node-text-content": "off",
|
|
180
|
+
"unicorn/prefer-event-target": "off",
|
|
181
|
+
"unicorn/prefer-global-this": "off",
|
|
182
|
+
"unicorn/prefer-import-meta-properties": "error",
|
|
183
|
+
"unicorn/prefer-logical-operator-over-ternary": "off",
|
|
184
|
+
"unicorn/prefer-modern-dom-apis": "off",
|
|
185
|
+
"unicorn/prefer-module": "off",
|
|
186
|
+
"unicorn/prefer-native-coercion-functions": "off",
|
|
187
|
+
"unicorn/prefer-optional-catch-binding": "off", // covered by sonarjs/no-ignored-exceptions
|
|
188
|
+
"unicorn/prefer-queue-microtask": [
|
|
189
|
+
"error",
|
|
190
|
+
{ checkSetImmediate: true, checkSetTimeout: true },
|
|
191
|
+
],
|
|
192
|
+
"unicorn/prefer-response-static-json": "off",
|
|
193
|
+
"unicorn/prefer-scoped-selector": "off",
|
|
194
|
+
"unicorn/prefer-short-arrow-method": "off",
|
|
195
|
+
"unicorn/prefer-single-call": "off",
|
|
196
|
+
"unicorn/prefer-spread": "off", // for now
|
|
197
|
+
"unicorn/prefer-string-raw": "off", // for now
|
|
198
|
+
"unicorn/prefer-ternary": "off",
|
|
199
|
+
"unicorn/prevent-abbreviations": "off",
|
|
200
|
+
"unicorn/relative-url-style": "warn",
|
|
201
|
+
"unicorn/require-css-escape": "off", // would be useful but we dont have CSS.escape()
|
|
202
|
+
"unicorn/require-module-attributes": "off",
|
|
203
|
+
"unicorn/require-module-specifiers": "off",
|
|
204
|
+
"unicorn/switch-case-braces": "off",
|
|
205
|
+
"unicorn/text-encoding-identifier-case": "off",
|
|
206
|
+
...filterRules(eslintConfigPrettier.rules, (rule) => {
|
|
207
|
+
return rule.startsWith("unicorn/");
|
|
208
|
+
}),
|
|
203
209
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
210
|
+
/* rule adjustments */
|
|
211
|
+
"prefer-object-spread": "error",
|
|
212
|
+
camelcase: "error",
|
|
213
|
+
complexity: ["warn", 10],
|
|
214
|
+
"consistent-return": "error",
|
|
215
|
+
"consistent-this": "off",
|
|
216
|
+
curly: "error",
|
|
217
|
+
"dot-notation": "error",
|
|
218
|
+
eqeqeq: ["error", "smart"],
|
|
219
|
+
"max-depth": ["warn", 4],
|
|
220
|
+
"max-params": ["error", { max: 5 }],
|
|
221
|
+
"new-cap": "error",
|
|
222
|
+
"no-console": "warn",
|
|
223
|
+
"no-dupe-class-members": "off",
|
|
224
|
+
"no-eval": "error",
|
|
225
|
+
"no-extend-native": "error",
|
|
226
|
+
"no-implied-eval": "error",
|
|
227
|
+
"no-loop-func": "error",
|
|
228
|
+
"no-new": "error",
|
|
229
|
+
"no-new-func": "error",
|
|
230
|
+
"no-undef": "off",
|
|
231
|
+
"no-unneeded-ternary": "error",
|
|
232
|
+
"no-unused-vars": ["error", { ignoreRestSiblings: true, argsIgnorePattern: "^_" }],
|
|
233
|
+
"no-var": "error",
|
|
234
|
+
"no-warning-comments": "warn",
|
|
235
|
+
"object-shorthand": "error",
|
|
236
|
+
"prefer-const": "error",
|
|
237
|
+
"prefer-rest-params": "error",
|
|
238
|
+
"prefer-spread": "error",
|
|
239
|
+
"prefer-template": "error",
|
|
240
|
+
"prettier/prettier": "warn",
|
|
241
|
+
radix: "error",
|
|
242
|
+
strict: "off",
|
|
243
|
+
yoda: "error",
|
|
238
244
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
"@eslint-community/eslint-comments/disable-enable-pair": [
|
|
246
|
+
"error",
|
|
247
|
+
{ allowWholeFile: true },
|
|
248
|
+
],
|
|
249
|
+
"@eslint-community/eslint-comments/require-description": [
|
|
250
|
+
"error",
|
|
251
|
+
{ ignore: ["eslint-enable", "eslint-env", "exported", "global", "globals"] },
|
|
252
|
+
],
|
|
253
|
+
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
|
245
254
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
255
|
+
"import-x/default": "off",
|
|
256
|
+
"import-x/extensions": ["error", "never", { json: "always" }],
|
|
257
|
+
"import-x/newline-after-import": "error",
|
|
258
|
+
"import-x/no-absolute-path": "error",
|
|
259
|
+
"import-x/no-deprecated": "error",
|
|
260
|
+
"import-x/no-dynamic-require": "error",
|
|
261
|
+
"import-x/no-extraneous-dependencies": "error",
|
|
262
|
+
"import-x/no-mutable-exports": "error",
|
|
263
|
+
"import-x/no-named-default": "error",
|
|
264
|
+
"import-x/no-useless-path-segments": "error",
|
|
265
|
+
"import-x/order": [
|
|
266
|
+
"warn",
|
|
267
|
+
{
|
|
268
|
+
alphabetize: {
|
|
269
|
+
order: "asc",
|
|
270
|
+
orderImportKind: "asc",
|
|
271
|
+
},
|
|
272
|
+
named: {
|
|
273
|
+
enabled: true,
|
|
274
|
+
types: "types-first",
|
|
275
|
+
},
|
|
262
276
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
],
|
|
269
|
-
"import-x/no-named-as-default": "error",
|
|
270
|
-
"import-x/no-named-as-default-member": "error",
|
|
271
|
-
"import-x/no-duplicates": "error",
|
|
277
|
+
],
|
|
278
|
+
"import-x/no-named-as-default": "error",
|
|
279
|
+
"import-x/no-named-as-default-member": "error",
|
|
280
|
+
"import-x/no-duplicates": "error",
|
|
272
281
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
282
|
+
/* this is checked by compiler and without additional configuration does not
|
|
283
|
+
* work with TypeScript */
|
|
284
|
+
"n/no-missing-import": "off",
|
|
285
|
+
"n/no-missing-require": "off",
|
|
277
286
|
|
|
278
|
-
|
|
279
|
-
|
|
287
|
+
/* prefer "node:foo" over "foo" */
|
|
288
|
+
"n/prefer-node-protocol": "error",
|
|
280
289
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
290
|
+
"security/detect-child-process": "off", // produces more noise than useful errors
|
|
291
|
+
"security/detect-non-literal-fs-filename": "off", // html-validate reads files, don't want to acknowledge all occurrences
|
|
292
|
+
"security/detect-non-literal-regexp": "error",
|
|
293
|
+
"security/detect-non-literal-require": "error",
|
|
294
|
+
"security/detect-object-injection": "off", // produces more noise than useful errors
|
|
295
|
+
"security/detect-unsafe-regex": "error",
|
|
287
296
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
297
|
+
"sonarjs/argument-type": "off", // handled by TypeScript (and this rule is sometimes wrong)
|
|
298
|
+
"sonarjs/arguments-order": "off", // another slow rule, would be nice to have enabled thought
|
|
299
|
+
"sonarjs/assertions-in-tests": "off", // could be useful but yields lots of false positives (e.g. node:test isn't recognized)
|
|
300
|
+
"sonarjs/cognitive-complexity": "off", // already covered by native complexity rule
|
|
301
|
+
"sonarjs/concise-regex": "off", // already covered by unicorn/better-regex
|
|
302
|
+
"sonarjs/deprecation": "off", // already covered by @typescript-eslint/no-deprecated
|
|
303
|
+
"sonarjs/function-return-type": "off", // overly broad and opinionated, let TypeScript deal with this
|
|
304
|
+
"sonarjs/no-alphabetical-sort": "off", // covered by unicorn/require-array-sort-compare
|
|
305
|
+
"sonarjs/no-commented-code": "off", // neat rule but is very very slow (over 50% of the total linting time)
|
|
306
|
+
"sonarjs/no-control-regex": "off", // already covered by no-control-regexp
|
|
307
|
+
"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 */
|
|
308
|
+
"sonarjs/no-redundant-optional": "off", // flags "foo?: string | undefined" as redundant even if `exactOptionalPropertyTypes` tsconfig is enabled */
|
|
309
|
+
"sonarjs/no-skipped-tests": "off", // covered by jest/no-disabled-tests and mocha/no-pending-tests
|
|
310
|
+
"sonarjs/no-small-switch": "off", // prefer to use small switches when the intention is to all more cases later
|
|
311
|
+
"sonarjs/no-trivial-assertions": "off", // produces a bit too much noise
|
|
312
|
+
"sonarjs/no-unused-vars": "off", // already coveredby @typescript-eslint/no-unused-vars
|
|
313
|
+
"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
|
|
314
|
+
"sonarjs/prefer-regexp-exec": "off", // prefer @typescript-eslint/prefer-regexp-exec
|
|
315
|
+
"sonarjs/prefer-single-boolean-return": "off", // prefer to use multiple returns even for booleans (looks better and can yield performance increase
|
|
316
|
+
"sonarjs/redundant-type-aliases": "off", // "redundant" type aliases helps with self-documenting code
|
|
317
|
+
"sonarjs/super-linear-regex": "off", // covered by regexp/no-super-linear-backtracking
|
|
318
|
+
"sonarjs/todo-tag": "off", // want to be able to leave todo tasks
|
|
319
|
+
"sonarjs/unused-import": "off", // already covered by @typescript-eslint/no-unused-vars
|
|
320
|
+
"sonarjs/unused-named-groups": "off", // named groups can help readability even if not used
|
|
321
|
+
"sonarjs/use-type-alias": "off", // overly broad, lets leave this to the discretion of the author
|
|
322
|
+
"sonarjs/void-use": "off", // used to silence warnings about unawaited promises
|
|
314
323
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
324
|
+
/* disable sonarjs AWS related rules as we dont use AWS */
|
|
325
|
+
"sonarjs/aws-apigateway-public-api": "off",
|
|
326
|
+
"sonarjs/aws-ec2-rds-dms-public": "off",
|
|
327
|
+
"sonarjs/aws-ec2-unencrypted-ebs-volume": "off",
|
|
328
|
+
"sonarjs/aws-efs-unencrypted": "off",
|
|
329
|
+
"sonarjs/aws-iam-all-privileges": "off",
|
|
330
|
+
"sonarjs/aws-iam-all-resources-accessible": "off",
|
|
331
|
+
"sonarjs/aws-iam-privilege-escalation": "off",
|
|
332
|
+
"sonarjs/aws-iam-public-access": "off",
|
|
333
|
+
"sonarjs/aws-opensearchservice-domain": "off",
|
|
334
|
+
"sonarjs/aws-rds-unencrypted-databases": "off",
|
|
335
|
+
"sonarjs/aws-restricted-ip-admin-access": "off",
|
|
336
|
+
"sonarjs/aws-s3-bucket-granted-access": "off",
|
|
337
|
+
"sonarjs/aws-s3-bucket-insecure-http": "off",
|
|
338
|
+
"sonarjs/aws-s3-bucket-public-access": "off",
|
|
339
|
+
"sonarjs/aws-s3-bucket-server-encryption": "off",
|
|
340
|
+
"sonarjs/aws-s3-bucket-versioning": "off",
|
|
341
|
+
"sonarjs/aws-sagemaker-unencrypted-notebook": "off",
|
|
342
|
+
"sonarjs/aws-sns-unencrypted-topics": "off",
|
|
343
|
+
"sonarjs/aws-sqs-unencrypted-queue": "off",
|
|
344
|
+
},
|
|
345
|
+
}),
|
|
337
346
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
defineConfig({
|
|
348
|
+
/* loosen rules for build scripts */
|
|
349
|
+
name: "@html-validate/eslint-config/scripts",
|
|
350
|
+
files: ["*.{js,mjs,cjs}", "*.{ts,mts,cts}"],
|
|
351
|
+
rules: {
|
|
352
|
+
"no-console": "off",
|
|
353
|
+
},
|
|
354
|
+
}),
|
|
346
355
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
356
|
+
defineConfig({
|
|
357
|
+
/* ensure all of these patterns are linted */
|
|
358
|
+
name: "@html-validate/eslint-config/extensions",
|
|
359
|
+
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
360
|
+
}),
|
|
352
361
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
+
defineConfig({
|
|
363
|
+
/* disable rules requiring esm-only features */
|
|
364
|
+
name: "@html-validate/eslint-config/cjs",
|
|
365
|
+
files: ["**/*.cjs", "**/*.cts"],
|
|
366
|
+
rules: {
|
|
367
|
+
"unicorn/prefer-import-meta-properties": "off",
|
|
368
|
+
"unicorn/prefer-top-level-await": "off",
|
|
369
|
+
},
|
|
370
|
+
}),
|
|
362
371
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
defineConfig({
|
|
373
|
+
/* specific rules for modules */
|
|
374
|
+
name: "@html-validate/eslint-config/esm",
|
|
375
|
+
files: moduleExtensions.map((it) => `**/*.${it}`),
|
|
376
|
+
rules: {
|
|
377
|
+
"import-x/extensions": [
|
|
378
|
+
"error",
|
|
379
|
+
"always",
|
|
380
|
+
{
|
|
381
|
+
ignorePackages: true,
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
}),
|
|
377
386
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
387
|
+
defineConfig({
|
|
388
|
+
/* files which should lint even if project isn't build yet */
|
|
389
|
+
name: "@html-validate/eslint-config/dist",
|
|
390
|
+
files: ["*.d.ts", ".htmlvalidate.{js,mjs,cjs}", "bin/*.{js,mjs,cjs}"],
|
|
391
|
+
rules: {
|
|
392
|
+
"import-x/export": "off",
|
|
393
|
+
"import-x/extensions": "off",
|
|
394
|
+
"import-x/no-unresolved": "off",
|
|
395
|
+
},
|
|
396
|
+
}),
|
|
388
397
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
];
|
|
398
|
+
defineConfig({
|
|
399
|
+
/* semantic-release is only installed on demand during release, so the
|
|
400
|
+
* imports in this file would be unresolved in a regular build */
|
|
401
|
+
name: "@html-validate/eslint-config/semantic-release",
|
|
402
|
+
files: ["release.config.{js,mjs}"],
|
|
403
|
+
rules: {
|
|
404
|
+
"import-x/no-unresolved": "off",
|
|
405
|
+
},
|
|
406
|
+
}),
|
|
407
|
+
];
|
|
408
|
+
|
|
409
|
+
return configs;
|
|
410
|
+
}
|