Skip to content

Commit

Permalink
fix(linter): normalize rule context file name for cross OS (#11604)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Aug 16, 2022
1 parent 2baa96a commit 3574fdc
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export default createESLintRule<Options, MessageIds>({
const projectPath = normalizePath(
(global as any).projectPath || workspaceRoot
);
const fileName = normalizePath(context.getFilename());

const projectGraph = readProjectGraph(RULE_NAME);

Expand Down Expand Up @@ -192,10 +193,7 @@ export default createESLintRule<Options, MessageIds>({
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.
Expand Down Expand Up @@ -327,7 +325,7 @@ export default createESLintRule<Options, MessageIds>({
if (importPath) {
// resolve the import path
const relativePath = relative(
dirname(context.getFilename()),
dirname(fileName),
dirname(importPath)
);

Expand Down

0 comments on commit 3574fdc

Please sign in to comment.