numtide / treefmt

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

feat: add dart format support #410

Closed JakobLichterfeld closed 2 months ago

JakobLichterfeld commented 2 months ago

As a user I do want to lint my dart code with treefmt multiplexer as well.

imo dart format follows the formatter-spec

Using the treefmt.toml configuration:

[formatter.dart]
command = "dart format"
options = []
includes = [ "*.dart" ]

results in treefmt: error: formatter command not found in PATH: failed to initialise formatter: dart even if dart format is present in $PATH

Happy to do a PR once pushed in the right direction.

a-kenji commented 2 months ago

Did you try:

[formatter.dart]
command = "dart"
options = ["format"]
includes = [ "*.dart" ]

?

JakobLichterfeld commented 2 months ago

Did you try:

[formatter.dart]
command = "dart"
options = ["format"]
includes = [ "*.dart" ]

?

Works like a charm. Ty!

Sometimes the most obvious is hard to see. I tried several combinations before posting, but obviously not this one.

Will add it to examples, see https://github.com/numtide/treefmt-nix/issues/231