From 3574fdc803cef277e28e9aae67ba617442908efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Tue, 16 Aug 2022 20:41:42 +0200 Subject: [PATCH] fix(linter): normalize rule context file name for cross OS (#11604) --- .../src/rules/enforce-module-boundaries.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts b/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts index f9e921a41329a..68fd6e6edaeab 100644 --- a/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts +++ b/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts @@ -149,6 +149,7 @@ export default createESLintRule({ const projectPath = normalizePath( (global as any).projectPath || workspaceRoot ); + const fileName = normalizePath(context.getFilename()); const projectGraph = readProjectGraph(RULE_NAME); @@ -192,10 +193,7 @@ export default createESLintRule({ return; } - const sourceFilePath = getSourceFilePath( - context.getFilename(), - projectPath - ); + const sourceFilePath = getSourceFilePath(fileName, projectPath); const sourceProject = findSourceProject(projectGraph, sourceFilePath); // If source is not part of an nx workspace, return. @@ -327,7 +325,7 @@ export default createESLintRule({ if (importPath) { // resolve the import path const relativePath = relative( - dirname(context.getFilename()), + dirname(fileName), dirname(importPath) );