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
config option to ignore paths #4708
Comments
May be worth mentioning that one of the benefits for allowing this is to improve the usage of shareable Prettier configs. My team has a shareable Prettier config that we're using across our packages, but we still need to create separate |
When running Prettier in a directory, I believe it will look for I believe, in addition to merging rc & ignore, this issue would also allow me to eliminate duplicate ignores by centralizing them under one .eslintrc.js
.prettierrc.js
.prettierignore # separate file
admin/.prettierignore # duplicate
common/.prettierignore # duplicate
docs/.prettierignore # duplicate
functions/prettierignore # duplicate
hosting/.prettierignore # duplicate |
At this moment, for practical reasons, The current options make it very hard to use prettier or to adopt prettier on bigger codebases as reformatting cannot happen over the night, it can easily take many months, especially if you happen to have at least one developer in the team that dislikes formatters. They will do their best to fight every related change. |
Is this a feature someone can work on or does the team not want this option? |
Yeah, would really appreciate this feature, having to duplicate .prettierignore for each leave package in a monorepo is inconvenient |
The worst part is that the prettierignore would always have to extend the already existing gitignore file. If we would use gitignore implicitly and add extra ignores from config file, we could avoid having two files for prettier at repository root. |
Direct copy of .gitignore. Hopefully can get rid of this file again one day, see prettier/prettier#4708
Everyone loves this request. I'd be happy to implement this if the core team can agree it'll get merged @prettier 🙏 I need fewer files at the root of the project. |
@prettier is there a way we can see this implemented? It is not a breaking change, and it will make a lot of people life's easier by allowing them to share their ignored paths, and easily picked by other tools (IDE extensions, other libraries relying on prettier, etc). |
|
I found two alternative workarounds until this feature is implemented. Opt 1: Exclude files using Prettier's
|
My use case involves both However, if you run |
This is particularly interesting to us as we have a centralised .prettierrc. This way we don't have copy/maintain .prettierignore across projects. |
Someone should take this on. It seems like a lot of people want this (including us) I won't have any power to merge or push this along, but it's certainly something many want with no visible downsides when executed properly using standard conventions the way other tools do this. |
I really want this because prettier config files can be extended but single ignore file cannot be extend |
Worth noting that this issue is about 5 years old. |
5 years of a want is a long time. That should have no bearing on prioritizing though. The @prettier team has not yet said whether they would even consider this, thus discouraging people from even wanting to try to implement it |
A possible fix is to add a new parser type that ignores files. Then ignoring files could be done like, e.g.: {
"overrides": [
{ "files": ["dist/**/*.js"], "options": { "parser": "ignore" } }
]
} |
@fisker Any chance this can be considered? I'm looking to remove all For example, I can remove ESLint's If everything can be moved into a JS config file, it works better with projects with nested directories. And it eliminates the need for a |
It's desirable to place rules for ignoring/excluding paths in
.prettierrc
rather than in.prettierignore
, so that configuration for Prettier is self-contained within a single file.(Of secondary concern, the
prettier-vscode
extension should soon support configuring the location of.prettierrc
, but not.prettierignore
. In general, more configuration files are just harder to deal with.)For prior art, consider TypeScript's
exclude
configuration option:The text was updated successfully, but these errors were encountered: