Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore ".prettierignore" when calling prettier on a single file #12494

Open
EdmundsEcho opened this issue Mar 20, 2022 · 1 comment
Open

Ignore ".prettierignore" when calling prettier on a single file #12494

EdmundsEcho opened this issue Mar 20, 2022 · 1 comment

Comments

@EdmundsEcho
Copy link

Prettier is a great productivity tool. Thank you so much. I've expanded my use of the tool when i have to work on not just js and the like, but now html, css, json etc... Great stuff.

I came across a counter-intuitive behavior. This is related to #10395, however, the recommendation might address the root cause more explicitly (not to be confused with draconian :)).

When calling prettier onto a single buffer or file, perhaps there might be a way to ignore the .prettierignore file (double negative = positive). This might be accomplished by having a flag that ignores the ignore file (e.g., --force).

The IDEs, plugins, dev-pipelines and the like that enable prettier wouldn't be impacted by the change unless they opted-in to reading the flag. On the other hand, by opting-in, the flag would allow the plugins and CLIs to ignore the .prettierignore file when they deemed it appropriate e.g., when explicitly setting prettier to check a file. To limit the use it might be something that can only be called (not something set in a configuration).

This behavior would be a norm consistent with how the options set when calling a binary take precedence over the same settings in a configuration file.

All in all, the behavior "as is" was counter-intuitive to me; it took a few folks a while to realize what was going on. When setting things up there is a long list of reasons things might not work as expected. The .prettierignore file wasn't even on the list! :))

@zhennann
Copy link

just like this:

prettier --write --ignore-path null fileName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants