Skip to content

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Dec 26, 2025

Prerequisites checklist

What is the purpose of this pull request?

In this PR, I've added the missing loc, comments, and tokens properties to the JavaScript code explorer.

In ESLint, the default espree parser inserts the loc, comments, and tokens properties into the resulting AST, as shown in the example below:

https://github.com/eslint/eslint/blob/main/lib/languages/js/index.js#L250-L254

image

However, the Code Explorer's current espree parser 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, and tokens options in espree to display these properties. Here's a brief before-and-after comparison:

Before

image

After

image

What changes did you make? (Give an overview)

In this PR, I've added the missing loc, comments, and tokens properties to the JavaScript code explorer.

Related Issues

Ref: eslint/eslint#20259

Is there anything you'd like reviewers to focus on?

N/A

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Dec 26, 2025
@netlify
Copy link

netlify bot commented Dec 26, 2025

Deploy Preview for eslint-code-explorer ready!

Name Link
🔨 Latest commit fa3870d
🔍 Latest deploy log https://app.netlify.com/projects/eslint-code-explorer/deploys/694e92c46d87100008505390
😎 Deploy Preview https://deploy-preview-280--eslint-code-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@eslintbot eslintbot added this to Triage Dec 26, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Dec 26, 2025
@lumirlumir lumirlumir marked this pull request as ready for review December 26, 2025 14:07
@lumirlumir lumirlumir requested review from a team and Copilot December 26, 2025 14:07
@lumirlumir lumirlumir changed the title fix: add missing loc, comment, tokens properties in JS fix: add missing loc, comments, tokens properties in JS Dec 26, 2025
Copy link

Copilot AI left a 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, and tokens options in espree parser configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@amareshsm amareshsm left a 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.

@lumirlumir lumirlumir added the accepted There is consensus among the team that this change meets the criteria for inclusion label Dec 27, 2025
@lumirlumir lumirlumir moved this from Needs Triage to Second Review Needed in Triage Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working

Projects

Status: Second Review Needed

Development

Successfully merging this pull request may close these issues.

3 participants