@icebreakers/eslint-config 1.6.29 → 1.6.31

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
@@ -1,678 +1,449 @@
1
- "use strict";
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
11
17
  };
12
18
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
19
27
  };
20
28
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var index_exports = {};
33
- __export(index_exports, {
34
- getPresets: () => getPresets,
35
- icebreaker: () => icebreaker,
36
- icebreakerLegacy: () => icebreakerLegacy
37
- });
38
- module.exports = __toCommonJS(index_exports);
39
-
40
- // ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
41
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
42
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
43
-
44
- // src/antfu.ts
45
- var antfu_exports = {};
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ //#endregion
34
+ let node_fs = require("node:fs");
35
+ node_fs = __toESM(node_fs);
36
+ let node_module = require("node:module");
37
+ let node_path = require("node:path");
38
+ node_path = __toESM(node_path);
39
+ let node_process = require("node:process");
40
+ node_process = __toESM(node_process);
41
+ //#region src/antfu.ts
42
+ var antfu_exports = /* @__PURE__ */ __exportAll({});
46
43
  __reExport(antfu_exports, require("@antfu/eslint-config"));
47
-
48
- // src/defaults.ts
49
- var INLINE_ELEMENTS = [
50
- "a",
51
- "abbr",
52
- "audio",
53
- "b",
54
- "bdi",
55
- "bdo",
56
- "canvas",
57
- "cite",
58
- "code",
59
- "data",
60
- "del",
61
- "dfn",
62
- "em",
63
- "i",
64
- "iframe",
65
- "ins",
66
- "kbd",
67
- "label",
68
- "map",
69
- "mark",
70
- "noscript",
71
- "object",
72
- "output",
73
- "picture",
74
- "q",
75
- "ruby",
76
- "s",
77
- "samp",
78
- "small",
79
- "span",
80
- "strong",
81
- "sub",
82
- "sup",
83
- "svg",
84
- "time",
85
- "u",
86
- "var",
87
- "video"
44
+ //#endregion
45
+ //#region src/defaults.ts
46
+ const INLINE_ELEMENTS = [
47
+ "a",
48
+ "abbr",
49
+ "audio",
50
+ "b",
51
+ "bdi",
52
+ "bdo",
53
+ "canvas",
54
+ "cite",
55
+ "code",
56
+ "data",
57
+ "del",
58
+ "dfn",
59
+ "em",
60
+ "i",
61
+ "iframe",
62
+ "ins",
63
+ "kbd",
64
+ "label",
65
+ "map",
66
+ "mark",
67
+ "noscript",
68
+ "object",
69
+ "output",
70
+ "picture",
71
+ "q",
72
+ "ruby",
73
+ "s",
74
+ "samp",
75
+ "small",
76
+ "span",
77
+ "strong",
78
+ "sub",
79
+ "sup",
80
+ "svg",
81
+ "time",
82
+ "u",
83
+ "var",
84
+ "video"
88
85
  ];
89
- var nestjsTypeScriptRules = {
90
- "ts/explicit-function-return-type": "off",
91
- "ts/explicit-module-boundary-types": "off",
92
- "ts/no-explicit-any": "off",
93
- "ts/no-parameter-properties": "off",
94
- "ts/no-empty-function": [
95
- "error",
96
- {
97
- allow: [
98
- "decoratedFunctions",
99
- "overrideMethods",
100
- "private-constructors",
101
- "protected-constructors"
102
- ]
103
- }
104
- ],
105
- "ts/no-empty-interface": "off",
106
- "ts/no-namespace": [
107
- "error",
108
- {
109
- allowDeclarations: true,
110
- allowDefinitionFiles: true
111
- }
112
- ],
113
- "ts/ban-types": [
114
- "error",
115
- {
116
- extendDefaults: true,
117
- types: {
118
- Function: false
119
- }
120
- }
121
- ]
86
+ const nestjsTypeScriptRules = {
87
+ "ts/explicit-function-return-type": "off",
88
+ "ts/explicit-module-boundary-types": "off",
89
+ "ts/no-explicit-any": "off",
90
+ "ts/no-parameter-properties": "off",
91
+ "ts/no-empty-function": ["error", { allow: [
92
+ "decoratedFunctions",
93
+ "overrideMethods",
94
+ "private-constructors",
95
+ "protected-constructors"
96
+ ] }],
97
+ "ts/no-empty-interface": "off",
98
+ "ts/no-namespace": ["error", {
99
+ allowDeclarations: true,
100
+ allowDefinitionFiles: true
101
+ }],
102
+ "ts/ban-types": ["error", {
103
+ extendDefaults: true,
104
+ types: { Function: false }
105
+ }]
122
106
  };
123
107
  function getDefaultVueOptions(opts) {
124
- const overrides = {
125
- "vue/attribute-hyphenation": "off",
126
- "vue/v-on-event-hyphenation": "off",
127
- "vue/custom-event-name-casing": "off",
128
- "vue/no-mutating-props": "warn",
129
- // https://eslint.vuejs.org/rules/no-useless-v-bind.html
130
- "vue/no-useless-v-bind": [
131
- "error",
132
- {
133
- // 不允许注释
134
- ignoreIncludesComment: false,
135
- // 允许在里面使用转义
136
- // 比如 v-bind:foo="'bar\nbaz'"
137
- ignoreStringEscape: true
138
- }
139
- ],
140
- // https://eslint.vuejs.org/rules/no-unused-refs.html
141
- "vue/no-unused-refs": "warn"
142
- };
143
- if (opts?.ionic) {
144
- overrides["vue/no-deprecated-slot-attribute"] = "off";
145
- }
146
- if (opts?.weapp) {
147
- overrides["vue/singleline-html-element-content-newline"] = [
148
- "warn",
149
- {
150
- ignoreWhenNoAttributes: true,
151
- ignoreWhenEmpty: true,
152
- ignores: [
153
- // 小程序标签
154
- "text",
155
- ...INLINE_ELEMENTS
156
- ],
157
- externalIgnores: []
158
- }
159
- ];
160
- }
161
- const vueOptions = {
162
- overrides
163
- };
164
- return vueOptions;
108
+ const overrides = {
109
+ "vue/attribute-hyphenation": "off",
110
+ "vue/v-on-event-hyphenation": "off",
111
+ "vue/custom-event-name-casing": "off",
112
+ "vue/no-mutating-props": "warn",
113
+ "vue/no-useless-v-bind": ["error", {
114
+ ignoreIncludesComment: false,
115
+ ignoreStringEscape: true
116
+ }],
117
+ "vue/no-unused-refs": "warn"
118
+ };
119
+ if (opts?.ionic) overrides["vue/no-deprecated-slot-attribute"] = "off";
120
+ if (opts?.weapp) overrides["vue/singleline-html-element-content-newline"] = ["warn", {
121
+ ignoreWhenNoAttributes: true,
122
+ ignoreWhenEmpty: true,
123
+ ignores: ["text", ...INLINE_ELEMENTS],
124
+ externalIgnores: []
125
+ }];
126
+ return { overrides };
165
127
  }
166
128
  function getDefaultTypescriptOptions(opts) {
167
- const overrides = {
168
- "ts/no-unused-vars": [
169
- "error",
170
- {
171
- args: "all",
172
- argsIgnorePattern: "^_",
173
- caughtErrors: "all",
174
- caughtErrorsIgnorePattern: "^_",
175
- destructuredArrayIgnorePattern: "^_",
176
- varsIgnorePattern: "^_",
177
- ignoreRestSiblings: true
178
- }
179
- ],
180
- "ts/prefer-ts-expect-error": "off",
181
- "ts/ban-ts-comment": "off",
182
- "ts/no-use-before-define": "warn",
183
- "ts/no-unused-expressions": [
184
- "error",
185
- {
186
- allowShortCircuit: true,
187
- allowTernary: true
188
- }
189
- ]
190
- };
191
- if (opts?.nestjs) {
192
- Object.assign(overrides, nestjsTypeScriptRules);
193
- }
194
- const typescriptOptions = {
195
- overrides
196
- };
197
- return typescriptOptions;
129
+ const overrides = {
130
+ "ts/no-unused-vars": ["error", {
131
+ args: "all",
132
+ argsIgnorePattern: "^_",
133
+ caughtErrors: "all",
134
+ caughtErrorsIgnorePattern: "^_",
135
+ destructuredArrayIgnorePattern: "^_",
136
+ varsIgnorePattern: "^_",
137
+ ignoreRestSiblings: true
138
+ }],
139
+ "ts/prefer-ts-expect-error": "off",
140
+ "ts/ban-ts-comment": "off",
141
+ "ts/no-use-before-define": "warn",
142
+ "ts/no-unused-expressions": ["error", {
143
+ allowShortCircuit: true,
144
+ allowTernary: true
145
+ }]
146
+ };
147
+ if (opts?.nestjs) Object.assign(overrides, nestjsTypeScriptRules);
148
+ return { overrides };
198
149
  }
199
-
200
- // src/features.ts
150
+ //#endregion
151
+ //#region src/features.ts
201
152
  function resolveTailwindPresets(option) {
202
- if (!option) {
203
- return [];
204
- }
205
- if (typeof option === "object") {
206
- return [
207
- (0, antfu_exports.interopDefault)(
208
- import("eslint-plugin-better-tailwindcss")
209
- ).then((eslintPluginBetterTailwindcss) => {
210
- const betterTailwindcssRules = {
211
- ...eslintPluginBetterTailwindcss.configs["recommended-warn"].rules,
212
- ...eslintPluginBetterTailwindcss.configs["recommended-error"].rules
213
- };
214
- return {
215
- name: "icebreaker/better-tailwindcss",
216
- plugins: {
217
- "better-tailwindcss": eslintPluginBetterTailwindcss
218
- },
219
- rules: betterTailwindcssRules,
220
- settings: {
221
- "better-tailwindcss": {
222
- entryPoint: option.entryPoint,
223
- tailwindConfig: option.tailwindConfig
224
- }
225
- }
226
- };
227
- })
228
- ];
229
- }
230
- return [
231
- // @ts-ignore optional dependency shape
232
- (0, antfu_exports.interopDefault)(
233
- import("eslint-plugin-tailwindcss")
234
- ).then((tailwind) => {
235
- return tailwind.configs["flat/recommended"];
236
- }),
237
- {
238
- rules: {
239
- "tailwindcss/no-custom-classname": "off"
240
- }
241
- }
242
- ];
153
+ if (!option) return [];
154
+ if (typeof option === "object") return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
155
+ const betterTailwindcssRules = {
156
+ ...eslintPluginBetterTailwindcss.configs["recommended-warn"].rules,
157
+ ...eslintPluginBetterTailwindcss.configs["recommended-error"].rules
158
+ };
159
+ return {
160
+ name: "icebreaker/better-tailwindcss",
161
+ plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
162
+ rules: betterTailwindcssRules,
163
+ settings: { "better-tailwindcss": {
164
+ entryPoint: option.entryPoint,
165
+ tailwindConfig: option.tailwindConfig
166
+ } }
167
+ };
168
+ })];
169
+ return [(0, antfu_exports.interopDefault)(import("eslint-plugin-tailwindcss")).then((tailwind) => {
170
+ return tailwind.configs["flat/recommended"];
171
+ }), { rules: { "tailwindcss/no-custom-classname": "off" } }];
243
172
  }
