Skip to content

fix: set espree range: true to fix scope crash#127

Merged
amareshsm merged 1 commit into
eslint:mainfrom
xbinaryx:fix-scope-analyzer-crash
Aug 13, 2025
Merged

fix: set espree range: true to fix scope crash#127
amareshsm merged 1 commit into
eslint:mainfrom
xbinaryx:fix-scope-analyzer-crash

Conversation

@xbinaryx
Copy link
Copy Markdown
Contributor

@xbinaryx xbinaryx commented Aug 13, 2025

Prerequisites checklist

What is the purpose of this pull request?

Fix a crash in the scope analyzer caused by missing node.range on nodes when parsing JavaScript.

The scope analyzer relies on node.range to be present. In particular, FunctionScope.__isValidResolution reads this.block.body.range[0] and d.name.range[0]. Espree’s default is range: false, so without enabling it, node.range is undefined, and accessing [0] throws Cannot read properties of undefined (reading '0').

Note: As a side effect of enabling range: true, the AST Tree view now displays a range property on each node.

What changes did you make? (Give an overview)

Set range: true in espree.parse so nodes include the range property required by the scope analyzer.

Related Issues

Fixes #125

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

@eslint-github-bot eslint-github-bot Bot added the bug Something isn't working label Aug 13, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 13, 2025

Deploy Preview for eslint-code-explorer ready!

Name Link
🔨 Latest commit 8e05e81
🔍 Latest deploy log https://app.netlify.com/projects/eslint-code-explorer/deploys/689cb9b18a33bc00080021dd
😎 Deploy Preview https://deploy-preview-127--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 Aug 13, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Aug 13, 2025
Copy link
Copy Markdown
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.

LGTM.

Verified it is working as expected - Preview Link

@amareshsm amareshsm merged commit 90a0e3c into eslint:main Aug 13, 2025
9 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Complete in Triage Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Bug: Code Explorer Broken - Error: Cannot read properties of undefined (reading '0')

3 participants