From 1d3b53749a632a3a1c960d2dee664c1e09a8a759 Mon Sep 17 00:00:00 2001 From: Paul Salaberria Date: Mon, 19 Oct 2026 13:29:18 +0200 Subject: [PATCH] fix: exclude positional args from format-options cache version The cache version hash was built from the raw CLI args object, which includes "_" (the targeted files/globs) and "--". This made the cache version change depending on which files were targeted in a given run, causing Cache.cleanup() to discard all previously cached entries for files not part of the current run. Fixes prettier/prettier-cli#88 Co-Authored-By: Claude Sonnet 5 --- src/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index b3679cd..b37db1f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -531,6 +531,9 @@ function normalizeFormatOptions(options: unknown): FormatOptions { for (const [key, value] of Object.entries(options)) { // Handled separately below, since "plugin" and "plugins" both map to "plugins" if (key === "plugin" || key === "plugins") continue; + // Positional arguments (the targeted files/globs) and the "--" separator are not format + // options: including them would make the cache version depend on which files were targeted + if (key === "_" || key === "--") continue; const validator = formatOptionsValidators[key]; if (validator) {