deno
deno copied to clipboard
Allow different fmt options for specific file types
I use these fmt options in my deno.json:
{
"fmt": { "indentWidth": 4, "semiColons": false, "singleQuote": true }
}
I just upgraded to Deno 2 and now deno fmt formats my YAML files too, which is great!
Except it forces them to be indented with 4 spaces 😦
It should be possible to configure/override fmt options for specific file types.
Right now, I think the only workaround is to exclude my YAML files, which is a bummer.
I also can't figure out a wildcard pattern to exclude all .yml files. **/*.yml doesn't match files in .github/.
I ended up having to to exclude .github/**/*.yml specifically.
Ugh, yeah, this is very unpleasant.
I think dot directories are already excluded by the CLI, but something must have changed in the VS Code extension or CLI because VS Code has started formatting those files anyway.
Adding this deno.json does at-least prevent that issue.
"fmt": {
"exclude": [
"**/*.yaml",
"**/*.yml",
".*/**/*.yaml",
".*/**/*.yml"
]
},