diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-02 13:23:21 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-02 13:24:38 +0200 |
commit | c8d70c2f2e2e6eeffa3be301b3d455802cf2565a (patch) | |
tree | f462f7154db6618535c5671ba277ebaf58cd194a /common/files/treefmt.nix | |
parent | fix(common): Remove the last occurrences of hard coded values (diff) | |
download | flake-templates-c8d70c2f2e2e6eeffa3be301b3d455802cf2565a.tar.gz flake-templates-c8d70c2f2e2e6eeffa3be301b3d455802cf2565a.zip |
refactor(common): Move all data files to `./common/files`
Diffstat (limited to 'common/files/treefmt.nix')
-rw-r--r-- | common/files/treefmt.nix | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/common/files/treefmt.nix b/common/files/treefmt.nix new file mode 100644 index 0000000..1cbab40 --- /dev/null +++ b/common/files/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"]; + }; + }; + }; + } +) |