@frabbit/eslint-config 7.4.6 → 7.6.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.d.mts +14 -4
- package/dist/index.mjs +87 -70
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -14489,6 +14489,9 @@ declare const jsonc: () => Config[];
|
|
|
14489
14489
|
//#region src/configs/markdown.d.ts
|
|
14490
14490
|
declare const markdown: () => Config[];
|
|
14491
14491
|
//#endregion
|
|
14492
|
+
//#region src/configs/nestjs.d.ts
|
|
14493
|
+
declare const nestjs: () => Config[];
|
|
14494
|
+
//#endregion
|
|
14492
14495
|
//#region src/configs/node.d.ts
|
|
14493
14496
|
declare const node: () => Config[];
|
|
14494
14497
|
//#endregion
|
|
@@ -14527,8 +14530,12 @@ declare const unicorn: () => Config[];
|
|
|
14527
14530
|
declare const unocss: () => Promise<Config[]>;
|
|
14528
14531
|
//#endregion
|
|
14529
14532
|
//#region src/configs/vue.d.ts
|
|
14533
|
+
interface VueOptions {
|
|
14534
|
+
/** Vue version. @default 3 */
|
|
14535
|
+
version?: 2 | 3;
|
|
14536
|
+
}
|
|
14530
14537
|
declare const reactivityTransform: () => Config[];
|
|
14531
|
-
declare const vue: () => Config[];
|
|
14538
|
+
declare const vue: (options?: VueOptions) => Config[];
|
|
14532
14539
|
//#endregion
|
|
14533
14540
|
//#region src/configs/yml.d.ts
|
|
14534
14541
|
declare const yml: () => Config[];
|
|
@@ -14537,6 +14544,7 @@ declare const yml: () => Config[];
|
|
|
14537
14544
|
declare const hasTypeScript: () => boolean;
|
|
14538
14545
|
declare const hasVue: () => boolean;
|
|
14539
14546
|
declare const hasUnocss: () => boolean;
|
|
14547
|
+
declare const hasNestjs: () => boolean;
|
|
14540
14548
|
declare function isInEditorEnv(): boolean;
|
|
14541
14549
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
14542
14550
|
//#endregion
|
|
@@ -14591,16 +14599,18 @@ interface Options {
|
|
|
14591
14599
|
command?: boolean;
|
|
14592
14600
|
/** markdown support. @default true */
|
|
14593
14601
|
markdown?: boolean;
|
|
14602
|
+
/** NestJS support. Auto-enable if detected. */
|
|
14603
|
+
nestjs?: boolean;
|
|
14594
14604
|
/** @default false */
|
|
14595
14605
|
pnpm?: boolean;
|
|
14596
14606
|
/** Prettier support. @default true */
|
|
14597
14607
|
prettier?: boolean;
|
|
14598
14608
|
/** UnoCSS support. Auto-enable if detected. */
|
|
14599
14609
|
unocss?: boolean;
|
|
14600
|
-
/** Vue support. Auto-enable if detected. */
|
|
14601
|
-
vue?: boolean;
|
|
14610
|
+
/** Vue support. Auto-enable if detected. Pass 2 for Vue 2 support. */
|
|
14611
|
+
vue?: boolean | 2;
|
|
14602
14612
|
}
|
|
14603
14613
|
/** `@frabbit`'s preset. */
|
|
14604
14614
|
declare function frabbit(options?: Options, ...userConfigs: Awaitable<Arrayable<Config> | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<Config, ConfigNames>;
|
|
14605
14615
|
//#endregion
|
|
14606
|
-
export { BaselineOptions, Config, ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_NUXT_LAYOUTS, GLOB_NUXT_PAGE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, Rules, baseline, command, comments, configCommand, configComments, configJs, deMorgan, frabbit, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, markdown, node, parserJsonc, parserVue, parserYml, pluginAntfu, pluginDeMorgan, pluginIgnore, pluginImport, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNode, pluginPerfectionist, pluginPnpm, pluginPrettier, pluginPrettierRecommended, pluginSecurity, pluginSonarJS, pluginSxzz, pluginUnicorn, pluginUnusedImports, pluginVue, pluginYml, pnpm, presetAll, presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, regexp, restrictedSyntaxJs, security, sonarjs, sortImports, sortPackageJson, sortPnpmWorkspace, sortTsconfig, specialCases, tseslint, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
14616
|
+
export { BaselineOptions, Config, ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_NUXT_LAYOUTS, GLOB_NUXT_PAGE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, Rules, VueOptions, baseline, command, comments, configCommand, configComments, configJs, deMorgan, frabbit, hasNestjs, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, markdown, nestjs, node, parserJsonc, parserVue, parserYml, pluginAntfu, pluginDeMorgan, pluginIgnore, pluginImport, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNode, pluginPerfectionist, pluginPnpm, pluginPrettier, pluginPrettierRecommended, pluginSecurity, pluginSonarJS, pluginSxzz, pluginUnicorn, pluginUnusedImports, pluginVue, pluginYml, pnpm, presetAll, presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, regexp, restrictedSyntaxJs, security, sonarjs, sortImports, sortPackageJson, sortPnpmWorkspace, sortTsconfig, specialCases, tseslint, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
package/dist/index.mjs
CHANGED
|
@@ -262,7 +262,7 @@ const javascript = () => [{
|
|
|
262
262
|
"require-await": "error",
|
|
263
263
|
"sxzz/prefer-string-function": "warn",
|
|
264
264
|
"unicode-bom": ["error", "never"],
|
|
265
|
-
"unused-imports/no-unused-imports": "
|
|
265
|
+
"unused-imports/no-unused-imports": "error",
|
|
266
266
|
"unused-imports/no-unused-vars": ["error", {
|
|
267
267
|
args: "after-used",
|
|
268
268
|
ignoreRestSiblings: true
|
|
@@ -352,6 +352,17 @@ const markdown = () => [...pluginMarkdown.configs.processor.map((config) => ({
|
|
|
352
352
|
}
|
|
353
353
|
}];
|
|
354
354
|
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/configs/nestjs.ts
|
|
357
|
+
const nestjs = () => [{
|
|
358
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
359
|
+
languageOptions: { parserOptions: {
|
|
360
|
+
emitDecoratorMetadata: true,
|
|
361
|
+
experimentalDecorators: true
|
|
362
|
+
} },
|
|
363
|
+
name: "frabbit/nestjs"
|
|
364
|
+
}];
|
|
365
|
+
|
|
355
366
|
//#endregion
|
|
356
367
|
//#region src/configs/node.ts
|
|
357
368
|
const node = () => [{
|
|
@@ -918,74 +929,78 @@ const vueTs = typescriptCore.filter((config) => config.name !== "typescript-esli
|
|
|
918
929
|
name: `frabbit/vue/${config.name?.replace("frabbit/", "") || "anonymous"}`
|
|
919
930
|
};
|
|
920
931
|
});
|
|
921
|
-
const
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
{
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
932
|
+
const vue = (options = {}) => {
|
|
933
|
+
const { version = 3 } = options;
|
|
934
|
+
const configKey = version === 2 ? "flat/vue2-recommended" : "flat/recommended";
|
|
935
|
+
const recommendedRules = pluginVue.configs[configKey].map((c) => c.rules).reduce((acc, c) => ({
|
|
936
|
+
...acc,
|
|
937
|
+
...c
|
|
938
|
+
}), {});
|
|
939
|
+
return [
|
|
940
|
+
...vueTs,
|
|
941
|
+
{
|
|
942
|
+
files: [GLOB_VUE],
|
|
943
|
+
languageOptions: {
|
|
944
|
+
parser: parserVue,
|
|
945
|
+
parserOptions: {
|
|
946
|
+
ecmaFeatures: { jsx: true },
|
|
947
|
+
extraFileExtensions: [".vue"],
|
|
948
|
+
parser: tseslint.parser,
|
|
949
|
+
sourceType: "module"
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
name: "frabbit/vue",
|
|
953
|
+
plugins: {
|
|
954
|
+
"@typescript-eslint": tseslint.plugin,
|
|
955
|
+
vue: pluginVue
|
|
956
|
+
},
|
|
957
|
+
processor: pluginVue.processors[".vue"],
|
|
958
|
+
rules: {
|
|
959
|
+
...recommendedRules,
|
|
960
|
+
"vue/block-order": ["error", { order: [
|
|
961
|
+
"script",
|
|
962
|
+
"template",
|
|
963
|
+
"style"
|
|
964
|
+
] }],
|
|
965
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
966
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
967
|
+
"vue/html-self-closing": ["error", {
|
|
968
|
+
html: {
|
|
969
|
+
component: "always",
|
|
970
|
+
normal: "always",
|
|
971
|
+
void: "any"
|
|
972
|
+
},
|
|
973
|
+
math: "always",
|
|
974
|
+
svg: "always"
|
|
975
|
+
}],
|
|
976
|
+
"vue/max-attributes-per-line": "off",
|
|
977
|
+
"vue/multi-word-component-names": "off",
|
|
978
|
+
"vue/no-constant-condition": "warn",
|
|
979
|
+
"vue/no-empty-pattern": "error",
|
|
980
|
+
"vue/no-loss-of-precision": "error",
|
|
981
|
+
"vue/no-ref-as-operand": "off",
|
|
982
|
+
"vue/no-unused-refs": "error",
|
|
983
|
+
"vue/no-useless-v-bind": "error",
|
|
984
|
+
"vue/no-v-html": "off",
|
|
985
|
+
"vue/object-shorthand": [
|
|
986
|
+
"error",
|
|
987
|
+
"always",
|
|
988
|
+
{
|
|
989
|
+
avoidQuotes: true,
|
|
990
|
+
ignoreConstructors: false
|
|
991
|
+
}
|
|
992
|
+
],
|
|
993
|
+
"vue/one-component-per-file": "off",
|
|
994
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
995
|
+
"vue/prefer-template": "error",
|
|
996
|
+
"vue/require-default-prop": "off",
|
|
997
|
+
"vue/require-prop-types": "off",
|
|
998
|
+
"vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
|
|
936
999
|
}
|
|
937
1000
|
},
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
vue: pluginVue
|
|
942
|
-
},
|
|
943
|
-
processor: pluginVue.processors[".vue"],
|
|
944
|
-
rules: {
|
|
945
|
-
...recommendedRules,
|
|
946
|
-
"vue/block-order": ["error", { order: [
|
|
947
|
-
"script",
|
|
948
|
-
"template",
|
|
949
|
-
"style"
|
|
950
|
-
] }],
|
|
951
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
952
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
953
|
-
"vue/html-self-closing": ["error", {
|
|
954
|
-
html: {
|
|
955
|
-
component: "always",
|
|
956
|
-
normal: "always",
|
|
957
|
-
void: "any"
|
|
958
|
-
},
|
|
959
|
-
math: "always",
|
|
960
|
-
svg: "always"
|
|
961
|
-
}],
|
|
962
|
-
"vue/max-attributes-per-line": "off",
|
|
963
|
-
"vue/multi-word-component-names": "off",
|
|
964
|
-
"vue/no-constant-condition": "warn",
|
|
965
|
-
"vue/no-empty-pattern": "error",
|
|
966
|
-
"vue/no-loss-of-precision": "error",
|
|
967
|
-
"vue/no-ref-as-operand": "off",
|
|
968
|
-
"vue/no-unused-refs": "error",
|
|
969
|
-
"vue/no-useless-v-bind": "error",
|
|
970
|
-
"vue/no-v-html": "off",
|
|
971
|
-
"vue/object-shorthand": [
|
|
972
|
-
"error",
|
|
973
|
-
"always",
|
|
974
|
-
{
|
|
975
|
-
avoidQuotes: true,
|
|
976
|
-
ignoreConstructors: false
|
|
977
|
-
}
|
|
978
|
-
],
|
|
979
|
-
"vue/one-component-per-file": "off",
|
|
980
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
981
|
-
"vue/prefer-template": "error",
|
|
982
|
-
"vue/require-default-prop": "off",
|
|
983
|
-
"vue/require-prop-types": "off",
|
|
984
|
-
"vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
|
|
985
|
-
}
|
|
986
|
-
},
|
|
987
|
-
...reactivityTransform()
|
|
988
|
-
];
|
|
1001
|
+
...version === 3 ? reactivityTransform() : []
|
|
1002
|
+
];
|
|
1003
|
+
};
|
|
989
1004
|
|
|
990
1005
|
//#endregion
|
|
991
1006
|
//#region src/configs/yml.ts
|
|
@@ -1008,6 +1023,7 @@ const yml = () => [{
|
|
|
1008
1023
|
const hasTypeScript = () => isPackageExists("typescript");
|
|
1009
1024
|
const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
1010
1025
|
const hasUnocss = () => isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt") || isPackageExists("@unocss/eslint-plugin");
|
|
1026
|
+
const hasNestjs = () => isPackageExists("@nestjs/core") || isPackageExists("@nestjs/common");
|
|
1011
1027
|
function isInEditorEnv() {
|
|
1012
1028
|
if (process.env.CI) return false;
|
|
1013
1029
|
if (isInGitHooksOrLintStaged()) return false;
|
|
@@ -1073,14 +1089,15 @@ const presetAll = async () => [
|
|
|
1073
1089
|
];
|
|
1074
1090
|
/** `@frabbit`'s preset. */
|
|
1075
1091
|
function frabbit(options = {}, ...userConfigs) {
|
|
1076
|
-
const { baseline: enableBaseline = true, command: enableCommand = true, markdown: enableMarkdown = true, pnpm: enablePnpm = false, prettier: enablePrettier = true, unocss: enableUnocss = hasUnocss(), vue: enableVue = hasVue() } = options;
|
|
1092
|
+
const { baseline: enableBaseline = true, command: enableCommand = true, markdown: enableMarkdown = true, nestjs: enableNestjs = hasNestjs(), pnpm: enablePnpm = false, prettier: enablePrettier = true, unocss: enableUnocss = hasUnocss(), vue: enableVue = hasVue() } = options;
|
|
1077
1093
|
const configs$1 = [
|
|
1078
1094
|
presetBasic(),
|
|
1079
1095
|
yml(),
|
|
1080
1096
|
presetJsonc()
|
|
1081
1097
|
];
|
|
1082
1098
|
if (enableBaseline) configs$1.push(baseline(typeof enableBaseline === "object" ? enableBaseline : {}));
|
|
1083
|
-
if (enableVue) configs$1.push(vue());
|
|
1099
|
+
if (enableVue) configs$1.push(vue({ version: enableVue === 2 ? 2 : 3 }));
|
|
1100
|
+
if (enableNestjs) configs$1.push(nestjs());
|
|
1084
1101
|
if (enableMarkdown) configs$1.push(markdown());
|
|
1085
1102
|
if (enableUnocss) configs$1.push(unocss());
|
|
1086
1103
|
if (enablePrettier) configs$1.push(prettier());
|
|
@@ -1091,4 +1108,4 @@ function frabbit(options = {}, ...userConfigs) {
|
|
|
1091
1108
|
}
|
|
1092
1109
|
|
|
1093
1110
|
//#endregion
|
|
1094
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_NUXT_LAYOUTS, GLOB_NUXT_PAGE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, baseline, command, comments, configCommand, configComments, configJs, deMorgan, frabbit, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, markdown, node, parserJsonc, parserVue, parserYml, pluginAntfu, pluginDeMorgan, pluginIgnore, pluginImport, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNode, pluginPerfectionist, pluginPnpm, pluginPrettier, pluginPrettierRecommended, pluginSecurity, pluginSonarJS, pluginSxzz, pluginUnicorn, pluginUnusedImports, pluginVue, pluginYml, pnpm, presetAll, presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, regexp, restrictedSyntaxJs, security, sonarjs, sortImports, sortPackageJson, sortPnpmWorkspace, sortTsconfig, specialCases, tseslint, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
1111
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_NUXT_LAYOUTS, GLOB_NUXT_PAGE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, baseline, command, comments, configCommand, configComments, configJs, deMorgan, frabbit, hasNestjs, hasTypeScript, hasUnocss, hasVue, ignores, imports, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, markdown, nestjs, node, parserJsonc, parserVue, parserYml, pluginAntfu, pluginDeMorgan, pluginIgnore, pluginImport, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNode, pluginPerfectionist, pluginPnpm, pluginPrettier, pluginPrettierRecommended, pluginSecurity, pluginSonarJS, pluginSxzz, pluginUnicorn, pluginUnusedImports, pluginVue, pluginYml, pnpm, presetAll, presetBasic, presetJavaScript, presetJsonc, presetLangsExtensions, prettier, reactivityTransform, regexp, restrictedSyntaxJs, security, sonarjs, sortImports, sortPackageJson, sortPnpmWorkspace, sortTsconfig, specialCases, tseslint, typescript, typescriptCore, unicorn, unocss, vue, yml };
|