diff --git a/src/cli/typescript/compile.ts b/src/cli/typescript/compile.ts index e5627f8..85af3c0 100644 --- a/src/cli/typescript/compile.ts +++ b/src/cli/typescript/compile.ts @@ -27,7 +27,9 @@ function getPathToErrorsMap(tscOutput: string[]): Map { const result = new Map(); tscOutput.forEach((error) => { - const path = resolve(process.cwd(), error.split('(')[0]); + const match = error.match(/^(.*?)(?=\(\d+,\d+\))/); + const beforePattern = match ? match[1] : error; + const path = resolve(process.cwd(), beforePattern); if (result.has(path)) { result.set(path, [...result.get(path)!, error]); diff --git a/src/cli/update-strict-comments/getFilePaths.ts b/src/cli/update-strict-comments/getFilePaths.ts index 67e7bb1..0d7fc7d 100644 --- a/src/cli/update-strict-comments/getFilePaths.ts +++ b/src/cli/update-strict-comments/getFilePaths.ts @@ -5,8 +5,11 @@ import { findStrictErrors } from '../findStrictErrors'; export const getFilePathsWithErrors = async (allFilePaths: string[]) => { const errors = await findStrictErrors(allFilePaths); - const getFilePathFromErrorMessage = (error: string) => - getAbsolutePath(process.cwd(), error.split('(')[0]); + const getFilePathFromErrorMessage = (error: string) => { + const match = error.match(/^(.*?)(?=\(\d+,\d+\))/); + const beforePattern = match ? match[1] : error; + return getAbsolutePath(process.cwd(), beforePattern); + }; return [...new Set(errors.map(getFilePathFromErrorMessage))]; };