Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(typescript-estree): the token value of an escaped identifier differs with espree#11116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dbarabashh wants to merge3 commits intotypescript-eslint:main
base:main
Choose a base branch
Loading
fromdbarabashh:fix-token-identifier-unicode

Conversation

dbarabashh
Copy link
Contributor

@dbarabashhdbarabashh commentedApr 29, 2025
edited
Loading

PR Checklist

Overview

Show case 1Show case 2

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@dbarabashh!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@netlifyNetlify
Copy link

netlifybot commentedApr 29, 2025
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitb0b6876
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6815377af6e75100085e5fc6
😎 Deploy Previewhttps://deploy-preview-11116--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify site configuration.

@nx-cloudNx Cloud
Copy link

nx-cloudbot commentedApr 29, 2025
edited
Loading

View yourCI Pipeline Execution ↗ for commitb0b6876.

CommandStatusDurationResult
nx typecheck ast-spec✅ Succeeded3sView ↗
nx run-many --target=build --exclude website --...✅ Succeeded50sView ↗
nx run-many --target=clean✅ Succeeded11sView ↗

☁️Nx Cloud last updated this comment at2025-05-05 15:20:23 UTC

@dbarabashhdbarabashh changed the titlefix(eslint-plugin): decode unicode escapes in identifier tokensfix(eslint-plugin): the token value of an escaped identifier differs with espreeApr 29, 2025
@codecovCodecov
Copy link

codecovbot commentedApr 29, 2025
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.84%. Comparing base(bca8a91) to head(b0b6876).

Additional details and impacted files
@@           Coverage Diff           @@##             main   #11116   +/-   ##=======================================  Coverage   90.84%   90.84%           =======================================  Files         497      497             Lines       50320    50332   +12       Branches     8311     8315    +4     =======================================+ Hits        45714    45726   +12  Misses       4591     4591             Partials       15       15
FlagCoverage Δ
unittest90.84% <100.00%> (+<0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Files with missing linesCoverage Δ
packages/typescript-estree/src/node-utils.ts63.81% <100.00%> (+0.68%)⬆️
🚀 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.

@dbarabashhdbarabashh changed the titlefix(eslint-plugin): the token value of an escaped identifier differs with espreefix(typescript-estree): the token value of an escaped identifier differs with espreeApr 29, 2025
@dbarabashh

This comment was marked as resolved.

@rubiesonthesky

This comment was marked as resolved.

@JoshuaKGoldberg

This comment was marked as resolved.

return String.fromCodePoint(codePoint);
},
);
}

Choose a reason for hiding this comment

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

[Question] I'm not very familiar with these\u shenanigans and don't particularly feel a drive to be. Is there a standard package that does this? If not, maybe it would make sense to make one?

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesMay 2, 2025
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🚀

I would definitely prefer someone like@bradzacher who's more familiar with text parsing review. But from my less-than-expert perspective this all looks great.

expect(unescapeUnicodeIdentifier('\\u00ZZ')).toBe('\\u00ZZ');
expect(unescapeUnicodeIdentifier('\\u{ZZ}')).toBe('\\u{ZZ}');
});
});

Choose a reason for hiding this comment

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

[Testing] Nit: I'm a fan of having one thing under test perit() case. I think it would make sense to split each of these two-paired ones into twoit()s. But I wouldn't block on it, this file already doesn't align to that (and even more so in existing code!).

@JoshuaKGoldbergJoshuaKGoldberg added the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelMay 2, 2025
Copy link
Member

@bradzacherbradzacher left a comment

Choose a reason for hiding this comment

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

my only concern here is that we're going to be doing a regex scan over every singleIdentifier in every single file we parse just so that we can potentially catch one specific edge-case that (a) likely isn't present in 99.9999% of code and (b) likely doesn't impact anyone's lint rules...

acorn gets away with producing a token with the non-encoded character because it is a true parser -- it derives the AST from the tokens it produces.

Truth be told -- I'm honestly not completely sold on us landing this to align with acorn/espree. WDYT @typescript-eslint/triage-team?

@dbarabashh
Copy link
ContributorAuthor

@bradzacher what if add a check before running the regex? Something like:

if(!text.includes('\\u')){returntext;}

this way we keep the compatibility but only run the expensive regex when there's actually a unicode escape. Should solve the performance concern since 99.9% of identifiers will take the fast path. any thoughts?

@JoshuaKGoldbergJoshuaKGoldberg removed the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelMay 5, 2025
@JoshuaKGoldbergJoshuaKGoldberg dismissed theirstale reviewMay 5, 2025 15:26

Brad raises a good point

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

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg left review comments

@bradzacherbradzacherAwaiting requested review from bradzacher

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Bug: The token value of an escaped identifier differs with espree
4 participants
@dbarabashh@rubiesonthesky@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp