numtide / treefmt-nix

treefmt nix configuration
https://numtide.github.io/treefmt/
MIT License
270 stars 83 forks source link

feat(programs): add dart format #231

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.

dart format follows the formatter-spec

Using the treefmt.toml configuration works:

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

As i struggled with the config (see https://github.com/numtide/treefmt/issues/410) I would like to add it to the examples

JakobLichterfeld commented 2 months ago

During execution of examples.sh a new warning is added:

trace: evaluation warning: getExe: Package "dart-3.5.1" does not have the meta.mainProgram attribute. We'll assume that the main program has the same name for now, but this behavior is deprecated, because it leads to surprising errors when the assumption does not hold. If the package has a main program, please set `meta.mainProgram` in its definition to make this warning go away. Otherwise, if the package does not have a main program, or if you don't control its definition, use getExe' to specify the name to the program, such as lib.getExe' foo "bar".

But

  meta = {
    mainProgram = "dart";
  };

results in error: The option 'meta.mainProgram' does not exist.

brianmcgee commented 2 months ago

The warning about meta.mainProgram is coming from the dart package in nixpkgs.

I created a PR to update it, but it's just a warning.