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

Add support to follow .gitignore (or custom .treefmtignore) file for ignoring files or directories? #198

Open
aldoborrero opened this issue Dec 11, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@aldoborrero
Copy link
Contributor

aldoborrero commented Dec 11, 2022

Rationale

Sometimes, you want to exclude directories that don't belong to any specific language but rather because you don't want treefmt to traverse those. As far as I'm aware, you need to exclude those from one specific formatter.

Note: There's global support for ignoring directories.

We can add support to follow the .gitignore options or if .treefmtignore is present, add those directories to the global config.

We can achieve a similar behaviour by leveraging something like gitignore crate.

@aldoborrero aldoborrero added the enhancement New feature or request label Dec 11, 2022
@aldoborrero aldoborrero changed the title Add support .gitignore options? Add support .treefmtignore / .gitignore / ignoring global directories in treefmt.toml options? Dec 11, 2022
@aldoborrero aldoborrero changed the title Add support .treefmtignore / .gitignore / ignoring global directories in treefmt.toml options? Add support to follow .gitignore (or custom .treefmtignore) file for ignoring files or directories? Dec 11, 2022
@zimbatm
Copy link
Member

zimbatm commented Dec 11, 2022

At the moment it looks for .ignore files during the tree traversal if I'm not mistaken, per the ignore crate. I think it can be extended to also load .gitignore files?

I think the big question is: are there cases where you want to treefmt a file that is not in git? If yes, then it would be circumventing that use case.

@zimbatm
Copy link
Member

zimbatm commented Dec 11, 2022

Related to #154 and #182

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

No branches or pull requests

2 participants