@forsakringskassan/eslint-config 15.2.0 → 15.3.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/index.mjs +35 -105
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -206,157 +206,86 @@ export default [
|
|
|
206
206
|
|
|
207
207
|
/* enable eslint-plugin-unicorn */
|
|
208
208
|
...eslintPluginUnicorn.configs.recommended.rules,
|
|
209
|
-
"unicorn/better-regex": "off", // covered by eslint-plugin-regexp
|
|
210
209
|
"unicorn/catch-error-name": "off",
|
|
211
210
|
"unicorn/consistent-assert": "off",
|
|
211
|
+
"unicorn/consistent-boolean-name": "off",
|
|
212
|
+
"unicorn/consistent-class-member-order": "off",
|
|
213
|
+
"unicorn/consistent-compound-words": "off",
|
|
212
214
|
"unicorn/consistent-date-clone": "off", // we prefer to use FDate instead of Date and structuredClone does not play well with jest
|
|
213
215
|
"unicorn/consistent-empty-array-spread": "off",
|
|
214
|
-
"unicorn/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
"unicorn/default-export-style": [
|
|
217
|
+
"error",
|
|
218
|
+
{
|
|
219
|
+
/* right now this rule is too restrictive with functions */
|
|
220
|
+
functions: "ignore",
|
|
221
|
+
/* classes should be default exported inline */
|
|
222
|
+
classes: "inline",
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
"unicorn/escape-case": "off", // typically not useful for this organization
|
|
220
226
|
"unicorn/expiring-todo-comments": "off", // could be useful later
|
|
221
227
|
"unicorn/explicit-length-check": [
|
|
222
228
|
"error",
|
|
223
229
|
{ "non-zero": "greater-than" },
|
|
224
230
|
],
|
|
225
231
|
"unicorn/filename-case": [
|
|
232
|
+
/* enforce kebab-case in filenames */
|
|
226
233
|
"error",
|
|
227
234
|
{
|
|
228
235
|
case: "kebabCase",
|
|
236
|
+
checkDirectories: false,
|
|
229
237
|
ignore: [
|
|
238
|
+
"^__(fixtures|mocks|snapshots|tests)__$",
|
|
230
239
|
"^Gruntfile.js$",
|
|
231
240
|
/* ignore mocks for @forsakringskassan/apimock-express */
|
|
232
241
|
"_(get|post|put|delete).(js|cjs|mjs|ts)$",
|
|
233
242
|
],
|
|
234
243
|
},
|
|
235
|
-
],
|
|
244
|
+
],
|
|
236
245
|
"unicorn/import-style": "off", // off for now
|
|
237
|
-
"unicorn/
|
|
238
|
-
"unicorn/new-for-builtins": "error",
|
|
246
|
+
"unicorn/name-replacements": "off", // maybe later
|
|
239
247
|
"unicorn/no-abusive-eslint-disable": "off", // covered by eslint-plugin-eslint-comments
|
|
240
|
-
"unicorn/no-accessor-recursion": "error",
|
|
241
248
|
"unicorn/no-anonymous-default-export": "off", // often used with configuration packages
|
|
242
|
-
"unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part
|
|
243
|
-
"unicorn/no-array-for-each": "error",
|
|
244
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
249
|
+
"unicorn/no-array-callback-reference": "off", // opinionated, prefer to allow passing function references to array methods (and for most part TypeScript will handle this)
|
|
245
250
|
"unicorn/no-array-reduce": "off", // allow usage of reduce()
|
|
246
|
-
"unicorn/no-array-reverse": "error", // prefer immutable .toReversed() (available in Node.js 20+)
|
|
247
|
-
"unicorn/no-array-sort": "error", // prefer immutable .toSorted() (available in Node.js 20+)
|
|
248
|
-
"unicorn/no-await-expression-member": "error",
|
|
249
|
-
"unicorn/no-await-in-promise-methods": "error",
|
|
250
|
-
"unicorn/no-console-spaces": "error",
|
|
251
|
-
"unicorn/no-document-cookie": "error",
|
|
252
251
|
"unicorn/no-empty-file": "off",
|
|
253
|
-
"unicorn/no-for-loop": "error",
|
|
254
|
-
"unicorn/no-hex-escape": "error",
|
|
255
252
|
"unicorn/no-immediate-mutation": "off",
|
|
256
|
-
"unicorn/no-
|
|
257
|
-
"unicorn/no-invalid-fetch-options": "off", // let
|
|
258
|
-
"unicorn/no-
|
|
259
|
-
"unicorn/no-magic-array-flat-depth": "error",
|
|
260
|
-
"unicorn/no-named-default": "off", // named default is useful for vue
|
|
253
|
+
"unicorn/no-invalid-argument-count": "off", // does not respect optional parameters (e.g. jsdoc [param])
|
|
254
|
+
"unicorn/no-invalid-fetch-options": "off", // let TypeScript and tests handle this
|
|
255
|
+
"unicorn/no-named-default": "off", // named default is useful for Vue.js
|
|
261
256
|
"unicorn/no-negated-condition": "off", // mostly agree with the rule but sometimes its useful to have the common case first even if negated
|
|
262
257
|
"unicorn/no-negation-in-equality-check": "off",
|
|
263
|
-
"unicorn/no-new-array": "error",
|
|
264
|
-
"unicorn/no-new-buffer": "error",
|
|
265
258
|
"unicorn/no-null": "off", // prefer using null over undefined
|
|
266
|
-
"unicorn/no-
|
|
267
|
-
"unicorn/no-process-exit": "off", // covered by n/no-process-exit (enabled by recommended-module preset)
|
|
268
|
-
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
269
|
-
"unicorn/no-static-only-class": "off",
|
|
270
|
-
"unicorn/no-thenable": "off",
|
|
271
|
-
"unicorn/no-this-assignment": "error",
|
|
272
|
-
"unicorn/no-typeof-undefined": "error",
|
|
273
|
-
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
274
|
-
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
275
|
-
"unicorn/no-unnecessary-await": "error",
|
|
259
|
+
"unicorn/no-this-outside-of-class": "off", // disagree somewhat with the rule, flags stateful objects
|
|
276
260
|
"unicorn/no-unnecessary-polyfills": "off",
|
|
277
|
-
"unicorn/no-unnecessary-slice-end": "error",
|
|
278
261
|
"unicorn/no-unreadable-array-destructuring": "off",
|
|
279
|
-
"unicorn/no-unreadable-iife": "off",
|
|
280
|
-
"unicorn/no-useless-collection-argument": "error",
|
|
281
|
-
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
282
|
-
"unicorn/no-useless-fallback-in-spread": "error",
|
|
283
|
-
"unicorn/no-useless-iterator-to-array": "error",
|
|
284
|
-
"unicorn/no-useless-length-check": "error",
|
|
285
|
-
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
286
|
-
"unicorn/no-useless-spread": "error",
|
|
287
262
|
"unicorn/no-useless-switch-case": "off",
|
|
288
263
|
"unicorn/no-useless-undefined": "off", // opinionated, I prefer to explicitly pass undefined
|
|
289
|
-
"unicorn/no-zero-fractions": "error",
|
|
290
|
-
"unicorn/number-literal-case": [
|
|
291
|
-
"error",
|
|
292
|
-
{ hexadecimalValue: "lowercase" },
|
|
293
|
-
],
|
|
294
|
-
"unicorn/numeric-separators-style": "off",
|
|
295
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
296
|
-
"unicorn/prefer-array-find": "error",
|
|
297
|
-
"unicorn/prefer-array-flat": "error",
|
|
298
|
-
"unicorn/prefer-array-flat-map": "error",
|
|
299
|
-
"unicorn/prefer-array-index-of": "error",
|
|
300
|
-
"unicorn/prefer-array-some": "error",
|
|
301
|
-
"unicorn/prefer-at": "error",
|
|
302
264
|
"unicorn/prefer-bigint-literals": "off",
|
|
303
|
-
"unicorn/prefer-
|
|
304
|
-
"unicorn/prefer-class-fields": "error",
|
|
305
|
-
"unicorn/prefer-classlist-toggle": "error",
|
|
306
|
-
"unicorn/prefer-code-point": "error",
|
|
307
|
-
"unicorn/prefer-date-now": "error",
|
|
308
|
-
"unicorn/prefer-default-parameters": "error",
|
|
309
|
-
"unicorn/prefer-dom-node-append": "error",
|
|
310
|
-
"unicorn/prefer-dom-node-dataset": "error",
|
|
311
|
-
"unicorn/prefer-dom-node-remove": "error",
|
|
312
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
313
|
-
"unicorn/prefer-event-target": "error",
|
|
314
|
-
"unicorn/prefer-export-from": "error",
|
|
265
|
+
"unicorn/prefer-boolean-return": "off", // creates inconsistent functions when using multiple conditions
|
|
315
266
|
"unicorn/prefer-global-this": "off",
|
|
267
|
+
"unicorn/prefer-hoisting-branch-code": "off", // lots of false positives with TypeScript code
|
|
316
268
|
"unicorn/prefer-import-meta-properties": "error",
|
|
317
|
-
"unicorn/prefer-
|
|
318
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
319
|
-
"unicorn/prefer-logical-operator-over-ternary": "off",
|
|
320
|
-
"unicorn/prefer-math-min-max": "error",
|
|
321
|
-
"unicorn/prefer-math-trunc": "error",
|
|
322
|
-
"unicorn/prefer-modern-dom-apis": "error",
|
|
323
|
-
"unicorn/prefer-modern-math-apis": "error",
|
|
269
|
+
"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`.
|
|
324
270
|
"unicorn/prefer-module": "off",
|
|
325
|
-
"unicorn/prefer-native-coercion-functions": "off",
|
|
326
|
-
"unicorn/prefer-negative-index": "error",
|
|
327
|
-
"unicorn/prefer-number-properties": "error",
|
|
328
|
-
"unicorn/prefer-object-from-entries": "error",
|
|
329
271
|
"unicorn/prefer-optional-catch-binding": "off", // covered by sonarjs/no-ignored-exceptions
|
|
330
|
-
"unicorn/prefer-
|
|
331
|
-
"unicorn/prefer-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
"unicorn/prefer-
|
|
336
|
-
"unicorn/prefer-set-size": "error",
|
|
337
|
-
"unicorn/prefer-simple-condition-first": "error",
|
|
272
|
+
"unicorn/prefer-promise-try": "off", // baseline but requires Node.js 23
|
|
273
|
+
"unicorn/prefer-queue-microtask": [
|
|
274
|
+
"error",
|
|
275
|
+
{ checkSetImmediate: true, checkSetTimeout: true },
|
|
276
|
+
],
|
|
277
|
+
"unicorn/prefer-scoped-selector": "off",
|
|
338
278
|
"unicorn/prefer-single-call": "off",
|
|
339
279
|
"unicorn/prefer-spread": "off", // for now
|
|
340
280
|
"unicorn/prefer-string-raw": "off", // for now
|
|
341
|
-
"unicorn/prefer-string-replace-all": "error",
|
|
342
|
-
"unicorn/prefer-string-slice": "error",
|
|
343
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
344
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
345
281
|
"unicorn/prefer-structured-clone": "off", // we use `deepClone` from `@fkui/logic` and structuredClone does not play well with jest
|
|
346
|
-
"unicorn/prefer-switch": "error",
|
|
347
282
|
"unicorn/prefer-ternary": "off",
|
|
348
|
-
"unicorn/prefer-
|
|
349
|
-
"unicorn/
|
|
350
|
-
"unicorn/prevent-abbreviations": "off",
|
|
351
|
-
"unicorn/relative-url-style": "error",
|
|
352
|
-
"unicorn/require-array-join-separator": "error",
|
|
283
|
+
"unicorn/prefer-uint8array-base64": "off",
|
|
284
|
+
"unicorn/relative-url-style": "warn",
|
|
353
285
|
"unicorn/require-module-attributes": "off",
|
|
354
286
|
"unicorn/require-module-specifiers": "off",
|
|
355
|
-
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
356
287
|
"unicorn/switch-case-braces": "off",
|
|
357
|
-
"unicorn/switch-case-break-position": "error",
|
|
358
288
|
"unicorn/text-encoding-identifier-case": "error",
|
|
359
|
-
"unicorn/throw-new-error": "error",
|
|
360
289
|
...filterRules(prettierConfig.rules, (rule) => {
|
|
361
290
|
return rule.startsWith("unicorn/");
|
|
362
291
|
}),
|
|
@@ -476,6 +405,7 @@ export default [
|
|
|
476
405
|
"error",
|
|
477
406
|
{
|
|
478
407
|
case: "pascalCase",
|
|
408
|
+
checkDirectories: false,
|
|
479
409
|
},
|
|
480
410
|
],
|
|
481
411
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forsakringskassan/eslint-config",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.1",
|
|
4
4
|
"description": "Försäkringskassans eslint shareable config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"eslint-plugin-prettier": "5.5.6",
|
|
34
34
|
"eslint-plugin-regexp": "3.1.1",
|
|
35
35
|
"eslint-plugin-sonarjs": "4.1.0",
|
|
36
|
-
"eslint-plugin-unicorn": "
|
|
36
|
+
"eslint-plugin-unicorn": "70.0.0",
|
|
37
37
|
"globals": "17.7.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": "^22.13 || >= 24"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d6cf2b2cf9ffc0fe5722736f4425911ecb2fac34"
|
|
46
46
|
}
|