From 6d7910f9290fb0e7e6f57944b9e4dba5e85abd8a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 29 Mar 2024 09:42:06 -0400 Subject: [PATCH 1/5] Adding leptos and taplo format checks. --- .leptosfmt.toml | 3 + .woodpecker.yml | 15 ++ Cargo.toml | 4 +- src/backend/mod.rs | 2 +- src/frontend/app.rs | 50 +++---- src/frontend/components/article_nav.rs | 81 +++++++---- src/frontend/components/credentials.rs | 110 ++++++++------- .../components/instance_follow_button.rs | 12 +- src/frontend/components/nav.rs | 132 +++++++++--------- src/frontend/mod.rs | 4 +- src/frontend/pages/article/actions.rs | 97 ++++++++----- src/frontend/pages/article/create.rs | 103 ++++++++------ src/frontend/pages/article/edit.rs | 105 ++++++++------ src/frontend/pages/article/history.rs | 60 +++++--- src/frontend/pages/article/list.rs | 54 ++++--- src/frontend/pages/article/read.rs | 29 ++-- src/frontend/pages/conflicts.rs | 33 +++-- src/frontend/pages/diff.rs | 46 +++--- src/frontend/pages/instance_details.rs | 42 +++--- src/frontend/pages/login.rs | 31 ++-- src/frontend/pages/register.rs | 31 ++-- src/frontend/pages/search.rs | 97 ++++++++----- src/frontend/pages/user_profile.rs | 30 ++-- src/main.rs | 2 +- 24 files changed, 692 insertions(+), 481 deletions(-) create mode 100644 .leptosfmt.toml diff --git a/.leptosfmt.toml b/.leptosfmt.toml new file mode 100644 index 0000000..e07de8d --- /dev/null +++ b/.leptosfmt.toml @@ -0,0 +1,3 @@ +max_width = 100 +tab_spaces = 2 +attr_value_brace_style = "WhenRequired" # "Always", "AlwaysUnlessLit", "WhenRequired" or "Preserve" diff --git a/.woodpecker.yml b/.woodpecker.yml index 2a2ac13..43088fb 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -12,6 +12,21 @@ steps: - rustup component add rustfmt - cargo +nightly fmt -- --check + leptos_fmt: + image: *rust_image + commands: + - *install_binstall + - cargo binstall -y leptosfmt + - leptosfmt -c .leptosfmt.toml --check src + when: + - event: pull_request + + toml_fmt: + image: tamasfe/taplo:0.8.1 + commands: + - taplo format --check + when: + - event: pull_request check_config_defaults_updated: image: *rust_image diff --git a/Cargo.toml b/Cargo.toml index eaeaf7f..29cb1e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ diesel = { version = "2.1.4", features = [ "postgres", "chrono", "uuid", - "r2d2" + "r2d2", ], optional = true } diesel-derive-newtype = { version = "2.1.0", optional = true } diesel_migrations = { version = "2.1.0", optional = true } @@ -97,5 +97,5 @@ debug = 0 [profile.release] lto = "thin" -strip = true # Automatically strip symbols from the binary. +strip = true # Automatically strip symbols from the binary. #opt-level = "z" # Optimize for size. diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 862ded0..362cf66 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -88,7 +88,7 @@ pub async fn start(config: IbisConfig) -> MyResult<()> { let config = data.clone(); let app = Router::new() - .leptos_routes(&leptos_options, routes, || view! { }) + .leptos_routes(&leptos_options, routes, || view! { }) .with_state(leptos_options) .nest("", asset_routes()?) .nest(FEDERATION_ROUTES_PREFIX, federation_routes()) diff --git a/src/frontend/app.rs b/src/frontend/app.rs index e172534..0df1bfb 100644 --- a/src/frontend/app.rs +++ b/src/frontend/app.rs @@ -90,30 +90,30 @@ pub fn App() -> impl IntoView { provide_context(create_rw_signal(global_state)); view! { - <> - - - -