Skip to content

Commit bbb1ffa

Browse files
committed
fix(feature): 目前仅支持js ts jsx tsx 后缀的文件
1 parent 8091768 commit bbb1ffa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/command/eslint-fix.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ export const eslintFix = async (
3939
"--name-only",
4040
"--cached",
4141
]);
42-
files = result?.split("\n").map((path) => `${cwd}/${path}`) || [];
42+
files =
43+
result
44+
?.split("\n")
45+
.map((path) => `${cwd}/${path}`)
46+
.filter(
47+
(path) =>
48+
path.endsWith(".js") ||
49+
path.endsWith(".jsx") ||
50+
path.endsWith(".ts") ||
51+
path.endsWith(".tsx")
52+
) || [];
4353
} else {
4454
files = paths.map((path) => `${cwd}/${path}`);
4555
}
@@ -55,6 +65,7 @@ export const eslintFix = async (
5565
}, "eslint checking...")();
5666
if (resultText) {
5767
loggerError(`💥eslint check fail! ${resultText}`);
68+
process.exit(1);
5869
} else {
5970
loggerSuccess("🎉 eslint check success!");
6071
}

0 commit comments

Comments
 (0)