no-duplicate-constant-values: apply minimum-group-size guard to booleans - #50247
Merged
Conversation
4 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix no-duplicate-constant-values to guard boolean literals
no-duplicate-constant-values: apply minimum-group-size guard to booleans
Aug 4, 2026
pelikhan
marked this pull request as ready for review
August 4, 2026 12:36
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a boolean duplicate-group threshold to reduce false positives in the ESLint rule.
Changes:
- Requires three matching boolean constants before reporting duplicates.
- Adds coverage for both accepted pairs and reported triplets.
Show a summary per file
| File | Description |
|---|---|
eslint-factory/src/rules/no-duplicate-constant-values.ts |
Applies the minimum group-size guard to booleans. |
eslint-factory/src/rules/no-duplicate-constant-values.test.ts |
Tests boolean duplicate thresholds. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
6 tasks
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Numeric constants required 3+ matches before being flagged as duplicates (to avoid false positives on coincidental small numbers like
0/1/-1), but booleans had no such guard despite having an even smaller value space (only 2 possible values). Any two unrelatedconstbindings both set totrue(or bothfalse) were incorrectly flagged.Rule changes (
no-duplicate-constant-values.ts)MIN_BOOLEAN_DUPLICATE_GROUP_SIZE = 3, mirroring the existing numeric threshold and rationale.shouldReportDuplicatesto compute aminGroupSizeper value-key prefix (number:andboolean:→ 3, everything else → 2), replacing the previous number-only special case.Tests