@frabbit/eslint-config 7.4.5 → 7.5.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/README.md +2 -3
- package/dist/index.d.mts +14 -8
- package/dist/index.mjs +24 -34
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# @frabbit/eslint-config [](https://npmjs.com/package/@frabbit/eslint-config)
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
Flat ESLint config for JavaScript, TypeScript, Vue 2, Vue 3, Prettier.
|
|
5
4
|
based on https://github.com/sxzz/eslint-config
|
|
6
5
|
|
|
@@ -30,6 +29,7 @@ Require Node.js >= 20.0.0, and ESLint >= 9.5.0.
|
|
|
30
29
|
|
|
31
30
|
```js
|
|
32
31
|
import { frabbit } from '@frabbit/eslint-config'
|
|
32
|
+
|
|
33
33
|
export default frabbit(
|
|
34
34
|
// Features: it'll detect installed dependency and enable necessary features automatically
|
|
35
35
|
{
|
|
@@ -40,7 +40,7 @@ export default frabbit(
|
|
|
40
40
|
},
|
|
41
41
|
[
|
|
42
42
|
/* your custom config */
|
|
43
|
-
]
|
|
43
|
+
]
|
|
44
44
|
).removeRules('foo/bar') // see more in https://github.com/antfu/eslint-flat-config-utils
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -75,4 +75,3 @@ Most of the rules are the same, but there are some differences:
|
|
|
75
75
|
- Use [Prettier](https://prettier.io/) instead of [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic).
|
|
76
76
|
- React and Svelte are not supported.
|
|
77
77
|
- Maybe stricter and simpler.
|
|
78
|
-
|
package/dist/index.d.mts
CHANGED
|
@@ -9,21 +9,21 @@ import pluginImport from "eslint-plugin-import-x";
|
|
|
9
9
|
import pluginJsdoc from "eslint-plugin-jsdoc";
|
|
10
10
|
import pluginJsonc from "eslint-plugin-jsonc";
|
|
11
11
|
import pluginNode from "eslint-plugin-n";
|
|
12
|
-
import pluginSxzz from "eslint-plugin-sxzz";
|
|
13
|
-
import tseslint from "typescript-eslint";
|
|
14
|
-
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
15
|
-
import pluginVue from "eslint-plugin-vue";
|
|
16
12
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
13
|
+
import pluginPnpm from "eslint-plugin-pnpm";
|
|
17
14
|
import pluginPrettier from "eslint-plugin-prettier";
|
|
18
15
|
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
19
|
-
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
20
|
-
import pluginPnpm from "eslint-plugin-pnpm";
|
|
21
16
|
import pluginSecurity from "eslint-plugin-security";
|
|
22
17
|
import pluginSonarJS from "eslint-plugin-sonarjs";
|
|
18
|
+
import pluginSxzz from "eslint-plugin-sxzz";
|
|
19
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
20
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
21
|
+
import pluginVue from "eslint-plugin-vue";
|
|
23
22
|
import pluginYml from "eslint-plugin-yml";
|
|
23
|
+
import parserJsonc from "jsonc-eslint-parser";
|
|
24
|
+
import tseslint from "typescript-eslint";
|
|
24
25
|
import parserVue from "vue-eslint-parser";
|
|
25
26
|
import parserYml from "yaml-eslint-parser";
|
|
26
|
-
import parserJsonc from "jsonc-eslint-parser";
|
|
27
27
|
import { Arrayable, Awaitable, FlatConfigComposer } from "eslint-flat-config-utils";
|
|
28
28
|
import { Linter } from "eslint";
|
|
29
29
|
|
|
@@ -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
|
|
@@ -14537,6 +14540,7 @@ declare const yml: () => Config[];
|
|
|
14537
14540
|
declare const hasTypeScript: () => boolean;
|
|
14538
14541
|
declare const hasVue: () => boolean;
|
|
14539
14542
|
declare const hasUnocss: () => boolean;
|
|
14543
|
+
declare const hasNestjs: () => boolean;
|
|
14540
14544
|
declare function isInEditorEnv(): boolean;
|
|
14541
14545
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
14542
14546
|
//#endregion
|
|
@@ -14591,6 +14595,8 @@ interface Options {
|
|
|
14591
14595
|
command?: boolean;
|
|
14592
14596
|
/** markdown support. @default true */
|
|
14593
14597
|
markdown?: boolean;
|
|
14598
|
+
/** NestJS support. Auto-enable if detected. */
|
|
14599
|
+
nestjs?: boolean;
|
|
14594
14600
|
/** @default false */
|
|
14595
14601
|
pnpm?: boolean;
|
|
14596
14602
|
/** Prettier support. @default true */
|
|
@@ -14603,4 +14609,4 @@ interface Options {
|
|
|
14603
14609
|
/** `@frabbit`'s preset. */
|
|
14604
14610
|
declare function frabbit(options?: Options, ...userConfigs: Awaitable<Arrayable<Config> | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<Config, ConfigNames>;
|
|
14605
14611
|
//#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 };
|
|
14612
|
+
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, 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
|
@@ -12,21 +12,21 @@ import pluginImport from "eslint-plugin-import-x";
|
|
|
12
12
|
import pluginJsdoc from "eslint-plugin-jsdoc";
|
|
13
13
|
const pluginJsonc = __cjs_require("eslint-plugin-jsonc");
|
|
14
14
|
const pluginNode = __cjs_require("eslint-plugin-n");
|
|
15
|
-
import pluginSxzz from "eslint-plugin-sxzz";
|
|
16
|
-
const tseslint = __cjs_require("typescript-eslint");
|
|
17
|
-
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
18
|
-
const pluginVue = __cjs_require("eslint-plugin-vue");
|
|
19
15
|
const pluginPerfectionist = __cjs_require("eslint-plugin-perfectionist");
|
|
16
|
+
import pluginPnpm from "eslint-plugin-pnpm";
|
|
20
17
|
const pluginPrettier = __cjs_require("eslint-plugin-prettier");
|
|
21
18
|
const pluginPrettierRecommended = __cjs_require("eslint-plugin-prettier/recommended");
|
|
22
|
-
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
23
|
-
import pluginPnpm from "eslint-plugin-pnpm";
|
|
24
19
|
const pluginSecurity = __cjs_require("eslint-plugin-security");
|
|
25
20
|
const pluginSonarJS = __cjs_require("eslint-plugin-sonarjs");
|
|
21
|
+
import pluginSxzz from "eslint-plugin-sxzz";
|
|
22
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
23
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
24
|
+
const pluginVue = __cjs_require("eslint-plugin-vue");
|
|
26
25
|
const pluginYml = __cjs_require("eslint-plugin-yml");
|
|
26
|
+
const parserJsonc = __cjs_require("jsonc-eslint-parser");
|
|
27
|
+
const tseslint = __cjs_require("typescript-eslint");
|
|
27
28
|
const parserVue = __cjs_require("vue-eslint-parser");
|
|
28
29
|
const parserYml = __cjs_require("yaml-eslint-parser");
|
|
29
|
-
const parserJsonc = __cjs_require("jsonc-eslint-parser");
|
|
30
30
|
const globals = __cjs_require("globals");
|
|
31
31
|
const {
|
|
32
32
|
configs
|
|
@@ -166,29 +166,7 @@ const imports = () => [{
|
|
|
166
166
|
"import/no-mutable-exports": "error",
|
|
167
167
|
"import/no-named-default": "error",
|
|
168
168
|
"import/no-self-import": "error",
|
|
169
|
-
"import/no-webpack-loader-syntax": "error"
|
|
170
|
-
"import/order": ["error", {
|
|
171
|
-
alphabetize: {
|
|
172
|
-
caseInsensitive: true,
|
|
173
|
-
order: "asc"
|
|
174
|
-
},
|
|
175
|
-
groups: [
|
|
176
|
-
"builtin",
|
|
177
|
-
"external",
|
|
178
|
-
"internal",
|
|
179
|
-
"parent",
|
|
180
|
-
"sibling",
|
|
181
|
-
"index",
|
|
182
|
-
"object",
|
|
183
|
-
"type"
|
|
184
|
-
],
|
|
185
|
-
"newlines-between": "always",
|
|
186
|
-
pathGroups: [{
|
|
187
|
-
group: "internal",
|
|
188
|
-
pattern: "{{@,~}/,#}**"
|
|
189
|
-
}],
|
|
190
|
-
pathGroupsExcludedImportTypes: ["type"]
|
|
191
|
-
}]
|
|
169
|
+
"import/no-webpack-loader-syntax": "error"
|
|
192
170
|
}
|
|
193
171
|
}, {
|
|
194
172
|
files: [
|
|
@@ -284,7 +262,7 @@ const javascript = () => [{
|
|
|
284
262
|
"require-await": "error",
|
|
285
263
|
"sxzz/prefer-string-function": "warn",
|
|
286
264
|
"unicode-bom": ["error", "never"],
|
|
287
|
-
"unused-imports/no-unused-imports": "
|
|
265
|
+
"unused-imports/no-unused-imports": "error",
|
|
288
266
|
"unused-imports/no-unused-vars": ["error", {
|
|
289
267
|
args: "after-used",
|
|
290
268
|
ignoreRestSiblings: true
|
|
@@ -374,6 +352,17 @@ const markdown = () => [...pluginMarkdown.configs.processor.map((config) => ({
|
|
|
374
352
|
}
|
|
375
353
|
}];
|
|
376
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
|
+
|
|
377
366
|
//#endregion
|
|
378
367
|
//#region src/configs/node.ts
|
|
379
368
|
const node = () => [{
|
|
@@ -485,7 +474,6 @@ const sonarjs = () => [{
|
|
|
485
474
|
"sonarjs/no-inverted-boolean-check": "off",
|
|
486
475
|
"sonarjs/no-nested-switch": "error",
|
|
487
476
|
"sonarjs/no-nested-template-literals": "error",
|
|
488
|
-
"sonarjs/no-one-iteration-loop": "error",
|
|
489
477
|
"sonarjs/no-redundant-boolean": "error",
|
|
490
478
|
"sonarjs/no-redundant-jump": "error",
|
|
491
479
|
"sonarjs/no-same-line-conditional": "error",
|
|
@@ -1031,6 +1019,7 @@ const yml = () => [{
|
|
|
1031
1019
|
const hasTypeScript = () => isPackageExists("typescript");
|
|
1032
1020
|
const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
1033
1021
|
const hasUnocss = () => isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt") || isPackageExists("@unocss/eslint-plugin");
|
|
1022
|
+
const hasNestjs = () => isPackageExists("@nestjs/core") || isPackageExists("@nestjs/common");
|
|
1034
1023
|
function isInEditorEnv() {
|
|
1035
1024
|
if (process.env.CI) return false;
|
|
1036
1025
|
if (isInGitHooksOrLintStaged()) return false;
|
|
@@ -1096,7 +1085,7 @@ const presetAll = async () => [
|
|
|
1096
1085
|
];
|
|
1097
1086
|
/** `@frabbit`'s preset. */
|
|
1098
1087
|
function frabbit(options = {}, ...userConfigs) {
|
|
1099
|
-
const { baseline: enableBaseline = true, command: enableCommand = true, markdown: enableMarkdown = true, pnpm: enablePnpm = false, prettier: enablePrettier = true, unocss: enableUnocss = hasUnocss(), vue: enableVue = hasVue() } = options;
|
|
1088
|
+
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;
|
|
1100
1089
|
const configs$1 = [
|
|
1101
1090
|
presetBasic(),
|
|
1102
1091
|
yml(),
|
|
@@ -1104,6 +1093,7 @@ function frabbit(options = {}, ...userConfigs) {
|
|
|
1104
1093
|
];
|
|
1105
1094
|
if (enableBaseline) configs$1.push(baseline(typeof enableBaseline === "object" ? enableBaseline : {}));
|
|
1106
1095
|
if (enableVue) configs$1.push(vue());
|
|
1096
|
+
if (enableNestjs) configs$1.push(nestjs());
|
|
1107
1097
|
if (enableMarkdown) configs$1.push(markdown());
|
|
1108
1098
|
if (enableUnocss) configs$1.push(unocss());
|
|
1109
1099
|
if (enablePrettier) configs$1.push(prettier());
|
|
@@ -1114,4 +1104,4 @@ function frabbit(options = {}, ...userConfigs) {
|
|
|
1114
1104
|
}
|
|
1115
1105
|
|
|
1116
1106
|
//#endregion
|
|
1117
|
-
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 };
|
|
1107
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frabbit/eslint-config",
|
|
3
|
-
"version": "7.4.5",
|
|
4
|
-
"description": "ESLint config for @frabbit.",
|
|
5
3
|
"type": "module",
|
|
4
|
+
"version": "7.5.0",
|
|
5
|
+
"description": "ESLint config for @frabbit.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/frabbit/eslint-config#readme",
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/frabbit/eslint-config/issues"
|
|
11
|
-
},
|
|
12
8
|
"funding": "https://github.com/sponsors/sxzz",
|
|
9
|
+
"homepage": "https://github.com/frabbit/eslint-config#readme",
|
|
13
10
|
"repository": {
|
|
14
11
|
"type": "git",
|
|
15
12
|
"url": "git+https://github.com/frenchrabbit/eslint-config.git"
|
|
16
13
|
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/frabbit/eslint-config/issues"
|
|
16
|
+
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": "./dist/index.mjs",
|
|
19
19
|
"./package.json": "./package.json"
|