Question: How to add line breaks for every export in ExportNamedDeclaration?
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
Original contents
```javascript
export {
Foo,
};
```
Recasting
```javascript
const b = recast.types.builders;
const exports = ast.program.body[0];
exports.specifiers = [
...exports.specifiers,
b.exportSpecifier(b.identifier('Bar'), b.identifier('Bar')),
];
ast.program.body = [exports];
console.log(recast.print(ast, {trailingComma: true}).code);
```
Result:
```javascript
export { Foo, Bar };
```
Desired:
```javascript
export {
Foo,
Bar,
};
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the example using recast.types.builders and recast.print with the trailingComma option. Inspect how ExportNamedDeclaration nodes are printed, then define and verify the formatting behavior that produces one specifier per line with a trailing comma.
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