benjamn / benjamn/ast-types

`export default class {}` breaks scope analysis

Open
#302 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

The lack of `.id` in an `export` ClassDeclaration causes a throw in scope analysis:

https://runkit.com/embed/rz8r6io0kclh (compares with and without providing a name)

The throw originates from:

https://github.com/benjamn/ast-types/blob/a7eaba5ecc79a58acb469cbbf9fe7603cec9f57e/lib/scope.js#L240

I suspect the fix might be the same as for FunctionDeclaration a couple of lines before, haven't verified this yet:

https://github.com/benjamn/ast-types/blob/a7eaba5ecc79a58acb469cbbf9fe7603cec9f57e/lib/scope.js#L235

Edit: I have a patch for this locally with a test, seeking approval to send the PR.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.