From 7bb5f1a2fc1e5204d8c03f6a3c32ce4d520df42b Mon Sep 17 00:00:00 2001 From: Vlad Frolov Date: Mon, 11 Jan 2021 15:13:48 +0200 Subject: [PATCH] fix: Replace all backslashes when normalizing path in getFormattedDiagnostic (#17915) I have not bumped into any bug, I was just playing around https://lgtm.com/projects/g/vercel/next.js/, and this looked like a legit suggestion to fix --- packages/next/lib/typescript/diagnosticFormatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/lib/typescript/diagnosticFormatter.ts b/packages/next/lib/typescript/diagnosticFormatter.ts index 7b50c9ada0efc27..6d183431415e716 100644 --- a/packages/next/lib/typescript/diagnosticFormatter.ts +++ b/packages/next/lib/typescript/diagnosticFormatter.ts @@ -45,7 +45,7 @@ export async function getFormattedDiagnostic( const character = pos.character + 1 let fileName = path.posix.normalize( - path.relative(baseDir, diagnostic.file.fileName).replace(/\\/, '/') + path.relative(baseDir, diagnostic.file.fileName).replace(/\\/g, '/') ) if (!fileName.startsWith('.')) { fileName = './' + fileName