244
173
  function resolveMdxPresets(isEnabled) {
245
- if (!isEnabled) {
246
- return [];
247
- }
248
- return [
249
- (0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
250
- return [
251
- {
252
- ...mdx.flat,
253
- processor: mdx.createRemarkProcessor({
254
- lintCodeBlocks: true,
255
- languageMapper: {}
256
- })
257
- },
258
- {
259
- ...mdx.flatCodeBlocks,
260
- rules: {
261
- ...mdx.flatCodeBlocks.rules
262
- }
263
- }
264
- ];
265
- })
266
- ];
174
+ if (!isEnabled) return [];
175
+ return [(0, antfu_exports.interopDefault)(import("eslint-plugin-mdx")).then((mdx) => {
176
+ return [{
177
+ ...mdx.flat,
178
+ processor: mdx.createRemarkProcessor({
179
+ lintCodeBlocks: true,
180
+ languageMapper: {}
181
+ })
182
+ }, {
183
+ ...mdx.flatCodeBlocks,
184
+ rules: { ...mdx.flatCodeBlocks.rules }
185
+ }];
186
+ })];
267
187
  }
268
188
  function resolveAccessibilityPresets(isEnabled, vueOption, reactOption) {
269
- if (!isEnabled) {
270
- return [];
271
- }
272
- const presets = [];
273
- if (vueOption) {
274
- presets.push(
275
- (0, antfu_exports.interopDefault)(
276
- import("eslint-plugin-vuejs-accessibility")
277
- ).then((pluginVueA11y) => {
278
- return pluginVueA11y.configs["flat/recommended"];
279
- })
280
- );
281
- }
282
- if (reactOption) {
283
- presets.push(
284
- (0, antfu_exports.interopDefault)(
285
- // @ts-ignore optional dependency shape
286
- import("eslint-plugin-jsx-a11y")
287
- ).then((jsxA11y) => {
288
- return jsxA11y.flatConfigs.recommended;
289
- })
290
- );
291
- }
292
- return presets;
189
+ if (!isEnabled) return [];
190
+ const presets = [];
191
+ if (vueOption) presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-vuejs-accessibility")).then((pluginVueA11y) => {
192
+ return pluginVueA11y.configs["flat/recommended"];
193
+ }));
194
+ if (reactOption) presets.push((0, antfu_exports.interopDefault)(import("eslint-plugin-jsx-a11y")).then((jsxA11y) => {
195
+ return jsxA11y.flatConfigs.recommended;
196
+ }));
197
+ return presets;
293
198
  }
