From 6ade2432600e6db1c1db6050e48df0b3d9f601df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Jul 2024 15:29:43 +0200 Subject: [PATCH] apply treefmt fix to respect global excludes --- flake.nix | 7 ++++++- treefmt-config.patch | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 treefmt-config.patch diff --git a/flake.nix b/flake.nix index 66a0c44..fa6e1d8 100644 --- a/flake.nix +++ b/flake.nix @@ -58,16 +58,21 @@ lib, self', system, + pkgs, ... }: { treefmt = { + package = pkgs.treefmt.overrideAttrs (_old: { + # https://github.com/numtide/treefmt/pull/325 + patches = [ ./treefmt-config.patch ]; + }); projectRootFile = ".git/config"; programs.terraform.enable = true; programs.shellcheck.enable = true; programs.deno.enable = true; - settings.formatter.deno.excludes = [ + settings.global.excludes = [ # generated files "sops/*" "terraform.tfstate" diff --git a/treefmt-config.patch b/treefmt-config.patch new file mode 100644 index 0000000..3e3f5b4 --- /dev/null +++ b/treefmt-config.patch @@ -0,0 +1,23 @@ +From 43b15f8757a7f8de0340cc977ff9619741a5d43f Mon Sep 17 00:00:00 2001 +From: Brian McGee +Date: Mon, 1 Jul 2024 14:20:22 +0100 +Subject: [PATCH] fix: configure toml key for global excludes + +Signed-off-by: Brian McGee +--- + config/config.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/config.go b/config/config.go +index d9e281f..be5c991 100644 +--- a/config/config.go ++++ b/config/config.go +@@ -10,7 +10,7 @@ import ( + type Config struct { + Global struct { + // Excludes is an optional list of glob patterns used to exclude certain files from all formatters. +- Excludes []string ++ Excludes []string `toml:"excludes"` + } + Formatters map[string]*Formatter `toml:"formatter"` + }