Skip to content

Proposal: --check-ast --write #3512

@rattrayalex

Description

@rattrayalex

When adding prettier to a large codebase for the first time, it is important to be extremely careful. While I generally trust prettier to not break my code, I'd like to be sure.

I currently have a command that does, essentially, prettier --debug-check 'files' && prettier --write 'files', but debug-check raises a lot of issues I don't care about (namely, prettier(x) != prettier(prettier(x)) and a select few "safe" AST modifications (like <span> hi</span> to <span>{' '}hi</span>).

Instead, it would be nice to be able to run prettier with --write but throw an error instead of writing if the input ast does not equal the output ast, modulo whitelisted deviances like {' '}.

I recognize that this would be slower 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliIssues with Prettier's Command Line Interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions