question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run prettier on generated code.

See original GitHub issue

Prettier is already imported. I see no disadvantages to use it for generated code. That will correct all ugly linebreaks produced

  1. 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"
    });
}
  1. apply prettifyTypescript in all writers before writing TS-code.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
anymaniaxcommented, May 23, 2021

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.

1reaction
anymaniaxcommented, Feb 4, 2022

yep, it’s a bug need to find a better solution for this

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found