From c130998f3fea892fdd8bd8d6f3c7b335146a3390 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Fri, 15 May 2026 10:41:02 -0700 Subject: [PATCH 1/8] t24: Add cargo fmt and cargo clippy gates to CI Two new `required` checks alongside the existing `line-endings` / `leptosfmt --check` / `trunk build` jobs: * `rustfmt` -- `cargo fmt --all -- --check` on stable. Catches the kind of trailing-newline / whitespace drift that `leptosfmt` doesn't see (`leptosfmt` only formats the contents of `view! { ... }` macro invocations; everything else is left to `rustfmt`). Also fixes one such offender: `image_button.rs` was missing the trailing newline that `rustfmt` requires after the closing brace. * `clippy` -- `cargo clippy --target wasm32-unknown-unknown --all-targets --no-deps -- -D warnings` on nightly with the `Swatinem/rust-cache` action keyed separately from the build job's cache so clippy and trunk don't fight over `target/`. `--no-deps` keeps the noise floor down (we only own our own crate); `-D warnings` makes any new lint failure the PR's problem rather than a slow drift. Both jobs run on `pull_request` to `main` and `push` to `main` like the rest of the suite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci.yaml | 35 ++++++++++++++++++++++++++++++++++ src/components/image_button.rs | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a9eac2..d6bf0b8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -61,6 +61,41 @@ jobs: - name: Run leptosfmt --check run: leptosfmt --check src + rustfmt: + name: cargo fmt --check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install stable Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Run cargo fmt --check + run: cargo fmt --all -- --check + + clippy: + name: cargo clippy + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + + - name: Install nightly Rust + uses: dtolnay/rust-toolchain@nightly + with: + targets: wasm32-unknown-unknown + components: clippy + + - name: Cache cargo registry and target + uses: Swatinem/rust-cache@v2 + with: + key: clippy + + - name: Run cargo clippy + run: cargo clippy --target wasm32-unknown-unknown --all-targets --no-deps -- -D warnings + build: name: Trunk build runs-on: ubuntu-latest diff --git a/src/components/image_button.rs b/src/components/image_button.rs index 2465099..9bb4a27 100644 --- a/src/components/image_button.rs +++ b/src/components/image_button.rs @@ -20,4 +20,4 @@ pub fn ImageButton( alt } -} \ No newline at end of file +} From 01f08083bce152df0279ee78228264a8a0adec1f Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Fri, 15 May 2026 10:47:20 -0700 Subject: [PATCH 2/8] t22: Externalize repo_view.rs D3 graph + clean up component The repository-dependency graph used on the three project pages was a single `repo_view.rs` file mixing four very different things: * ~230 lines of inline D3 v7 JavaScript embedded in a Rust `format!()` string with doubled braces everywhere -- impossible to lint, format, or read with JS tooling. * ~50 lines of CSS embedded in another Rust string and injected into `` on every component mount. * The Rust component itself, plus an unused `D3` `JsValue` extern, redundant `use leptos::*;` / `use leptos::html::*;` glob imports, and two `signal()` pairs whose setters were never used. * A per-mount ` + + + diff --git a/public/repo_graph.js b/public/repo_graph.js index 558f8d4..e69957b 100644 --- a/public/repo_graph.js +++ b/public/repo_graph.js @@ -16,17 +16,30 @@ const ZOOM_MAX = 3; function render() { + if (typeof d3 === "undefined") { + // d3 is loaded as a sibling