summary refs log tree commit diff stats
path: root/treefmt.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-05 15:38:58 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-05 15:38:58 +0200
commitaa1881d9d41fa7ee5b649b835379f6f60fb2240c (patch)
tree2415ec0538ef91a8c4dd9d62c0ce5a669859f3f4 /treefmt.nix
downloadsatzung-aa1881d9d41fa7ee5b649b835379f6f60fb2240c.tar.gz
satzung-aa1881d9d41fa7ee5b649b835379f6f60fb2240c.zip
chore: Init
Diffstat (limited to 'treefmt.nix')
-rw-r--r--treefmt.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/treefmt.nix b/treefmt.nix
new file mode 100644
index 0000000..1cbab40
--- /dev/null
+++ b/treefmt.nix
@@ -0,0 +1,73 @@
+{
+  treefmt-nix,
+  pkgs,
+}:
+treefmt-nix.lib.evalModule pkgs (
+  {pkgs, ...}: {
+    # Used to find the project root
+    projectRootFile = "flake.nix";
+
+    programs = {
+      alejandra.enable = true;
+      rustfmt.enable = true;
+      clang-format.enable = true;
+      mdformat.enable = true;
+      shfmt = {
+        enable = true;
+        indent_size = 4;
+      };
+      shellcheck.enable = true;
+      prettier = {
+        settings = {
+          arrowParens = "always";
+          bracketSameLine = false;
+          bracketSpacing = true;
+          editorconfig = true;
+          embeddedLanguageFormatting = "auto";
+          endOfLine = "lf";
+          # experimentalTernaries = false;
+          htmlWhitespaceSensitivity = "css";
+          insertPragma = false;
+          jsxSingleQuote = true;
+          printWidth = 80;
+          proseWrap = "always";
+          quoteProps = "consistent";
+          requirePragma = false;
+          semi = true;
+          singleAttributePerLine = true;
+          singleQuote = true;
+          trailingComma = "all";
+          useTabs = false;
+          vueIndentScriptAndStyle = false;
+
+          tabWidth = 4;
+          overrides = {
+            files = ["*.js"];
+            options.tabwidth = 2;
+          };
+        };
+      };
+      stylua.enable = true;
+      ruff = {
+        enable = true;
+        format = true;
+      };
+      taplo.enable = true;
+    };
+
+    settings = {
+      global.excludes = [
+        "CHANGELOG.md"
+        "NEWS.md"
+      ];
+      formatter = {
+        clang-format = {
+          options = ["--style" "GNU"];
+        };
+        shfmt = {
+          includes = ["*.bash"];
+        };
+      };
+    };
+  }
+)