Dylint lints for apps created with the Leptos framework.
Install Dylint with
cargo install cargo-dylint dylint-linkPut the next configuration in the Cargo.toml of your workspace.
[workspace.metadata.dylint]
libraries = [{ git = "https://github.com/leptos-rs/leptos-lints", tag = "v0.1.2" }]Run the lints with
cargo dylint --allSee cargo dylint --help for more information.
[workspace.metadata.dylint]
libraries = [{ git = "https://github.com/leptos-rs/leptos-lints", tag = "v0.1.2" }]Use the RUSTFLAGS environment variable to set custom lint levels for each lint.
For example, to set leptos_print_stdout lint to deny, run the next command.
RUSTFLAGS="-Dleptos_print_stdout" cargo dylint --allOr in the file .cargo/config.toml to avoid repeating the command.
[target.'cfg(all())']
rustflags = ["-Dleptos_print_stdout"]The downside of this approach is that the project will be compiled from scratch
every time you edit the RUSTFLAGS variable.
Use [lints.rust] table in Cargo.toml to set custom lint levels for each lint.
For example, to set leptos_print_stdout lint to deny in a workspace,
add the next lines to the Cargo.toml file.
[workspace.lints.rust]
unknown_lints = "allow"
leptos_print_stdout = "deny"The downside of this approach is that unknown lints will be allowed by default.
| Rule | Description | Default level |
|---|---|---|
leptos_event_target |
Warn about usages of leptos::prelude::event_target |
warn |
leptos_event_target_value |
Warn about usages of leptos::prelude::event_target_value |
warn |
leptos_print_stdout |
Check for calls to leptos::logging::log! |
warn |
leptos_unscoped_spawn |
Forbids the use of leptos::task::spawn_local |
warn |