How to print all `Properties` in a `ObjectPattern` in the same line?
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
Hi, I'm trying to modify my code, and converting a `variableDeclarator` into an `arrowFunctionExpression` like this:
http://astexplorer.net/#/JxZcRETnjv
As you can see, each `Property` in the `ObjectPattern` passed as params to the arrow function is put in a new line, even though I'm specifying the template string for them to be in the same line:
``` js
return statement`
generateStyles = ({theme, palette, geometry}) => ${body}
`;
```
gives:
``` js
generateStyles = (
{
theme,
palette,
geometry,
},
) => ({
...body...
});
```
I looked at the options available in recast, but couldn't find one which forces params to be in one line. Is there a way to do this?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the AST Explorer example linked in the issue and inspect how recast prints the arrow function's ObjectPattern parameters. Read the available recast printing options and the template-string usage shown in the report. Done means identifying a supported way to keep the destructured parameters on one line, or documenting that no such option exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100