@pengzhanbo/eslint-config 1.5.0 → 1.5.2
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/README.md +2 -2
- package/dist/index.cjs +13 -74
- package/dist/index.d.cts +12 -34
- package/dist/index.d.ts +12 -34
- package/dist/index.js +13 -73
- package/package.json +9 -11
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Fork for [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
4
4
|
|
|
5
|
-
与 [@antfu/eslint-config](https://github.com/antfu/eslint-config) 不同的是,
|
|
6
|
-
将 framework 相关的配置划分为独立的 eslint 配置包。
|
|
5
|
+
与 [@antfu/eslint-config](https://github.com/antfu/eslint-config) 不同的是,
|
|
6
|
+
将 framework 相关的配置划分为独立的 eslint 配置包。
|
|
7
7
|
|
|
8
8
|
包括 `vue` 、 `react` 等都移动到其他的 package 中,只保留 通用的配置,
|
|
9
9
|
再根据项目的需求引入对应的 package。 并添加了 `solid-js` , `svelte` 等的配置支持。
|
package/dist/index.cjs
CHANGED
|
@@ -64,7 +64,6 @@ __export(src_exports, {
|
|
|
64
64
|
defaultPreset: () => defaultPreset,
|
|
65
65
|
formatters: () => formatters,
|
|
66
66
|
getOverrides: () => getOverrides,
|
|
67
|
-
html: () => html,
|
|
68
67
|
ignores: () => ignores,
|
|
69
68
|
imports: () => imports,
|
|
70
69
|
interopDefault: () => interopDefault,
|
|
@@ -518,7 +517,6 @@ async function jsdoc(options = {}) {
|
|
|
518
517
|
{
|
|
519
518
|
name: "config:jsdoc",
|
|
520
519
|
plugins: {
|
|
521
|
-
// @ts-expect-error missing types
|
|
522
520
|
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
523
521
|
},
|
|
524
522
|
rules: {
|
|
@@ -1382,57 +1380,6 @@ async function tailwindcss(options = {}) {
|
|
|
1382
1380
|
];
|
|
1383
1381
|
}
|
|
1384
1382
|
|
|
1385
|
-
// src/configs/html.ts
|
|
1386
|
-
async function html(options = {}) {
|
|
1387
|
-
const {
|
|
1388
|
-
files = [GLOB_HTML],
|
|
1389
|
-
overrides = {},
|
|
1390
|
-
stylistic: stylistic2 = true
|
|
1391
|
-
} = options;
|
|
1392
|
-
const {
|
|
1393
|
-
indent = 2
|
|
1394
|
-
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1395
|
-
const [
|
|
1396
|
-
pluginHtml,
|
|
1397
|
-
parserHtml
|
|
1398
|
-
] = await Promise.all([
|
|
1399
|
-
interopDefault(import("@html-eslint/eslint-plugin")),
|
|
1400
|
-
interopDefault(import("@html-eslint/parser"))
|
|
1401
|
-
]);
|
|
1402
|
-
return [
|
|
1403
|
-
{
|
|
1404
|
-
name: "config:html:setup",
|
|
1405
|
-
plugins: {
|
|
1406
|
-
html: pluginHtml
|
|
1407
|
-
}
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
files,
|
|
1411
|
-
name: "config:html:rules",
|
|
1412
|
-
languageOptions: {
|
|
1413
|
-
parser: parserHtml
|
|
1414
|
-
},
|
|
1415
|
-
rules: {
|
|
1416
|
-
"html/require-lang": "error",
|
|
1417
|
-
"html/require-img-alt": "error",
|
|
1418
|
-
"html/require-doctype": "error",
|
|
1419
|
-
"html/require-title": "error",
|
|
1420
|
-
"html/no-extra-spacing-attrs": "error",
|
|
1421
|
-
"html/no-duplicate-id": "error",
|
|
1422
|
-
"html/indent": ["error", indent],
|
|
1423
|
-
"html/require-li-container": "error",
|
|
1424
|
-
"html/quotes": "error",
|
|
1425
|
-
"html/require-closing-tags": "error",
|
|
1426
|
-
"html/no-duplicate-attrs": "error",
|
|
1427
|
-
"html/element-newline": ["error", {
|
|
1428
|
-
skip: ["span", "i", "code", "pre"]
|
|
1429
|
-
}],
|
|
1430
|
-
...overrides
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
];
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
1383
|
// src/configs/toml.ts
|
|
1437
1384
|
async function toml(options = {}) {
|
|
1438
1385
|
const {
|
|
@@ -1661,6 +1608,15 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1661
1608
|
return configs;
|
|
1662
1609
|
}
|
|
1663
1610
|
|
|
1611
|
+
// src/resolveSubOptions.ts
|
|
1612
|
+
function resolveSubOptions(options, key) {
|
|
1613
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1614
|
+
}
|
|
1615
|
+
function getOverrides(options, key) {
|
|
1616
|
+
const sub = resolveSubOptions(options, key);
|
|
1617
|
+
return "overrides" in sub ? sub.overrides : {};
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1664
1620
|
// src/preset.ts
|
|
1665
1621
|
var defaultPreset = (options) => {
|
|
1666
1622
|
const {
|
|
@@ -1742,12 +1698,6 @@ var defaultPreset = (options) => {
|
|
|
1742
1698
|
stylistic: stylisticOptions
|
|
1743
1699
|
}));
|
|
1744
1700
|
}
|
|
1745
|
-
if (options.html) {
|
|
1746
|
-
configs.push(html({
|
|
1747
|
-
overrides: getOverrides(options, "html"),
|
|
1748
|
-
stylistic: stylisticOptions
|
|
1749
|
-
}));
|
|
1750
|
-
}
|
|
1751
1701
|
if (options.unocss) {
|
|
1752
1702
|
configs.push(unocss({
|
|
1753
1703
|
...resolveSubOptions(options, "unocss"),
|
|
@@ -1799,7 +1749,6 @@ function resolveOptions(options = {}) {
|
|
|
1799
1749
|
yaml: yaml2 = true,
|
|
1800
1750
|
toml: toml2 = true,
|
|
1801
1751
|
markdown: markdown2 = true,
|
|
1802
|
-
html: html2 = true,
|
|
1803
1752
|
formatters: formatters2 = false,
|
|
1804
1753
|
unocss: enableUnocss = false,
|
|
1805
1754
|
tailwindcss: enableTailwindcss = false
|
|
@@ -1831,7 +1780,6 @@ function resolveOptions(options = {}) {
|
|
|
1831
1780
|
markdown: markdown2,
|
|
1832
1781
|
unocss: unocss2,
|
|
1833
1782
|
tailwindcss: tailwindcss2,
|
|
1834
|
-
html: html2,
|
|
1835
1783
|
formatters: formatters2
|
|
1836
1784
|
};
|
|
1837
1785
|
}
|
|
@@ -1866,23 +1814,15 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
|
|
|
1866
1814
|
);
|
|
1867
1815
|
return merged;
|
|
1868
1816
|
}
|
|
1817
|
+
|
|
1818
|
+
// src/createConfig.ts
|
|
1869
1819
|
function createConfig(preset) {
|
|
1870
|
-
return (options = {}, ...userConfigs)
|
|
1820
|
+
return function eslintFlatConfig2(options = {}, ...userConfigs) {
|
|
1871
1821
|
const userPreset = options.preset || [];
|
|
1872
1822
|
const presetList = Array.isArray(preset) ? preset : [preset];
|
|
1873
1823
|
presetList.push(...userPreset);
|
|
1874
1824
|
options.preset = presetList;
|
|
1875
|
-
return
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
function resolveSubOptions(options, key) {
|
|
1879
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1880
|
-
}
|
|
1881
|
-
function getOverrides(options, key) {
|
|
1882
|
-
const sub = resolveSubOptions(options, key);
|
|
1883
|
-
return {
|
|
1884
|
-
...options.overrides?.[key],
|
|
1885
|
-
..."overrides" in sub ? sub.overrides || {} : {}
|
|
1825
|
+
return eslintFlatConfig2(options, ...userConfigs);
|
|
1886
1826
|
};
|
|
1887
1827
|
}
|
|
1888
1828
|
|
|
@@ -1923,7 +1863,6 @@ var src_default = eslintFlatConfig;
|
|
|
1923
1863
|
defaultPreset,
|
|
1924
1864
|
formatters,
|
|
1925
1865
|
getOverrides,
|
|
1926
|
-
html,
|
|
1927
1866
|
ignores,
|
|
1928
1867
|
imports,
|
|
1929
1868
|
interopDefault,
|
package/dist/index.d.cts
CHANGED
|
@@ -190,8 +190,6 @@ interface OptionsComponentExts {
|
|
|
190
190
|
*/
|
|
191
191
|
componentExts?: string[];
|
|
192
192
|
}
|
|
193
|
-
interface OptionsFrameworkExtract {
|
|
194
|
-
}
|
|
195
193
|
interface OptionsTypeScriptParserOptions {
|
|
196
194
|
/**
|
|
197
195
|
* Additional parser options for TypeScript.
|
|
@@ -258,6 +256,8 @@ interface OptionsTailwindCSS extends OptionsOverrides {
|
|
|
258
256
|
customClassNames?: boolean;
|
|
259
257
|
}
|
|
260
258
|
type PresetItem = (options: Required<Omit<OptionsConfig, 'preset'>>) => Awaitable<FlatConfigItem[]>[];
|
|
259
|
+
interface OptionsFrameworkExtract {
|
|
260
|
+
}
|
|
261
261
|
interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
262
262
|
/**
|
|
263
263
|
* Enable gitignore support.
|
|
@@ -325,10 +325,6 @@ interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
|
325
325
|
* @default true
|
|
326
326
|
*/
|
|
327
327
|
markdown?: boolean;
|
|
328
|
-
/**
|
|
329
|
-
* Enable HTML support.
|
|
330
|
-
*/
|
|
331
|
-
html?: boolean | OptionsOverrides;
|
|
332
328
|
/**
|
|
333
329
|
* Enable stylistic rules.
|
|
334
330
|
*
|
|
@@ -367,34 +363,9 @@ interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
|
367
363
|
* @default auto-detect based on the process.env
|
|
368
364
|
*/
|
|
369
365
|
isInEditor?: boolean;
|
|
370
|
-
/**
|
|
371
|
-
* Provide overrides for rules for each integration.
|
|
372
|
-
*
|
|
373
|
-
* @deprecated use `overrides` option in each integration key instead
|
|
374
|
-
*/
|
|
375
|
-
overrides?: {
|
|
376
|
-
html?: FlatConfigItem['rules'];
|
|
377
|
-
javascript?: FlatConfigItem['rules'];
|
|
378
|
-
typescript?: FlatConfigItem['rules'];
|
|
379
|
-
test?: FlatConfigItem['rules'];
|
|
380
|
-
jsonc?: FlatConfigItem['rules'];
|
|
381
|
-
markdown?: FlatConfigItem['rules'];
|
|
382
|
-
yaml?: FlatConfigItem['rules'];
|
|
383
|
-
toml?: FlatConfigItem['rules'];
|
|
384
|
-
vue?: FlatConfigItem['rules'];
|
|
385
|
-
react?: FlatConfigItem['rules'];
|
|
386
|
-
nextjs?: FlatConfigItem['rules'];
|
|
387
|
-
solid?: FlatConfigItem['rules'];
|
|
388
|
-
svelte?: FlatConfigItem['rules'];
|
|
389
|
-
astro?: FlatConfigItem['rules'];
|
|
390
|
-
};
|
|
391
366
|
}
|
|
392
367
|
|
|
393
368
|
declare function eslintFlatConfig(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
394
|
-
declare function createConfig(preset: PresetItem | PresetItem[]): typeof eslintFlatConfig;
|
|
395
|
-
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
396
|
-
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
397
|
-
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): any;
|
|
398
369
|
|
|
399
370
|
declare const parserPlain: {
|
|
400
371
|
meta: {
|
|
@@ -511,12 +482,19 @@ declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
|
511
482
|
|
|
512
483
|
declare function tailwindcss(options?: OptionsTailwindCSS): Promise<FlatConfigItem[]>;
|
|
513
484
|
|
|
514
|
-
declare function html(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
515
|
-
|
|
516
485
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
517
486
|
|
|
518
487
|
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
519
488
|
|
|
520
489
|
declare const defaultPreset: PresetItem;
|
|
521
490
|
|
|
522
|
-
|
|
491
|
+
interface EslintFlatConfigFunction {
|
|
492
|
+
(options: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
493
|
+
}
|
|
494
|
+
declare function createConfig(preset: PresetItem | PresetItem[]): EslintFlatConfigFunction;
|
|
495
|
+
|
|
496
|
+
type ResolvedNoNullableOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
497
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedNoNullableOptions<OptionsConfig[K]>;
|
|
498
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): FlatConfigItem['rules'];
|
|
499
|
+
|
|
500
|
+
export { type Awaitable, type EslintFlatConfigFunction, 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_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsFrameworkExtract, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -190,8 +190,6 @@ interface OptionsComponentExts {
|
|
|
190
190
|
*/
|
|
191
191
|
componentExts?: string[];
|
|
192
192
|
}
|
|
193
|
-
interface OptionsFrameworkExtract {
|
|
194
|
-
}
|
|
195
193
|
interface OptionsTypeScriptParserOptions {
|
|
196
194
|
/**
|
|
197
195
|
* Additional parser options for TypeScript.
|
|
@@ -258,6 +256,8 @@ interface OptionsTailwindCSS extends OptionsOverrides {
|
|
|
258
256
|
customClassNames?: boolean;
|
|
259
257
|
}
|
|
260
258
|
type PresetItem = (options: Required<Omit<OptionsConfig, 'preset'>>) => Awaitable<FlatConfigItem[]>[];
|
|
259
|
+
interface OptionsFrameworkExtract {
|
|
260
|
+
}
|
|
261
261
|
interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
262
262
|
/**
|
|
263
263
|
* Enable gitignore support.
|
|
@@ -325,10 +325,6 @@ interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
|
325
325
|
* @default true
|
|
326
326
|
*/
|
|
327
327
|
markdown?: boolean;
|
|
328
|
-
/**
|
|
329
|
-
* Enable HTML support.
|
|
330
|
-
*/
|
|
331
|
-
html?: boolean | OptionsOverrides;
|
|
332
328
|
/**
|
|
333
329
|
* Enable stylistic rules.
|
|
334
330
|
*
|
|
@@ -367,34 +363,9 @@ interface OptionsConfig extends OptionsComponentExts, OptionsFrameworkExtract {
|
|
|
367
363
|
* @default auto-detect based on the process.env
|
|
368
364
|
*/
|
|
369
365
|
isInEditor?: boolean;
|
|
370
|
-
/**
|
|
371
|
-
* Provide overrides for rules for each integration.
|
|
372
|
-
*
|
|
373
|
-
* @deprecated use `overrides` option in each integration key instead
|
|
374
|
-
*/
|
|
375
|
-
overrides?: {
|
|
376
|
-
html?: FlatConfigItem['rules'];
|
|
377
|
-
javascript?: FlatConfigItem['rules'];
|
|
378
|
-
typescript?: FlatConfigItem['rules'];
|
|
379
|
-
test?: FlatConfigItem['rules'];
|
|
380
|
-
jsonc?: FlatConfigItem['rules'];
|
|
381
|
-
markdown?: FlatConfigItem['rules'];
|
|
382
|
-
yaml?: FlatConfigItem['rules'];
|
|
383
|
-
toml?: FlatConfigItem['rules'];
|
|
384
|
-
vue?: FlatConfigItem['rules'];
|
|
385
|
-
react?: FlatConfigItem['rules'];
|
|
386
|
-
nextjs?: FlatConfigItem['rules'];
|
|
387
|
-
solid?: FlatConfigItem['rules'];
|
|
388
|
-
svelte?: FlatConfigItem['rules'];
|
|
389
|
-
astro?: FlatConfigItem['rules'];
|
|
390
|
-
};
|
|
391
366
|
}
|
|
392
367
|
|
|
393
368
|
declare function eslintFlatConfig(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
394
|
-
declare function createConfig(preset: PresetItem | PresetItem[]): typeof eslintFlatConfig;
|
|
395
|
-
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
396
|
-
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
397
|
-
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): any;
|
|
398
369
|
|
|
399
370
|
declare const parserPlain: {
|
|
400
371
|
meta: {
|
|
@@ -511,12 +482,19 @@ declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
|
511
482
|
|
|
512
483
|
declare function tailwindcss(options?: OptionsTailwindCSS): Promise<FlatConfigItem[]>;
|
|
513
484
|
|
|
514
|
-
declare function html(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
515
|
-
|
|
516
485
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
517
486
|
|
|
518
487
|
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
519
488
|
|
|
520
489
|
declare const defaultPreset: PresetItem;
|
|
521
490
|
|
|
522
|
-
|
|
491
|
+
interface EslintFlatConfigFunction {
|
|
492
|
+
(options: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
493
|
+
}
|
|
494
|
+
declare function createConfig(preset: PresetItem | PresetItem[]): EslintFlatConfigFunction;
|
|
495
|
+
|
|
496
|
+
type ResolvedNoNullableOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
497
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedNoNullableOptions<OptionsConfig[K]>;
|
|
498
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): FlatConfigItem['rules'];
|
|
499
|
+
|
|
500
|
+
export { type Awaitable, type EslintFlatConfigFunction, 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_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsFrameworkExtract, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type PresetItem, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, createConfig, eslintFlatConfig as default, defaultPreset, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, yaml };
|
package/dist/index.js
CHANGED
|
@@ -418,7 +418,6 @@ async function jsdoc(options = {}) {
|
|
|
418
418
|
{
|
|
419
419
|
name: "config:jsdoc",
|
|
420
420
|
plugins: {
|
|
421
|
-
// @ts-expect-error missing types
|
|
422
421
|
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
423
422
|
},
|
|
424
423
|
rules: {
|
|
@@ -1282,57 +1281,6 @@ async function tailwindcss(options = {}) {
|
|
|
1282
1281
|
];
|
|
1283
1282
|
}
|
|
1284
1283
|
|
|
1285
|
-
// src/configs/html.ts
|
|
1286
|
-
async function html(options = {}) {
|
|
1287
|
-
const {
|
|
1288
|
-
files = [GLOB_HTML],
|
|
1289
|
-
overrides = {},
|
|
1290
|
-
stylistic: stylistic2 = true
|
|
1291
|
-
} = options;
|
|
1292
|
-
const {
|
|
1293
|
-
indent = 2
|
|
1294
|
-
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1295
|
-
const [
|
|
1296
|
-
pluginHtml,
|
|
1297
|
-
parserHtml
|
|
1298
|
-
] = await Promise.all([
|
|
1299
|
-
interopDefault(import("@html-eslint/eslint-plugin")),
|
|
1300
|
-
interopDefault(import("@html-eslint/parser"))
|
|
1301
|
-
]);
|
|
1302
|
-
return [
|
|
1303
|
-
{
|
|
1304
|
-
name: "config:html:setup",
|
|
1305
|
-
plugins: {
|
|
1306
|
-
html: pluginHtml
|
|
1307
|
-
}
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
files,
|
|
1311
|
-
name: "config:html:rules",
|
|
1312
|
-
languageOptions: {
|
|
1313
|
-
parser: parserHtml
|
|
1314
|
-
},
|
|
1315
|
-
rules: {
|
|
1316
|
-
"html/require-lang": "error",
|
|
1317
|
-
"html/require-img-alt": "error",
|
|
1318
|
-
"html/require-doctype": "error",
|
|
1319
|
-
"html/require-title": "error",
|
|
1320
|
-
"html/no-extra-spacing-attrs": "error",
|
|
1321
|
-
"html/no-duplicate-id": "error",
|
|
1322
|
-
"html/indent": ["error", indent],
|
|
1323
|
-
"html/require-li-container": "error",
|
|
1324
|
-
"html/quotes": "error",
|
|
1325
|
-
"html/require-closing-tags": "error",
|
|
1326
|
-
"html/no-duplicate-attrs": "error",
|
|
1327
|
-
"html/element-newline": ["error", {
|
|
1328
|
-
skip: ["span", "i", "code", "pre"]
|
|
1329
|
-
}],
|
|
1330
|
-
...overrides
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
];
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1284
|
// src/configs/toml.ts
|
|
1337
1285
|
async function toml(options = {}) {
|
|
1338
1286
|
const {
|
|
@@ -1561,6 +1509,15 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1561
1509
|
return configs;
|
|
1562
1510
|
}
|
|
1563
1511
|
|
|
1512
|
+
// src/resolveSubOptions.ts
|
|
1513
|
+
function resolveSubOptions(options, key) {
|
|
1514
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1515
|
+
}
|
|
1516
|
+
function getOverrides(options, key) {
|
|
1517
|
+
const sub = resolveSubOptions(options, key);
|
|
1518
|
+
return "overrides" in sub ? sub.overrides : {};
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1564
1521
|
// src/preset.ts
|
|
1565
1522
|
var defaultPreset = (options) => {
|
|
1566
1523
|
const {
|
|
@@ -1642,12 +1599,6 @@ var defaultPreset = (options) => {
|
|
|
1642
1599
|
stylistic: stylisticOptions
|
|
1643
1600
|
}));
|
|
1644
1601
|
}
|
|
1645
|
-
if (options.html) {
|
|
1646
|
-
configs.push(html({
|
|
1647
|
-
overrides: getOverrides(options, "html"),
|
|
1648
|
-
stylistic: stylisticOptions
|
|
1649
|
-
}));
|
|
1650
|
-
}
|
|
1651
1602
|
if (options.unocss) {
|
|
1652
1603
|
configs.push(unocss({
|
|
1653
1604
|
...resolveSubOptions(options, "unocss"),
|
|
@@ -1699,7 +1650,6 @@ function resolveOptions(options = {}) {
|
|
|
1699
1650
|
yaml: yaml2 = true,
|
|
1700
1651
|
toml: toml2 = true,
|
|
1701
1652
|
markdown: markdown2 = true,
|
|
1702
|
-
html: html2 = true,
|
|
1703
1653
|
formatters: formatters2 = false,
|
|
1704
1654
|
unocss: enableUnocss = false,
|
|
1705
1655
|
tailwindcss: enableTailwindcss = false
|
|
@@ -1731,7 +1681,6 @@ function resolveOptions(options = {}) {
|
|
|
1731
1681
|
markdown: markdown2,
|
|
1732
1682
|
unocss: unocss2,
|
|
1733
1683
|
tailwindcss: tailwindcss2,
|
|
1734
|
-
html: html2,
|
|
1735
1684
|
formatters: formatters2
|
|
1736
1685
|
};
|
|
1737
1686
|
}
|
|
@@ -1766,23 +1715,15 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
|
|
|
1766
1715
|
);
|
|
1767
1716
|
return merged;
|
|
1768
1717
|
}
|
|
1718
|
+
|
|
1719
|
+
// src/createConfig.ts
|
|
1769
1720
|
function createConfig(preset) {
|
|
1770
|
-
return (options = {}, ...userConfigs)
|
|
1721
|
+
return function eslintFlatConfig2(options = {}, ...userConfigs) {
|
|
1771
1722
|
const userPreset = options.preset || [];
|
|
1772
1723
|
const presetList = Array.isArray(preset) ? preset : [preset];
|
|
1773
1724
|
presetList.push(...userPreset);
|
|
1774
1725
|
options.preset = presetList;
|
|
1775
|
-
return
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
function resolveSubOptions(options, key) {
|
|
1779
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1780
|
-
}
|
|
1781
|
-
function getOverrides(options, key) {
|
|
1782
|
-
const sub = resolveSubOptions(options, key);
|
|
1783
|
-
return {
|
|
1784
|
-
...options.overrides?.[key],
|
|
1785
|
-
..."overrides" in sub ? sub.overrides || {} : {}
|
|
1726
|
+
return eslintFlatConfig2(options, ...userConfigs);
|
|
1786
1727
|
};
|
|
1787
1728
|
}
|
|
1788
1729
|
|
|
@@ -1823,7 +1764,6 @@ export {
|
|
|
1823
1764
|
defaultPreset,
|
|
1824
1765
|
formatters,
|
|
1825
1766
|
getOverrides,
|
|
1826
|
-
html,
|
|
1827
1767
|
ignores,
|
|
1828
1768
|
imports,
|
|
1829
1769
|
interopDefault,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pengzhanbo/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.2",
|
|
5
5
|
"author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/pengzhanbo/configs#readme",
|
|
@@ -50,23 +50,21 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
53
|
-
"@eslint-types/jsdoc": "
|
|
54
|
-
"@eslint-types/typescript-eslint": "^6.
|
|
53
|
+
"@eslint-types/jsdoc": "47.0.2",
|
|
54
|
+
"@eslint-types/typescript-eslint": "^6.17.0",
|
|
55
55
|
"@eslint-types/unicorn": "^50.0.1",
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
60
|
-
"@typescript-eslint/parser": "^6.16.0",
|
|
56
|
+
"@stylistic/eslint-plugin": "^1.5.3",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^6.18.0",
|
|
58
|
+
"@typescript-eslint/parser": "^6.18.0",
|
|
61
59
|
"eslint-config-flat-gitignore": "^0.1.2",
|
|
62
60
|
"eslint-merge-processors": "^0.1.0",
|
|
63
61
|
"eslint-plugin-antfu": "^2.1.1",
|
|
64
62
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
65
63
|
"eslint-plugin-i": "^2.29.1",
|
|
66
|
-
"eslint-plugin-jsdoc": "^
|
|
64
|
+
"eslint-plugin-jsdoc": "^48.0.2",
|
|
67
65
|
"eslint-plugin-jsonc": "^2.11.2",
|
|
68
66
|
"eslint-plugin-markdown": "^3.0.1",
|
|
69
|
-
"eslint-plugin-n": "^16.6.
|
|
67
|
+
"eslint-plugin-n": "^16.6.1",
|
|
70
68
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
71
69
|
"eslint-plugin-perfectionist": "^2.5.0",
|
|
72
70
|
"eslint-plugin-toml": "^0.8.0",
|
|
@@ -82,7 +80,7 @@
|
|
|
82
80
|
"yaml-eslint-parser": "^1.2.2"
|
|
83
81
|
},
|
|
84
82
|
"devDependencies": {
|
|
85
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
83
|
+
"@unocss/eslint-plugin": "^0.58.3",
|
|
86
84
|
"eslint": "^8.56.0",
|
|
87
85
|
"eslint-flat-config-viewer": "^0.1.4",
|
|
88
86
|
"eslint-plugin-format": "^0.1.0",
|