summary refs log tree commit diff stats
path: root/treefmt.nix
blob: 794e8fc6f3e126c98117b0af395563d2764fe35d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
  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 = {
        enable = true;
        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 = false;
          trailingComma = "all";
          useTabs = false;
          vueIndentScriptAndStyle = false;

          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"];
        };
      };
    };
  }
)