LOC-ENUS counts the named constant, so folding the literal is not mistaken for fixing it

Folding eight en-US call sites onto library/utils/formatCount.js took the matrix from 13 warns to 3,
and that looked like progress. It was not: the rule matches a LITERAL 'en-US', the helper calls
toLocaleString(COUNT_LOCALE), so my eight sites went INVISIBLE while the behaviour was untouched — the
same false-green as a precondition that skips the file under test. The audit had stopped seeing a
decision that is still in force.

The rule now also matches the constant's DEFINITION. One site, attributed to every bundle that imports
it, which is what "held in one place" should read as: 5 warns —
  library/utils/formatCount.js:26   against research-dashboard and people-groups-grid
  RegionCountryMap.vue:394          regions' held Driver decision
  pplr-coverage.vue:128, pplr-pins.vue:60
regions' catch-fallback discrimination is untouched and its self-test stays green (rc=0).

Gate only, no product code, no rebuild.
This commit is contained in:
Doxa Maps 2026-09-27 07:01:17 +00:00
parent f3b7e25e49
commit e214cc2b7b

View file

@ -106,6 +106,15 @@ const RULES = [
&& /(?:toLocaleString|NumberFormat|DateTimeFormat)\s*\(\s*`[^`]*\$\{/.test(before)
if (!isFallback) out.push(m.index)
}
// ★ THE NAMED CONSTANT COUNTS TOO, or folding the literal into one module LOOKS like fixing it.
// library/utils/formatCount.js now holds the fleet's en-US decision and calls
// toLocaleString(COUNT_LOCALE) — no literal — so the pattern above went quiet and 8 of the
// tree's 13 warns vanished with the BEHAVIOUR unchanged. That is the same false-green as a
// precondition that skips the file under test: the audit stopped seeing a decision still in
// force. One site, attributed to every bundle that imports it, is what "held in one place"
// should read as in the matrix — not zero.
const constRe = /COUNT_LOCALE\s*=\s*['"]en(?:-US)?['"]/g
while ((m = constRe.exec(src))) out.push(m.index)
return out
} },
// A whole-file rule: the fetch and the helper need not be on the same line, only in the same file.