Fix FlatConfigLoader cache behavior when configOverride is supplied
Summary
FlatConfigLoader.getConfigFor() caches a ResolvedConfig by filename before it processes configOverride.
A later call for the same filename with a different configOverride returns the cached result. This ignores the later override. The problem applies to every ConfigData field, including aria, not only aria.
Affected area
src/flat-config/flat-config-loader.nodejs.tsFlatConfigLoader.getConfigFor()
Reproduction
const loader = new FlatConfigLoader(configFilePath);
const filename = "test.html";
const first = await loader.getConfigFor(filename, { aria: "1.2" });
const second = await loader.getConfigFor(filename, { aria: "1.3" });
expect(first.getAriaVersion()).toBe("1.2");
expect(second.getAriaVersion()).toBe("1.3"); // Currently returns "1.2" from the filename cache.The same behavior occurs with other override properties. For example, a later configOverride.rules value can be ignored after an earlier call has cached the filename.
Required change
Do not use the filename-only cache when configOverride is supplied. Preserve the existing cache behavior for calls without configOverride. Alternatively, include a complete and stable representation of configOverride in the cache key.
Acceptance criteria
- Two calls for the same filename with different override values return configurations that reflect their respective overrides.
- A call with
configOverridedoes not pollute the cache used by calls withoutconfigOverride. - Calls without
configOverrideretain filename-based caching. - Tests cover at least two calls for one filename with different override values.
Backlinks
- Merge request: !1413 (merged)
- Review discussion: !1413 (comment 3721342969)
- Requested by: @extsidvind