@ivanmaxlogiudice/eslint-config 3.0.0-beta.3 → 3.0.0-beta.4

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/index.js CHANGED
@@ -1,20 +1,22 @@
1
1
  // src/configs/comments.ts
2
2
  import plugin from "@eslint-community/eslint-plugin-eslint-comments";
3
- var comments = [
4
- {
5
- name: "ivanmaxlogiudice/comments/rules",
6
- plugins: {
7
- "eslint-comments": plugin
8
- },
9
- rules: {
10
- "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
11
- "eslint-comments/no-aggregating-enable": "error",
12
- "eslint-comments/no-duplicate-disable": "error",
13
- "eslint-comments/no-unlimited-disable": "error",
14
- "eslint-comments/no-unused-enable": "error"
3
+ function comments() {
4
+ return [
5
+ {
6
+ name: "ivanmaxlogiudice/comments/rules",
7
+ plugins: {
8
+ "eslint-comments": plugin
9
+ },
10
+ rules: {
11
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
12
+ "eslint-comments/no-aggregating-enable": "error",
13
+ "eslint-comments/no-duplicate-disable": "error",
14
+ "eslint-comments/no-unlimited-disable": "error",
15
+ "eslint-comments/no-unused-enable": "error"
16
+ }
15
17
  }
16
- }
17
- ];
18
+ ];
19
+ }
18
20
 
19
21
  // src/configs/ignores.ts
20
22
  import { dedupe, parsePath, toFlatConfig } from "@ivanmaxlogiudice/gitignore";
@@ -183,35 +185,37 @@ function ignores() {
183
185
 
184
186
  // src/configs/imports.ts
185
187
  import plugin2 from "eslint-plugin-import-x";
186
- var imports = [
187
- {
188
- name: "ivanmaxlogiudice/imports/rules",
189
- plugins: {
190
- import: plugin2
188
+ function imports() {
189
+ return [
190
+ {
191
+ name: "ivanmaxlogiudice/imports/rules",
192
+ plugins: {
193
+ import: plugin2
194
+ },
195
+ rules: {
196
+ "antfu/import-dedupe": "error",
197
+ "antfu/no-import-dist": "error",
198
+ "antfu/no-import-node-modules-by-path": "error",
199
+ "import/first": "error",
200
+ "import/no-duplicates": "error",
201
+ "import/no-mutable-exports": "error",
202
+ "import/no-named-default": "error",
203
+ "import/no-self-import": "error",
204
+ "import/no-webpack-loader-syntax": "error",
205
+ // Stylistic
206
+ "import/newline-after-import": ["error", { count: 1 }]
207
+ }
191
208
  },
192
- rules: {
193
- "antfu/import-dedupe": "error",
194
- "antfu/no-import-dist": "error",
195
- "antfu/no-import-node-modules-by-path": "error",
196
- "import/first": "error",
197
- "import/no-duplicates": "error",
198
- "import/no-mutable-exports": "error",
199
- "import/no-named-default": "error",
200
- "import/no-self-import": "error",
201
- "import/no-webpack-loader-syntax": "error",
202
- // Stylistic
203
- "import/newline-after-import": ["error", { count: 1 }]
204
- }
205
- },
206
- {
207
- name: "ivanmaxlogiudice/imports/disables/bin",
208
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
209
- rules: {
210
- "antfu/no-import-dist": "off",
211
- "antfu/no-import-node-modules-by-path": "off"
209
+ {
210
+ name: "ivanmaxlogiudice/imports/disables/bin",
211
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
212
+ rules: {
213
+ "antfu/no-import-dist": "off",
214
+ "antfu/no-import-node-modules-by-path": "off"
215
+ }
212
216
  }
213
- }
214
- ];
217
+ ];
218
+ }
215
219
 
216
220
  // src/configs/javascript.ts
217
221
  import pluginAntfu from "eslint-plugin-antfu";
@@ -222,305 +226,323 @@ var restrictedSyntaxJs = [
222
226
  "LabeledStatement",
223
227
  "WithStatement"
224
228
  ];
225
- var javascript = [
226
- {
227
- name: "ivanmaxlogiudice/javascript/setup",
228
- languageOptions: {
229
- ecmaVersion: 2022,
230
- globals: {
231
- ...globals.browser,
232
- ...globals.es2021,
233
- ...globals.node,
234
- document: "readonly",
235
- navigator: "readonly",
236
- window: "readonly"
237
- },
238
- parserOptions: {
239
- ecmaFeatures: {
240
- jsx: true
241
- },
229
+ function javascript(options = {}) {
230
+ const {
231
+ isInEditor = false,
232
+ overrides = {}
233
+ } = options;
234
+ return [
235
+ {
236
+ name: "ivanmaxlogiudice/javascript/setup",
237
+ languageOptions: {
242
238
  ecmaVersion: 2022,
239
+ globals: {
240
+ ...globals.browser,
241
+ ...globals.es2021,
242
+ ...globals.node,
243
+ document: "readonly",
244
+ navigator: "readonly",
245
+ window: "readonly"
246
+ },
247
+ parserOptions: {
248
+ ecmaFeatures: {
249
+ jsx: true
250
+ },
251
+ ecmaVersion: 2022,
252
+ sourceType: "module"
253
+ },
243
254
  sourceType: "module"
244
255
  },
245
- sourceType: "module"
246
- },
247
- linterOptions: {
248
- reportUnusedDisableDirectives: true
249
- }
250
- },
251
- {
252
- name: "ivanmaxlogiudice/javascript/rules",
253
- plugins: {
254
- "antfu": pluginAntfu,
255
- "unused-imports": pluginUnused
256
+ linterOptions: {
257
+ reportUnusedDisableDirectives: true
258
+ }
256
259
  },
257
- rules: {
258
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
259
- "array-callback-return": "error",
260
- "block-scoped-var": "error",
261
- "constructor-super": "error",
262
- "default-case-last": "error",
263
- "dot-notation": ["error", { allowKeywords: true }],
264
- "eqeqeq": ["error", "smart"],
265
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
266
- "no-alert": "error",
267
- "no-array-constructor": "error",
268
- "no-async-promise-executor": "error",
269
- "no-caller": "error",
270
- "no-case-declarations": "error",
271
- "no-class-assign": "error",
272
- "no-compare-neg-zero": "error",
273
- "no-cond-assign": ["error", "always"],
274
- "no-console": ["error", { allow: ["warn", "error"] }],
275
- "no-const-assign": "error",
276
- "no-control-regex": "error",
277
- "no-debugger": "error",
278
- "no-delete-var": "error",
279
- "no-dupe-args": "error",
280
- "no-dupe-class-members": "error",
281
- "no-dupe-keys": "error",
282
- "no-duplicate-case": "error",
283
- "no-empty": ["error", { allowEmptyCatch: true }],
284
- "no-empty-character-class": "error",
285
- "no-empty-pattern": "error",
286
- "no-eval": "error",
287
- "no-ex-assign": "error",
288
- "no-extend-native": "error",
289
- "no-extra-bind": "error",
290
- "no-extra-boolean-cast": "error",
291
- "no-fallthrough": "error",
292
- "no-func-assign": "error",
293
- "no-global-assign": "error",
294
- "no-implied-eval": "error",
295
- "no-import-assign": "error",
296
- "no-invalid-regexp": "error",
297
- "no-irregular-whitespace": "error",
298
- "no-iterator": "error",
299
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
300
- "no-lone-blocks": "error",
301
- "no-loss-of-precision": "error",
302
- "no-misleading-character-class": "error",
303
- "no-multi-str": "error",
304
- "no-new": "error",
305
- "no-new-func": "error",
306
- "no-new-native-nonconstructor": "error",
307
- "no-new-wrappers": "error",
308
- "no-obj-calls": "error",
309
- "no-octal": "error",
310
- "no-octal-escape": "error",
311
- "no-proto": "error",
312
- "no-prototype-builtins": "error",
313
- "no-redeclare": ["error", { builtinGlobals: false }],
314
- "no-regex-spaces": "error",
315
- "no-restricted-globals": [
316
- "error",
317
- { name: "global", message: "Use `globalThis` instead." },
318
- { name: "self", message: "Use `globalThis` instead." }
319
- ],
320
- "no-restricted-properties": [
321
- "error",
322
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
323
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
324
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
325
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
326
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
327
- ],
328
- "no-restricted-syntax": [
329
- "error",
330
- "DebuggerStatement",
331
- "LabeledStatement",
332
- "WithStatement",
333
- "TSEnumDeclaration[const=true]",
334
- "TSExportAssignment"
335
- ],
336
- "no-self-assign": ["error", { props: true }],
337
- "no-self-compare": "error",
338
- "no-sequences": "error",
339
- "no-shadow-restricted-names": "error",
340
- "no-sparse-arrays": "error",
341
- "no-template-curly-in-string": "error",
342
- "no-this-before-super": "error",
343
- "no-throw-literal": "error",
344
- "no-undef": "error",
345
- "no-undef-init": "error",
346
- "no-unexpected-multiline": "error",
347
- "no-unmodified-loop-condition": "error",
348
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
349
- "no-unreachable": "error",
350
- "no-unreachable-loop": "error",
351
- "no-unsafe-finally": "error",
352
- "no-unsafe-negation": "error",
353
- "no-unused-expressions": ["error", {
354
- allowShortCircuit: true,
355
- allowTaggedTemplates: true,
356
- allowTernary: true
357
- }],
358
- "no-unused-vars": ["error", {
359
- args: "none",
360
- caughtErrors: "none",
361
- ignoreRestSiblings: true,
362
- vars: "all"
363
- }],
364
- "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
365
- "no-useless-backreference": "error",
366
- "no-useless-call": "error",
367
- "no-useless-catch": "error",
368
- "no-useless-computed-key": "error",
369
- "no-useless-constructor": "error",
370
- "no-useless-rename": "error",
371
- "no-useless-return": "error",
372
- "no-var": "error",
373
- "no-with": "error",
374
- "object-shorthand": [
375
- "error",
376
- "always",
377
- {
378
- avoidQuotes: true,
379
- ignoreConstructors: false
380
- }
381
- ],
382
- "one-var": ["error", { initialized: "never" }],
383
- "prefer-arrow-callback": [
384
- "error",
385
- {
386
- allowNamedFunctions: false,
387
- allowUnboundThis: true
388
- }
389
- ],
390
- "prefer-const": [
391
- "error",
392
- {
393
- destructuring: "all",
394
- ignoreReadBeforeAssign: true
395
- }
396
- ],
397
- "prefer-exponentiation-operator": "error",
398
- "prefer-promise-reject-errors": "error",
399
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
400
- "prefer-rest-params": "error",
401
- "prefer-spread": "error",
402
- "prefer-template": "error",
403
- "symbol-description": "error",
404
- "unicode-bom": ["error", "never"],
405
- "unused-imports/no-unused-imports": isInEditorEnv() ? "off" : "error",
406
- "unused-imports/no-unused-vars": [
407
- "error",
408
- {
409
- args: "after-used",
410
- argsIgnorePattern: "^_",
260
+ {
261
+ name: "ivanmaxlogiudice/javascript/rules",
262
+ plugins: {
263
+ "antfu": pluginAntfu,
264
+ "unused-imports": pluginUnused
265
+ },
266
+ rules: {
267
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
268
+ "array-callback-return": "error",
269
+ "block-scoped-var": "error",
270
+ "constructor-super": "error",
271
+ "default-case-last": "error",
272
+ "dot-notation": ["error", { allowKeywords: true }],
273
+ "eqeqeq": ["error", "smart"],
274
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
275
+ "no-alert": "error",
276
+ "no-array-constructor": "error",
277
+ "no-async-promise-executor": "error",
278
+ "no-caller": "error",
279
+ "no-case-declarations": "error",
280
+ "no-class-assign": "error",
281
+ "no-compare-neg-zero": "error",
282
+ "no-cond-assign": ["error", "always"],
283
+ "no-console": ["error", { allow: ["warn", "error"] }],
284
+ "no-const-assign": "error",
285
+ "no-control-regex": "error",
286
+ "no-debugger": "error",
287
+ "no-delete-var": "error",
288
+ "no-dupe-args": "error",
289
+ "no-dupe-class-members": "error",
290
+ "no-dupe-keys": "error",
291
+ "no-duplicate-case": "error",
292
+ "no-empty": ["error", { allowEmptyCatch: true }],
293
+ "no-empty-character-class": "error",
294
+ "no-empty-pattern": "error",
295
+ "no-eval": "error",
296
+ "no-ex-assign": "error",
297
+ "no-extend-native": "error",
298
+ "no-extra-bind": "error",
299
+ "no-extra-boolean-cast": "error",
300
+ "no-fallthrough": "error",
301
+ "no-func-assign": "error",
302
+ "no-global-assign": "error",
303
+ "no-implied-eval": "error",
304
+ "no-import-assign": "error",
305
+ "no-invalid-regexp": "error",
306
+ "no-irregular-whitespace": "error",
307
+ "no-iterator": "error",
308
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
309
+ "no-lone-blocks": "error",
310
+ "no-loss-of-precision": "error",
311
+ "no-misleading-character-class": "error",
312
+ "no-multi-str": "error",
313
+ "no-new": "error",
314
+ "no-new-func": "error",
315
+ "no-new-native-nonconstructor": "error",
316
+ "no-new-wrappers": "error",
317
+ "no-obj-calls": "error",
318
+ "no-octal": "error",
319
+ "no-octal-escape": "error",
320
+ "no-proto": "error",
321
+ "no-prototype-builtins": "error",
322
+ "no-redeclare": ["error", { builtinGlobals: false }],
323
+ "no-regex-spaces": "error",
324
+ "no-restricted-globals": [
325
+ "error",
326
+ { name: "global", message: "Use `globalThis` instead." },
327
+ { name: "self", message: "Use `globalThis` instead." }
328
+ ],
329
+ "no-restricted-properties": [
330
+ "error",
331
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
332
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
333
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
334
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
335
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
336
+ ],
337
+ "no-restricted-syntax": [
338
+ "error",
339
+ "DebuggerStatement",
340
+ "LabeledStatement",
341
+ "WithStatement",
342
+ "TSEnumDeclaration[const=true]",
343
+ "TSExportAssignment"
344
+ ],
345
+ "no-self-assign": ["error", { props: true }],
346
+ "no-self-compare": "error",
347
+ "no-sequences": "error",
348
+ "no-shadow-restricted-names": "error",
349
+ "no-sparse-arrays": "error",
350
+ "no-template-curly-in-string": "error",
351
+ "no-this-before-super": "error",
352
+ "no-throw-literal": "error",
353
+ "no-undef": "error",
354
+ "no-undef-init": "error",
355
+ "no-unexpected-multiline": "error",
356
+ "no-unmodified-loop-condition": "error",
357
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
358
+ "no-unreachable": "error",
359
+ "no-unreachable-loop": "error",
360
+ "no-unsafe-finally": "error",
361
+ "no-unsafe-negation": "error",
362
+ "no-unused-expressions": ["error", {
363
+ allowShortCircuit: true,
364
+ allowTaggedTemplates: true,
365
+ allowTernary: true
366
+ }],
367
+ "no-unused-vars": ["error", {
368
+ args: "none",
369
+ caughtErrors: "none",
411
370
  ignoreRestSiblings: true,
412
- vars: "all",
413
- varsIgnorePattern: "^_"
414
- }
415
- ],
416
- "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
417
- "valid-typeof": ["error", { requireStringLiterals: true }],
418
- "vars-on-top": "error",
419
- "yoda": ["error", "never"]
420
- }
421
- },
422
- {
423
- name: "ivanmaxlogiudice/javascript/disables/cli",
424
- files: [`scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`],
425
- rules: {
426
- "no-console": "off"
371
+ vars: "all"
372
+ }],
373
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
374
+ "no-useless-backreference": "error",
375
+ "no-useless-call": "error",
376
+ "no-useless-catch": "error",
377
+ "no-useless-computed-key": "error",
378
+ "no-useless-constructor": "error",
379
+ "no-useless-rename": "error",
380
+ "no-useless-return": "error",
381
+ "no-var": "error",
382
+ "no-with": "error",
383
+ "object-shorthand": [
384
+ "error",
385
+ "always",
386
+ {
387
+ avoidQuotes: true,
388
+ ignoreConstructors: false
389
+ }
390
+ ],
391
+ "one-var": ["error", { initialized: "never" }],
392
+ "prefer-arrow-callback": [
393
+ "error",
394
+ {
395
+ allowNamedFunctions: false,
396
+ allowUnboundThis: true
397
+ }
398
+ ],
399
+ "prefer-const": [
400
+ "error",
401
+ {
402
+ destructuring: "all",
403
+ ignoreReadBeforeAssign: true
404
+ }
405
+ ],
406
+ "prefer-exponentiation-operator": "error",
407
+ "prefer-promise-reject-errors": "error",
408
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
409
+ "prefer-rest-params": "error",
410
+ "prefer-spread": "error",
411
+ "prefer-template": "error",
412
+ "symbol-description": "error",
413
+ "unicode-bom": ["error", "never"],
414
+ "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
415
+ "unused-imports/no-unused-vars": [
416
+ "error",
417
+ {
418
+ args: "after-used",
419
+ argsIgnorePattern: "^_",
420
+ ignoreRestSiblings: true,
421
+ vars: "all",
422
+ varsIgnorePattern: "^_"
423
+ }
424
+ ],
425
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
426
+ "valid-typeof": ["error", { requireStringLiterals: true }],
427
+ "vars-on-top": "error",
428
+ "yoda": ["error", "never"],
429
+ ...overrides
430
+ }
431
+ },
432
+ {
433
+ name: "ivanmaxlogiudice/javascript/disables/cli",
434
+ files: [`scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`],
435
+ rules: {
436
+ "no-console": "off"
437
+ }
427
438
  }
428
- }
429
- ];
439
+ ];
440
+ }
430
441
 
431
442
  // src/configs/jsdoc.ts
432
443
  import plugin3 from "eslint-plugin-jsdoc";
433
- var jsdoc = [
434
- {
435
- name: "ivanmaxlogiudice/jsdoc/rules",
436
- plugins: {
437
- jsdoc: plugin3
438
- },
439
- rules: {
440
- "jsdoc/check-access": "warn",
441
- "jsdoc/check-param-names": "warn",
442
- "jsdoc/check-property-names": "warn",
443
- "jsdoc/check-types": "warn",
444
- "jsdoc/empty-tags": "warn",
445
- "jsdoc/implements-on-classes": "warn",
446
- "jsdoc/no-defaults": "warn",
447
- "jsdoc/no-multi-asterisks": "warn",
448
- "jsdoc/require-param-name": "warn",
449
- "jsdoc/require-property": "warn",
450
- "jsdoc/require-property-description": "warn",
451
- "jsdoc/require-property-name": "warn",
452
- "jsdoc/require-returns-check": "warn",
453
- "jsdoc/require-returns-description": "warn",
454
- "jsdoc/require-yields-check": "warn",
455
- // Stylistic
456
- "jsdoc/check-alignment": "warn",
457
- "jsdoc/multiline-blocks": "warn"
444
+ function jsdoc() {
445
+ return [
446
+ {
447
+ name: "ivanmaxlogiudice/jsdoc/rules",
448
+ plugins: {
449
+ jsdoc: plugin3
450
+ },
451
+ rules: {
452
+ "jsdoc/check-access": "warn",
453
+ "jsdoc/check-param-names": "warn",
454
+ "jsdoc/check-property-names": "warn",
455
+ "jsdoc/check-types": "warn",
456
+ "jsdoc/empty-tags": "warn",
457
+ "jsdoc/implements-on-classes": "warn",
458
+ "jsdoc/no-defaults": "warn",
459
+ "jsdoc/no-multi-asterisks": "warn",
460
+ "jsdoc/require-param-name": "warn",
461
+ "jsdoc/require-property": "warn",
462
+ "jsdoc/require-property-description": "warn",
463
+ "jsdoc/require-property-name": "warn",
464
+ "jsdoc/require-returns-check": "warn",
465
+ "jsdoc/require-returns-description": "warn",
466
+ "jsdoc/require-yields-check": "warn",
467
+ // Stylistic
468
+ "jsdoc/check-alignment": "warn",
469
+ "jsdoc/multiline-blocks": "warn"
470
+ }
458
471
  }
459
- }
460
- ];
472
+ ];
473
+ }
461
474
 
462
475
  // src/configs/jsonc.ts
463
476
  import plugin4 from "eslint-plugin-jsonc";
464
477
  import parser from "jsonc-eslint-parser";
465
- var jsonc = [
466
- {
467
- name: "ivanmaxlogiudice/jsonc/setup",
468
- plugins: {
469
- jsonc: plugin4
470
- }
471
- },
472
- {
473
- name: "ivanmaxlogiudice/jsonc/rules",
474
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
475
- languageOptions: {
476
- parser
478
+ function jsonc(options = {}) {
479
+ const {
480
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
481
+ overrides = {}
482
+ } = options;
483
+ return [
484
+ {
485
+ name: "ivanmaxlogiudice/jsonc/setup",
486
+ plugins: {
487
+ jsonc: plugin4
488
+ }
477
489
  },
478
- rules: {
479
- "jsonc/no-bigint-literals": "error",
480
- "jsonc/no-binary-expression": "error",
481
- "jsonc/no-binary-numeric-literals": "error",
482
- "jsonc/no-dupe-keys": "error",
483
- "jsonc/no-escape-sequence-in-identifier": "error",
484
- "jsonc/no-floating-decimal": "error",
485
- "jsonc/no-hexadecimal-numeric-literals": "error",
486
- "jsonc/no-infinity": "error",
487
- "jsonc/no-multi-str": "error",
488
- "jsonc/no-nan": "error",
489
- "jsonc/no-number-props": "error",
490
- "jsonc/no-numeric-separators": "error",
491
- "jsonc/no-octal": "error",
492
- "jsonc/no-octal-escape": "error",
493
- "jsonc/no-octal-numeric-literals": "error",
494
- "jsonc/no-parenthesized": "error",
495
- "jsonc/no-plus-sign": "error",
496
- "jsonc/no-regexp-literals": "error",
497
- "jsonc/no-sparse-arrays": "error",
498
- "jsonc/no-template-literals": "error",
499
- "jsonc/no-undefined-value": "error",
500
- "jsonc/no-unicode-codepoint-escapes": "error",
501
- "jsonc/no-useless-escape": "error",
502
- "jsonc/space-unary-ops": "error",
503
- "jsonc/valid-json-number": "error",
504
- "jsonc/vue-custom-block/no-parsing-error": "error",
505
- // Stylistic
506
- "jsonc/array-bracket-spacing": ["error", "never"],
507
- "jsonc/comma-dangle": ["error", "never"],
508
- "jsonc/comma-style": ["error", "last"],
509
- "jsonc/indent": ["error", 4],
510
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
511
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
512
- "jsonc/object-curly-spacing": ["error", "always"],
513
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
514
- "jsonc/quote-props": "error",
515
- "jsonc/quotes": "error"
490
+ {
491
+ name: "ivanmaxlogiudice/jsonc/rules",
492
+ files,
493
+ languageOptions: {
494
+ parser
495
+ },
496
+ rules: {
497
+ "jsonc/no-bigint-literals": "error",
498
+ "jsonc/no-binary-expression": "error",
499
+ "jsonc/no-binary-numeric-literals": "error",
500
+ "jsonc/no-dupe-keys": "error",
501
+ "jsonc/no-escape-sequence-in-identifier": "error",
502
+ "jsonc/no-floating-decimal": "error",
503
+ "jsonc/no-hexadecimal-numeric-literals": "error",
504
+ "jsonc/no-infinity": "error",
505
+ "jsonc/no-multi-str": "error",
506
+ "jsonc/no-nan": "error",
507
+ "jsonc/no-number-props": "error",
508
+ "jsonc/no-numeric-separators": "error",
509
+ "jsonc/no-octal": "error",
510
+ "jsonc/no-octal-escape": "error",
511
+ "jsonc/no-octal-numeric-literals": "error",
512
+ "jsonc/no-parenthesized": "error",
513
+ "jsonc/no-plus-sign": "error",
514
+ "jsonc/no-regexp-literals": "error",
515
+ "jsonc/no-sparse-arrays": "error",
516
+ "jsonc/no-template-literals": "error",
517
+ "jsonc/no-undefined-value": "error",
518
+ "jsonc/no-unicode-codepoint-escapes": "error",
519
+ "jsonc/no-useless-escape": "error",
520
+ "jsonc/space-unary-ops": "error",
521
+ "jsonc/valid-json-number": "error",
522
+ "jsonc/vue-custom-block/no-parsing-error": "error",
523
+ // Stylistic
524
+ "jsonc/array-bracket-spacing": ["error", "never"],
525
+ "jsonc/comma-dangle": ["error", "never"],
526
+ "jsonc/comma-style": ["error", "last"],
527
+ "jsonc/indent": ["error", 4],
528
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
529
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
530
+ "jsonc/object-curly-spacing": ["error", "always"],
531
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
532
+ "jsonc/quote-props": "error",
533
+ "jsonc/quotes": "error",
534
+ ...overrides
535
+ }
516
536
  }
517
- }
518
- ];
537
+ ];
538
+ }
519
539
 
520
540
  // src/configs/markdown.ts
521
541
  async function markdown(options = {}) {
522
542
  const {
523
- componentExts = []
543
+ componentExts = [],
544
+ files = [GLOB_MARKDOWN],
545
+ overrides = {}
524
546
  } = options;
525
547
  await ensurePackages(["eslint-plugin-markdown"]);
526
548
  const plugin10 = await interopDefault(import("eslint-plugin-markdown"));
@@ -533,7 +555,7 @@ async function markdown(options = {}) {
533
555
  },
534
556
  {
535
557
  name: "ivanmaxlogiudice/markdown/processor",
536
- files: [GLOB_MARKDOWN],
558
+ files,
537
559
  processor: "markdown/markdown"
538
560
  },
539
561
  {
@@ -572,7 +594,8 @@ async function markdown(options = {}) {
572
594
  "ts/no-use-before-define": "off",
573
595
  "unicode-bom": "off",
574
596
  "unused-imports/no-unused-imports": "off",
575
- "unused-imports/no-unused-vars": "off"
597
+ "unused-imports/no-unused-vars": "off",
598
+ ...overrides
576
599
  }
577
600
  }
578
601
  ];
@@ -580,63 +603,70 @@ async function markdown(options = {}) {
580
603
 
581
604
  // src/configs/node.ts
582
605
  import plugin5 from "eslint-plugin-n";
583
- var node = [
584
- {
585
- name: "ivanmaxlogiudice/node/rules",
586
- plugins: {
587
- node: plugin5
588
- },
589
- rules: {
590
- "node/handle-callback-err": ["error", "^(err|error)$"],
591
- "node/no-deprecated-api": "error",
592
- "node/no-exports-assign": "error",
593
- "node/no-new-require": "error",
594
- "node/no-path-concat": "error",
595
- "node/no-unsupported-features/es-builtins": "error",
596
- "node/prefer-global/buffer": ["error", "never"],
597
- "node/prefer-global/process": ["error", "never"],
598
- "node/process-exit-as-throw": "error"
606
+ function node() {
607
+ return [
608
+ {
609
+ name: "ivanmaxlogiudice/node/rules",
610
+ plugins: {
611
+ node: plugin5
612
+ },
613
+ rules: {
614
+ "node/handle-callback-err": ["error", "^(err|error)$"],
615
+ "node/no-deprecated-api": "error",
616
+ "node/no-exports-assign": "error",
617
+ "node/no-new-require": "error",
618
+ "node/no-path-concat": "error",
619
+ "node/no-unsupported-features/es-builtins": "error",
620
+ "node/prefer-global/buffer": ["error", "never"],
621
+ "node/prefer-global/process": ["error", "never"],
622
+ "node/process-exit-as-throw": "error"
623
+ }
599
624
  }
600
- }
601
- ];
625
+ ];
626
+ }
602
627
 
603
628
  // src/configs/perfectionist.ts
604
629
  import plugin6 from "eslint-plugin-perfectionist";
605
- var perfectionist = [
606
- {
607
- name: "ivanmaxlogiudice/perfectionist/rules",
608
- plugins: {
609
- perfectionist: plugin6
610
- },
611
- rules: {
612
- "perfectionist/sort-imports": ["warn", {
613
- groups: [
614
- "builtin",
615
- "external",
616
- "internal",
617
- "internal-type",
618
- "parent",
619
- "parent-type",
620
- "sibling",
621
- "sibling-type",
622
- "index",
623
- "index-type",
624
- "object",
625
- "type",
626
- "side-effect",
627
- "side-effect-style"
628
- ],
629
- internalPattern: ["@/**"],
630
- newlinesBetween: "ignore"
631
- }],
632
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
633
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
630
+ function perfectionist() {
631
+ return [
632
+ {
633
+ name: "ivanmaxlogiudice/perfectionist/rules",
634
+ plugins: {
635
+ perfectionist: plugin6
636
+ },
637
+ rules: {
638
+ "perfectionist/sort-imports": ["warn", {
639
+ groups: [
640
+ "builtin",
641
+ "external",
642
+ "internal",
643
+ "internal-type",
644
+ "parent",
645
+ "parent-type",
646
+ "sibling",
647
+ "sibling-type",
648
+ "index",
649
+ "index-type",
650
+ "object",
651
+ "type",
652
+ "side-effect",
653
+ "side-effect-style"
654
+ ],
655
+ internalPattern: ["@/**"],
656
+ newlinesBetween: "ignore"
657
+ }],
658
+ "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
659
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
660
+ }
634
661
  }
635
- }
636
- ];
662
+ ];
663
+ }
637
664
 
638
665
  // src/configs/regexp.ts
639
- async function regexp() {
666
+ async function regexp(options = {}) {
667
+ const {
668
+ overrides = {}
669
+ } = options;
640
670
  await ensurePackages(["eslint-plugin-regexp"]);
641
671
  const plugin10 = await interopDefault(import("eslint-plugin-regexp"));
642
672
  return [
@@ -646,214 +676,219 @@ async function regexp() {
646
676
  regexp: plugin10
647
677
  },
648
678
  rules: {
649
- ...plugin10.configs["flat/recommended"].rules
679
+ ...plugin10.configs["flat/recommended"].rules,
680
+ ...overrides
650
681
  }
651
682
  }
652
683
  ];
653
684
  }
654
685
 
655
686
  // src/configs/sort.ts
656
- var sortPackageJson = [
657
- {
658
- name: "ivanmaxlogiudice/sort/packageJson",
659
- files: ["**/package.json"],
660
- rules: {
661
- "jsonc/sort-array-values": [
662
- "error",
663
- {
664
- order: { type: "asc" },
665
- pathPattern: "^files$"
666
- }
667
- ],
668
- "jsonc/sort-keys": [
669
- "error",
670
- {
671
- order: [
672
- "name",
673
- "version",
674
- "private",
675
- "packageManager",
676
- "description",
677
- "type",
678
- "keywords",
679
- "license",
680
- "homepage",
681
- "bugs",
682
- "repository",
683
- "author",
684
- "contributors",
685
- "funding",
686
- "files",
687
- "main",
688
- "module",
689
- "types",
690
- "exports",
691
- "typesVersions",
692
- "sideEffects",
693
- "unpkg",
694
- "jsdelivr",
695
- "browser",
696
- "bin",
697
- "man",
698
- "directories",
699
- "publishConfig",
700
- "scripts",
701
- "peerDependencies",
702
- "peerDependenciesMeta",
703
- "optionalDependencies",
704
- "dependencies",
705
- "devDependencies",
706
- "engines",
707
- "config",
708
- "overrides",
709
- "pnpm",
710
- "husky",
711
- "lint-staged",
712
- "eslintConfig",
713
- "prettier"
714
- ],
715
- pathPattern: "^$"
716
- },
717
- {
718
- order: { type: "asc" },
719
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
720
- },
721
- {
722
- order: ["types", "require", "import", "default"],
723
- pathPattern: "^exports.*$"
724
- },
725
- {
726
- order: { type: "asc" },
727
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
728
- }
729
- ]
687
+ function sortPackageJson() {
688
+ return [
689
+ {
690
+ name: "ivanmaxlogiudice/sort/packageJson",
691
+ files: ["**/package.json"],
692
+ rules: {
693
+ "jsonc/sort-array-values": [
694
+ "error",
695
+ {
696
+ order: { type: "asc" },
697
+ pathPattern: "^files$"
698
+ }
699
+ ],
700
+ "jsonc/sort-keys": [
701
+ "error",
702
+ {
703
+ order: [
704
+ "name",
705
+ "version",
706
+ "private",
707
+ "packageManager",
708
+ "description",
709
+ "type",
710
+ "keywords",
711
+ "license",
712
+ "homepage",
713
+ "bugs",
714
+ "repository",
715
+ "author",
716
+ "contributors",
717
+ "funding",
718
+ "files",
719
+ "main",
720
+ "module",
721
+ "types",
722
+ "exports",
723
+ "typesVersions",
724
+ "sideEffects",
725
+ "unpkg",
726
+ "jsdelivr",
727
+ "browser",
728
+ "bin",
729
+ "man",
730
+ "directories",
731
+ "publishConfig",
732
+ "scripts",
733
+ "peerDependencies",
734
+ "peerDependenciesMeta",
735
+ "optionalDependencies",
736
+ "dependencies",
737
+ "devDependencies",
738
+ "engines",
739
+ "config",
740
+ "overrides",
741
+ "pnpm",
742
+ "husky",
743
+ "lint-staged",
744
+ "eslintConfig",
745
+ "prettier"
746
+ ],
747
+ pathPattern: "^$"
748
+ },
749
+ {
750
+ order: { type: "asc" },
751
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
752
+ },
753
+ {
754
+ order: ["types", "require", "import", "default"],
755
+ pathPattern: "^exports.*$"
756
+ },
757
+ {
758
+ order: { type: "asc" },
759
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
760
+ }
761
+ ]
762
+ }
730
763
  }
731
- }
732
- ];
733
- var sortTsconfig = [
734
- {
735
- name: "ivanmaxlogiudice/sort/tsconfig",
736
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
737
- rules: {
738
- "jsonc/sort-keys": [
739
- "error",
740
- {
741
- order: [
742
- "extends",
743
- "compilerOptions",
744
- "references",
745
- "files",
746
- "include",
747
- "exclude"
748
- ],
749
- pathPattern: "^$"
750
- },
751
- {
752
- order: [
753
- /* Projects */
754
- "incremental",
755
- "composite",
756
- "tsBuildInfoFile",
757
- "disableSourceOfProjectReferenceRedirect",
758
- "disableSolutionSearching",
759
- "disableReferencedProjectLoad",
760
- /* Language and Environment */
761
- "target",
762
- "jsx",
763
- "jsxFactory",
764
- "jsxFragmentFactory",
765
- "jsxImportSource",
766
- "lib",
767
- "moduleDetection",
768
- "noLib",
769
- "reactNamespace",
770
- "useDefineForClassFields",
771
- "emitDecoratorMetadata",
772
- "experimentalDecorators",
773
- /* Modules */
774
- "baseUrl",
775
- "rootDir",
776
- "rootDirs",
777
- "customConditions",
778
- "module",
779
- "moduleResolution",
780
- "moduleSuffixes",
781
- "noResolve",
782
- "paths",
783
- "resolveJsonModule",
784
- "resolvePackageJsonExports",
785
- "resolvePackageJsonImports",
786
- "typeRoots",
787
- "types",
788
- "allowArbitraryExtensions",
789
- "allowImportingTsExtensions",
790
- "allowUmdGlobalAccess",
791
- /* JavaScript Support */
792
- "allowJs",
793
- "checkJs",
794
- "maxNodeModuleJsDepth",
795
- /* Type Checking */
796
- "strict",
797
- "strictBindCallApply",
798
- "strictFunctionTypes",
799
- "strictNullChecks",
800
- "strictPropertyInitialization",
801
- "allowUnreachableCode",
802
- "allowUnusedLabels",
803
- "alwaysStrict",
804
- "exactOptionalPropertyTypes",
805
- "noFallthroughCasesInSwitch",
806
- "noImplicitAny",
807
- "noImplicitOverride",
808
- "noImplicitReturns",
809
- "noImplicitThis",
810
- "noPropertyAccessFromIndexSignature",
811
- "noUncheckedIndexedAccess",
812
- "noUnusedLocals",
813
- "noUnusedParameters",
814
- "useUnknownInCatchVariables",
815
- /* Emit */
816
- "declaration",
817
- "declarationDir",
818
- "declarationMap",
819
- "downlevelIteration",
820
- "emitBOM",
821
- "emitDeclarationOnly",
822
- "importHelpers",
823
- "importsNotUsedAsValues",
824
- "inlineSourceMap",
825
- "inlineSources",
826
- "isolatedDeclarations",
827
- "mapRoot",
828
- "newLine",
829
- "noEmit",
830
- "noEmitHelpers",
831
- "noEmitOnError",
832
- "outDir",
833
- "outFile",
834
- "preserveConstEnums",
835
- "preserveValueImports",
836
- "removeComments",
837
- "sourceMap",
838
- "sourceRoot",
839
- "stripInternal",
840
- /* Interop Constraints */
841
- "allowSyntheticDefaultImports",
842
- "esModuleInterop",
843
- "forceConsistentCasingInFileNames",
844
- "isolatedModules",
845
- "preserveSymlinks",
846
- "verbatimModuleSyntax",
847
- /* Completeness */
848
- "skipDefaultLibCheck",
849
- "skipLibCheck"
850
- ],
851
- pathPattern: "^compilerOptions$"
852
- }
853
- ]
764
+ ];
765
+ }
766
+ function sortTsconfig() {
767
+ return [
768
+ {
769
+ name: "ivanmaxlogiudice/sort/tsconfig",
770
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
771
+ rules: {
772
+ "jsonc/sort-keys": [
773
+ "error",
774
+ {
775
+ order: [
776
+ "extends",
777
+ "compilerOptions",
778
+ "references",
779
+ "files",
780
+ "include",
781
+ "exclude"
782
+ ],
783
+ pathPattern: "^$"
784
+ },
785
+ {
786
+ order: [
787
+ /* Projects */
788
+ "incremental",
789
+ "composite",
790
+ "tsBuildInfoFile",
791
+ "disableSourceOfProjectReferenceRedirect",
792
+ "disableSolutionSearching",
793
+ "disableReferencedProjectLoad",
794
+ /* Language and Environment */
795
+ "target",
796
+ "jsx",
797
+ "jsxFactory",
798
+ "jsxFragmentFactory",
799
+ "jsxImportSource",
800
+ "lib",
801
+ "moduleDetection",
802
+ "noLib",
803
+ "reactNamespace",
804
+ "useDefineForClassFields",
805
+ "emitDecoratorMetadata",
806
+ "experimentalDecorators",
807
+ /* Modules */
808
+ "baseUrl",
809
+ "rootDir",
810
+ "rootDirs",
811
+ "customConditions",
812
+ "module",
813
+ "moduleResolution",
814
+ "moduleSuffixes",
815
+ "noResolve",
816
+ "paths",
817
+ "resolveJsonModule",
818
+ "resolvePackageJsonExports",
819
+ "resolvePackageJsonImports",
820
+ "typeRoots",
821
+ "types",
822
+ "allowArbitraryExtensions",
823
+ "allowImportingTsExtensions",
824
+ "allowUmdGlobalAccess",
825
+ /* JavaScript Support */
826
+ "allowJs",
827
+ "checkJs",
828
+ "maxNodeModuleJsDepth",
829
+ /* Type Checking */
830
+ "strict",
831
+ "strictBindCallApply",
832
+ "strictFunctionTypes",
833
+ "strictNullChecks",
834
+ "strictPropertyInitialization",
835
+ "allowUnreachableCode",
836
+ "allowUnusedLabels",
837
+ "alwaysStrict",
838
+ "exactOptionalPropertyTypes",
839
+ "noFallthroughCasesInSwitch",
840
+ "noImplicitAny",
841
+ "noImplicitOverride",
842
+ "noImplicitReturns",
843
+ "noImplicitThis",
844
+ "noPropertyAccessFromIndexSignature",
845
+ "noUncheckedIndexedAccess",
846
+ "noUnusedLocals",
847
+ "noUnusedParameters",
848
+ "useUnknownInCatchVariables",
849
+ /* Emit */
850
+ "declaration",
851
+ "declarationDir",
852
+ "declarationMap",
853
+ "downlevelIteration",
854
+ "emitBOM",
855
+ "emitDeclarationOnly",
856
+ "importHelpers",
857
+ "importsNotUsedAsValues",
858
+ "inlineSourceMap",
859
+ "inlineSources",
860
+ "isolatedDeclarations",
861
+ "mapRoot",
862
+ "newLine",
863
+ "noEmit",
864
+ "noEmitHelpers",
865
+ "noEmitOnError",
866
+ "outDir",
867
+ "outFile",
868
+ "preserveConstEnums",
869
+ "preserveValueImports",
870
+ "removeComments",
871
+ "sourceMap",
872
+ "sourceRoot",
873
+ "stripInternal",
874
+ /* Interop Constraints */
875
+ "allowSyntheticDefaultImports",
876
+ "esModuleInterop",
877
+ "forceConsistentCasingInFileNames",
878
+ "isolatedModules",
879
+ "preserveSymlinks",
880
+ "verbatimModuleSyntax",
881
+ /* Completeness */
882
+ "skipDefaultLibCheck",
883
+ "skipLibCheck"
884
+ ],
885
+ pathPattern: "^compilerOptions$"
886
+ }
887
+ ]
888
+ }
854
889
  }
855
- }
856
- ];
890
+ ];
891
+ }
857
892
 
858
893
  // src/configs/stylistic.ts
859
894
  import plugin7 from "@stylistic/eslint-plugin";
@@ -866,26 +901,37 @@ var config = plugin7.configs.customize({
866
901
  semi: false
867
902
  });
868
903
  config.rules["style/indent"][2].offsetTernaryExpressions = false;
869
- var stylistic = [
870
- {
871
- name: "ivanmaxlogiudice/stylistic/rules",
872
- plugins: {
873
- style: plugin7
874
- },
875
- rules: {
876
- ...config.rules,
877
- "antfu/consistent-list-newline": "error",
878
- "antfu/curly": "error",
879
- "antfu/if-newline": "error",
880
- "antfu/top-level-function": "error",
881
- "style/function-call-spacing": ["error", "never"]
904
+ function stylistic(options = {}) {
905
+ const {
906
+ overrides = {}
907
+ } = options;
908
+ return [
909
+ {
910
+ name: "ivanmaxlogiudice/stylistic/rules",
911
+ plugins: {
912
+ style: plugin7
913
+ },
914
+ rules: {
915
+ ...config.rules,
916
+ "antfu/consistent-list-newline": "error",
917
+ "antfu/curly": "error",
918
+ "antfu/if-newline": "error",
919
+ "antfu/top-level-function": "error",
920
+ "style/function-call-spacing": ["error", "never"],
921
+ ...overrides
922
+ }
882
923
  }
883
- }
884
- ];
924
+ ];
925
+ }
885
926
 
886
927
  // src/configs/test.ts
887
928
  var _pluginTest;
888
- async function test() {
929
+ async function test(options = {}) {
930
+ const {
931
+ files = GLOB_TESTS,
932
+ isInEditor = false,
933
+ overrides = {}
934
+ } = options;
889
935
  const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
890
936
  interopDefault(import("@vitest/eslint-plugin")),
891
937
  // @ts-expect-error missing types
@@ -908,16 +954,17 @@ async function test() {
908
954
  },
909
955
  {
910
956
  name: "ivanmaxlogiudice/test/rules",
911
- files: GLOB_TESTS,
957
+ files,
912
958
  rules: {
913
959
  "node/prefer-global/process": "off",
914
960
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
915
961
  "test/no-identical-title": "error",
916
962
  "test/no-import-node-test": "error",
917
- "test/no-only-tests": isInEditorEnv() ? "off" : "error",
963
+ "test/no-only-tests": isInEditor ? "off" : "error",
918
964
  "test/prefer-hooks-in-order": "error",
919
965
  "test/prefer-lowercase-title": "error",
920
- "ts/explicit-function-return-type": "off"
966
+ "ts/explicit-function-return-type": "off",
967
+ ...overrides
921
968
  }
922
969
  }
923
970
  ];
@@ -929,9 +976,10 @@ import parser2 from "@typescript-eslint/parser";
929
976
  function typescript(options = {}) {
930
977
  const {
931
978
  componentExts = [],
979
+ overrides = {},
932
980
  type = "app"
933
981
  } = options;
934
- const files = [GLOB_TS, ...componentExts.map((ext) => `**/*.${ext}`)];
982
+ const files = options.files ?? [GLOB_TS, ...componentExts.map((ext) => `**/*.${ext}`)];
935
983
  return [
936
984
  {
937
985
  name: "ivanmaxlogiudice/typescript/setup",
@@ -991,7 +1039,8 @@ function typescript(options = {}) {
991
1039
  allowHigherOrderFunctions: true,
992
1040
  allowIIFEs: true
993
1041
  }]
994
- } : {}
1042
+ } : {},
1043
+ ...overrides
995
1044
  }
996
1045
  },
997
1046
  {
@@ -1023,47 +1072,50 @@ function typescript(options = {}) {
1023
1072
 
1024
1073
  // src/configs/unicorn.ts
1025
1074
  import plugin9 from "eslint-plugin-unicorn";
1026
- var unicorn = [
1027
- {
1028
- name: "ivanmaxlogiudice/unicorn/rules",
1029
- plugins: {
1030
- unicorn: plugin9
1031
- },
1032
- rules: {
1033
- // Pass error message when throwing errors
1034
- "unicorn/error-message": "error",
1035
- // Uppercase regex escapes
1036
- "unicorn/escape-case": "error",
1037
- // Array.isArray instead of instanceof
1038
- "unicorn/no-instanceof-array": "error",
1039
- // Ban `new Array` as `Array` constructor's params are ambiguous
1040
- "unicorn/no-new-array": "error",
1041
- // Prevent deprecated `new Buffer()`
1042
- "unicorn/no-new-buffer": "error",
1043
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1044
- "unicorn/number-literal-case": "error",
1045
- // textContent instead of innerText
1046
- "unicorn/prefer-dom-node-text-content": "error",
1047
- // includes over indexOf when checking for existence
1048
- "unicorn/prefer-includes": "error",
1049
- // Prefer using the node: protocol
1050
- "unicorn/prefer-node-protocol": "error",
1051
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1052
- "unicorn/prefer-number-properties": "error",
1053
- // String methods startsWith/endsWith instead of more complicated stuff
1054
- "unicorn/prefer-string-starts-ends-with": "error",
1055
- // Enforce throwing type error when throwing error while checking typeof
1056
- "unicorn/prefer-type-error": "error",
1057
- // Use new when throwing error
1058
- "unicorn/throw-new-error": "error"
1075
+ function unicorn() {
1076
+ return [
1077
+ {
1078
+ name: "ivanmaxlogiudice/unicorn/rules",
1079
+ plugins: {
1080
+ unicorn: plugin9
1081
+ },
1082
+ rules: {
1083
+ // Pass error message when throwing errors
1084
+ "unicorn/error-message": "error",
1085
+ // Uppercase regex escapes
1086
+ "unicorn/escape-case": "error",
1087
+ // Array.isArray instead of instanceof
1088
+ "unicorn/no-instanceof-array": "error",
1089
+ // Ban `new Array` as `Array` constructor's params are ambiguous
1090
+ "unicorn/no-new-array": "error",
1091
+ // Prevent deprecated `new Buffer()`
1092
+ "unicorn/no-new-buffer": "error",
1093
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1094
+ "unicorn/number-literal-case": "error",
1095
+ // textContent instead of innerText
1096
+ "unicorn/prefer-dom-node-text-content": "error",
1097
+ // includes over indexOf when checking for existence
1098
+ "unicorn/prefer-includes": "error",
1099
+ // Prefer using the node: protocol
1100
+ "unicorn/prefer-node-protocol": "error",
1101
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1102
+ "unicorn/prefer-number-properties": "error",
1103
+ // String methods startsWith/endsWith instead of more complicated stuff
1104
+ "unicorn/prefer-string-starts-ends-with": "error",
1105
+ // Enforce throwing type error when throwing error while checking typeof
1106
+ "unicorn/prefer-type-error": "error",
1107
+ // Use new when throwing error
1108
+ "unicorn/throw-new-error": "error"
1109
+ }
1059
1110
  }
1060
- }
1061
- ];
1111
+ ];
1112
+ }
1062
1113
 
1063
1114
  // src/configs/unocss.ts
1064
1115
  async function unocss(options = {}) {
1065
1116
  const {
1066
1117
  attributify = true,
1118
+ overrides = {},
1067
1119
  strict = false
1068
1120
  } = options;
1069
1121
  await ensurePackages(["@unocss/eslint-plugin"]);
@@ -1079,7 +1131,8 @@ async function unocss(options = {}) {
1079
1131
  rules: {
1080
1132
  "unocss/order": "warn",
1081
1133
  ...attributify ? { "unocss/order-attributify": "warn" } : {},
1082
- ...strict ? { "unocss/blocklist": "error" } : {}
1134
+ ...strict ? { "unocss/blocklist": "error" } : {},
1135
+ ...overrides
1083
1136
  }
1084
1137
  }
1085
1138
  ];
@@ -1087,6 +1140,10 @@ async function unocss(options = {}) {
1087
1140
 
1088
1141
  // src/configs/vue.ts
1089
1142
  async function vue(options = {}) {
1143
+ const {
1144
+ files = [GLOB_VUE],
1145
+ overrides = {}
1146
+ } = options;
1090
1147
  await ensurePackages(["eslint-plugin-vue", "vue-eslint-parser"]);
1091
1148
  const [plugin10, parser3] = await Promise.all([
1092
1149
  // @ts-expect-error missing types
@@ -1122,7 +1179,7 @@ async function vue(options = {}) {
1122
1179
  },
1123
1180
  {
1124
1181
  name: "ivanmaxlogiudice/vue/rules",
1125
- files: [GLOB_VUE],
1182
+ files,
1126
1183
  languageOptions: {
1127
1184
  parser: parser3,
1128
1185
  parserOptions: {
@@ -1214,14 +1271,19 @@ async function vue(options = {}) {
1214
1271
  "vue/padding-line-between-blocks": ["error", "always"],
1215
1272
  "vue/quote-props": ["error", "consistent-as-needed"],
1216
1273
  "vue/space-in-parens": ["error", "never"],
1217
- "vue/template-curly-spacing": "error"
1274
+ "vue/template-curly-spacing": "error",
1275
+ ...overrides
1218
1276
  }
1219
1277
  }
1220
1278
  ];
1221
1279
  }
1222
1280
 
1223
1281
  // src/configs/yaml.ts
1224
- async function yaml() {
1282
+ async function yaml(options = {}) {
1283
+ const {
1284
+ files = [GLOB_YAML],
1285
+ overrides = {}
1286
+ } = options;
1225
1287
  await ensurePackages(["eslint-plugin-yml", "yaml-eslint-parser"]);
1226
1288
  const [plugin10, parser3] = await Promise.all([
1227
1289
  interopDefault(import("eslint-plugin-yml")),
@@ -1236,7 +1298,7 @@ async function yaml() {
1236
1298
  },
1237
1299
  {
1238
1300
  name: "ivanmaxlogiudice/yaml/rules",
1239
- files: [GLOB_YAML],
1301
+ files,
1240
1302
  languageOptions: {
1241
1303
  parser: parser3
1242
1304
  },
@@ -1261,7 +1323,8 @@ async function yaml() {
1261
1323
  "yaml/key-spacing": "error",
1262
1324
  "yaml/no-tab-indent": "error",
1263
1325
  "yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
1264
- "yaml/spaced-comment": "error"
1326
+ "yaml/spaced-comment": "error",
1327
+ ...overrides
1265
1328
  }
1266
1329
  }
1267
1330
  ];
@@ -1272,25 +1335,33 @@ async function config2(options = {}, ...userConfigs) {
1272
1335
  clearPackageCache();
1273
1336
  const {
1274
1337
  componentExts = [],
1338
+ isInEditor = isInEditorEnv(),
1275
1339
  regexp: enableRegexp = false,
1276
1340
  typescript: enableTypeScript = packageExists("typescript"),
1277
1341
  unocss: enableUnoCSS = hasSomePackage(["unocss", "@unocss/nuxt"]),
1278
1342
  vue: enableVue = hasSomePackage(["vue", "nuxt", "vitepress", "@slidev/cli"])
1279
1343
  } = options;
1280
1344
  const configs = [
1281
- comments,
1345
+ comments(),
1282
1346
  ignores(),
1283
- imports,
1284
- javascript,
1285
- jsdoc,
1286
- node,
1287
- perfectionist,
1288
- stylistic,
1289
- unicorn,
1347
+ imports(),
1348
+ javascript({
1349
+ isInEditor,
1350
+ overrides: getOverrides(options, "javascript")
1351
+ }),
1352
+ jsdoc(),
1353
+ node(),
1354
+ perfectionist(),
1355
+ stylistic({
1356
+ overrides: getOverrides(options, "stylistic")
1357
+ }),
1358
+ unicorn(),
1290
1359
  // Basic json(c) file support and sorting json keys
1291
- jsonc,
1292
- sortPackageJson,
1293
- sortTsconfig
1360
+ jsonc({
1361
+ overrides: getOverrides(options, "jsonc")
1362
+ }),
1363
+ sortPackageJson(),
1364
+ sortTsconfig()
1294
1365
  ];
1295
1366
  if (enableVue) {
1296
1367
  componentExts.push("vue");
@@ -1298,31 +1369,44 @@ async function config2(options = {}, ...userConfigs) {
1298
1369
  if (enableTypeScript) {
1299
1370
  configs.push(typescript({
1300
1371
  componentExts,
1372
+ overrides: getOverrides(options, "typescript"),
1301
1373
  type: options.type
1302
1374
  }));
1303
1375
  }
1304
1376
  if (enableRegexp) {
1305
- configs.push(regexp());
1377
+ configs.push(regexp({
1378
+ overrides: getOverrides(options, "regexp")
1379
+ }));
1306
1380
  }
1307
1381
  if (options.test ?? true) {
1308
- configs.push(test());
1382
+ configs.push(test({
1383
+ isInEditor,
1384
+ overrides: getOverrides(options, "test")
1385
+ }));
1309
1386
  }
1310
1387
  if (enableVue) {
1311
1388
  configs.push(vue({
1312
- typescript: enableTypeScript
1389
+ ...resolveSubOptions(options, "vue"),
1390
+ overrides: getOverrides(options, "vue"),
1391
+ typescript: !!enableTypeScript
1313
1392
  }));
1314
1393
  }
1315
1394
  if (enableUnoCSS) {
1316
1395
  configs.push(unocss({
1317
- ...resolveSubOptions(options, "unocss")
1396
+ ...resolveSubOptions(options, "unocss"),
1397
+ overrides: getOverrides(options, "unocss")
1318
1398
  }));
1319
1399
  }
1320
1400
  if (options.yaml) {
1321
- configs.push(yaml());
1401
+ configs.push(yaml({
1402
+ overrides: getOverrides(options, "yaml")
1403
+ }));
1322
1404
  }
1323
1405
  if (options.markdown) {
1324
1406
  configs.push(markdown({
1325
- componentExts
1407
+ componentExts,
1408
+ ...resolveSubOptions(options, "markdown"),
1409
+ overrides: getOverrides(options, "markdown")
1326
1410
  }));
1327
1411
  }
1328
1412
  const merged = await combine(
@@ -1334,6 +1418,13 @@ async function config2(options = {}, ...userConfigs) {
1334
1418
  function resolveSubOptions(options, key) {
1335
1419
  return typeof options[key] === "boolean" ? {} : options[key] || {};
1336
1420
  }
1421
+ function getOverrides(options, key) {
1422
+ const sub = resolveSubOptions(options, key);
1423
+ return {
1424
+ ...options.overrides?.[key],
1425
+ ..."overrides" in sub ? sub.overrides : {}
1426
+ };
1427
+ }
1337
1428
 
1338
1429
  // src/index.ts
1339
1430
  var src_default = config2;
@@ -1359,6 +1450,7 @@ export {
1359
1450
  src_default as default,
1360
1451
  ensurePackages,
1361
1452
  findUp,
1453
+ getOverrides,
1362
1454
  hasSomePackage,
1363
1455
  ignores,
1364
1456
  imports,