-
-
Notifications
You must be signed in to change notification settings - Fork 17
fix: add missing loc, comments, tokens properties in JS
#280
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for eslint-code-explorer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
loc, comment, tokens properties in JSloc, comments, tokens properties in JS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for location information, comments, and tokens in the JavaScript code explorer's AST visualization by enabling additional parsing options in espree. The change aligns the code explorer's behavior with ESLint's default parser configuration.
Key changes:
- Enabled
loc,comment, andtokensoptions in espree parser configuration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I’ll leave it open for a while in case there are any additional inputs.
Prerequisites checklist
What is the purpose of this pull request?
In this PR, I've added the missing
loc,comments, andtokensproperties to the JavaScript code explorer.In ESLint, the default
espreeparser inserts theloc,comments, andtokensproperties into the resulting AST, as shown in the example below:https://github.com/eslint/eslint/blob/main/lib/languages/js/index.js#L250-L254
However, the Code Explorer's current
espreeparser doesn't include these properties, so working on JavaScript-related features is somewhat inconvenient and the AST appears incorrect because some properties are missing.So, I've enabled the
loc,comments, andtokensoptions inespreeto display these properties. Here's a brief before-and-after comparison:Before
After
What changes did you make? (Give an overview)
In this PR, I've added the missing
loc,comments, andtokensproperties to the JavaScript code explorer.Related Issues
Ref: eslint/eslint#20259
Is there anything you'd like reviewers to focus on?
N/A