benjamn / benjamn/recast

Leading comment removed from consequent of ConditionalExpression

Open
#509 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.3k
Forks
364
Avg merge
3d 8h
Merged PRs (30d)
3

Description

When a `ConditionalExpression` is modified, the printer may remove a leading comment from the consequent/left side of the expression. This does not happen to comments on the alternate/right side of the expression.

I created [this example](http://astexplorer.net/#/gist/0a3ad62148aeacd8efce2c2228a1bd07/a6e7b19b4810e24dd849abd6e845a4db85910e7b) to reproduce the issue using `jscodeshift` to transform the code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the AST Explorer reproduction linked in the issue and trace how the printer handles a modified ConditionalExpression, comparing the consequent/left side with the alternate/right side. Confirm the behavior with a focused regression test; done means modifying the expression preserves leading comments on both sides.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.