From 4cf55de60e115f206f1b4b3315f3fca368bf47dc Mon Sep 17 00:00:00 2001 From: David Michon Date: Mon, 6 Jan 2025 17:19:23 -0800 Subject: [PATCH] [eslint-bulk] Fix caching during eslintrc lookup (#5065) Co-authored-by: David Michon --- .../eslint-cache-bug_2025-01-07-00-34.json | 10 ++++++++++ .../bulk-suppressions-patch.ts | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 common/changes/@rushstack/eslint-patch/eslint-cache-bug_2025-01-07-00-34.json diff --git a/common/changes/@rushstack/eslint-patch/eslint-cache-bug_2025-01-07-00-34.json b/common/changes/@rushstack/eslint-patch/eslint-cache-bug_2025-01-07-00-34.json new file mode 100644 index 00000000000..7be887ed6c8 --- /dev/null +++ b/common/changes/@rushstack/eslint-patch/eslint-cache-bug_2025-01-07-00-34.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/eslint-patch", + "comment": "Fix a performance issue when locating \".eslint-bulk-suppressions.json\".", + "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 72978ceb69a..68b897f7a8c 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 @@ -110,7 +110,9 @@ function findEslintrcFolderPathForNormalizedFileAbsolutePath(normalizedFilePath: ) { const cachedEslintrcFolderPath: string | undefined = eslintrcPathByFileOrFolderPath.get(currentFolder); if (cachedEslintrcFolderPath) { - return cachedEslintrcFolderPath; + // Need to cache this result into the intermediate paths + eslintrcFolderPath = cachedEslintrcFolderPath; + break; } pathsToCache.push(currentFolder);