fix: no-all-caps-body-text false positive on CJK text - #1432
Open
skoshx wants to merge 2 commits into
Open
Conversation
…caps The rule was treating any text without lowercase letters as 'all caps', which incorrectly flagged Japanese, Chinese, Korean, and Arabic text. Now only text that contains uppercase letters AND lacks lowercase letters is considered literal uppercase. Caseless scripts are skipped entirely. Fixes #1429 Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
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.
Summary
Fixes
no-all-caps-body-textfalse positive on Japanese, Chinese, Korean, and Arabic text (caseless scripts).Closes #1429
Root Cause
The rule's detection logic treated any text without lowercase letters as "all caps":
For CJK scripts (Japanese, Chinese, Korean) and Arabic, which have no letter case, this condition is always true. Every long paragraph in these languages was incorrectly flagged as all-caps body copy, with no actionable fix (there is no "sentence case" for caseless scripts).
The Fix
Changed the logic to require actual uppercase letters before considering text "all caps":
Now:
Scope
This fix is deliberately narrow and conservative:
hasUppercaseStyle()check (CSStext-transform: uppercasedetection)Testing
Added comprehensive unit tests covering:
All existing tests pass.
Parity
Could not run
rde paritydue to schema version mismatch in the eval environment (expecting v1, current is v3). However:Changeset
Added patch-level changeset for
oxlint-plugin-react-doctor.