Skip to content

Commit

Permalink
ci: check examples
Browse files Browse the repository at this point in the history
  • Loading branch information
brofrain committed Oct 27, 2023
1 parent 4c43116 commit 96ff2cf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Formatting
run: just fmt-check
- name: Lint
run: just lint
- run: just ci
4 changes: 0 additions & 4 deletions examples/csr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ getrandom = { version = "0.2.10", features = ["js"], optional = true }
leptos = { version = "0.5.2", features = ["csr", "nightly"] }
leptos_animated_for = { path = "../.." }
rand = "0.8.5"

[lints.clippy]
pedantic = "warn"
module-name-repetitions = "allow"
1 change: 0 additions & 1 deletion examples/csr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ struct Item {

const INITIAL_ITEM_COUNT: usize = 40;

#[allow(clippy::too_many_lines)]
#[component]
fn App() -> impl IntoView {
let last_added_item_id = StoredValue::new(0);
Expand Down
4 changes: 0 additions & 4 deletions examples/ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,3 @@ lib-features = ["hydrate"]
#
# Optional. Defaults to false.
lib-default-features = false

[lints.clippy]
pedantic = "warn"
module-name-repetitions = "allow"
23 changes: 22 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _fmt-rustfmt flag='':
# Formats Leptos components using leptosfmt
_fmt-leptosfmt flag='':
leptosfmt src/components/**/*.rs {{ flag }}
leptosfmt src/**/*.rs {{ flag }}

# Formats justfile
_fmt-justfile:
Expand All @@ -37,10 +37,31 @@ fmt-check:
just _fmt-check-leptosfmt
just _fmt-check-justfile

# Checks examples formatting
fmt-check-examples:
#!/usr/bin/env sh
(cd examples/csr && just _fmt-check-rustfmt)
(cd examples/csr && just _fmt-check-leptosfmt)
(cd examples/ssr && just _fmt-check-rustfmt)
(cd examples/ssr && just _fmt-check-leptosfmt)
# Lints source with Clippy
lint:
cargo clippy -- -D warnings

# Lints examples with Clippy
lint-examples:
#!/usr/bin/env sh
(cd examples/csr && cargo clippy -- -D warnings)
(cd examples/ssr && cargo clippy --features ssr -- -D warnings)
(cd examples/ssr && cargo clippy --lib --features hydrate -- -D warnings)
ci:
just fmt-check
just lint
just fmt-check-examples
just lint-examples

_vscode-fmt:
# Using `leptosfmt --stdin --rustfmt` seems to add redundant newlines
leptosfmt --stdin | rustfmt

0 comments on commit 96ff2cf

Please sign in to comment.