From f89595f7c614f5e86b08a0058d5505afba9999c2 Mon Sep 17 00:00:00 2001 From: fvrings Date: Sun, 6 Jul 2025 12:58:27 +0800 Subject: [PATCH] feat: add qmlformat formatter --- README.md | 3 ++- examples/formatter-qmlformat.toml | 5 +++++ programs/qmlformat.nix | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 examples/formatter-qmlformat.toml create mode 100644 programs/qmlformat.nix diff --git a/README.md b/README.md index 8982bd4..1a6f881 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ functions. -`treefmt-nix` currently supports 111 formatters: +`treefmt-nix` currently supports 112 formatters: * [actionlint](programs/actionlint.nix) * [alejandra](programs/alejandra.nix) @@ -304,6 +304,7 @@ functions. * [prettier](programs/prettier.nix) * [protolint](programs/protolint.nix) * [purs-tidy](programs/purs-tidy.nix) +* [qmlformat](programs/qmlformat.nix) * [rstfmt](programs/rstfmt.nix) * [rubocop](programs/rubocop.nix) * [ruff-check](programs/ruff-check.nix) diff --git a/examples/formatter-qmlformat.toml b/examples/formatter-qmlformat.toml new file mode 100644 index 0000000..b288c0e --- /dev/null +++ b/examples/formatter-qmlformat.toml @@ -0,0 +1,5 @@ +[formatter.qmlformat] +command = "qmlformat" +excludes = [] +includes = ["*.qml"] +options = [] diff --git a/programs/qmlformat.nix b/programs/qmlformat.nix new file mode 100644 index 0000000..de5822e --- /dev/null +++ b/programs/qmlformat.nix @@ -0,0 +1,27 @@ +{ + mkFormatterModule, + ... +}: +{ + meta.maintainers = [ + "fvrings" + ]; + + imports = [ + (mkFormatterModule { + name = "qmlformat"; + mainProgram = "qmlformat"; + package = [ + "kdePackages" + "qtdeclarative" + ]; + args = [ + "-i" + ]; + includes = [ + "*.qml" + ]; + }) + ]; + +}