294
199
  function resolveNestPresets(isEnabled) {
295
- if (!isEnabled) {
296
- return [];
297
- }
298
- return [{
299
- name: "icebreaker/nestjs/rules",
300
- rules: nestjsTypeScriptRules
301
- }];
200
+ if (!isEnabled) return [];
201
+ return [{
202
+ name: "icebreaker/nestjs/rules",
203
+ rules: nestjsTypeScriptRules
204
+ }];
302
205
  }
303
206
  function resolveQueryPresets(isEnabled) {
304
- if (!isEnabled) {
305
- return [];
306
- }
307
- return [
308
- (0, antfu_exports.interopDefault)(
309
- import("@tanstack/eslint-plugin-query")
310
- ).then((pluginQuery) => pluginQuery.configs["flat/recommended"])
311
- ];
207
+ if (!isEnabled) return [];
208
+ return [(0, antfu_exports.interopDefault)(import("@tanstack/eslint-plugin-query")).then((pluginQuery) => pluginQuery.configs["flat/recommended"])];
312
209
  }
313
-
314
- // src/options.ts
315
- var import_node_fs = __toESM(require("fs"), 1);
316
- var import_node_module = require("module");
317
- var import_node_path = __toESM(require("path"), 1);
318
- var import_node_process = __toESM(require("process"), 1);
319
-
320
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
210
+ //#endregion
211
+ //#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
321
212
  function isPlainObject(value) {
322
- if (value === null || typeof value !== "object") {
323
- return false;
324
- }
325
- const prototype = Object.getPrototypeOf(value);
326
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
327
- return false;
328
- }
329
- if (Symbol.iterator in value) {
330
- return false;
331
- }
332
- if (Symbol.toStringTag in value) {
333
- return Object.prototype.toString.call(value) === "[object Module]";
334
- }
335
- return true;
213
+ if (value === null || typeof value !== "object") return false;
214
+ const prototype = Object.getPrototypeOf(value);
215
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
216
+ if (Symbol.iterator in value) return false;
217
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
218
+ return true;
336
219
  }
