@icebreakers/eslint-config 0.3.18 → 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 +66 -36
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +64 -36
- package/package.json +2 -2
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,43 +109,60 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
110
109
|
var antfu_exports = {};
|
|
111
110
|
__reExport(antfu_exports, require("@antfu/eslint-config"));
|
|
112
111
|
|
|
113
|
-
// src/
|
|
114
|
-
function
|
|
112
|
+
// src/preset.ts
|
|
113
|
+
function getPresets(options) {
|
|
115
114
|
const {
|
|
116
|
-
tailwindcss: enableTailwindcss
|
|
115
|
+
tailwindcss: enableTailwindcss,
|
|
117
116
|
mdx: enableMDX,
|
|
118
117
|
a11y: enableA11y,
|
|
118
|
+
vue: enableVue,
|
|
119
119
|
...opts
|
|
120
|
-
} =
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
} = options;
|
|
121
|
+
const presetRules = {
|
|
122
|
+
"curly": ["error", "all"],
|
|
123
|
+
"no-console": ["warn"],
|
|
124
|
+
"ts/prefer-ts-expect-error": "off",
|
|
125
|
+
"ts/ban-ts-comment": "off",
|
|
126
|
+
// 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
|
|
127
|
+
// 'unused-imports/no-unused-imports': 'error',
|
|
128
|
+
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
129
|
+
"no-unused-vars": "off",
|
|
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
|
+
"unused-imports/no-unused-vars": "off",
|
|
140
|
+
"ts/no-use-before-define": "warn"
|
|
141
|
+
};
|
|
142
|
+
if (enableVue) {
|
|
143
|
+
Object.assign(presetRules, {
|
|
144
|
+
"vue/attribute-hyphenation": "off",
|
|
145
|
+
"vue/v-on-event-hyphenation": "off",
|
|
146
|
+
"vue/custom-event-name-casing": "off",
|
|
147
|
+
"vue/no-mutating-props": "warn"
|
|
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
|
+
}
|
|
162
|
+
}
|
|
123
163
|
const presets = [
|
|
124
164
|
{
|
|
125
|
-
rules:
|
|
126
|
-
"curly": ["error", "all"],
|
|
127
|
-
"no-console": ["warn"],
|
|
128
|
-
"ts/prefer-ts-expect-error": "off",
|
|
129
|
-
"ts/ban-ts-comment": "off",
|
|
130
|
-
"vue/attribute-hyphenation": "off",
|
|
131
|
-
"vue/v-on-event-hyphenation": "off",
|
|
132
|
-
"vue/custom-event-name-casing": "off",
|
|
133
|
-
// 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
|
|
134
|
-
// 'unused-imports/no-unused-imports': 'error',
|
|
135
|
-
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
136
|
-
"no-unused-vars": "off",
|
|
137
|
-
"ts/no-unused-vars": ["error", {
|
|
138
|
-
args: "all",
|
|
139
|
-
argsIgnorePattern: "^_",
|
|
140
|
-
caughtErrors: "all",
|
|
141
|
-
caughtErrorsIgnorePattern: "^_",
|
|
142
|
-
destructuredArrayIgnorePattern: "^_",
|
|
143
|
-
varsIgnorePattern: "^_",
|
|
144
|
-
ignoreRestSiblings: true
|
|
145
|
-
}],
|
|
146
|
-
"unused-imports/no-unused-vars": "off",
|
|
147
|
-
"vue/no-mutating-props": "warn",
|
|
148
|
-
"ts/no-use-before-define": "warn"
|
|
149
|
-
}
|
|
165
|
+
rules: presetRules
|
|
150
166
|
}
|
|
151
167
|
];
|
|
152
168
|
if (enableTailwindcss) {
|
|
@@ -184,7 +200,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
184
200
|
}));
|
|
185
201
|
}
|
|
186
202
|
if (enableA11y) {
|
|
187
|
-
if (
|
|
203
|
+
if (enableVue) {
|
|
188
204
|
presets.push(
|
|
189
205
|
(0, antfu_exports.interopDefault)(
|
|
190
206
|
// @ts-ignore
|
|
@@ -205,9 +221,23 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
205
221
|
);
|
|
206
222
|
}
|
|
207
223
|
}
|
|
208
|
-
return
|
|
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);
|
|
209
237
|
}
|
|
210
238
|
// Annotate the CommonJS export names for ESM import in node:
|
|
211
239
|
0 && (module.exports = {
|
|
240
|
+
getPresets,
|
|
241
|
+
getRestConfigAndPresets,
|
|
212
242
|
icebreaker
|
|
213
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
|
-
|
|
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
|
-
|
|
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,43 +85,60 @@ 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/
|
|
92
|
-
function
|
|
88
|
+
// src/preset.ts
|
|
89
|
+
function getPresets(options) {
|
|
93
90
|
const {
|
|
94
|
-
tailwindcss: enableTailwindcss
|
|
91
|
+
tailwindcss: enableTailwindcss,
|
|
95
92
|
mdx: enableMDX,
|
|
96
93
|
a11y: enableA11y,
|
|
94
|
+
vue: enableVue,
|
|
97
95
|
...opts
|
|
98
|
-
} =
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
} = options;
|
|
97
|
+
const presetRules = {
|
|
98
|
+
"curly": ["error", "all"],
|
|
99
|
+
"no-console": ["warn"],
|
|
100
|
+
"ts/prefer-ts-expect-error": "off",
|
|
101
|
+
"ts/ban-ts-comment": "off",
|
|
102
|
+
// 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
|
|
103
|
+
// 'unused-imports/no-unused-imports': 'error',
|
|
104
|
+
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
105
|
+
"no-unused-vars": "off",
|
|
106
|
+
"ts/no-unused-vars": ["error", {
|
|
107
|
+
args: "all",
|
|
108
|
+
argsIgnorePattern: "^_",
|
|
109
|
+
caughtErrors: "all",
|
|
110
|
+
caughtErrorsIgnorePattern: "^_",
|
|
111
|
+
destructuredArrayIgnorePattern: "^_",
|
|
112
|
+
varsIgnorePattern: "^_",
|
|
113
|
+
ignoreRestSiblings: true
|
|
114
|
+
}],
|
|
115
|
+
"unused-imports/no-unused-vars": "off",
|
|
116
|
+
"ts/no-use-before-define": "warn"
|
|
117
|
+
};
|
|
118
|
+
if (enableVue) {
|
|
119
|
+
Object.assign(presetRules, {
|
|
120
|
+
"vue/attribute-hyphenation": "off",
|
|
121
|
+
"vue/v-on-event-hyphenation": "off",
|
|
122
|
+
"vue/custom-event-name-casing": "off",
|
|
123
|
+
"vue/no-mutating-props": "warn"
|
|
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
|
+
}
|
|
138
|
+
}
|
|
101
139
|
const presets = [
|
|
102
140
|
{
|
|
103
|
-
rules:
|
|
104
|
-
"curly": ["error", "all"],
|
|
105
|
-
"no-console": ["warn"],
|
|
106
|
-
"ts/prefer-ts-expect-error": "off",
|
|
107
|
-
"ts/ban-ts-comment": "off",
|
|
108
|
-
"vue/attribute-hyphenation": "off",
|
|
109
|
-
"vue/v-on-event-hyphenation": "off",
|
|
110
|
-
"vue/custom-event-name-casing": "off",
|
|
111
|
-
// 问题在于 auto fix 的时候,会直接 remove 整个 import ,而我们想让用户自己去 remove
|
|
112
|
-
// 'unused-imports/no-unused-imports': 'error',
|
|
113
|
-
// https://typescript-eslint.io/rules/no-unused-vars/
|
|
114
|
-
"no-unused-vars": "off",
|
|
115
|
-
"ts/no-unused-vars": ["error", {
|
|
116
|
-
args: "all",
|
|
117
|
-
argsIgnorePattern: "^_",
|
|
118
|
-
caughtErrors: "all",
|
|
119
|
-
caughtErrorsIgnorePattern: "^_",
|
|
120
|
-
destructuredArrayIgnorePattern: "^_",
|
|
121
|
-
varsIgnorePattern: "^_",
|
|
122
|
-
ignoreRestSiblings: true
|
|
123
|
-
}],
|
|
124
|
-
"unused-imports/no-unused-vars": "off",
|
|
125
|
-
"vue/no-mutating-props": "warn",
|
|
126
|
-
"ts/no-use-before-define": "warn"
|
|
127
|
-
}
|
|
141
|
+
rules: presetRules
|
|
128
142
|
}
|
|
129
143
|
];
|
|
130
144
|
if (enableTailwindcss) {
|
|
@@ -162,7 +176,7 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
162
176
|
}));
|
|
163
177
|
}
|
|
164
178
|
if (enableA11y) {
|
|
165
|
-
if (
|
|
179
|
+
if (enableVue) {
|
|
166
180
|
presets.push(
|
|
167
181
|
(0, antfu_exports.interopDefault)(
|
|
168
182
|
// @ts-ignore
|
|
@@ -183,8 +197,22 @@ function icebreaker(options = {}, ...userConfigs) {
|
|
|
183
197
|
);
|
|
184
198
|
}
|
|
185
199
|
}
|
|
186
|
-
return
|
|
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);
|
|
187
213
|
}
|
|
188
214
|
export {
|
|
215
|
+
getPresets,
|
|
216
|
+
getRestConfigAndPresets,
|
|
189
217
|
icebreaker
|
|
190
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.
|
|
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.
|
|
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",
|