Bug: new-cap doesn't report names starting with an astral letter
Author: sary8Created Sep 26, 2026Updated Sep 26, 2026
Labelsbugruleacceptedrepro:yes
This issue was created with AI (Claude Fable 5.1, Claude Opus 5.5).
Environment
Node version: v25.2.1 npm version: v11.6.2 Local ESLint version: v10.11.0 (Currently used) Global ESLint version: Not found Operating System: win32 10.0.26200
What parser are you using?
Default (Espree)
What did you do?
/*eslint new-cap: "error"*/
new φ(); // reported
new (); // not reported
Φ(); // reported
(); // not reportedand are Deseret letters (U+10428, U+10400), so each one is a surrogate pair.
What did you expect to happen?
All four calls should be reported.
What actually happened?
3:5 error A constructor name should not start with a lowercase letter new-cap
6:1 error A function with a name starting with an uppercase letter should only be used as a constructor new-cap
✖ 2 problems (2 errors, 0 warnings)Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.
AI acknowledgment
- I did not use AI to generate this issue report.
- (If the above is not checked) I have reviewed the AI-generated content before submitting.
Additional comments
getCap() uses str.charAt(0), which returns only the high surrogate (\uD801) for these names, so they end up as "non-alpha":
const [firstChar] = str; would fix it.
Source: eslint/eslint