Skip to content

Quality: Locale-sensitive lowercasing can break module detection#4000

Draft
tuanaiseo wants to merge 1 commit intojsx-eslint:masterfrom
tuanaiseo:contribai/improve/quality/locale-sensitive-lowercasing-can-break-m
Draft

Quality: Locale-sensitive lowercasing can break module detection#4000
tuanaiseo wants to merge 1 commit intojsx-eslint:masterfrom
tuanaiseo:contribai/improve/quality/locale-sensitive-lowercasing-can-break-m

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The rule checks require()/import source names using pragma.toLocaleLowerCase(). Locale-sensitive casing can produce incorrect results in some locales (for example Turkish casing), causing false negatives/positives when resolving React pragma imports.

Severity: medium
File: lib/util/isDestructuredFromPragmaImport.js

Solution

Replace toLocaleLowerCase() with toLowerCase() for stable, locale-independent module name normalization.

Changes

  • lib/util/isDestructuredFromPragmaImport.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The rule checks `require()`/`import` source names using `pragma.toLocaleLowerCase()`. Locale-sensitive casing can produce incorrect results in some locales (for example Turkish casing), causing false negatives/positives when resolving React pragma imports.

Affected files: isDestructuredFromPragmaImport.js

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.74%. Comparing base (012ec39) to head (902512e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4000      +/-   ##
==========================================
+ Coverage   97.58%   97.74%   +0.15%     
==========================================
  Files         137      137              
  Lines       10182    10182              
  Branches     3795     3795              
==========================================
+ Hits         9936     9952      +16     
+ Misses        246      230      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be intentional - but either way, we’d need regression tests

@ljharb ljharb marked this pull request as draft April 8, 2026 03:21
@ljharb
Copy link
Copy Markdown
Member

ljharb commented Apr 8, 2026

Also, please be sure any LLM usage is for your own edification and not to generate comments and code :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants