chore: Simplify formatting toolchain
Remove treefmt and djlint from pre-commit hooks. djlint corrupted Askama template syntax on first run. Use individual formatters (cargo fmt, shfmt, oxfmt) directly instead. Update prek hooks to use fmt-rs and fmt-sh separately.
This commit is contained in:
parent
527358b695
commit
197f0f541b
4 changed files with 19 additions and 41 deletions
11
.mise.toml
11
.mise.toml
|
|
@ -8,8 +8,7 @@ prek = "latest"
|
||||||
"github:watchexec/cargo-watch" = "latest"
|
"github:watchexec/cargo-watch" = "latest"
|
||||||
shellcheck = "latest"
|
shellcheck = "latest"
|
||||||
flyctl = "latest"
|
flyctl = "latest"
|
||||||
"aqua:numtide/treefmt" = "latest"
|
"aqua:mvdan/sh" = "latest"
|
||||||
"npm:oxfmt" = "latest"
|
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
SQLX_OFFLINE = "false"
|
SQLX_OFFLINE = "false"
|
||||||
|
|
@ -19,12 +18,10 @@ install-deps = "sudo apt-get update && sudo apt-get install -y --no-install-reco
|
||||||
|
|
||||||
install-py-deps = "uv tool install djlint"
|
install-py-deps = "uv tool install djlint"
|
||||||
|
|
||||||
fmt = { depends = ["fmt:rs", "fmt:sh", "fmt:templates"] }
|
fmt = { depends = ["fmt:rs", "fmt:sh", "fmt:assets"] }
|
||||||
"fmt:rs" = "cargo fmt"
|
"fmt:rs" = "cargo fmt"
|
||||||
"fmt:sh" = "treefmt --filter shfmt"
|
"fmt:sh" = "shfmt -i 2 -s -w $(find . -name '*.sh' -not -path './target/*')"
|
||||||
"fmt:templates" = { depends = ["fmt:html", "fmt:assets"] }
|
"fmt:assets" = "oxfmt --write $(find . \\( -name '*.css' -o -name '*.json' -o -name '*.yaml' -o -name '*.yml' -o -name '*.md' \\) -not -path './target/*' -not -path './.git/*')"
|
||||||
"fmt:html" = "uvx djlint templates/ --reformat"
|
|
||||||
"fmt:assets" = "treefmt --filter oxfmt"
|
|
||||||
|
|
||||||
lint = { depends = ["lint:rs", "lint:sh"] }
|
lint = { depends = ["lint:rs", "lint:sh"] }
|
||||||
"lint:rs" = "cargo clippy -- -D warnings"
|
"lint:rs" = "cargo clippy -- -D warnings"
|
||||||
|
|
|
||||||
16
prek.toml
16
prek.toml
|
|
@ -14,14 +14,24 @@ hooks = [
|
||||||
repo = "local"
|
repo = "local"
|
||||||
hooks = [
|
hooks = [
|
||||||
{
|
{
|
||||||
id = "fmt-check",
|
id = "fmt-rs",
|
||||||
name = "fmt-check",
|
name = "fmt-rs",
|
||||||
entry = "treefmt --fail-on-change --no-cache",
|
entry = "cargo fmt -- --check",
|
||||||
language = "system",
|
language = "system",
|
||||||
|
files = "\\.rs$",
|
||||||
pass_filenames = false,
|
pass_filenames = false,
|
||||||
fail_fast = true,
|
fail_fast = true,
|
||||||
stages = ["pre-commit"],
|
stages = ["pre-commit"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id = "fmt-sh",
|
||||||
|
name = "fmt-sh",
|
||||||
|
entry = "shfmt -i 2 -d",
|
||||||
|
language = "system",
|
||||||
|
types = ["shell"],
|
||||||
|
fail_fast = true,
|
||||||
|
stages = ["pre-commit"],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id = "clippy",
|
id = "clippy",
|
||||||
name = "clippy",
|
name = "clippy",
|
||||||
|
|
|
||||||
|
|
@ -236,9 +236,7 @@ input.input-field[type="number"] {
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
:root {
|
:root {
|
||||||
--fixed-nav-h: calc(
|
--fixed-nav-h: calc(max(1rem, env(safe-area-inset-top, 0px) * 0.9) + 3.25rem);
|
||||||
max(1rem, env(safe-area-inset-top, 0px) * 0.9) + 3.25rem
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-bar {
|
.nav-bar {
|
||||||
|
|
@ -557,9 +555,7 @@ input.input-field[type="number"] {
|
||||||
/* ── Data page ─────────────────────────────────────────────────── */
|
/* ── Data page ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
/* Hide duplicate search inside data page - search is in the tab bar */
|
/* Hide duplicate search inside data page - search is in the tab bar */
|
||||||
.data-page-content
|
.data-page-content section:has(.responsive-table) > div:first-child:has(input[type="search"]) {
|
||||||
section:has(.responsive-table)
|
|
||||||
> div:first-child:has(input[type="search"]) {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
25
treefmt.toml
25
treefmt.toml
|
|
@ -1,25 +0,0 @@
|
||||||
[formatter.rust]
|
|
||||||
command = "rustfmt"
|
|
||||||
options = ["--edition", "2024"]
|
|
||||||
include = ["*.rs"]
|
|
||||||
|
|
||||||
[formatter.shell]
|
|
||||||
command = "shfmt"
|
|
||||||
options = ["-i", "2", "-s", "-w"]
|
|
||||||
include = ["*.sh"]
|
|
||||||
|
|
||||||
[formatter.oxfmt]
|
|
||||||
command = "oxfmt"
|
|
||||||
options = ["--write"]
|
|
||||||
include = [
|
|
||||||
"*.css",
|
|
||||||
"*.json",
|
|
||||||
"*.yaml",
|
|
||||||
"*.yml",
|
|
||||||
"*.md",
|
|
||||||
]
|
|
||||||
|
|
||||||
[formatter.djlint]
|
|
||||||
command = "djlint"
|
|
||||||
options = ["--reformat", "--quiet"]
|
|
||||||
include = ["*.html"]
|
|
||||||
Loading…
Reference in a new issue