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.

Add Check Option to Format CLI Command

See original GitHub issue

Problem

Currently, one can only format a schema using prisma format but can’t validate the schema is formatted, in CI for example.

Suggested solution

Add a --check option to the CLI for validating the schema is properly formatted.

Alternatives

Add integration with Prettier which already has this functionality as described here: https://github.com/prisma/prisma/issues/1761

Additional context

In https://github.com/amplication/amplication we are currently struggling with keeping consistent formatting of our Prisma Schema file. I can write a script to validate it in our CI but I think this functionality is relevant for more users and would be much simpler to implement if it was part of the CLI.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
iddancommented, Feb 23, 2022

In prettier I have a command to validate the code is formatted correctly: prettier --check (https://prettier.io/docs/en/cli.html#--check). I thought it would make sense that prisma format will have a way to validate the schema is formatted correctly and if not it will return status code 1 (so it can fail CI)

0reactions
janpiocommented, Feb 10, 2022

Still do not fully get it. Do you want a command that tells you true/false if a schema is already formatted or not? Or something else?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI - Prettier
When you want to check if your files are formatted, you can run Prettier with the --check flag (or -c ). This will...
Read more >
CLI Command Reference - checkov
--add-check, Generate a new check via CLI prompt ; -f, --file FILE, File to scan (can not be used together with –directory). With...
Read more >
Setting the AWS CLI output format - AWS Documentation
This topic describes the different output formats for the AWS Command Line Interface (AWS CLI). The AWS CLI supports the following output formats:...
Read more >
dotnet format command - .NET CLI - Microsoft Learn
Verifies that no formatting changes would be performed. Terminates with a non zero exit code if any files would have been formatted. --include...
Read more >
wp option | WP-CLI Command
Retrieves and sets site options, including plugin and WordPress settings. ... See the Plugin Settings API and the Theme Options for more information...
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