337
220
  function _defu(baseObject, defaults, namespace = ".", merger) {
338
- if (!isPlainObject(defaults)) {
339
- return _defu(baseObject, {}, namespace, merger);
340
- }
341
- const object = Object.assign({}, defaults);
342
- for (const key in baseObject) {
343
- if (key === "__proto__" || key === "constructor") {
344
- continue;
345
- }
346
- const value = baseObject[key];
347
- if (value === null || value === void 0) {
348
- continue;
349
- }
350
- if (merger && merger(object, key, value, namespace)) {
351
- continue;
352
- }
353
- if (Array.isArray(value) && Array.isArray(object[key])) {
354
- object[key] = [...value, ...object[key]];
355
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
356
- object[key] = _defu(
357
- value,
358
- object[key],
359
- (namespace ? `${namespace}.` : "") + key.toString(),
360
- merger
361
- );
362
- } else {
363
- object[key] = value;
364
- }
365
- }
366
- return object;
221
+ if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
222
+ const object = Object.assign({}, defaults);
223
+ for (const key in baseObject) {
224
+ if (key === "__proto__" || key === "constructor") continue;
225
+ const value = baseObject[key];
226
+ if (value === null || value === void 0) continue;
227
+ if (merger && merger(object, key, value, namespace)) continue;
228
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
229
+ else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
230
+ else object[key] = value;
231
+ }
232
+ return object;
367
233
  }
368
234
  function createDefu(merger) {
369
- return (...arguments_) => (
370
- // eslint-disable-next-line unicorn/no-array-reduce
371
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
372
- );
235
+ return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
373
236
  }
