aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-10-11 09:15:20 -0400
committerEugene Triguba <hello@eugenetriguba.com>2025-10-11 09:15:20 -0400
commit5417e742982e3c24f5679e9952fcb88d05ee76e4 (patch)
treeb19dc462660dddc8e2ae2f40f6462ccd34a4d6de
parentAdjust variable placement in test.sh (diff)
downloadcli-5417e742982e3c24f5679e9952fcb88d05ee76e4.zip
Add .editorconfig to remove some shfmt flags in scripts
-rw-r--r--.editorconfig25
-rwxr-xr-xscripts/format.sh4
-rwxr-xr-xscripts/lint.sh2
3 files changed, 28 insertions, 3 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b5949b4
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,25 @@
+# https://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{sh,bash}]
+indent_style = space
+indent_size = 2
+# switch_case_indent: true is equivalent to -ci flag in shfmt
+switch_case_indent = true
+
+[*.go]
+indent_style = tab
+indent_size = 4
+
+[*.{yml,yaml}]
+indent_style = space
+indent_size = 2
+
+[*.{md,markdown}]
+trim_trailing_whitespace = false
diff --git a/scripts/format.sh b/scripts/format.sh
index 5a9ee8b..b6a875e 100755
--- a/scripts/format.sh
+++ b/scripts/format.sh
@@ -82,10 +82,10 @@ format_shfmt() {
fi
local unformatted
- unformatted=$(shfmt -l -i 2 -ci scripts/)
+ unformatted=$(shfmt -l scripts/)
if [[ -n "$unformatted" ]]; then
log_step "Formatting files with shfmt..."
- shfmt -w -i 2 -ci scripts/
+ shfmt -w scripts/
log_success "shfmt completed"
return 0
fi
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 6c991e2..63cdb0e 100755
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -103,7 +103,7 @@ lint_shfmt() {
fi
local unformatted
- unformatted=$(shfmt -l -i 2 -ci scripts/)
+ unformatted=$(shfmt -l scripts/)
if [[ -n "$unformatted" ]]; then
log_error "The following files are not formatted:"
echo "$unformatted"