diff --git a/.tangled/workflows/ci.yml b/.tangled/workflows/ci.yml index 2131b5a..45d5251 100644 --- a/.tangled/workflows/ci.yml +++ b/.tangled/workflows/ci.yml @@ -36,7 +36,8 @@ steps: # Install the Elixir toolchain into the workspace and pre-compile, so the # later steps are quiet and just run their one check. The workspace (incl. # .elixir, deps/, _build/) persists across steps; PATH does not, so each - # Elixir step re-exports it. + # Elixir step re-exports it. The compile is run with --warnings-as-errors so + # any compiler warning fails the build here rather than slipping through. - name: "Setup (toolchain + deps)" command: | set -eu @@ -59,7 +60,7 @@ steps: mix local.hex --force mix local.rebar --force mix deps.get - mix compile + mix compile --warnings-as-errors - name: "Format" command: | diff --git a/CLAUDE.md b/CLAUDE.md index f0c4f46..b3a32c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,8 +27,11 @@ mise run setup # install tools, deps, wire git hooks (hk) ``` `hk` runs a pre-commit hook: `mix format --check-formatted` on staged `.ex/.exs`, -`tsc --noEmit` when staged `.ts` files exist, and `shadix-registry` (regenerate + -re-stage `priv/registry/*.json`) when a component source or `assets/ts/*.ts` is staged. +`mix compile --warnings-as-errors` when staged `.ex/.exs` exists (compiler warnings +block the commit), `tsc --noEmit` when staged `.ts` files exist, and `shadix-registry` +(regenerate + re-stage `priv/registry/*.json`) when a component source or +`assets/ts/*.ts` is staged. CI mirrors this: the setup step compiles with +`--warnings-as-errors`, so warnings fail the build. A11y tests are a **separate** Playwright/axe-core suite under `test/a11y/` (its own `package.json`, not run by `mix test`). They drive the live docs site. diff --git a/hk.pkl b/hk.pkl index faef573..9e0b780 100644 --- a/hk.pkl +++ b/hk.pkl @@ -6,6 +6,15 @@ local linters = new Mapping { check = "mix format --check-formatted {{files}}" fix = "mix format {{files}}" } + // Compile with --warnings-as-errors so compiler warnings block the commit. + // Gated on staged Elixir sources (mirrors mix-format) so it stays dormant + // for non-code changes; no glob would make it run on every commit. It's a + // check-only step (compile can't auto-fix), so it runs in both `hk check` + // and the `fix = true` pre-commit hook. + ["mix-compile"] { + glob = List("*.ex", "*.exs") + check = "mix compile --warnings-as-errors" + } // Whole-project type check; gated on staged .ts files so it stays dormant // until the TypeScript hooks land under assets/. ["tsc"] { diff --git a/website/components/component_doc.ex b/website/components/component_doc.ex index 6c6c6a4..4d2e2e0 100644 --- a/website/components/component_doc.ex +++ b/website/components/component_doc.ex @@ -49,14 +49,12 @@ defmodule Shadix.Website.Components.ComponentDoc do end compiled = - EEx.compile_string(source, - engine: Phoenix.LiveView.TagEngine, - tag_handler: Phoenix.LiveView.HTMLEngine, + Phoenix.LiveView.TagEngine.compile(source, caller: __CALLER__, - source: source, file: __CALLER__.file, line: __CALLER__.line, - indentation: 0 + indentation: 0, + tag_handler: Phoenix.LiveView.HTMLEngine ) trimmed_source = String.trim_trailing(source)