374
- var defu = createDefu();
375
- var defuFn = createDefu((object, key, currentValue) => {
376
- if (object[key] !== void 0 && typeof currentValue === "function") {
377
- object[key] = currentValue(object[key]);
378
- return true;
379
- }
237
+ const defu = createDefu();
238
+ createDefu((object, key, currentValue) => {
239
+ if (object[key] !== void 0 && typeof currentValue === "function") {
240
+ object[key] = currentValue(object[key]);
241
+ return true;
242
+ }
380
243
  });
381
- var defuArrayFn = createDefu((object, key, currentValue) => {
382
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
383
- object[key] = currentValue(object[key]);
384
- return true;
385
- }
244
+ createDefu((object, key, currentValue) => {
245
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
246
+ object[key] = currentValue(object[key]);
247
+ return true;
248
+ }
386
249
  });
387
-
388
- // src/utils.ts
250
+ //#endregion
251
+ //#region src/utils.ts
389
252
  function isObject(o) {
390
- return Object.prototype.toString.call(o) === "[object Object]";
253
+ return Object.prototype.toString.call(o) === "[object Object]";
391
254
  }
392
-
393
- // src/options.ts
394
- var BASE_DEFAULTS = {
395
- formatters: true,
396
- pnpm: false,
397
- javascript: {
398
- overrides: {
399
- "curly": ["error", "all"],
400
- "no-console": ["warn"]
401
- }
402
- },
403
- test: {
404
- overrides: {
405
- "test/prefer-lowercase-title": ["off"]
406
- }
407
- }
255
+ //#endregion
256
+ //#region src/options.ts
257
+ const BASE_DEFAULTS = {
258
+ formatters: true,
259
+ pnpm: false,
260
+ javascript: { overrides: {
261
+ "curly": ["error", "all"],
262
+ "no-console": ["warn"]
263
+ } },
264
+ test: { overrides: { "test/prefer-lowercase-title": ["off"] } }
408
265
  };
409
- var BASE_RULES = {
410
- // `noPropertyAccessFromIndexSignature` requires bracket access (`obj['key']`)
411
- // for index-signature properties, which conflicts with ESLint core `dot-notation`.
412
- "dot-notation": "off",
413
- // Keep dependency bans visible without blocking CI on upstream preset defaults.
414
- "e18e/ban-dependencies": "warn",
415
- // Disable until upstream fixes false positives on non-array iterables (Set, Map).
416
- // See: [...new Set(arr)].sort() → new Set(arr).toSorted() is invalid.
417
- "e18e/prefer-array-to-sorted": "off",
418
- // Disable all pnpm rules by default
419
- // @antfu/eslint-config auto-enables pnpm plugin when pnpm-workspace.yaml exists
420
- // but we want it opt-in instead of auto-enabled
421
- "pnpm/json-enforce-catalog": "off",
422
- "pnpm/json-prefer-workspace-settings": "off",
423
- "pnpm/json-valid-catalog": "off",
424
- "pnpm/yaml-enforce-settings": "off",
425
- "pnpm/yaml-no-duplicate-catalog-item": "off",
426
- "pnpm/yaml-no-unused-catalog-item": "off",
427
- "unused-imports/no-unused-vars": "off",
428
- "unicorn/prefer-number-properties": "warn"
266
+ const BASE_RULES = {
267
+ "dot-notation": "off",
268
+ "e18e/ban-dependencies": "warn",
269
+ "e18e/prefer-array-to-sorted": "off",
270
+ "pnpm/json-enforce-catalog": "off",
271
+ "pnpm/json-prefer-workspace-settings": "off",
272
+ "pnpm/json-valid-catalog": "off",
273
+ "pnpm/yaml-enforce-settings": "off",
274
+ "pnpm/yaml-no-duplicate-catalog-item": "off",
275
+ "pnpm/yaml-no-unused-catalog-item": "off",
276
+ "unused-imports/no-unused-vars": "off",
277
+ "unicorn/prefer-number-properties": "warn"
429
278
  };
430
- var require2 = (0, import_node_module.createRequire)(importMetaUrl);
431
- var ANTFU_PACKAGE_DIR = import_node_path.default.dirname(
432
- require2.resolve("@antfu/eslint-config/package.json")
433
- );
434
- var GENERAL_EDITORCONFIG_SECTIONS = /* @__PURE__ */ new Set([
435
- "*",
436
- "**",
437
- "**/*",
438
- "*.*",
439
- "**.*",
440
- "**/*.*"
279
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
280
+ const ANTFU_PACKAGE_DIR = node_path.default.dirname(require$1.resolve("@antfu/eslint-config/package.json"));
281
+ const GENERAL_EDITORCONFIG_SECTIONS = new Set([
282
+ "*",
283
+ "**",
284
+ "**/*",
285
+ "*.*",
286
+ "**.*",
287
+ "**/*.*"
441
288
  ]);
442
- var NEWLINE_PATTERN = /\r?\n/u;
289
+ const NEWLINE_PATTERN = /\r?\n/u;
443
290
  function mergeOptionWithDefaults(input, defaults, options = {}) {
444
- const { postProcess, useDefaultWhenUndefined = false } = options;
445
- const shouldUseDefaults = input === true || useDefaultWhenUndefined && input === void 0;
446
- if (shouldUseDefaults) {
447
- postProcess?.(defaults);
448
- return defaults;
449
- }
450
- if (isObject(input)) {
451
- const merged = defu(input, defaults);
452
- postProcess?.(merged);
453
- return merged;
454
- }
455
- return input;
291
+ const { postProcess, useDefaultWhenUndefined = false } = options;
292
+ if (input === true || useDefaultWhenUndefined && input === void 0) {
293
+ postProcess?.(defaults);
294
+ return defaults;
295
+ }
296
+ if (isObject(input)) {
297
+ const merged = defu(input, defaults);
298
+ postProcess?.(merged);
299
+ return merged;
300
+ }
301
+ return input;
456
302
  }
457
303
  function applyVueVersionSpecificRules(option) {
458
- if (!option || typeof option !== "object") {
459
- return;
460
- }
461
- const overrides = option.overrides;
462
- if (!overrides) {
463
- return;
464
- }
465
- if (option.vueVersion === 2) {
466
- Object.assign(overrides, {
467
- "vue/no-v-for-template-key-on-child": "off",
468
- "vue/no-v-for-template-key": "error",
469
- "vue/no-deprecated-v-bind-sync": "off"
470
- });
471
- return;
472
- }
473
- Object.assign(overrides, {
474
- "vue/no-v-for-template-key-on-child": "error",
475
- "vue/no-v-for-template-key": "off"
476
- });
304
+ if (!option || typeof option !== "object") return;
305
+ const overrides = option.overrides;
306
+ if (!overrides) return;
307
+ if (option.vueVersion === 2) {
308
+ Object.assign(overrides, {
309
+ "vue/no-v-for-template-key-on-child": "off",
310
+ "vue/no-v-for-template-key": "error",
311
+ "vue/no-deprecated-v-bind-sync": "off"
312
+ });
313
+ return;
314
+ }
315
+ Object.assign(overrides, {
316
+ "vue/no-v-for-template-key-on-child": "error",
317
+ "vue/no-v-for-template-key": "off"
318
+ });
477
319
  }
478
320
  function isPackageAvailable(name, paths) {
479
- try {
480
- require2.resolve(name, paths ? { paths } : void 0);
481
- return true;
482
- } catch {
483
- return false;
484
- }
321
+ try {
322
+ require$1.resolve(name, paths ? { paths } : void 0);
323
+ return true;
324
+ } catch {
325
+ return false;
326
+ }
485
327
  }
486
- function getDefaultFormatterOptions(cwd = import_node_process.default.cwd()) {
487
- const hasXmlPlugin = isPackageAvailable("@prettier/plugin-xml", [ANTFU_PACKAGE_DIR]);
488
- return {
489
- astro: isPackageAvailable("prettier-plugin-astro", [ANTFU_PACKAGE_DIR]),
490
- css: true,
491
- graphql: true,
492
- html: true,
493
- markdown: true,
494
- slidev: isPackageAvailable("@slidev/cli", [cwd]),
495
- svg: hasXmlPlugin,
496
- xml: hasXmlPlugin
497
- };
328
+ function getDefaultFormatterOptions(cwd = node_process.default.cwd()) {
329
+ const hasXmlPlugin = isPackageAvailable("@prettier/plugin-xml", [ANTFU_PACKAGE_DIR]);
330
+ return {
331
+ astro: isPackageAvailable("prettier-plugin-astro", [ANTFU_PACKAGE_DIR]),
332
+ css: true,
333
+ graphql: true,
334
+ html: true,
335
+ markdown: true,
336
+ slidev: isPackageAvailable("@slidev/cli", [cwd]),
337
+ svg: hasXmlPlugin,
338
+ xml: hasXmlPlugin
339
+ };
498
340
  }
499
341
  function normalizeEditorConfigEndOfLine(value) {
500
- switch (value.trim().toLowerCase()) {
501
- case "cr":
502
- case "crlf":
503
- case "lf":
504
- return value.trim().toLowerCase();
505
- default:
506
- return void 0;
507
- }
342
+ switch (value.trim().toLowerCase()) {
343
+ case "cr":
344
+ case "crlf":
345
+ case "lf": return value.trim().toLowerCase();
346
+ default: return;
347
+ }
508
348
  }
509
349
  function isGeneralEditorConfigSection(section) {
510
- return GENERAL_EDITORCONFIG_SECTIONS.has(section.trim());
350
+ return GENERAL_EDITORCONFIG_SECTIONS.has(section.trim());
511
351
  }
512
352
  function parseEditorConfig(filePath) {
513
- const lines = import_node_fs.default.readFileSync(filePath, "utf8").split(NEWLINE_PATTERN);
514
- let currentSection;
515
- let endOfLine;
516
- let isRoot = false;
517
- for (const rawLine of lines) {
518
- const line = rawLine.trim();
519
- if (!line || line.startsWith("#") || line.startsWith(";")) {
520
- continue;
521
- }
522
- if (line.startsWith("[") && line.endsWith("]")) {
523
- currentSection = line.slice(1, -1).trim();
524
- continue;
525
- }
526
- const separatorIndex = line.indexOf("=");
527
- if (separatorIndex === -1) {
528
- continue;
529
- }
530
- const key = line.slice(0, separatorIndex).trim().toLowerCase();
531
- const value = line.slice(separatorIndex + 1).trim();
532
- if (!currentSection && key === "root") {
533
- isRoot = value.toLowerCase() === "true";
534
- continue;
535
- }
536
- if (key !== "end_of_line") {
537
- continue;
538
- }
539
- const normalized = normalizeEditorConfigEndOfLine(value);
540
- if (!normalized) {
541
- continue;
542
- }
543
- if (!currentSection || isGeneralEditorConfigSection(currentSection)) {
544
- endOfLine = normalized;
545
- }
546
- }
547
- return endOfLine ? {
548
- endOfLine,
549
- isRoot
550
- } : {
551
- isRoot
552
- };
353
+ const lines = node_fs.default.readFileSync(filePath, "utf8").split(NEWLINE_PATTERN);
354
+ let currentSection;
355
+ let endOfLine;
356
+ let isRoot = false;
357
+ for (const rawLine of lines) {
358
+ const line = rawLine.trim();
359
+ if (!line || line.startsWith("#") || line.startsWith(";")) continue;
360
+ if (line.startsWith("[") && line.endsWith("]")) {
361
+ currentSection = line.slice(1, -1).trim();
362
+ continue;
363
+ }
364
+ const separatorIndex = line.indexOf("=");
365
+ if (separatorIndex === -1) continue;
366
+ const key = line.slice(0, separatorIndex).trim().toLowerCase();
367
+ const value = line.slice(separatorIndex + 1).trim();
368
+ if (!currentSection && key === "root") {
369
+ isRoot = value.toLowerCase() === "true";
370
+ continue;
371
+ }
372
+ if (key !== "end_of_line") continue;
373
+ const normalized = normalizeEditorConfigEndOfLine(value);
374
+ if (!normalized) continue;
375
+ if (!currentSection || isGeneralEditorConfigSection(currentSection)) endOfLine = normalized;
376
+ }
377
+ return endOfLine ? {
378
+ endOfLine,
379
+ isRoot
380
+ } : { isRoot };
553
381
  }
554
- function inferPrettierEndOfLineFromEditorConfig(cwd = import_node_process.default.cwd()) {
555
- const configs = [];
556
- let currentDir = import_node_path.default.resolve(cwd);
557
- while (true) {
558
- const editorConfigPath = import_node_path.default.join(currentDir, ".editorconfig");
559
- if (import_node_fs.default.existsSync(editorConfigPath)) {
560
- configs.push(editorConfigPath);
561
- if (parseEditorConfig(editorConfigPath).isRoot) {
562
- break;
563
- }
564
- }
565
- const parentDir = import_node_path.default.dirname(currentDir);
566
- if (parentDir === currentDir) {
567
- break;
568
- }
569
- currentDir = parentDir;
570
- }
571
- let endOfLine;
572
- for (const filePath of configs.reverse()) {
573
- const parsed = parseEditorConfig(filePath);
574
- if (parsed.endOfLine) {
575
- endOfLine = parsed.endOfLine;
576
- }
577
- }
578
- return endOfLine;
382
+ function inferPrettierEndOfLineFromEditorConfig(cwd = node_process.default.cwd()) {
383
+ const configs = [];
384
+ let currentDir = node_path.default.resolve(cwd);
385
+ while (true) {
386
+ const editorConfigPath = node_path.default.join(currentDir, ".editorconfig");
387
+ if (node_fs.default.existsSync(editorConfigPath)) {
388
+ configs.push(editorConfigPath);
389
+ if (parseEditorConfig(editorConfigPath).isRoot) break;
390
+ }
391
+ const parentDir = node_path.default.dirname(currentDir);
392
+ if (parentDir === currentDir) break;
393
+ currentDir = parentDir;
394
+ }
395
+ let endOfLine;
396
+ for (const filePath of configs.reverse()) {
397
+ const parsed = parseEditorConfig(filePath);
398
+ if (parsed.endOfLine) endOfLine = parsed.endOfLine;
399
+ }
400
+ return endOfLine;
579
401
  }
580
- function resolveFormattersOption(input, cwd = import_node_process.default.cwd()) {
581
- if (input === false) {
582
- return false;
583
- }
584
- const defaults = getDefaultFormatterOptions(cwd);
585
- const inferredEndOfLine = inferPrettierEndOfLineFromEditorConfig(cwd);
586
- const defaultsWithPrettier = inferredEndOfLine ? defu(
587
- {
588
- prettierOptions: {
589
- endOfLine: inferredEndOfLine
590
- }
591
- },
592
- defaults
593
- ) : defaults;
594
- if (input === void 0) {
595
- return inferredEndOfLine ? defaultsWithPrettier : true;
596
- }
597
- if (input === true) {
598
- return defaultsWithPrettier;
599
- }
600
- if (isObject(input)) {
601
- return defu(input, defaultsWithPrettier);
602
- }
603
- return defaultsWithPrettier;
402
+ function resolveFormattersOption(input, cwd = node_process.default.cwd()) {
403
+ if (input === false) return false;
404
+ const defaults = getDefaultFormatterOptions(cwd);
405
+ const inferredEndOfLine = inferPrettierEndOfLineFromEditorConfig(cwd);
406
+ const defaultsWithPrettier = inferredEndOfLine ? defu({ prettierOptions: { endOfLine: inferredEndOfLine } }, defaults) : defaults;
407
+ if (input === void 0) return inferredEndOfLine ? defaultsWithPrettier : true;
408
+ if (input === true) return defaultsWithPrettier;
409
+ if (isObject(input)) return defu(input, defaultsWithPrettier);
410
+ return defaultsWithPrettier;
604
411
  }
605
412
  function resolveUserOptions(options) {
606
- const resolved = defu(
607
- {},
608
- options ?? {},
609
- BASE_DEFAULTS
610
- );
611
- const resolvedVue = mergeOptionWithDefaults(
612
- resolved.vue,
613
- getDefaultVueOptions(options),
614
- {
615
- postProcess: applyVueVersionSpecificRules
616
- }
617
- );
618
- if (resolvedVue === void 0) {
619
- delete resolved.vue;
620
- } else {
621
- resolved.vue = resolvedVue;
622
- }
623
- const resolvedTypescript = mergeOptionWithDefaults(
624
- resolved.typescript,
625
- getDefaultTypescriptOptions(options),
626
- {
627
- useDefaultWhenUndefined: true
628
- }
629
- );
630
- if (resolvedTypescript === void 0) {
631
- delete resolved.typescript;
632
- } else {
633
- resolved.typescript = resolvedTypescript;
634
- }
635
- resolved.formatters = resolveFormattersOption(options?.formatters);
636
- return resolved;
413
+ const resolved = defu({}, options ?? {}, BASE_DEFAULTS);
414
+ const resolvedVue = mergeOptionWithDefaults(resolved.vue, getDefaultVueOptions(options), { postProcess: applyVueVersionSpecificRules });
415
+ if (resolvedVue === void 0) delete resolved.vue;
416
+ else resolved.vue = resolvedVue;
417
+ const resolvedTypescript = mergeOptionWithDefaults(resolved.typescript, getDefaultTypescriptOptions(options), { useDefaultWhenUndefined: true });
418
+ if (resolvedTypescript === void 0) delete resolved.typescript;
419
+ else resolved.typescript = resolvedTypescript;
420
+ resolved.formatters = resolveFormattersOption(options?.formatters);
421
+ return resolved;
637
422
  }
638
423
  function createBaseRuleSet(isLegacy) {
639
- if (!isLegacy) {
640
- return BASE_RULES;
641
- }
642
- return {
643
- ...BASE_RULES,
644
- "perfectionist/sort-imports": "off"
645
- };
424
+ if (!isLegacy) return BASE_RULES;
425
+ return {
426
+ ...BASE_RULES,
427
+ "perfectionist/sort-imports": "off"
428
+ };
646
429
  }
647
-
648
- // src/preset.ts
430
+ //#endregion
431
+ //#region src/preset.ts
649
432
  function getPresets(options, mode) {
650
- const resolved = resolveUserOptions(options);
651
- const presets = [
652
- {
653
- rules: createBaseRuleSet(mode === "legacy")
654
- }
655
- ];
656
- presets.push(
657
- ...resolveTailwindPresets(resolved.tailwindcss),
658
- ...resolveMdxPresets(resolved.mdx),
659
- ...resolveNestPresets(resolved.nestjs),
660
- ...resolveQueryPresets(resolved.query),
661
- ...resolveAccessibilityPresets(resolved.a11y, resolved.vue, resolved.react)
662
- );
663
- return [resolved, ...presets];
433
+ const resolved = resolveUserOptions(options);
434
+ const presets = [{ rules: createBaseRuleSet(mode === "legacy") }];
435
+ presets.push(...resolveTailwindPresets(resolved.tailwindcss), ...resolveMdxPresets(resolved.mdx), ...resolveNestPresets(resolved.nestjs), ...resolveQueryPresets(resolved.query), ...resolveAccessibilityPresets(resolved.a11y, resolved.vue, resolved.react));
436
+ return [resolved, ...presets];
664
437
  }
665
-
666
- // src/factory.ts
438
+ //#endregion
439
+ //#region src/factory.ts
667
440
  function icebreaker(options = {}, ...userConfigs) {
668
- return (0, antfu_exports.antfu)(...getPresets(options), ...userConfigs);
441
+ return (0, antfu_exports.antfu)(...getPresets(options), ...userConfigs);
669
442
  }
670
443
  function icebreakerLegacy(options = {}, ...userConfigs) {
671
- return (0, antfu_exports.antfu)(...getPresets(options, "legacy"), ...userConfigs);
444
+ return (0, antfu_exports.antfu)(...getPresets(options, "legacy"), ...userConfigs);
672
445
  }
673
- // Annotate the CommonJS export names for ESM import in node:
674
- 0 && (module.exports = {
675
- getPresets,
676
- icebreaker,
677
- icebreakerLegacy
678
- });
446
+ //#endregion
447
+ exports.getPresets = getPresets;
448
+ exports.icebreaker = icebreaker;
449
+ exports.icebreakerLegacy = icebreakerLegacy;