numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
592 stars 37 forks source link

Parse hidden files #153

Open loicreynier opened 2 years ago

loicreynier commented 2 years ago

I am not sure if this is intended or not, but hidden files are not formatted while running treefmt in the project root directory. I do not see why hidden files, which are generally configuration files should not be formatted.

Describe the solution you'd like

I would like to have hidden files formatted while running treefmt in the project root directory.

Describe alternatives you've considered

Currently hidden files can be formatted by passing them as command line arguments as in

treefmt .pre-commit-config.yaml
zimbatm commented 2 years ago

It's something that comes default with the ignore crate. It's quite convenient as some of the hidden folders like .git wouldn't make sense to traverse.

I think this should stay the default but still look at hidden files IFF they are listed explicitly in the config.

loicreynier commented 2 years ago

I agree with you, I did not think about the hidden directories and yes a better alternative is having the following configuration file:

[formatter.prettier]
command = "prettier"
options = ["--write"]
includes = [
    ".pre-commit-config.yaml",
    "*.yaml",
]
sevenautumns commented 1 year ago

@zimbatm please reopen. prettier is nice to format github workflow files. right now this does not seem to work for explicitly listed files in the config

nokazn commented 1 year ago

I think this should stay the default but still look at hidden files IFF they are listed explicitly in the config.

I agree with your idea, but now even if hidden files are listed in includes option they are not formatted. It would be good to specifying hidden files explicitly overrides this default behavior.

Edited: This issue seems to resolve for me by #250.