Skip to content

Commit a030ceb

Browse files
committed
🔧 chore(app): 引入自动修复导入模块顺序插件
1 parent 687bbc4 commit a030ceb

22 files changed

+83
-70
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
"ecmaVersion": "latest"
1414
},
1515
"plugins": [
16-
"@typescript-eslint"
16+
"@typescript-eslint",
17+
"simple-import-sort"
1718
],
1819
"rules": {
20+
"simple-import-sort/imports": "error",
21+
"simple-import-sort/exports": "error"
1922
}
2023
}

.prettierrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

package-lock.json

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"@typescript-eslint/eslint-plugin": "^6.7.0",
6666
"@typescript-eslint/parser": "^6.7.0",
6767
"cross-env": "^7.0.3",
68+
"eslint-plugin-simple-import-sort": "^10.0.0",
6869
"esno": "^0.17.0",
6970
"release-it": "^16.1.5",
7071
"simple-git-hooks": "^2.9.0",

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import cac from "cac";
22

33
import { cmdInstaller, handleError } from "@/helper";
4+
import config from "@/index";
45

56
import pkg from "../package.json";
6-
import config from "@/index";
77

88
const setupCli = async () => {
99
const cli = cac("codeg");

src/command/clear.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import type { CAC } from "cac";
2-
31
import path from "node:path";
42

5-
import fs from "fs-extra";
3+
import type { CAC } from "cac";
64
import enquirer from "enquirer";
5+
import fs from "fs-extra";
76

8-
import { execCommand, loggerInfo } from "@/helper";
97
import { ACTIVATION, clearGlob } from "@/config";
8+
import { execCommand, loggerInfo } from "@/helper";
109
import { ClearOptions } from "@/types";
1110

1211
const generateEnquirer = async (): Promise<ClearOptions> => {

src/command/create-project.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { CAC } from "cac";
2-
32
import enquirer from "enquirer";
43

5-
import { execCommand, loggerInfo } from "@/helper";
64
import { ACTIVATION, projectSources } from "@/config";
5+
import { execCommand, loggerInfo } from "@/helper";
76
import { ProjectSource } from "@/types";
87

98
interface PromptResult {

src/command/eslint-fix.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
import type { CAC } from "cac";
22

3+
import { ACTIVATION, eslintGlob } from "@/config";
34
import {
45
execCommand,
56
loggerError,
67
loggerInfo,
78
printError,
89
printInfo,
910
} from "@/helper";
10-
import { ACTIVATION, eslintGlob } from "@/config";
1111

1212
export const eslintFix = async (paths: string[]) => {
1313
if (ACTIVATION) {
1414
loggerInfo(`eslintFix 参数信息: \n ${paths}`);
1515
}
1616

1717
try {
18-
await execCommand(
19-
"npx",
20-
["eslint", "--fix", "--fix-type", "problem,suggestion", ...paths],
21-
{
22-
stdio: "inherit",
23-
},
24-
);
18+
await execCommand("npx", ["eslint", "--fix", ...paths], {
19+
stdio: "inherit",
20+
});
2521
printInfo("代码已通过 eslint 校验");
2622
} catch (error) {
2723
printError(`代码未通过 eslint 校验`);

src/command/git-commit-verify.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { CAC } from "cac";
2-
31
import { readFileSync } from "node:fs";
42
import path from "node:path";
53

6-
import { printError, printInfo, execCommand } from "@/helper";
4+
import type { CAC } from "cac";
5+
6+
import { execCommand, printError, printInfo } from "@/helper";
77

88
export const gitCommitVerify = async () => {
99
const dogit = await execCommand("git", ["rev-parse", "--show-toplevel"]);

src/command/git-commit.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { CAC } from "cac";
2-
32
import enquirer from "enquirer";
43

5-
import { loggerInfo, execCommand } from "@/helper";
64
import { ACTIVATION, gitCommitScopes, gitCommitTypes } from "@/config";
5+
import { execCommand, loggerInfo } from "@/helper";
76
import { GitCommitOptions } from "@/types";
87

98
const generateEnquirer = async (): Promise<

0 commit comments

Comments
 (0)