benjamn / benjamn/recast

Force arrow functions to be one-line?

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

Description

I'm using jscodeshift to convert React string refs to arrow functions.

My input looks like this:
```jsx
();
```

And my output looks like this:
```jsx
( {
this.refTest = ref;
}} />);
```

But, I really want it to look like this:
```jsx
( { this.refTest = ref; }} />);
```

Is there any way to force arrow functions to be one-line?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the jscodeshift conversion from the issue and inspect recast's pretty-printing behavior for arrow functions with block bodies. Compare the current multiline JSX output with the requested one-line form, then verify the formatter preserves that wording without changing other output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.