A Rust crate for writing JavaScript and TypeScript linters.
This crate powers
deno lint, but is not
Deno specific and can be used as a standalone crate.
It ships with a set of built-in rules, including a recommended set that is
enabled by default and requires no configuration.
The list of available rules and their documentation is hosted at docs.deno.com/lint/rules.
examples/dlint/main.rs provides a minimal standalone binary demonstrating how
deno_lint can be used as a crate.
# Build standalone binary
$ cargo build --example dlint
$ ./target/debug/examples/dlint --help
dlint
USAGE:
dlint <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
rules
run
$ ./target/debug/examples/dlint run ../deno/std/http/server.ts ../deno/std/http/file_server.ts
(no-empty) Empty block statement
--> ../deno/std/http/server.ts:93:14
|
93 | } catch {}
| ^^
|
(ban-untagged-todo) TODO should be tagged with (@username) or (#issue)
--> ../deno/std/http/file_server.ts:5:0
|
5 | // TODO Stream responses instead of reading them into memory.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Found 2 problemsFor a more complete integration, see how deno_lint is used in
deno.
Make sure to have the latest stable version of Rust installed, see rust-toolchain.toml.
# check version
$ rustc --version
# build all targets
$ cargo build --all-targets
# test it
$ cargo test-
If you are going to work on an issue, mention so in the issue comments before you start working on the issue.
-
Please be professional in the forums. We follow Rust's code of conduct (CoC).
-
Ask for help in the community chat room.
Before submitting, please make sure the following is done:
- That there is a related issue and it is referenced in the PR text.
- There are tests that cover the changes.
- Ensure
cargo testpasses. - Format your code with
deno run --allow-run tools/format.ts. - Make sure
deno run --allow-run --allow-env tools/lint.tspasses. - If you've added a new rule, open a PR to denoland/docs with documentation for the rule.