@icebreakers/eslint-config 0.3.19 → 0.3.20

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
@@ -31,13 +31,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
+ getPresets: () => getPresets,
35
+ getRestConfigAndPresets: () => getRestConfigAndPresets,
34
36
  icebreaker: () => icebreaker
35
37
  });
36
38
  module.exports = __toCommonJS(src_exports);
37
39
 
38
- // src/factory.ts
39
- var import_local_pkg = require("local-pkg");
40
-
41
40
  // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
42
41
  function isPlainObject(value) {
43
42
  if (value === null || typeof value !== "object") {
@@ -110,17 +109,15 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
110
109
  var antfu_exports = {};
111
110
  __reExport(antfu_exports, require("@antfu/eslint-config"));
112
111
 
113
- // src/factory.ts
114
- function icebreaker(options = {}, ...userConfigs) {
112
+ // src/preset.ts
113
+ function getPresets(options) {
115
114
  const {
116
- tailwindcss: enableTailwindcss = (0, import_local_pkg.isPackageExists)("tailwindcss"),
115
+ tailwindcss: enableTailwindcss,
117
116
  mdx: enableMDX,
118
117
  a11y: enableA11y,
119
118
  vue: enableVue,
120
119
  ...opts
121
- } = defu(options, {
122
- formatters: true
123
- });
120
+ } = options;
124
121
  const presetRules = {
125
122
  "curly": ["error", "all"],
126
123
  "no-console": ["warn"],
@@ -149,6 +146,19 @@ function icebreaker(options = {}, ...userConfigs) {
149
146
  "vue/custom-event-name-casing": "off",
150
147
  "vue/no-mutating-props": "warn"
151
148
  });
149
+ if (typeof enableVue === "object") {
150
+ if (enableVue.vueVersion === 2) {
151
+ Object.assign(presetRules, {
152
+ "vue/no-v-for-template-key-on-child": "off",
153
+ "vue/no-v-for-template-key": "error"
154
+ });
155
+ } else {
156
+ Object.assign(presetRules, {
157
+ "vue/no-v-for-template-key-on-child": "error",
158
+ "vue/no-v-for-template-key": "off"
159
+ });
160
+ }
161
+ }
152
162
  }
153
163
  const presets = [
154
164
  {
@@ -211,9 +221,23 @@ function icebreaker(options = {}, ...userConfigs) {
211
221
  );
212
222
  }
213
223
  }
214
- return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
224
+ return presets;
225
+ }
226
+
227
+ // src/factory.ts
228
+ function getRestConfigAndPresets(options) {
229
+ const opts = defu(options, {
230
+ formatters: true
231
+ });
232
+ const presets = getPresets(opts);
233
+ return [opts, ...presets];
234
+ }
235
+ function icebreaker(options = {}, ...userConfigs) {
236
+ return (0, antfu_exports.antfu)(...getRestConfigAndPresets(options), ...userConfigs);
215
237
  }
216
238
  // Annotate the CommonJS export names for ESM import in node:
217
239
  0 && (module.exports = {
240
+ getPresets,
241
+ getRestConfigAndPresets,
218
242
  icebreaker
219
243
  });
package/dist/index.d.cts CHANGED
@@ -9,6 +9,9 @@ type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
9
9
  };
10
10
  type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>;
11
11
 
12
+ declare function getRestConfigAndPresets(options?: UserDefinedOptions): [OptionsConfig & TypedFlatConfigItem, ...UserConfigItem[]];
12
13
  declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
13
14
 
14
- export { type UserConfigItem, type UserDefinedOptions, icebreaker };
15
+ declare function getPresets(options: UserDefinedOptions): UserConfigItem[];
16
+
17
+ export { type UserConfigItem, type UserDefinedOptions, getPresets, getRestConfigAndPresets, icebreaker };
package/dist/index.d.ts CHANGED
@@ -9,6 +9,9 @@ type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
9
9
  };
