prettier / prettier/prettier

Add diff in output of --check (for CI use cases)

Open
#6,885 121 comments 154 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Edit 2025-03-06 by @lydell: This is a very long thread. It starts out with me asking for use cases for this feature. People then provide use cases over and over. It is clear that this is a wanted feature. There is no need to add more comments about that, but do react with 👍 on this post. There is a pull request https://github.com/prettier/prettier/pull/12598 for this feature, but it is (in my opinion) a bit lacking: https://github.com/prettier/prettier/pull/12598#issuecomment-2338648470. I’m not a maintainer anymore, but it seems to me like a good PR for this would be merged.


More people submit PR for documents in Markdown files or other things via Github web editor. If they make a mistake then the CI fails but there is no chance to inform the user whats wrong.

I see some infos should be with the --debug-check but currently there is no output with this option.

Environments:

  • Prettier Version: 1.18.2
  • Running Prettier via: cli
  • Runtime: node?
  • Operating System: linux

Steps to reproduce:

prettier "**/*.{md,css,scss,yaml,yml,ts}" "--check"

Expected behavior:

Show each error and the changes like with --debug-check here in #4415

Actual behavior:

Show nothing about the errors:

> @ prettier /home/circleci/project
> prettier "**/*.{md,css,scss,yaml,yml,ts}" "--check"

Checking formatting...
docs/contributing/environment.md
Code style issues found in the above file(s). Forgot to run Prettier?

Also there are no more infos available with this commands:

prettier "**/*.{md,css,scss,yaml,yml,ts}" "--debug-check"
prettier "**/*.{md,css,scss,yaml,yml,ts}" "--debug-check" "--check"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Prettier CLI behavior for --check and --debug-check, then read pull request #12598 and its linked review comment to understand the existing approach and remaining concerns. Reproduce the command shown in the issue and compare the desired diagnostic diff with the current output; the work is done when --check reports the relevant changes for CI users.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.