@pengzhanbo/eslint-config 2.9.1 → 2.9.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/dist/index.d.ts +36 -9
- package/dist/index.js +303 -149
- package/package.json +16 -16
package/dist/index.d.ts
CHANGED
|
@@ -3561,6 +3561,11 @@ interface RuleOptions {
|
|
|
3561
3561
|
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/json/json-valid-catalog.test.ts
|
|
3562
3562
|
*/
|
|
3563
3563
|
'pnpm/json-valid-catalog'?: Linter.RuleEntry<PnpmJsonValidCatalog>;
|
|
3564
|
+
/**
|
|
3565
|
+
* Require blank lines around multi-line entries in `pnpm-workspace.yaml`, and disallow them between single-line entries
|
|
3566
|
+
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-blank-lines.test.ts
|
|
3567
|
+
*/
|
|
3568
|
+
'pnpm/yaml-blank-lines'?: Linter.RuleEntry<[]>;
|
|
3564
3569
|
/**
|
|
3565
3570
|
* Enforce settings in `pnpm-workspace.yaml`
|
|
3566
3571
|
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-enforce-settings.test.ts
|
|
@@ -11518,6 +11523,7 @@ type JsdocNoUndefinedTypes = [] | [{
|
|
|
11518
11523
|
// ----- jsdoc/no-unnecessary-type-assertion -----
|
|
11519
11524
|
type JsdocNoUnnecessaryTypeAssertion = [] | [{
|
|
11520
11525
|
checkLiteralConstAssertions?: boolean;
|
|
11526
|
+
enableFixer?: boolean;
|
|
11521
11527
|
treatAnyAsRedundant?: boolean;
|
|
11522
11528
|
typesToIgnore?: string[];
|
|
11523
11529
|
}];
|
|
@@ -14882,10 +14888,6 @@ type PerfectionistSortImports = {
|
|
|
14882
14888
|
sortBy?: ("specifier" | "path");
|
|
14883
14889
|
})[];
|
|
14884
14890
|
newlinesBetween?: ("ignore" | number);
|
|
14885
|
-
tsconfig?: {
|
|
14886
|
-
rootDir: string;
|
|
14887
|
-
filename?: string;
|
|
14888
|
-
};
|
|
14889
14891
|
maxLineLength?: number;
|
|
14890
14892
|
sortSideEffects?: boolean;
|
|
14891
14893
|
environment?: ("node" | "bun");
|
|
@@ -14920,6 +14922,10 @@ type PerfectionistSortImports = {
|
|
|
14920
14922
|
pattern: string;
|
|
14921
14923
|
flags?: string;
|
|
14922
14924
|
} | string));
|
|
14925
|
+
tsconfig?: {
|
|
14926
|
+
rootDir: string;
|
|
14927
|
+
filename?: string;
|
|
14928
|
+
};
|
|
14923
14929
|
}[];
|
|
14924
14930
|
// ----- perfectionist/sort-interfaces -----
|
|
14925
14931
|
type PerfectionistSortInterfaces = {
|
|
@@ -15504,6 +15510,7 @@ type PerfectionistSortModules = [] | [{
|
|
|
15504
15510
|
order?: ("asc" | "desc");
|
|
15505
15511
|
})[];
|
|
15506
15512
|
newlinesBetween?: ("ignore" | number);
|
|
15513
|
+
additionalModuleBlockTypes?: string[];
|
|
15507
15514
|
useExperimentalDependencyDetection?: boolean;
|
|
15508
15515
|
newlinesBetweenOverloadSignatures?: ("ignore" | number);
|
|
15509
15516
|
partitionByComment?: (boolean | (({
|
|
@@ -15529,6 +15536,10 @@ type PerfectionistSortModules = [] | [{
|
|
|
15529
15536
|
} | string)));
|
|
15530
15537
|
});
|
|
15531
15538
|
partitionByNewLine?: boolean;
|
|
15539
|
+
tsconfig?: {
|
|
15540
|
+
rootDir: string;
|
|
15541
|
+
filename?: string;
|
|
15542
|
+
};
|
|
15532
15543
|
}];
|
|
15533
15544
|
// ----- perfectionist/sort-named-exports -----
|
|
15534
15545
|
type PerfectionistSortNamedExports = {
|
|
@@ -16057,6 +16068,13 @@ type PerfectionistSortObjects = {
|
|
|
16057
16068
|
partitionByComputedKey?: boolean;
|
|
16058
16069
|
styledComponents?: boolean;
|
|
16059
16070
|
useExperimentalDependencyDetection?: boolean;
|
|
16071
|
+
ignoreCallbackDependenciesPatterns?: (({
|
|
16072
|
+
pattern: string;
|
|
16073
|
+
flags?: string;
|
|
16074
|
+
} | string)[] | ({
|
|
16075
|
+
pattern: string;
|
|
16076
|
+
flags?: string;
|
|
16077
|
+
} | string));
|
|
16060
16078
|
partitionByComment?: (boolean | (({
|
|
16061
16079
|
pattern: string;
|
|
16062
16080
|
flags?: string;
|
|
@@ -16392,6 +16410,13 @@ type PerfectionistSortVariableDeclarations = {
|
|
|
16392
16410
|
matchesAstSelector?: string;
|
|
16393
16411
|
};
|
|
16394
16412
|
useExperimentalDependencyDetection?: boolean;
|
|
16413
|
+
ignoreCallbackDependenciesPatterns?: (({
|
|
16414
|
+
pattern: string;
|
|
16415
|
+
flags?: string;
|
|
16416
|
+
} | string)[] | ({
|
|
16417
|
+
pattern: string;
|
|
16418
|
+
flags?: string;
|
|
16419
|
+
} | string));
|
|
16395
16420
|
partitionByComment?: (boolean | (({
|
|
16396
16421
|
pattern: string;
|
|
16397
16422
|
flags?: string;
|
|
@@ -19146,7 +19171,9 @@ type TsNoMeaninglessVoidOperator = [] | [{
|
|
|
19146
19171
|
}];
|
|
19147
19172
|
// ----- ts/no-misused-promises -----
|
|
19148
19173
|
type TsNoMisusedPromises = [] | [{
|
|
19149
|
-
checksConditionals?: boolean
|
|
19174
|
+
checksConditionals?: (boolean | {
|
|
19175
|
+
flagUnions?: ("all" | "strict" | "none");
|
|
19176
|
+
});
|
|
19150
19177
|
checksSpreads?: boolean;
|
|
19151
19178
|
checksVoidReturn?: (boolean | {
|
|
19152
19179
|
arguments?: boolean;
|
|
@@ -21635,7 +21662,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
21635
21662
|
onlyEquality?: boolean;
|
|
21636
21663
|
}];
|
|
21637
21664
|
// Names of all the configs
|
|
21638
|
-
type ConfigNames = 'config/gitignore' | 'config/ignores' | 'config/javascript/setup' | 'config/javascript/rules' | 'config/eslint-comments/rules' | 'config/node/setup' | 'config/node/rules' | 'config/jsdoc/setup' | 'config/jsdoc/rules' | 'config/imports/rules' | 'config/command/rules' | 'config/perfectionist/setup' | 'config/node/setup' | 'config/node/rules' | 'config/jsdoc/setup' | 'config/jsdoc/rules' | 'config/imports/rules' | 'config/unicorn/setup' | 'config/unicorn/rules' | 'config/jsx/setup' | 'config/typescript/setup' | 'config/typescript/parser' | 'config/typescript/type-aware-parser' | 'config/typescript/rules' | 'config/typescript/rules-type-aware' | 'config/typescript/erasable-syntax-only' | 'config/stylistic/rules' | 'config/regexp/rules' | 'config/test/setup' | 'config/test/rules' | 'config/vue/setup' | 'config/vue/rules' | 'config/react/setup' | 'config/react/rules' | 'config/react/typescript' | 'config/react/type-aware-rules' | 'config/nextjs/setup' | 'config/nextjs/rules' | 'config/solid/setup' | 'config/solid/rules' | 'config/svelte/setup' | 'config/svelte/rules' | 'config/unocss/rules' | 'config/astro/setup' | 'config/astro/rules' | 'antfu/angular/setup' | 'antfu/angular/rules/ts' | 'antfu/angular/rules/template' | 'config/jsonc/setup' | 'config/jsonc/rules' | 'config/sort/package-json' | 'config/sort/tsconfig-json' | 'config/pnpm/package-json' | 'config/pnpm/pnpm-workspace-yaml' | 'config/pnpm/pnpm-workspace-yaml-sort' | 'config/yaml/setup' | 'config/yaml/rules' | 'config/toml/setup' | 'config/toml/rules' | 'config/markdown/setup' | 'config/markdown/processor' | 'config/markdown/parser' | 'config/markdown/rules' | 'config/markdown/disables/code' | 'config/
|
|
21665
|
+
type ConfigNames = 'config/gitignore' | 'config/ignores' | 'config/javascript/setup' | 'config/javascript/rules' | 'config/eslint-comments/rules' | 'config/node/setup' | 'config/node/rules' | 'config/jsdoc/setup' | 'config/jsdoc/rules' | 'config/imports/rules' | 'config/command/rules' | 'config/perfectionist/setup' | 'config/node/setup' | 'config/node/rules' | 'config/jsdoc/setup' | 'config/jsdoc/rules' | 'config/imports/rules' | 'config/unicorn/setup' | 'config/unicorn/rules' | 'config/jsx/setup' | 'config/typescript/setup' | 'config/typescript/parser' | 'config/typescript/type-aware-parser' | 'config/typescript/rules' | 'config/typescript/rules-type-aware' | 'config/typescript/erasable-syntax-only' | 'config/stylistic/rules' | 'config/regexp/rules' | 'config/test/setup' | 'config/test/rules' | 'config/vue/setup' | 'config/vue/rules' | 'config/react/setup' | 'config/react/rules' | 'config/react/typescript' | 'config/react/type-aware-rules' | 'config/nextjs/setup' | 'config/nextjs/rules' | 'config/solid/setup' | 'config/solid/rules' | 'config/svelte/setup' | 'config/svelte/rules' | 'config/unocss/rules' | 'config/astro/setup' | 'config/astro/rules' | 'antfu/angular/setup' | 'antfu/angular/rules/ts' | 'antfu/angular/rules/template' | 'config/jsonc/setup' | 'config/jsonc/rules' | 'config/sort/package-json' | 'config/sort/tsconfig-json' | 'config/pnpm/package-json' | 'config/pnpm/pnpm-workspace-yaml' | 'config/pnpm/pnpm-workspace-yaml-stylistic' | 'config/pnpm/pnpm-workspace-yaml-sort' | 'config/yaml/setup' | 'config/yaml/rules' | 'config/toml/setup' | 'config/toml/rules' | 'config/markdown/setup' | 'config/markdown/processor' | 'config/markdown/parser' | 'config/markdown/rules' | 'config/markdown/disables/code' | 'config/formatter/setup' | 'config/formatter/css' | 'config/formatter/scss' | 'config/formatter/less' | 'config/formatter/html' | 'config/formatter/xml' | 'config/formatter/svg' | 'config/formatter/markdown' | 'config/formatter/astro' | 'config/formatter/astro/disables' | 'config/formatter/graphql' | 'config/disables/scripts' | 'config/disables/cli' | 'config/disables/bin' | 'config/disables/dts' | 'config/disables/cjs' | 'config/disables/config-files';
|
|
21639
21666
|
//#endregion
|
|
21640
21667
|
//#region src/vender/prettier-types.d.ts
|
|
21641
21668
|
/**
|
|
@@ -21709,7 +21736,7 @@ interface VendoredPrettierOptionsRequired {
|
|
|
21709
21736
|
/**
|
|
21710
21737
|
* Provide ability to support new languages to prettier.
|
|
21711
21738
|
*/
|
|
21712
|
-
plugins: Array<string |
|
|
21739
|
+
plugins: Array<string | Record<string, unknown>>;
|
|
21713
21740
|
/**
|
|
21714
21741
|
* How to handle whitespaces in HTML.
|
|
21715
21742
|
* @default "css"
|
|
@@ -21995,7 +22022,7 @@ interface OptionsRegExp {
|
|
|
21995
22022
|
interface OptionsIsInEditor {
|
|
21996
22023
|
isInEditor?: boolean;
|
|
21997
22024
|
}
|
|
21998
|
-
interface OptionsPnpm extends OptionsIsInEditor {
|
|
22025
|
+
interface OptionsPnpm extends OptionsIsInEditor, OptionsStylistic {
|
|
21999
22026
|
/**
|
|
22000
22027
|
* Requires catalogs usage
|
|
22001
22028
|
*
|
|
@@ -22351,7 +22378,7 @@ declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
|
22351
22378
|
declare function e18e(options?: OptionsE18e & OptionsProjectType & OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
|
|
22352
22379
|
//#endregion
|
|
22353
22380
|
//#region src/configs/formatters.d.ts
|
|
22354
|
-
declare function formatters(
|
|
22381
|
+
declare function formatters(rawOptions?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
22355
22382
|
//#endregion
|
|
22356
22383
|
//#region src/configs/ignores.d.ts
|
|
22357
22384
|
declare function ignores(userIgnores?: string[] | ((originals: string[]) => string[]), ignoreTypeScript?: boolean): Promise<TypedFlatConfigItem[]>;
|
package/dist/index.js
CHANGED
|
@@ -504,7 +504,6 @@ async function stylistic(options = {}) {
|
|
|
504
504
|
}
|
|
505
505
|
//#endregion
|
|
506
506
|
//#region src/configs/formatters.ts
|
|
507
|
-
const formatPackages = ["eslint-plugin-format"];
|
|
508
507
|
function mergePrettierOptions(options, overrides) {
|
|
509
508
|
return {
|
|
510
509
|
...options,
|
|
@@ -512,22 +511,122 @@ function mergePrettierOptions(options, overrides) {
|
|
|
512
511
|
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
513
512
|
};
|
|
514
513
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
css
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
514
|
+
function buildCssConfigs(prettierOptions) {
|
|
515
|
+
return [
|
|
516
|
+
[
|
|
517
|
+
[GLOB_CSS, GLOB_POSTCSS],
|
|
518
|
+
"css",
|
|
519
|
+
"config/formatter/css"
|
|
520
|
+
],
|
|
521
|
+
[
|
|
522
|
+
[GLOB_SCSS],
|
|
523
|
+
"scss",
|
|
524
|
+
"config/formatter/scss"
|
|
525
|
+
],
|
|
526
|
+
[
|
|
527
|
+
[GLOB_LESS],
|
|
528
|
+
"less",
|
|
529
|
+
"config/formatter/less"
|
|
530
|
+
]
|
|
531
|
+
].map(([files, parser, name]) => ({
|
|
532
|
+
files: [...files],
|
|
533
|
+
languageOptions: { parser: parserPlain },
|
|
534
|
+
name,
|
|
535
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser })] }
|
|
536
|
+
}));
|
|
537
|
+
}
|
|
538
|
+
function buildXmlLikeConfig(prettierOptions, prettierXmlOptions, files, name) {
|
|
539
|
+
return {
|
|
540
|
+
files,
|
|
541
|
+
languageOptions: { parser: parserPlain },
|
|
542
|
+
name,
|
|
543
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
544
|
+
...prettierXmlOptions,
|
|
545
|
+
...prettierOptions
|
|
546
|
+
}, {
|
|
547
|
+
parser: "xml",
|
|
548
|
+
plugins: ["@prettier/plugin-xml"]
|
|
549
|
+
})] }
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function buildMarkdownConfigs(options, prettierOptions, dprintOptions) {
|
|
553
|
+
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
554
|
+
return [{
|
|
555
|
+
files: [GLOB_MARKDOWN],
|
|
556
|
+
ignores: [],
|
|
557
|
+
languageOptions: { parser: parserPlain },
|
|
558
|
+
name: "config/formatter/markdown",
|
|
559
|
+
rules: { [`format/${formater}`]: ["error", formater === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
560
|
+
embeddedLanguageFormatting: "off",
|
|
561
|
+
parser: "markdown"
|
|
562
|
+
}) : {
|
|
563
|
+
...dprintOptions,
|
|
564
|
+
language: "markdown"
|
|
565
|
+
}] }
|
|
566
|
+
}];
|
|
567
|
+
}
|
|
568
|
+
function buildAstroConfigs(prettierOptions) {
|
|
569
|
+
return [{
|
|
570
|
+
files: [GLOB_ASTRO],
|
|
571
|
+
languageOptions: { parser: parserPlain },
|
|
572
|
+
name: "config/formatter/astro",
|
|
573
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
574
|
+
parser: "astro",
|
|
575
|
+
plugins: ["prettier-plugin-astro"]
|
|
576
|
+
})] }
|
|
577
|
+
}, {
|
|
578
|
+
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
579
|
+
name: "config/formatter/astro/disables",
|
|
580
|
+
rules: {
|
|
581
|
+
"style/arrow-parens": "off",
|
|
582
|
+
"style/block-spacing": "off",
|
|
583
|
+
"style/comma-dangle": "off",
|
|
584
|
+
"style/indent": "off",
|
|
585
|
+
"style/no-multi-spaces": "off",
|
|
586
|
+
"style/quotes": "off",
|
|
587
|
+
"style/semi": "off"
|
|
588
|
+
}
|
|
589
|
+
}];
|
|
590
|
+
}
|
|
591
|
+
function resolveFormattersOptions(options) {
|
|
592
|
+
if (options !== true) return options;
|
|
593
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
594
|
+
return {
|
|
595
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
596
|
+
css: true,
|
|
597
|
+
graphql: true,
|
|
598
|
+
html: true,
|
|
599
|
+
markdown: true,
|
|
600
|
+
svg: isPrettierPluginXmlInScope,
|
|
601
|
+
xml: isPrettierPluginXmlInScope
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function buildHtmlConfig(prettierOptions) {
|
|
605
|
+
return {
|
|
606
|
+
files: [GLOB_HTML],
|
|
607
|
+
languageOptions: { parser: parserPlain },
|
|
608
|
+
name: "config/formatter/html",
|
|
609
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function buildGraphqlConfig(prettierOptions) {
|
|
613
|
+
return {
|
|
614
|
+
files: [GLOB_GRAPHQL],
|
|
615
|
+
languageOptions: { parser: parserPlain },
|
|
616
|
+
name: "config/formatter/graphql",
|
|
617
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function getFormattersPackagesToEnsure(options) {
|
|
621
|
+
return [
|
|
622
|
+
"eslint-plugin-format",
|
|
623
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
624
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
625
|
+
];
|
|
626
|
+
}
|
|
627
|
+
async function formatters(rawOptions = {}, stylistic = {}) {
|
|
628
|
+
const options = resolveFormattersOptions(rawOptions);
|
|
629
|
+
await ensurePackages(getFormattersPackagesToEnsure(options));
|
|
531
630
|
const { indent, quotes, semi } = {
|
|
532
631
|
...StylisticConfigDefaults,
|
|
533
632
|
...stylistic
|
|
@@ -554,100 +653,16 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
554
653
|
...options.dprintOptions || {}
|
|
555
654
|
};
|
|
556
655
|
const configs = [{
|
|
557
|
-
name: "config/
|
|
656
|
+
name: "config/formatter/setup",
|
|
558
657
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
559
658
|
}];
|
|
560
|
-
if (options.css) configs.push(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
languageOptions: { parser: parserPlain },
|
|
568
|
-
name: "config/formatter/scss",
|
|
569
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
|
|
570
|
-
}, {
|
|
571
|
-
files: [GLOB_LESS],
|
|
572
|
-
languageOptions: { parser: parserPlain },
|
|
573
|
-
name: "config/formatter/less",
|
|
574
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
575
|
-
});
|
|
576
|
-
if (options.html) configs.push({
|
|
577
|
-
files: [GLOB_HTML],
|
|
578
|
-
languageOptions: { parser: parserPlain },
|
|
579
|
-
name: "config/formatter/html",
|
|
580
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
581
|
-
});
|
|
582
|
-
if (options.xml) configs.push({
|
|
583
|
-
files: [GLOB_XML],
|
|
584
|
-
languageOptions: { parser: parserPlain },
|
|
585
|
-
name: "config/formatter/xml",
|
|
586
|
-
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
587
|
-
...prettierXmlOptions,
|
|
588
|
-
...prettierOptions
|
|
589
|
-
}, {
|
|
590
|
-
parser: "xml",
|
|
591
|
-
plugins: ["@prettier/plugin-xml"]
|
|
592
|
-
})] }
|
|
593
|
-
});
|
|
594
|
-
if (options.svg) configs.push({
|
|
595
|
-
files: [GLOB_SVG],
|
|
596
|
-
languageOptions: { parser: parserPlain },
|
|
597
|
-
name: "config/formatter/svg",
|
|
598
|
-
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
599
|
-
...prettierXmlOptions,
|
|
600
|
-
...prettierOptions
|
|
601
|
-
}, {
|
|
602
|
-
parser: "xml",
|
|
603
|
-
plugins: ["@prettier/plugin-xml"]
|
|
604
|
-
})] }
|
|
605
|
-
});
|
|
606
|
-
if (options.markdown) {
|
|
607
|
-
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
608
|
-
configs.push({
|
|
609
|
-
files: [GLOB_MARKDOWN],
|
|
610
|
-
languageOptions: { parser: parserPlain },
|
|
611
|
-
name: "config/formatter/markdown",
|
|
612
|
-
rules: { [`format/${formater}`]: ["error", formater === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
613
|
-
embeddedLanguageFormatting: "off",
|
|
614
|
-
parser: "markdown"
|
|
615
|
-
}) : {
|
|
616
|
-
...dprintOptions,
|
|
617
|
-
language: "markdown"
|
|
618
|
-
}] }
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
if (options.astro) {
|
|
622
|
-
configs.push({
|
|
623
|
-
files: [GLOB_ASTRO],
|
|
624
|
-
languageOptions: { parser: parserPlain },
|
|
625
|
-
name: "config/formatter/astro",
|
|
626
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
627
|
-
parser: "astro",
|
|
628
|
-
plugins: ["prettier-plugin-astro"]
|
|
629
|
-
})] }
|
|
630
|
-
});
|
|
631
|
-
configs.push({
|
|
632
|
-
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
633
|
-
name: "config/formatter/astro/disables",
|
|
634
|
-
rules: {
|
|
635
|
-
"style/arrow-parens": "off",
|
|
636
|
-
"style/block-spacing": "off",
|
|
637
|
-
"style/comma-dangle": "off",
|
|
638
|
-
"style/indent": "off",
|
|
639
|
-
"style/no-multi-spaces": "off",
|
|
640
|
-
"style/quotes": "off",
|
|
641
|
-
"style/semi": "off"
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
if (options.graphql) configs.push({
|
|
646
|
-
files: [GLOB_GRAPHQL],
|
|
647
|
-
languageOptions: { parser: parserPlain },
|
|
648
|
-
name: "config/formatter/graphql",
|
|
649
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
650
|
-
});
|
|
659
|
+
if (options.css) configs.push(...buildCssConfigs(prettierOptions));
|
|
660
|
+
if (options.html) configs.push(buildHtmlConfig(prettierOptions));
|
|
661
|
+
if (options.xml) configs.push(buildXmlLikeConfig(prettierOptions, prettierXmlOptions, [GLOB_XML], "config/formatter/xml"));
|
|
662
|
+
if (options.svg) configs.push(buildXmlLikeConfig(prettierOptions, prettierXmlOptions, [GLOB_SVG], "config/formatter/svg"));
|
|
663
|
+
if (options.markdown) configs.push(...buildMarkdownConfigs(options, prettierOptions, dprintOptions));
|
|
664
|
+
if (options.astro) configs.push(...buildAstroConfigs(prettierOptions));
|
|
665
|
+
if (options.graphql) configs.push(buildGraphqlConfig(prettierOptions));
|
|
651
666
|
return configs;
|
|
652
667
|
}
|
|
653
668
|
//#endregion
|
|
@@ -1230,7 +1245,7 @@ async function pnpm(options) {
|
|
|
1230
1245
|
interopDefault(import("eslint-plugin-yml")),
|
|
1231
1246
|
interopDefault(import("yaml-eslint-parser"))
|
|
1232
1247
|
]);
|
|
1233
|
-
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
|
|
1248
|
+
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, stylistic = true, yaml = true } = options;
|
|
1234
1249
|
const configs = [];
|
|
1235
1250
|
if (json) configs.push({
|
|
1236
1251
|
files: ["package.json", "**/package.json"],
|
|
@@ -1254,6 +1269,7 @@ async function pnpm(options) {
|
|
|
1254
1269
|
plugins: { pnpm: pluginPnpm },
|
|
1255
1270
|
rules: {
|
|
1256
1271
|
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1272
|
+
minimumReleaseAgeExcludePrune: true,
|
|
1257
1273
|
shellEmulator: true,
|
|
1258
1274
|
trustPolicy: "no-downgrade"
|
|
1259
1275
|
} }],
|
|
@@ -1261,6 +1277,13 @@ async function pnpm(options) {
|
|
|
1261
1277
|
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1262
1278
|
}
|
|
1263
1279
|
});
|
|
1280
|
+
if (stylistic) configs.push({
|
|
1281
|
+
files: ["pnpm-workspace.yaml"],
|
|
1282
|
+
languageOptions: { parser: yamlParser },
|
|
1283
|
+
name: "config/pnpm/pnpm-workspace-yaml-stylistic",
|
|
1284
|
+
plugins: { pnpm: pluginPnpm },
|
|
1285
|
+
rules: { "pnpm/yaml-blank-lines": "error" }
|
|
1286
|
+
});
|
|
1264
1287
|
if (sort) configs.push({
|
|
1265
1288
|
files: ["pnpm-workspace.yaml"],
|
|
1266
1289
|
languageOptions: { parser: yamlParser },
|
|
@@ -1271,65 +1294,190 @@ async function pnpm(options) {
|
|
|
1271
1294
|
{
|
|
1272
1295
|
order: [
|
|
1273
1296
|
...[
|
|
1274
|
-
"
|
|
1297
|
+
"dedupeInjectedDeps",
|
|
1298
|
+
"disallowWorkspaceCycles",
|
|
1299
|
+
"failIfNoMatch",
|
|
1300
|
+
"ignoreWorkspaceCycles",
|
|
1301
|
+
"ignoreWorkspaceRootCheck",
|
|
1302
|
+
"includeWorkspaceRoot",
|
|
1303
|
+
"injectWorkspacePackages",
|
|
1304
|
+
"legacyDirFiltering",
|
|
1305
|
+
"linkWorkspacePackages",
|
|
1306
|
+
"preferWorkspacePackages",
|
|
1307
|
+
"saveWorkspaceProtocol",
|
|
1308
|
+
"sharedWorkspaceLockfile",
|
|
1309
|
+
"syncInjectedDepsAfterScripts"
|
|
1310
|
+
],
|
|
1311
|
+
...[
|
|
1275
1312
|
"catalogMode",
|
|
1276
|
-
"
|
|
1277
|
-
"
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
"
|
|
1313
|
+
"catalogPrune",
|
|
1314
|
+
"cleanupUnusedCatalogs"
|
|
1315
|
+
],
|
|
1316
|
+
...[
|
|
1317
|
+
"allowedDeprecatedVersions",
|
|
1318
|
+
"blockExoticSubdeps",
|
|
1319
|
+
"ignoredOptionalDependencies",
|
|
1320
|
+
"minimumReleaseAge",
|
|
1321
|
+
"minimumReleaseAgeIgnoreMissingTime",
|
|
1322
|
+
"minimumReleaseAgeStrict",
|
|
1323
|
+
"minimumReleaseAgeExcludePrune",
|
|
1324
|
+
"minimumReleaseAgeExclude",
|
|
1325
|
+
"registrySupportsTimeField",
|
|
1326
|
+
"resolutionMode",
|
|
1327
|
+
"supportedArchitectures",
|
|
1328
|
+
"trustLockfile",
|
|
1329
|
+
"trustPolicy",
|
|
1330
|
+
"trustPolicyIgnoreAfter",
|
|
1331
|
+
"trustPolicyExclude",
|
|
1332
|
+
"update"
|
|
1333
|
+
],
|
|
1334
|
+
...[
|
|
1335
|
+
"autoInstallPeers",
|
|
1336
|
+
"dedupePeerDependents",
|
|
1337
|
+
"dedupePeers",
|
|
1338
|
+
"peerDependencyRules",
|
|
1339
|
+
"resolvePeersFromWorkspaceRoot",
|
|
1340
|
+
"strictPeerDependencies"
|
|
1341
|
+
],
|
|
1342
|
+
...[
|
|
1343
|
+
"fetchMinSpeedKiBps",
|
|
1344
|
+
"fetchRetries",
|
|
1345
|
+
"fetchRetryFactor",
|
|
1346
|
+
"fetchRetryMaxtimeout",
|
|
1347
|
+
"fetchRetryMintimeout",
|
|
1348
|
+
"fetchTimeout",
|
|
1349
|
+
"fetchWarnTimeoutMs",
|
|
1350
|
+
"gitShallowHosts",
|
|
1351
|
+
"httpProxy",
|
|
1352
|
+
"httpsProxy",
|
|
1353
|
+
"localAddress",
|
|
1354
|
+
"maxsockets",
|
|
1355
|
+
"namedRegistries",
|
|
1356
|
+
"networkConcurrency",
|
|
1357
|
+
"noProxy",
|
|
1358
|
+
"registries",
|
|
1359
|
+
"registry",
|
|
1360
|
+
"strictSsl"
|
|
1361
|
+
],
|
|
1362
|
+
...[
|
|
1363
|
+
"dlxCacheMaxAge",
|
|
1364
|
+
"enableGlobalVirtualStore",
|
|
1365
|
+
"enableModulesDir",
|
|
1281
1366
|
"extendNodePath",
|
|
1367
|
+
"modulesCacheMaxAge",
|
|
1368
|
+
"modulesDir",
|
|
1369
|
+
"nodeExperimentalPackageMap",
|
|
1370
|
+
"nodeLinker",
|
|
1371
|
+
"nodePackageMapType",
|
|
1372
|
+
"packageImportMethod",
|
|
1373
|
+
"preferSymlinkedExecutables",
|
|
1374
|
+
"symlink",
|
|
1375
|
+
"virtualStoreDir",
|
|
1376
|
+
"virtualStoreDirMaxLength",
|
|
1377
|
+
"virtualStoreOnly",
|
|
1378
|
+
"virtualStoreType"
|
|
1379
|
+
],
|
|
1380
|
+
...[
|
|
1282
1381
|
"hoist",
|
|
1382
|
+
"hoistingLimits",
|
|
1283
1383
|
"hoistPattern",
|
|
1284
1384
|
"hoistWorkspacePackages",
|
|
1285
|
-
"
|
|
1385
|
+
"publicHoistPattern",
|
|
1386
|
+
"shamefullyHoist"
|
|
1387
|
+
],
|
|
1388
|
+
...[
|
|
1389
|
+
"frozenStore",
|
|
1390
|
+
"storeDir",
|
|
1391
|
+
"strictStorePkgContentCheck",
|
|
1392
|
+
"useRunningStoreServer",
|
|
1393
|
+
"verifyStoreIntegrity"
|
|
1394
|
+
],
|
|
1395
|
+
...[
|
|
1396
|
+
"gitBranchLockfile",
|
|
1397
|
+
"lockfile",
|
|
1398
|
+
"lockfileIncludeTarballUrl",
|
|
1399
|
+
"mergeGitBranchLockfilesBranchPattern",
|
|
1400
|
+
"peersSuffixMaxLength",
|
|
1401
|
+
"preferFrozenLockfile"
|
|
1402
|
+
],
|
|
1403
|
+
...[
|
|
1404
|
+
"childConcurrency",
|
|
1405
|
+
"dangerouslyAllowAllBuilds",
|
|
1406
|
+
"enablePrePostScripts",
|
|
1286
1407
|
"ignoreDepScripts",
|
|
1287
1408
|
"ignoreScripts",
|
|
1288
|
-
"
|
|
1409
|
+
"nodeOptions",
|
|
1410
|
+
"requiredScripts",
|
|
1411
|
+
"scriptShell",
|
|
1412
|
+
"shellEmulator",
|
|
1413
|
+
"sideEffectsCache",
|
|
1414
|
+
"sideEffectsCacheReadonly",
|
|
1415
|
+
"strictDepBuilds",
|
|
1416
|
+
"unsafePerm",
|
|
1417
|
+
"verifyDepsBeforeRun"
|
|
1418
|
+
],
|
|
1419
|
+
...[
|
|
1289
1420
|
"managePackageManagerVersions",
|
|
1290
|
-
"
|
|
1291
|
-
"minimumReleaseAgeExclude",
|
|
1292
|
-
"modulesDir",
|
|
1293
|
-
"nodeLinker",
|
|
1421
|
+
"nodeDownloadMirrors",
|
|
1294
1422
|
"nodeVersion",
|
|
1295
|
-
"optimisticRepeatInstall",
|
|
1296
1423
|
"packageManagerStrict",
|
|
1297
1424
|
"packageManagerStrictVersion",
|
|
1298
|
-
"
|
|
1299
|
-
"
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
"
|
|
1303
|
-
"
|
|
1425
|
+
"pmOnFail",
|
|
1426
|
+
"runtimeOnFail"
|
|
1427
|
+
],
|
|
1428
|
+
...[
|
|
1429
|
+
"ci",
|
|
1430
|
+
"color",
|
|
1431
|
+
"engineStrict",
|
|
1432
|
+
"loglevel",
|
|
1433
|
+
"npmPath",
|
|
1434
|
+
"recursiveInstall",
|
|
1435
|
+
"updateNotifier",
|
|
1436
|
+
"useBetaCli",
|
|
1437
|
+
"useStderr"
|
|
1438
|
+
],
|
|
1439
|
+
...[
|
|
1440
|
+
"cacheDir",
|
|
1441
|
+
"globalBinDir",
|
|
1442
|
+
"globalDir",
|
|
1443
|
+
"globalPnpmfile",
|
|
1444
|
+
"globalShims",
|
|
1445
|
+
"ignorePnpmfile",
|
|
1446
|
+
"npmrcAuthFile",
|
|
1447
|
+
"pnpmfile",
|
|
1448
|
+
"stateDir"
|
|
1449
|
+
],
|
|
1450
|
+
...["audit", "versioning"],
|
|
1451
|
+
...[
|
|
1452
|
+
"allowNonAppliedPatches",
|
|
1453
|
+
"dedupeDirectDeps",
|
|
1454
|
+
"deployAllFiles",
|
|
1455
|
+
"ignoreCompatibilityDb",
|
|
1456
|
+
"initAuthorEmail",
|
|
1457
|
+
"initAuthorName",
|
|
1458
|
+
"initAuthorUrl",
|
|
1459
|
+
"initLicense",
|
|
1460
|
+
"initVersion",
|
|
1461
|
+
"optimisticRepeatInstall",
|
|
1462
|
+
"saveExact",
|
|
1304
1463
|
"savePrefix",
|
|
1305
|
-
"
|
|
1306
|
-
"shamefullyHoist",
|
|
1307
|
-
"shellEmulator",
|
|
1308
|
-
"stateDir",
|
|
1309
|
-
"supportedArchitectures",
|
|
1310
|
-
"symlink",
|
|
1311
|
-
"tag",
|
|
1312
|
-
"trustPolicy",
|
|
1313
|
-
"trustPolicyExclude",
|
|
1314
|
-
"updateNotifier"
|
|
1464
|
+
"tag"
|
|
1315
1465
|
],
|
|
1316
1466
|
"packages",
|
|
1467
|
+
"packageConfigs",
|
|
1317
1468
|
"overrides",
|
|
1469
|
+
"packageExtensions",
|
|
1318
1470
|
"patchedDependencies",
|
|
1319
|
-
"
|
|
1320
|
-
"
|
|
1471
|
+
"configDependencies",
|
|
1472
|
+
"allowBuilds",
|
|
1321
1473
|
...[
|
|
1322
|
-
"allowedDeprecatedVersions",
|
|
1323
|
-
"allowNonAppliedPatches",
|
|
1324
|
-
"configDependencies",
|
|
1325
1474
|
"ignoredBuiltDependencies",
|
|
1326
|
-
"ignoredOptionalDependencies",
|
|
1327
1475
|
"neverBuiltDependencies",
|
|
1328
1476
|
"onlyBuiltDependencies",
|
|
1329
|
-
"onlyBuiltDependenciesFile"
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1477
|
+
"onlyBuiltDependenciesFile"
|
|
1478
|
+
],
|
|
1479
|
+
"catalog",
|
|
1480
|
+
"catalogs"
|
|
1333
1481
|
],
|
|
1334
1482
|
pathPattern: "^$"
|
|
1335
1483
|
},
|
|
@@ -2042,6 +2190,7 @@ async function typescript(options = {}) {
|
|
|
2042
2190
|
plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
|
|
2043
2191
|
rules: {
|
|
2044
2192
|
"erasable-syntax-only/enums": "error",
|
|
2193
|
+
"erasable-syntax-only/export-aliases": "error",
|
|
2045
2194
|
"erasable-syntax-only/import-aliases": "error",
|
|
2046
2195
|
"erasable-syntax-only/namespaces": "error",
|
|
2047
2196
|
"erasable-syntax-only/parameter-properties": "error"
|
|
@@ -2336,6 +2485,11 @@ async function yaml(options = {}) {
|
|
|
2336
2485
|
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2337
2486
|
"yaml/indent": ["error", typeof indent === "number" ? indent : 2],
|
|
2338
2487
|
"yaml/key-spacing": "error",
|
|
2488
|
+
"yaml/no-multiple-empty-lines": ["error", {
|
|
2489
|
+
max: 1,
|
|
2490
|
+
maxBOF: 0,
|
|
2491
|
+
maxEOF: 0
|
|
2492
|
+
}],
|
|
2339
2493
|
"yaml/no-tab-indent": "error",
|
|
2340
2494
|
"yaml/quotes": ["error", {
|
|
2341
2495
|
avoidEscape: true,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pengzhanbo/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.2",
|
|
5
5
|
"author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/pengzhanbo/configs#readme",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@angular-eslint/eslint-plugin": "^22.2.0",
|
|
26
26
|
"@angular-eslint/eslint-plugin-template": "^22.2.0",
|
|
27
27
|
"@angular-eslint/template-parser": "^22.2.0",
|
|
28
|
-
"@eslint-react/eslint-plugin": "^5.18.
|
|
29
|
-
"@next/eslint-plugin-next": "^16.3.
|
|
28
|
+
"@eslint-react/eslint-plugin": "^5.18.7",
|
|
29
|
+
"@next/eslint-plugin-next": "^16.3.4",
|
|
30
30
|
"@prettier/plugin-xml": "^3.4.2",
|
|
31
|
-
"@unocss/eslint-plugin": "^66.
|
|
31
|
+
"@unocss/eslint-plugin": "^66.9.2",
|
|
32
32
|
"astro-eslint-parser": "^3.1.0",
|
|
33
33
|
"eslint": "^10.9.1",
|
|
34
34
|
"eslint-plugin-astro": "^3.1.0",
|
|
35
35
|
"eslint-plugin-format": "^2.0.1",
|
|
36
|
-
"eslint-plugin-react-refresh": "^0.5.
|
|
36
|
+
"eslint-plugin-react-refresh": "^0.5.6",
|
|
37
37
|
"eslint-plugin-solid": "^0.17.0",
|
|
38
38
|
"eslint-plugin-svelte": "^3.23.0",
|
|
39
39
|
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
114
114
|
"@eslint/markdown": "^8.0.3",
|
|
115
115
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
117
|
-
"@typescript-eslint/parser": "^8.
|
|
116
|
+
"@typescript-eslint/eslint-plugin": "^8.69.0",
|
|
117
|
+
"@typescript-eslint/parser": "^8.69.0",
|
|
118
118
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
119
119
|
"eslint-config-flat-gitignore": "^2.4.0",
|
|
120
120
|
"eslint-flat-config-utils": "^3.2.0",
|
|
@@ -123,19 +123,19 @@
|
|
|
123
123
|
"eslint-plugin-command": "^4.0.0",
|
|
124
124
|
"eslint-plugin-erasable-syntax-only": "^0.7.1",
|
|
125
125
|
"eslint-plugin-import-lite": "^0.6.0",
|
|
126
|
-
"eslint-plugin-jsdoc": "^64.3.
|
|
126
|
+
"eslint-plugin-jsdoc": "^64.3.4",
|
|
127
127
|
"eslint-plugin-jsonc": "^3.4.2",
|
|
128
128
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
129
129
|
"eslint-plugin-n": "^18.3.0",
|
|
130
130
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
131
|
-
"eslint-plugin-perfectionist": "^5.
|
|
132
|
-
"eslint-plugin-pnpm": "^1.
|
|
131
|
+
"eslint-plugin-perfectionist": "^5.11.0",
|
|
132
|
+
"eslint-plugin-pnpm": "^1.9.1",
|
|
133
133
|
"eslint-plugin-regexp": "^3.2.0",
|
|
134
134
|
"eslint-plugin-toml": "^1.5.0",
|
|
135
135
|
"eslint-plugin-unicorn": "^74.0.0",
|
|
136
136
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
137
137
|
"eslint-plugin-yml": "^3.8.1",
|
|
138
|
-
"globals": "^17.
|
|
138
|
+
"globals": "^17.12.0",
|
|
139
139
|
"local-pkg": "^1.2.1",
|
|
140
140
|
"parse-gitignore": "^2.0.0",
|
|
141
141
|
"toml-eslint-parser": "^1.0.3",
|
|
@@ -146,16 +146,16 @@
|
|
|
146
146
|
"@angular-eslint/eslint-plugin-template": "^22.2.0",
|
|
147
147
|
"@angular-eslint/template-parser": "^22.2.0",
|
|
148
148
|
"@angular/core": "^22.1.4",
|
|
149
|
-
"@eslint-react/eslint-plugin": "^5.18.
|
|
150
|
-
"@eslint/config-inspector": "^3.
|
|
151
|
-
"@next/eslint-plugin-next": "^16.3.
|
|
149
|
+
"@eslint-react/eslint-plugin": "^5.18.7",
|
|
150
|
+
"@eslint/config-inspector": "^3.4.0",
|
|
151
|
+
"@next/eslint-plugin-next": "^16.3.4",
|
|
152
152
|
"@prettier/plugin-xml": "^3.4.2",
|
|
153
|
-
"@unocss/eslint-plugin": "^66.
|
|
153
|
+
"@unocss/eslint-plugin": "^66.9.2",
|
|
154
154
|
"astro-eslint-parser": "^3.1.0",
|
|
155
155
|
"eslint": "^10.9.1",
|
|
156
156
|
"eslint-plugin-astro": "^3.1.0",
|
|
157
157
|
"eslint-plugin-format": "^2.0.1",
|
|
158
|
-
"eslint-plugin-react-refresh": "^0.5.
|
|
158
|
+
"eslint-plugin-react-refresh": "^0.5.6",
|
|
159
159
|
"eslint-plugin-solid": "^0.17.0",
|
|
160
160
|
"eslint-plugin-svelte": "^3.23.0",
|
|
161
161
|
"eslint-plugin-tailwindcss": "^4.4.0",
|