Add Check Option to Format CLI Command
See original GitHub issueProblem
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:
- Created 3 years ago
- Reactions:10
- Comments:5 (2 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
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 thatprisma 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)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?