Skip to content

Commit

Permalink
tidy: Check TOML format
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 22, 2024
1 parent bf0da83 commit d42e9cc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Taplo configuration
# https://taplo.tamasfe.dev/configuration/formatter-options.html

[formatting]
align_comments = false
allowed_blank_lines = 1
array_auto_collapse = false
array_auto_expand = false
indent_string = " "
15 changes: 15 additions & 0 deletions tools/tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,21 @@ if [[ -n "$(git ls-files '*.yaml')" ]]; then
git ls-files '*.yaml'
fi

# TOML (if exists)
if [[ -n "$(git ls-files '*.toml')" ]]; then
info "checking TOML style"
if [[ ! -e .taplo.toml ]]; then
warn "could not found .taplo.toml in the repository root"
fi
if type -P npm &>/dev/null; then
echo "+ npx -y @taplo/cli fmt \$(git ls-files '*.toml')"
npx -y @taplo/cli fmt $(git ls-files '*.toml')
check_diff $(git ls-files '*.toml')
else
warn "'npm' is not installed; skipped TOML style check"
fi
fi

# Markdown (if exists)
if [[ -n "$(git ls-files '*.md')" ]]; then
info "checking Markdown style"
Expand Down

0 comments on commit d42e9cc

Please sign in to comment.