Skip to content

Commit 09b2b40

Browse files
committed
fix: use fastRelativePath when processing ignore paths
An ignore path can be relative. For example: - folder can be `/foo/configs` - file can be `/foo/src/index.ts` - the ignore file can be `/foo/configs/.prettierignore` - the ignore contents can be `../src/index.ts` This means we end up doing: ``` // does not fall back to path.relative fastRelativeChildPath('/foo/configs', '/foo/src/index.ts'); ``` Which fails since we actually need `fastRelativePath`: ``` // falls back to path.relative fastRelativePath('/foo/configs', '/foo/src/index.ts'); ```
1 parent 4b1a66a commit 09b2b40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/config_ignore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const getIgnoresContentMap = async (foldersPaths: string[], filesNames: string[]
2727
const getIgnoreBy = (folderPath: string, filesContents: string[]): Ignore => {
2828
const ignore = fastIgnore(filesContents);
2929
return (filePath: string): boolean => {
30-
const fileRelativePath = fastRelativeChildPath(folderPath, filePath);
30+
const fileRelativePath = fastRelativePath(folderPath, filePath);
3131
return !!fileRelativePath && ignore(fileRelativePath);
3232
};
3333
};

0 commit comments

Comments
 (0)