-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreefmt.toml
More file actions
79 lines (75 loc) · 1.71 KB
/
treefmt.toml
File metadata and controls
79 lines (75 loc) · 1.71 KB
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
71
72
73
74
75
76
77
78
79
# treefmt configuration
# Validates shell scripts, GitHub workflows, and process-compose configs
#
# Usage:
# treefmt # Run validators on all files
# treefmt --fail-on-change # Exit 1 if any file fails validation
# treefmt path/to/file # Validate specific file
#
# Devbox scripts:
# devbox run format # Run all validators
# devbox run format:check # Run validators, exit 1 on failure
# devbox run lint # Alias for format:check
#
# Git hook integration:
# Add to .git/hooks/pre-commit:
# #!/bin/sh
# exec treefmt --fail-on-change
[global]
# Use git to walk files, which respects .gitignore
walk = "git"
excludes = [
"*.md",
"*.lock",
"*.json",
".devbox/*",
"devbox.d/*",
"node_modules/*",
"examples/*/node_modules/*",
"test-results/*",
"tests/test-results/*",
"reports/*",
]
# Shellcheck for shell scripts
[formatter.shellcheck]
command = "sh"
options = ["-c", "shellcheck -S warning \"$@\" || exit 0", "--"]
includes = ["*.sh"]
excludes = []
# GitHub Actions workflow validator
[formatter.workflows]
command = "sh"
options = [
"-c",
'''
for file in "$@"; do
if ! act -W "$file" -l > /dev/null 2>&1; then
echo "✗ $file has syntax errors" >&2
exit 1
fi
done
''',
"--"
]
includes = [".github/workflows/*.yml", ".github/workflows/*.yaml"]
excludes = []
# Process-compose config validator
[formatter.process-compose]
command = "sh"
options = [
"-c",
'''
for file in "$@"; do
if ! process-compose -f "$file" --dry-run > /dev/null 2>&1; then
echo "✗ $file has syntax errors" >&2
exit 1
fi
done
''',
"--"
]
includes = [
"tests/process-compose*.yaml",
"examples/*/tests/*.yaml",
]
excludes = []