@icebreakers/eslint-config 0.3.19 → 0.3.21

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ice breaker
3
+ Copyright (c) 2024 ice breaker
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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,20 @@ 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
+ "vue/no-deprecated-v-bind-sync": "off"
155
+ });
156
+ } else {
157
+ Object.assign(presetRules, {
158
+ "vue/no-v-for-template-key-on-child": "error",
159
+ "vue/no-v-for-template-key": "off"
160
+ });
161
+ }
162
+ }
152
163
  }
153
164
  const presets = [
154
165
  {
@@ -211,9 +222,23 @@ function icebreaker(options = {}, ...userConfigs) {
211
222
  );
212
223
  }
213
224
  }
214
- return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
225
+ return presets;
226
+ }
227
+
228
+ // src/factory.ts
229
+ function getRestConfigAndPresets(options) {
230
+ const opts = defu(options, {
231
+ formatters: true
232
+ });
233
+ const presets = getPresets(opts);
234
+ return [opts, ...presets];
235
+ }
236
+ function icebreaker(options = {}, ...userConfigs) {
237
+ return (0, antfu_exports.antfu)(...getRestConfigAndPresets(options), ...userConfigs);
215
238
  }
216
239
  // Annotate the CommonJS export names for ESM import in node:
217
240
  0 && (module.exports = {
241
+ getPresets,
242
+ getRestConfigAndPresets,
218
243
  icebreaker
219
244
  });
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,20 @@ 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
+ "vue/no-deprecated-v-bind-sync": "off"
131
+ });
132
+ } else {
133
+ Object.assign(presetRules, {
134
+ "vue/no-v-for-template-key-on-child": "error",
135
+ "vue/no-v-for-template-key": "off"
136
+ });
137
+ }
138
+ }
130
139
  }
131
140
  const presets = [
132
141
  {
@@ -189,8 +198,22 @@ function icebreaker(options = {}, ...userConfigs) {
189
198
  );
190
199
  }
191
200
  }
192
- return (0, antfu_exports.antfu)(opts, ...presets, ...userConfigs);
201
+ return presets;
202
+ }
203
+
204
+ // src/factory.ts
205
+ function getRestConfigAndPresets(options) {
206
+ const opts = defu(options, {
207
+ formatters: true
208
+ });
209
+ const presets = getPresets(opts);
210
+ return [opts, ...presets];
211
+ }
212
+ function icebreaker(options = {}, ...userConfigs) {
213
+ return (0, antfu_exports.antfu)(...getRestConfigAndPresets(options), ...userConfigs);
193
214
  }
194
215
  export {
216
+ getPresets,
217
+ getRestConfigAndPresets,
195
218
  icebreaker
196
219
  };
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.21",
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",