Skip to content

fix: no-all-caps-body-text false positive on CJK text - #1432

Open
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1429-ba4c
Open

fix: no-all-caps-body-text false positive on CJK text#1432
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1429-ba4c

Conversation

@skoshx

@skoshx skoshx commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes no-all-caps-body-text false 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":

const isLiteralUppercase = !LOWERCASE_LETTER_PATTERN.test(staticText);

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":

const hasUppercase = UPPERCASE_LETTER_PATTERN.test(staticText);
const hasLowercase = LOWERCASE_LETTER_PATTERN.test(staticText);
const isLiteralUppercase = hasUppercase && !hasLowercase;

Now:

  • Caseless scripts (CJK, Arabic, etc.) are skipped entirely
  • Latin text in all caps is still caught correctly
  • Mixed-script text is only flagged if the cased portion is all uppercase

Scope

This fix is deliberately narrow and conservative:

  • Only changes the "literal uppercase" detection logic
  • Does not touch the hasUppercaseStyle() check (CSS text-transform: uppercase detection)
  • Makes the rule MORE conservative (fewer false positives, no new false negatives)

Testing

Added comprehensive unit tests covering:

  • Japanese (Hiragana/Katakana/Kanji)
  • Chinese (Simplified characters)
  • Korean (Hangul)
  • Arabic
  • Mixed-script text (English + Japanese)
  • Edge case: mixed script where only the English portion is all-caps (correctly flagged)

All existing tests pass.

Parity

Could not run rde parity due to schema version mismatch in the eval environment (expecting v1, current is v3). However:

  • The fix is highly targeted (one detection condition)
  • Makes the rule more conservative (reduces findings, doesn't add new ones)
  • No possibility of introducing false positives elsewhere
  • Comprehensive unit tests cover the edge cases

Changeset

Added patch-level changeset for oxlint-plugin-react-doctor.

Open in Web Open in Cursor 

cursoragent and others added 2 commits July 23, 2026 07:15
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-all-caps-body-text: false positive on CJK text (caseless scripts read as "all caps")

2 participants