numtide / treefmt-nix

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

Add leptosfmt #108

Closed srid closed 1 year ago

srid commented 1 year ago

Resolves #106

srid commented 1 year ago

Tested in https://github.com/juspay/nix-browser/commit/ea612562bd9d6a7077905f891ee2300df641840c

srid commented 1 year ago

It touches the file but doesn't modify it. Is that a problem?

image
zimbatm commented 1 year ago

yeah, that means it doesn't pass (2) of the spec: https://numtide.github.io/treefmt/formatters-spec/#2-write-to-changed-files

treefmt relies on the file mtime to detect if there was a file change

srid commented 1 year ago

I see. I've filed https://github.com/bram209/leptosfmt/issues/64

I suppose meanwhile I can improve the bash script to do a leptosfmt --stdin < src/app.rs > $TMPDIR/output and then manually write back the file only if it is changed?

Aside: would be nice to have the CI check for this.

zimbatm commented 1 year ago

yeah it's going to be pretty slow, but sure.

I agree, it might be a good time to extend the test framework and add samples for each formatter.

srid commented 1 year ago

This PR should be ready to go. The wrapper is doing a couple of things; we can remove it after the two linked issues are resolved upstream.