@icebreakers/eslint-config 1.6.13 → 1.6.14

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.cjs CHANGED
@@ -41,8 +41,8 @@ module.exports = __toCommonJS(index_exports);
41
41
  var antfu_exports = {};
42
42
  __reExport(antfu_exports, require("@antfu/eslint-config"));
43
43
 
44
- // ../../node_modules/.pnpm/eslint-plugin-vue@10.6.2_@stylistic+eslint-plugin@5.7.0_eslint@9.39.2_jiti@2.6.1___@typ_42c182fa04e8e2c9315bba1ef6120b42/node_modules/eslint-plugin-vue/lib/utils/inline-non-void-elements.json
45
- var inline_non_void_elements_default = [
44
+ // src/defaults.ts
45
+ var INLINE_ELEMENTS = [
46
46
  "a",
47
47
  "abbr",
48
48
  "audio",
@@ -82,8 +82,6 @@ var inline_non_void_elements_default = [
82
82
  "var",
83
83
  "video"
84
84
  ];
85
-
86
- // src/defaults.ts
87
85
  var nestjsTypeScriptRules = {
88
86
  "ts/explicit-function-return-type": "off",
89
87
  "ts/explicit-module-boundary-types": "off",
@@ -150,7 +148,7 @@ function getDefaultVueOptions(opts) {
150
148
  ignores: [
151
149
  // 小程序标签
152
150
  "text",
153
- ...inline_non_void_elements_default
151
+ ...INLINE_ELEMENTS
154
152
  ],
155
153
  externalIgnores: []
156
154
  }
@@ -411,6 +409,20 @@ var BASE_RULES = {
411
409
  "unused-imports/no-unused-vars": "off",
412
410
  "unicorn/prefer-number-properties": "warn"
413
411
  };
412
+ function mergeOptionWithDefaults(input, defaults, options = {}) {
413
+ const { postProcess, useDefaultWhenUndefined = false } = options;
414
+ const shouldUseDefaults = input === true || useDefaultWhenUndefined && input === void 0;
415
+ if (shouldUseDefaults) {
416
+ postProcess?.(defaults);
417
+ return defaults;
418
+ }
419
+ if (isObject(input)) {
420
+ const merged = defu(input, defaults);
421
+ postProcess?.(merged);
422
+ return merged;
423
+ }
424
+ return input;
425
+ }
414
426
  function applyVueVersionSpecificRules(option) {
415
427
  if (!option || typeof option !== "object") {
416
428
  return;
@@ -438,19 +450,20 @@ function resolveUserOptions(options) {
438
450
  options ?? {},
439
451
  BASE_DEFAULTS
440
452
  );
441
- const vueOptions = getDefaultVueOptions(options);
442
- if (resolved.vue === true) {
443
- resolved.vue = vueOptions;
444
- } else if (isObject(resolved.vue)) {
445
- resolved.vue = defu(resolved.vue, vueOptions);
446
- }
447
- applyVueVersionSpecificRules(resolved.vue);
448
- const typescriptOptions = getDefaultTypescriptOptions(options);
449
- if (resolved.typescript === void 0 || resolved.typescript === true) {
450
- resolved.typescript = typescriptOptions;
451
- } else if (isObject(resolved.typescript)) {
452
- resolved.typescript = defu(resolved.typescript, typescriptOptions);
453
- }
453
+ resolved.vue = mergeOptionWithDefaults(
454
+ resolved.vue,
455
+ getDefaultVueOptions(options),
456
+ {
457
+ postProcess: applyVueVersionSpecificRules
458
+ }
459
+ );
460
+ resolved.typescript = mergeOptionWithDefaults(
461
+ resolved.typescript,
462
+ getDefaultTypescriptOptions(options),
463
+ {
464
+ useDefaultWhenUndefined: true
465
+ }
466
+ );
454
467
  return resolved;
455
468
  }
456
469
  function createBaseRuleSet(isLegacy) {
package/dist/index.js CHANGED
@@ -17,8 +17,8 @@ var antfu_exports = {};
17
17
  __reExport(antfu_exports, eslint_config_star);
18
18
  import * as eslint_config_star from "@antfu/eslint-config";
19
19
 
20
- // ../../node_modules/.pnpm/eslint-plugin-vue@10.6.2_@stylistic+eslint-plugin@5.7.0_eslint@9.39.2_jiti@2.6.1___@typ_42c182fa04e8e2c9315bba1ef6120b42/node_modules/eslint-plugin-vue/lib/utils/inline-non-void-elements.json
21
- var inline_non_void_elements_default = [
20
+ // src/defaults.ts
21
+ var INLINE_ELEMENTS = [
22
22
  "a",
23
23
  "abbr",
24
24
  "audio",
@@ -58,8 +58,6 @@ var inline_non_void_elements_default = [
58
58
  "var",
59
59
  "video"
60
60
  ];
61
-
62
- // src/defaults.ts
63
61
  var nestjsTypeScriptRules = {
64
62
  "ts/explicit-function-return-type": "off",
65
63
  "ts/explicit-module-boundary-types": "off",
@@ -126,7 +124,7 @@ function getDefaultVueOptions(opts) {
126
124
  ignores: [
127
125
  // 小程序标签
128
126
  "text",
129
- ...inline_non_void_elements_default
127
+ ...INLINE_ELEMENTS
130
128
  ],
131
129
  externalIgnores: []
132
130
  }
@@ -387,6 +385,20 @@ var BASE_RULES = {
387
385
  "unused-imports/no-unused-vars": "off",
388
386
  "unicorn/prefer-number-properties": "warn"
389
387
  };
388
+ function mergeOptionWithDefaults(input, defaults, options = {}) {
389
+ const { postProcess, useDefaultWhenUndefined = false } = options;
390
+ const shouldUseDefaults = input === true || useDefaultWhenUndefined && input === void 0;
391
+ if (shouldUseDefaults) {
392
+ postProcess?.(defaults);
393
+ return defaults;
394
+ }
395
+ if (isObject(input)) {
396
+ const merged = defu(input, defaults);
397
+ postProcess?.(merged);
398
+ return merged;
399
+ }
400
+ return input;
401
+ }
390
402
  function applyVueVersionSpecificRules(option) {
391
403
  if (!option || typeof option !== "object") {
392
404
  return;
@@ -414,19 +426,20 @@ function resolveUserOptions(options) {
414
426
  options ?? {},
415
427
  BASE_DEFAULTS
416
428
  );
417
- const vueOptions = getDefaultVueOptions(options);
418
- if (resolved.vue === true) {
419
- resolved.vue = vueOptions;
420
- } else if (isObject(resolved.vue)) {
421
- resolved.vue = defu(resolved.vue, vueOptions);
422
- }
423
- applyVueVersionSpecificRules(resolved.vue);
424
- const typescriptOptions = getDefaultTypescriptOptions(options);
425
- if (resolved.typescript === void 0 || resolved.typescript === true) {
426
- resolved.typescript = typescriptOptions;
427
- } else if (isObject(resolved.typescript)) {
428
- resolved.typescript = defu(resolved.typescript, typescriptOptions);
429
- }
429
+ resolved.vue = mergeOptionWithDefaults(
430
+ resolved.vue,
431
+ getDefaultVueOptions(options),
432
+ {
433
+ postProcess: applyVueVersionSpecificRules
434
+ }
435
+ );
436
+ resolved.typescript = mergeOptionWithDefaults(
437
+ resolved.typescript,
438
+ getDefaultTypescriptOptions(options),
439
+ {
440
+ useDefaultWhenUndefined: true
441
+ }
442
+ );
430
443
  return resolved;
431
444
  }
432
445
  function createBaseRuleSet(isLegacy) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
3
  "type": "module",
4
- "version": "1.6.13",
4
+ "version": "1.6.14",
5
5
  "description": "ESLint preset from Icebreaker's dev-configs",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -49,10 +49,10 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@antfu/eslint-config": "7.0.1",
53
- "@eslint-react/eslint-plugin": "^2.6.4",
54
- "@next/eslint-plugin-next": "^16.1.2",
55
- "@tanstack/eslint-plugin-query": "^5.91.2",
52
+ "@antfu/eslint-config": "7.1.0",
53
+ "@eslint-react/eslint-plugin": "^2.7.2",
54
+ "@next/eslint-plugin-next": "^16.1.4",
55
+ "@tanstack/eslint-plugin-query": "^5.91.3",
56
56
  "eslint-plugin-better-tailwindcss": "^4.0.1",
57
57
  "eslint-plugin-format": "1.3.1",
58
58
  "eslint-plugin-jsx-a11y": "^6.10.2",