Skip to content

leptos-rs/leptos-lints

Repository files navigation

leptos-lints

Dylint lints for apps created with the Leptos framework.

Quick start

Install Dylint with

cargo install cargo-dylint dylint-link

Put 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.0" }]

Run the lints with

cargo dylint --all

See cargo dylint --help for more information.

Configuration

Workspace

[workspace.metadata.dylint]
libraries = [{ git = "https://github.com/leptos-rs/leptos-lints", tag = "v0.1.0" }]

Lint levels

RUSTFLAGS

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 --all

Or 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.

Cargo.toml

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.

Lints

Rule Description
leptos_print_stdout Check for calls to leptos::logging::log!.

About

A set of lints to make Leptos development easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages