diff --git a/common/changes/@rushstack/eslint-patch/fix-4454-bulk-suppression-in-polyrepo_2023-12-13-21-38.json b/common/changes/@rushstack/eslint-patch/fix-4454-bulk-suppression-in-polyrepo_2023-12-13-21-38.json new file mode 100644 index 00000000000..6183c079dd8 --- /dev/null +++ b/common/changes/@rushstack/eslint-patch/fix-4454-bulk-suppression-in-polyrepo_2023-12-13-21-38.json @@ -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" +} \ No newline at end of file diff --git a/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts b/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts index 6648f120d7e..11e4cd4d7d3 100644 --- a/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts +++ b/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts @@ -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');