Summary
eslint-factory/src/rules/no-duplicate-constant-values.ts flags a later module-level const declaration whenever its static value duplicates an earlier one. For numeric literals the rule requires at least MIN_NUMERIC_DUPLICATE_GROUP_SIZE = 3 declarations sharing a value before reporting (src/rules/no-duplicate-constant-values.ts:10,82) — an explicit acknowledgment that small numbers (0, 1, -1, etc.) collide coincidentally all the time and a 2-way match is too weak a signal.
Booleans get no such guard: getStaticValueKey maps every boolean literal to one of exactly two keys (boolean:true / boolean:false, via the generic ${typeof node.value}:${String(node.value)} branch at line 17), and shouldReportDuplicates only special-cases the number: prefix (line 82). Since there are only 2 possible boolean values module-wide — versus an effectively unbounded but coincidence-prone numeric range that still got a 3-way threshold — any two unrelated top-level const bindings that happen to both be true (or both false) will be flagged as "duplicating" each other, even though there's no reason to believe they're supposed to share a single source of truth. This is at least as prone to coincidental collision as the numeric case the threshold was added for, but has no corresponding protection.
Short/generic string sentinels (e.g. two unrelated const X = ""; or two unrelated 2-3 char status/mode strings) are analogously exposed, though the collision space there is larger and harder to hit by accident.
Why this wasn't filed with a live example
A search of actions/setup/js/*.cjs for module-level const NAME = true; / const NAME = false; / const NAME = ""; currently turns up zero coincidental collisions — the corpus is disciplined. This mirrors the precedent set by the require-fs-sync-try-catch catch-less-try/finally finding filed 2026-07-08: an ungrounded but cheap, clearly-reasoned soundness/FP gap worth fixing proactively before the corpus grows into it.
Acceptance criteria
Scope
eslint-factory/src/rules/no-duplicate-constant-values.ts and its test file only.
Generated by 🤖 ESLint Refiner · agent · 261.5 AIC · ⌖ 30.2 AIC · ⊞ 4.9K · ◷
Summary
eslint-factory/src/rules/no-duplicate-constant-values.tsflags a later module-levelconstdeclaration whenever its static value duplicates an earlier one. For numeric literals the rule requires at leastMIN_NUMERIC_DUPLICATE_GROUP_SIZE = 3declarations sharing a value before reporting (src/rules/no-duplicate-constant-values.ts:10,82) — an explicit acknowledgment that small numbers (0,1,-1, etc.) collide coincidentally all the time and a 2-way match is too weak a signal.Booleans get no such guard:
getStaticValueKeymaps every boolean literal to one of exactly two keys (boolean:true/boolean:false, via the generic${typeof node.value}:${String(node.value)}branch at line 17), andshouldReportDuplicatesonly special-cases thenumber:prefix (line 82). Since there are only 2 possible boolean values module-wide — versus an effectively unbounded but coincidence-prone numeric range that still got a 3-way threshold — any two unrelated top-levelconstbindings that happen to both betrue(or bothfalse) will be flagged as "duplicating" each other, even though there's no reason to believe they're supposed to share a single source of truth. This is at least as prone to coincidental collision as the numeric case the threshold was added for, but has no corresponding protection.Short/generic string sentinels (e.g. two unrelated
const X = "";or two unrelated 2-3 char status/mode strings) are analogously exposed, though the collision space there is larger and harder to hit by accident.Why this wasn't filed with a live example
A search of
actions/setup/js/*.cjsfor module-levelconst NAME = true;/const NAME = false;/const NAME = "";currently turns up zero coincidental collisions — the corpus is disciplined. This mirrors the precedent set by therequire-fs-sync-try-catchcatch-less-try/finally finding filed 2026-07-08: an ungrounded but cheap, clearly-reasoned soundness/FP gap worth fixing proactively before the corpus grows into it.Acceptance criteria
constdeclarations both set totrue(different names, no semantic relationship) — decide and assert the intended behavior (flag or don't).Scope
eslint-factory/src/rules/no-duplicate-constant-values.tsand its test file only.