Skip to content

Commit

Permalink
fix(eslint-patch): fix bulk suppression in polyrepo
Browse files Browse the repository at this point in the history
Fixes #4454
  • Loading branch information
SpenserJ committed Dec 13, 2023
1 parent d9e0c73 commit 1ab0b46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/eslint-patch",
"comment": "Fix bulk suppression patch's eslintrc detection in polyrepos",
"type": "patch"
}
],
"packageName": "@rushstack/eslint-patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function getGitRootPath(): string {
export const GitRootPath = getGitRootPath();

function findEslintrcDirectory(fileAbsolutePath: string): string {
for (let currentDir = fileAbsolutePath; currentDir !== GitRootPath; currentDir = path.dirname(currentDir))
for (let currentDir = fileAbsolutePath; currentDir.startsWith(GitRootPath); currentDir = path.dirname(currentDir))
if (['.eslintrc.js', '.eslintrc.cjs'].some((eslintrc) => fs.existsSync(path.join(currentDir, eslintrc))))
return currentDir;
throw new Error('Cannot locate eslintrc');
Expand Down

0 comments on commit 1ab0b46

Please sign in to comment.