Skip to content

Commit 1b0c308

Browse files
committed
🐛fix(core): 仅可以识别暂存区未删除的文件
1 parent 9943896 commit 1b0c308

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/shared/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ACTIVATION } from "./config";
1010
export const execCommand = async (
1111
cmd: string,
1212
args: string[],
13-
options?: Options
13+
options?: Options,
1414
) => {
1515
try {
1616
const res = await execa(cmd, args, options);
@@ -63,7 +63,7 @@ export const loggerError = (content: string | unknown) => {
6363

6464
export function filterFiles(
6565
fileList: string[],
66-
allowedExtensions: string[]
66+
allowedExtensions: string[],
6767
): string[] {
6868
const filteredFiles: string[] = [];
6969

@@ -113,13 +113,14 @@ export const getLintFiles = async (
113113
cwd: string,
114114
staged: boolean,
115115
paths: string[],
116-
suffix: string[]
116+
suffix: string[],
117117
) => {
118118
let files: string[] = [];
119119
if (staged) {
120120
const result = await execCommand("git", [
121121
"diff",
122122
"--name-only",
123+
"--diff-filter=d",
123124
"--cached",
124125
]);
125126
files = result?.split("\n").map((path) => `${cwd}/${path}`) || [];

0 commit comments

Comments
 (0)