Run prettier on generated code.
See original GitHub issuePrettier is already imported. I see no disadvantages to use it for generated code. That will correct all ugly linebreaks produced
- add
src/utils/formatter.ts
import Prettier from 'prettier';
export function prettifyTypescript(data){
return Prettier.format(data, {
parser: 'typescript',
"useTabs": false,
"tabWidth": 4,
"singleQuote": true,
"semi": true,
"printWidth": 100,
"trailingComma": "all",
"proseWrap": "never"
});
}
- apply
prettifyTypescript
in all writers before writing TS-code.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Install - Prettier
In addition to running Prettier from the command line ( prettier --write ), checking formatting in CI, and running Prettier from your editor,...
Read more >Study using Prettier to format generated code #6379 - GitHub
We spend a lot of time to generate well-formatted code. Prettier is a source code formatter, available as a Node module: it should...
Read more >How to Add Prettier to a Project - Bits and Pieces
Prettier is a code formatter that automatically adjusts your code to adhere to well-defined conventions. Using tools like this is a great way...
Read more >How to Format All Files in a Directory with Prettier
From the directory you want to format, run Prettier with --write : prettier --write . This will format the entire directory recursively with ......
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
You can configure JavaScript code auto-formatting with Prettier to work per-project. This allows you to get a consistent formatting without ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Prettier is use as dev dependency at the moment. That’s a new feature that can be added but should be config in the orval config file. Also could be good to try to find a prettier config in the project and not only apply a custom config.
yep, it’s a bug need to find a better solution for this