From 26dbc30f4c0625fbefd2c2ec25d6c981bc7c972c Mon Sep 17 00:00:00 2001 From: dfh Date: Fri, 2 Aug 2024 20:11:16 +0000 Subject: [PATCH] feat: Add editorconfig If prettier is called via treefmt-nix it does not source .editorconfig files per default, hence the integration is enabled explicitly. --- .editorconfig | 17 +++++++++++++++++ treefmt.nix | 12 ++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a6a006f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true +end_of_line = lf +insert_final_newline = true +indent_style = tabs + +[*.nix] +indent_size = 2 +indent_style = space + +[*.md] +indent_size = 2 +trim_trailing_whitespace = false + diff --git a/treefmt.nix b/treefmt.nix index e96f245..75e6698 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -3,7 +3,10 @@ _: { projectRootFile = "flake.nix"; # Files not to format. - settings.global.excludes = [ "LICENSE" ]; + settings.global.excludes = [ + ".editorconfig" + "LICENSE" + ]; # nix programs.nixfmt.enable = true; # As of 2024-07-30 this is nixfmt-rfc-style. @@ -11,5 +14,10 @@ _: { programs.deadnix.enable = true; # markdown - programs.prettier.enable = true; + programs.prettier = { + enable = true; + settings = { + editorconfig = true; + }; + }; }