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

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