@pengzhanbo/eslint-config 1.1.0 → 1.2.0
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 +58 -13
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +57 -13
- package/package.json +11 -4
package/dist/index.cjs
CHANGED
|
@@ -82,6 +82,7 @@ __export(src_exports, {
|
|
|
82
82
|
toArray: () => toArray,
|
|
83
83
|
typescript: () => typescript,
|
|
84
84
|
unicorn: () => unicorn,
|
|
85
|
+
unocss: () => unocss,
|
|
85
86
|
yaml: () => yaml
|
|
86
87
|
});
|
|
87
88
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -175,7 +176,8 @@ var GLOB_ALL_SRC = [
|
|
|
175
176
|
GLOB_VUE,
|
|
176
177
|
GLOB_YAML,
|
|
177
178
|
GLOB_HTML,
|
|
178
|
-
GLOB_ASTRO
|
|
179
|
+
GLOB_ASTRO,
|
|
180
|
+
GLOB_SVELTE
|
|
179
181
|
];
|
|
180
182
|
var GLOB_EXCLUDE = [
|
|
181
183
|
"**/node_modules",
|
|
@@ -323,7 +325,6 @@ async function javascript(options = {}) {
|
|
|
323
325
|
"no-implied-eval": "error",
|
|
324
326
|
"no-import-assign": "error",
|
|
325
327
|
"no-invalid-regexp": "error",
|
|
326
|
-
"no-invalid-this": "error",
|
|
327
328
|
"no-irregular-whitespace": "error",
|
|
328
329
|
"no-iterator": "error",
|
|
329
330
|
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
@@ -1013,7 +1014,6 @@ async function typescript(options = {}) {
|
|
|
1013
1014
|
"antfu/generic-spacing": "error",
|
|
1014
1015
|
"antfu/named-tuple-spacing": "error",
|
|
1015
1016
|
"no-dupe-class-members": "off",
|
|
1016
|
-
"no-invalid-this": "off",
|
|
1017
1017
|
"no-loss-of-precision": "off",
|
|
1018
1018
|
"no-redeclare": "off",
|
|
1019
1019
|
"no-use-before-define": "off",
|
|
@@ -1027,7 +1027,6 @@ async function typescript(options = {}) {
|
|
|
1027
1027
|
"ts/no-explicit-any": "off",
|
|
1028
1028
|
"ts/no-extraneous-class": "off",
|
|
1029
1029
|
"ts/no-import-type-side-effects": "error",
|
|
1030
|
-
"ts/no-invalid-this": "error",
|
|
1031
1030
|
"ts/no-invalid-void-type": "off",
|
|
1032
1031
|
"ts/no-loss-of-precision": "error",
|
|
1033
1032
|
"ts/no-non-null-assertion": "off",
|
|
@@ -1227,6 +1226,44 @@ async function perfectionist() {
|
|
|
1227
1226
|
];
|
|
1228
1227
|
}
|
|
1229
1228
|
|
|
1229
|
+
// src/configs/unocss.ts
|
|
1230
|
+
var import_local_pkg = require("local-pkg");
|
|
1231
|
+
var unocssPackages = ["@unocss/eslint-plugin"];
|
|
1232
|
+
async function unocss(options = {}) {
|
|
1233
|
+
const {
|
|
1234
|
+
attributify = true,
|
|
1235
|
+
strict = false
|
|
1236
|
+
} = options;
|
|
1237
|
+
const unInstalled = unocssPackages.filter((i) => !(0, import_local_pkg.isPackageExists)(i));
|
|
1238
|
+
if (unInstalled.length > 0) {
|
|
1239
|
+
const installed = unInstalled.join(", ");
|
|
1240
|
+
console.warn(`${installed} is not installed, please install it first.`);
|
|
1241
|
+
return [];
|
|
1242
|
+
}
|
|
1243
|
+
const [
|
|
1244
|
+
pluginUnoCSS
|
|
1245
|
+
] = await Promise.all([
|
|
1246
|
+
interopDefault(import("@unocss/eslint-plugin"))
|
|
1247
|
+
]);
|
|
1248
|
+
return [
|
|
1249
|
+
{
|
|
1250
|
+
name: "config:unocss",
|
|
1251
|
+
plugins: {
|
|
1252
|
+
unocss: pluginUnoCSS
|
|
1253
|
+
},
|
|
1254
|
+
rules: {
|
|
1255
|
+
"unocss/order": "warn",
|
|
1256
|
+
...attributify ? {
|
|
1257
|
+
"unocss/order-attributify": "warn"
|
|
1258
|
+
} : {},
|
|
1259
|
+
...strict ? {
|
|
1260
|
+
"unocss/blocklist": "error"
|
|
1261
|
+
} : {}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
];
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1230
1267
|
// src/preset.ts
|
|
1231
1268
|
var defaultPreset = (options) => {
|
|
1232
1269
|
const {
|
|
@@ -1306,12 +1343,14 @@ var defaultPreset = (options) => {
|
|
|
1306
1343
|
overrides: overrides.markdown
|
|
1307
1344
|
}));
|
|
1308
1345
|
}
|
|
1346
|
+
if (options.unocss)
|
|
1347
|
+
configs.push(unocss(options.unocss === true ? {} : options.unocss));
|
|
1309
1348
|
return configs;
|
|
1310
1349
|
};
|
|
1311
1350
|
|
|
1312
1351
|
// src/resolvedOptions.ts
|
|
1313
1352
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
1314
|
-
var
|
|
1353
|
+
var import_local_pkg2 = require("local-pkg");
|
|
1315
1354
|
var VuePackages = [
|
|
1316
1355
|
"vue",
|
|
1317
1356
|
"nuxt",
|
|
@@ -1325,19 +1364,23 @@ function resolveOptions(options = {}) {
|
|
|
1325
1364
|
gitignore = true,
|
|
1326
1365
|
isInEditor = !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !import_node_process2.default.env.CI),
|
|
1327
1366
|
overrides = {},
|
|
1328
|
-
typescript: typescript2 = (0,
|
|
1367
|
+
typescript: typescript2 = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1329
1368
|
jsx = true,
|
|
1330
1369
|
test: test2 = true,
|
|
1331
1370
|
jsonc: jsonc2 = true,
|
|
1332
1371
|
yaml: yaml2 = true,
|
|
1333
1372
|
markdown: markdown2 = true
|
|
1334
1373
|
} = options;
|
|
1335
|
-
const
|
|
1336
|
-
if (
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
if (
|
|
1374
|
+
const stylistic2 = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1375
|
+
if (stylistic2 && !("jsx" in stylistic2))
|
|
1376
|
+
stylistic2.jsx = options.jsx ?? true;
|
|
1377
|
+
const unocss2 = options.unocss === false ? false : typeof options.unocss === "object" ? options.unocss : {};
|
|
1378
|
+
if (VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)))
|
|
1340
1379
|
componentExts.push("vue");
|
|
1380
|
+
if ((0, import_local_pkg2.isPackageExists)("astro"))
|
|
1381
|
+
componentExts.push("astro");
|
|
1382
|
+
if ((0, import_local_pkg2.isPackageExists)("svelte"))
|
|
1383
|
+
componentExts.push("svelte");
|
|
1341
1384
|
return {
|
|
1342
1385
|
...options,
|
|
1343
1386
|
componentExts,
|
|
@@ -1346,12 +1389,13 @@ function resolveOptions(options = {}) {
|
|
|
1346
1389
|
isInEditor,
|
|
1347
1390
|
overrides,
|
|
1348
1391
|
typescript: typescript2,
|
|
1349
|
-
stylistic:
|
|
1392
|
+
stylistic: stylistic2,
|
|
1350
1393
|
jsx,
|
|
1351
1394
|
test: test2,
|
|
1352
1395
|
jsonc: jsonc2,
|
|
1353
1396
|
yaml: yaml2,
|
|
1354
|
-
markdown: markdown2
|
|
1397
|
+
markdown: markdown2,
|
|
1398
|
+
unocss: unocss2
|
|
1355
1399
|
};
|
|
1356
1400
|
}
|
|
1357
1401
|
|
|
@@ -1450,5 +1494,6 @@ var src_default = eslintFlatConfig;
|
|
|
1450
1494
|
toArray,
|
|
1451
1495
|
typescript,
|
|
1452
1496
|
unicorn,
|
|
1497
|
+
unocss,
|
|
1453
1498
|
yaml
|
|
1454
1499
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -80,6 +80,18 @@ interface OptionsOverrides {
|
|
|
80
80
|
interface OptionsIsInEditor {
|
|
81
81
|
isInEditor?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface OptionsUnoCSS {
|
|
84
|
+
/**
|
|
85
|
+
* Enable attributify support.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
attributify?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable strict mode by throwing errors about blocklisted classes.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
strict?: boolean;
|
|
94
|
+
}
|
|
83
95
|
type PresetItem = (options: Required<Omit<OptionsConfig, 'preset'>> & {
|
|
84
96
|
stylistic: false | StylisticConfig;
|
|
85
97
|
}) => Awaitable<FlatConfigItem[]>[];
|
|
@@ -147,6 +159,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
147
159
|
* @default true
|
|
148
160
|
*/
|
|
149
161
|
stylistic?: boolean | StylisticConfig;
|
|
162
|
+
/**
|
|
163
|
+
* Enable unocss rules.
|
|
164
|
+
*
|
|
165
|
+
* Requires installing:
|
|
166
|
+
* - `@unocss/eslint-plugin`
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
150
171
|
/**
|
|
151
172
|
* Control to disable some rules in editors.
|
|
152
173
|
* @default auto-detect based on the process.env
|
|
@@ -164,6 +185,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
164
185
|
yaml?: FlatConfigItem['rules'];
|
|
165
186
|
vue?: FlatConfigItem['rules'];
|
|
166
187
|
react?: FlatConfigItem['rules'];
|
|
188
|
+
nextjs?: FlatConfigItem['rules'];
|
|
167
189
|
solid?: FlatConfigItem['rules'];
|
|
168
190
|
svelte?: FlatConfigItem['rules'];
|
|
169
191
|
astro?: FlatConfigItem['rules'];
|
|
@@ -255,6 +277,8 @@ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverri
|
|
|
255
277
|
*/
|
|
256
278
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
257
279
|
|
|
280
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
281
|
+
|
|
258
282
|
declare const defaultPreset: PresetItem;
|
|
259
283
|
|
|
260
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, yaml };
|
|
284
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,18 @@ interface OptionsOverrides {
|
|
|
80
80
|
interface OptionsIsInEditor {
|
|
81
81
|
isInEditor?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface OptionsUnoCSS {
|
|
84
|
+
/**
|
|
85
|
+
* Enable attributify support.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
attributify?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable strict mode by throwing errors about blocklisted classes.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
strict?: boolean;
|
|
94
|
+
}
|
|
83
95
|
type PresetItem = (options: Required<Omit<OptionsConfig, 'preset'>> & {
|
|
84
96
|
stylistic: false | StylisticConfig;
|
|
85
97
|
}) => Awaitable<FlatConfigItem[]>[];
|
|
@@ -147,6 +159,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
147
159
|
* @default true
|
|
148
160
|
*/
|
|
149
161
|
stylistic?: boolean | StylisticConfig;
|
|
162
|
+
/**
|
|
163
|
+
* Enable unocss rules.
|
|
164
|
+
*
|
|
165
|
+
* Requires installing:
|
|
166
|
+
* - `@unocss/eslint-plugin`
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
150
171
|
/**
|
|
151
172
|
* Control to disable some rules in editors.
|
|
152
173
|
* @default auto-detect based on the process.env
|
|
@@ -164,6 +185,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
164
185
|
yaml?: FlatConfigItem['rules'];
|
|
165
186
|
vue?: FlatConfigItem['rules'];
|
|
166
187
|
react?: FlatConfigItem['rules'];
|
|
188
|
+
nextjs?: FlatConfigItem['rules'];
|
|
167
189
|
solid?: FlatConfigItem['rules'];
|
|
168
190
|
svelte?: FlatConfigItem['rules'];
|
|
169
191
|
astro?: FlatConfigItem['rules'];
|
|
@@ -255,6 +277,8 @@ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverri
|
|
|
255
277
|
*/
|
|
256
278
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
257
279
|
|
|
280
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
281
|
+
|
|
258
282
|
declare const defaultPreset: PresetItem;
|
|
259
283
|
|
|
260
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, yaml };
|
|
284
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, yaml };
|
package/dist/index.js
CHANGED
|
@@ -87,7 +87,8 @@ var GLOB_ALL_SRC = [
|
|
|
87
87
|
GLOB_VUE,
|
|
88
88
|
GLOB_YAML,
|
|
89
89
|
GLOB_HTML,
|
|
90
|
-
GLOB_ASTRO
|
|
90
|
+
GLOB_ASTRO,
|
|
91
|
+
GLOB_SVELTE
|
|
91
92
|
];
|
|
92
93
|
var GLOB_EXCLUDE = [
|
|
93
94
|
"**/node_modules",
|
|
@@ -235,7 +236,6 @@ async function javascript(options = {}) {
|
|
|
235
236
|
"no-implied-eval": "error",
|
|
236
237
|
"no-import-assign": "error",
|
|
237
238
|
"no-invalid-regexp": "error",
|
|
238
|
-
"no-invalid-this": "error",
|
|
239
239
|
"no-irregular-whitespace": "error",
|
|
240
240
|
"no-iterator": "error",
|
|
241
241
|
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
@@ -925,7 +925,6 @@ async function typescript(options = {}) {
|
|
|
925
925
|
"antfu/generic-spacing": "error",
|
|
926
926
|
"antfu/named-tuple-spacing": "error",
|
|
927
927
|
"no-dupe-class-members": "off",
|
|
928
|
-
"no-invalid-this": "off",
|
|
929
928
|
"no-loss-of-precision": "off",
|
|
930
929
|
"no-redeclare": "off",
|
|
931
930
|
"no-use-before-define": "off",
|
|
@@ -939,7 +938,6 @@ async function typescript(options = {}) {
|
|
|
939
938
|
"ts/no-explicit-any": "off",
|
|
940
939
|
"ts/no-extraneous-class": "off",
|
|
941
940
|
"ts/no-import-type-side-effects": "error",
|
|
942
|
-
"ts/no-invalid-this": "error",
|
|
943
941
|
"ts/no-invalid-void-type": "off",
|
|
944
942
|
"ts/no-loss-of-precision": "error",
|
|
945
943
|
"ts/no-non-null-assertion": "off",
|
|
@@ -1139,6 +1137,44 @@ async function perfectionist() {
|
|
|
1139
1137
|
];
|
|
1140
1138
|
}
|
|
1141
1139
|
|
|
1140
|
+
// src/configs/unocss.ts
|
|
1141
|
+
import { isPackageExists } from "local-pkg";
|
|
1142
|
+
var unocssPackages = ["@unocss/eslint-plugin"];
|
|
1143
|
+
async function unocss(options = {}) {
|
|
1144
|
+
const {
|
|
1145
|
+
attributify = true,
|
|
1146
|
+
strict = false
|
|
1147
|
+
} = options;
|
|
1148
|
+
const unInstalled = unocssPackages.filter((i) => !isPackageExists(i));
|
|
1149
|
+
if (unInstalled.length > 0) {
|
|
1150
|
+
const installed = unInstalled.join(", ");
|
|
1151
|
+
console.warn(`${installed} is not installed, please install it first.`);
|
|
1152
|
+
return [];
|
|
1153
|
+
}
|
|
1154
|
+
const [
|
|
1155
|
+
pluginUnoCSS
|
|
1156
|
+
] = await Promise.all([
|
|
1157
|
+
interopDefault(import("@unocss/eslint-plugin"))
|
|
1158
|
+
]);
|
|
1159
|
+
return [
|
|
1160
|
+
{
|
|
1161
|
+
name: "config:unocss",
|
|
1162
|
+
plugins: {
|
|
1163
|
+
unocss: pluginUnoCSS
|
|
1164
|
+
},
|
|
1165
|
+
rules: {
|
|
1166
|
+
"unocss/order": "warn",
|
|
1167
|
+
...attributify ? {
|
|
1168
|
+
"unocss/order-attributify": "warn"
|
|
1169
|
+
} : {},
|
|
1170
|
+
...strict ? {
|
|
1171
|
+
"unocss/blocklist": "error"
|
|
1172
|
+
} : {}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
];
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1142
1178
|
// src/preset.ts
|
|
1143
1179
|
var defaultPreset = (options) => {
|
|
1144
1180
|
const {
|
|
@@ -1218,12 +1254,14 @@ var defaultPreset = (options) => {
|
|
|
1218
1254
|
overrides: overrides.markdown
|
|
1219
1255
|
}));
|
|
1220
1256
|
}
|
|
1257
|
+
if (options.unocss)
|
|
1258
|
+
configs.push(unocss(options.unocss === true ? {} : options.unocss));
|
|
1221
1259
|
return configs;
|
|
1222
1260
|
};
|
|
1223
1261
|
|
|
1224
1262
|
// src/resolvedOptions.ts
|
|
1225
1263
|
import process2 from "process";
|
|
1226
|
-
import { isPackageExists } from "local-pkg";
|
|
1264
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1227
1265
|
var VuePackages = [
|
|
1228
1266
|
"vue",
|
|
1229
1267
|
"nuxt",
|
|
@@ -1237,19 +1275,23 @@ function resolveOptions(options = {}) {
|
|
|
1237
1275
|
gitignore = true,
|
|
1238
1276
|
isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI),
|
|
1239
1277
|
overrides = {},
|
|
1240
|
-
typescript: typescript2 =
|
|
1278
|
+
typescript: typescript2 = isPackageExists2("typescript"),
|
|
1241
1279
|
jsx = true,
|
|
1242
1280
|
test: test2 = true,
|
|
1243
1281
|
jsonc: jsonc2 = true,
|
|
1244
1282
|
yaml: yaml2 = true,
|
|
1245
1283
|
markdown: markdown2 = true
|
|
1246
1284
|
} = options;
|
|
1247
|
-
const
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1250
|
-
const
|
|
1251
|
-
if (
|
|
1285
|
+
const stylistic2 = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1286
|
+
if (stylistic2 && !("jsx" in stylistic2))
|
|
1287
|
+
stylistic2.jsx = options.jsx ?? true;
|
|
1288
|
+
const unocss2 = options.unocss === false ? false : typeof options.unocss === "object" ? options.unocss : {};
|
|
1289
|
+
if (VuePackages.some((i) => isPackageExists2(i)))
|
|
1252
1290
|
componentExts.push("vue");
|
|
1291
|
+
if (isPackageExists2("astro"))
|
|
1292
|
+
componentExts.push("astro");
|
|
1293
|
+
if (isPackageExists2("svelte"))
|
|
1294
|
+
componentExts.push("svelte");
|
|
1253
1295
|
return {
|
|
1254
1296
|
...options,
|
|
1255
1297
|
componentExts,
|
|
@@ -1258,12 +1300,13 @@ function resolveOptions(options = {}) {
|
|
|
1258
1300
|
isInEditor,
|
|
1259
1301
|
overrides,
|
|
1260
1302
|
typescript: typescript2,
|
|
1261
|
-
stylistic:
|
|
1303
|
+
stylistic: stylistic2,
|
|
1262
1304
|
jsx,
|
|
1263
1305
|
test: test2,
|
|
1264
1306
|
jsonc: jsonc2,
|
|
1265
1307
|
yaml: yaml2,
|
|
1266
|
-
markdown: markdown2
|
|
1308
|
+
markdown: markdown2,
|
|
1309
|
+
unocss: unocss2
|
|
1267
1310
|
};
|
|
1268
1311
|
}
|
|
1269
1312
|
|
|
@@ -1362,5 +1405,6 @@ export {
|
|
|
1362
1405
|
toArray,
|
|
1363
1406
|
typescript,
|
|
1364
1407
|
unicorn,
|
|
1408
|
+
unocss,
|
|
1365
1409
|
yaml
|
|
1366
1410
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pengzhanbo/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/pengzhanbo/configs#readme",
|
|
@@ -32,16 +32,22 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
|
+
"@unocss/eslint-plugin": ">=0.50.0",
|
|
35
36
|
"eslint": ">=8.40.0"
|
|
36
37
|
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@unocss/eslint-plugin": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
37
43
|
"dependencies": {
|
|
38
44
|
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
39
45
|
"@eslint-types/jsdoc": "46.9.0",
|
|
40
46
|
"@eslint-types/typescript-eslint": "^6.12.0",
|
|
41
47
|
"@eslint-types/unicorn": "^49.0.0",
|
|
42
48
|
"@stylistic/eslint-plugin": "^1.4.1",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
44
|
-
"@typescript-eslint/parser": "^6.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
50
|
+
"@typescript-eslint/parser": "^6.13.1",
|
|
45
51
|
"eslint-config-flat-gitignore": "^0.1.1",
|
|
46
52
|
"eslint-plugin-antfu": "^1.0.11",
|
|
47
53
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
@@ -51,7 +57,7 @@
|
|
|
51
57
|
"eslint-plugin-markdown": "^3.0.1",
|
|
52
58
|
"eslint-plugin-n": "^16.3.1",
|
|
53
59
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
54
|
-
"eslint-plugin-perfectionist": "^2.
|
|
60
|
+
"eslint-plugin-perfectionist": "^2.5.0",
|
|
55
61
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
56
62
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
57
63
|
"eslint-plugin-vitest": "^0.3.10",
|
|
@@ -63,6 +69,7 @@
|
|
|
63
69
|
"yaml-eslint-parser": "^1.2.2"
|
|
64
70
|
},
|
|
65
71
|
"devDependencies": {
|
|
72
|
+
"@unocss/eslint-plugin": "^0.57.7",
|
|
66
73
|
"eslint": "^8.54.0",
|
|
67
74
|
"eslint-flat-config-viewer": "^0.1.3",
|
|
68
75
|
"tsup": "^8.0.1"
|