10
10
  type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>;
11
11
 
12
+ declare function getRestConfigAndPresets(options?: UserDefinedOptions): [OptionsConfig & TypedFlatConfigItem, ...UserConfigItem[]];
12
13
  declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
13
14
 
14
- export { type UserConfigItem, type UserDefinedOptions, icebreaker };
15
+ declare function getPresets(options: UserDefinedOptions): UserConfigItem[];
16
+
17
+ export { type UserConfigItem, type UserDefinedOptions, getPresets, getRestConfigAndPresets, icebreaker };
package/dist/index.js CHANGED
@@ -12,9 +12,6 @@ var __copyProps = (to, from, except, desc) => {
12
12
  };
13
13
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
14
 
15
- // src/factory.ts
16
- import { isPackageExists } from "local-pkg";
17
-
18
15
  // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
19
16
  function isPlainObject(value) {
20
17
  if (value === null || typeof value !== "object") {
@@ -88,17 +85,15 @@ var antfu_exports = {};
88
85
  __reExport(antfu_exports, eslint_config_star);
89
86
  import * as eslint_config_star from "@antfu/eslint-config";
90
87
 
91
- // src/factory.ts
92
- function icebreaker(options = {}, ...userConfigs) {
88
+ // src/preset.ts
89
+ function getPresets(options) {
93
90
  const {
94
- tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
91
+ tailwindcss: enableTailwindcss,
95
92
  mdx: enableMDX,
96
93
  a11y: enableA11y,
97
94
  vue: enableVue,
98
95
  ...opts
99
- } = defu(options, {
100
- formatters: true
101
- });
96
+ } = options;
102
97
  const presetRules = {
103
98
  "curly": ["error", "all"],
104
99
  "no-console": ["warn"],
@@ -127,6 +122,19 @@ function icebreaker(options = {}, ...userConfigs) {
127
122
  "vue/custom-event-name-casing": "off",
128
123
  "vue/no-mutating-props": "warn"
129
124
  });
125
+ if (typeof enableVue === "object") {
126
+ if (enableVue.vueVersion === 2) {
127
+ Object.assign(presetRules, {
128
+ "vue/no-v-for-template-key-on-child": "off",
129
+ "vue/no-v-for-template-key": "error"
130
+ });
131
+ } else {
132
+ Object.assign(presetRules, {
133
+ "vue/no-v-for-template-key-on-child": "error",
134
+ "vue/no-v-for-template-key": "off"
135
+ });
136
+ }
137
+ }
130
138
  }
131
139
  const presets = [
132
140
  {
@@ -189,8 +197,22 @@ function icebreaker(options = {}, ...userConfigs) {
189
197
  );
190
198
  }
191
199
  }
192
- return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
200
+ return presets;
201
+ }
202
+
203
+ // src/factory.ts
204
+ function getRestConfigAndPresets(options) {
205
+ const opts = defu(options, {
206
+ formatters: true
207
+ });
208
+ const presets = getPresets(opts);
209
+ return [opts, ...presets];
210
+ }
211
+ function icebreaker(options = {}, ...userConfigs) {
212
+ return (0, antfu_exports.antfu)(...getRestConfigAndPresets(options), ...userConfigs);
193
213
  }
194
214
  export {
215
+ getPresets,
216
+ getRestConfigAndPresets,
195
217
  icebreaker
196
218
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
3
  "type": "module",
4
- "version": "0.3.19",
4
+ "version": "0.3.20",
5
5
  "description": "icebreakers's eslint config",
6
6
  "author": "SonOfMagic <qq1324318532@gmail.com>",
7
7
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@antfu/eslint-config": "2.25.0",
36
+ "@antfu/eslint-config": "2.26.0",
37
37
  "eslint-plugin-format": "0.1.2",
38
38
  "eslint-plugin-jsx-a11y": "^6.9.0",
39
39
  "eslint-plugin-mdx": "3.1.5",