deno icon indicating copy to clipboard operation
deno copied to clipboard

Allow different fmt options for specific file types

Open injust opened this issue 1 year ago • 1 comments

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.

injust avatar Oct 16 '24 21:10 injust

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.

injust avatar Oct 16 '24 21:10 injust

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"
		]
	},

AlexanderOMara avatar Dec 07 '24 19:12 AlexanderOMara