Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Blazing fast linter for JavaScript and TypeScript written in Rust

License

NotificationsYou must be signed in to change notification settings

denoland/deno_lint

Repository files navigation

Discord Chat

A Rust crate for writing fast JavaScript and TypeScript linters.

This crate powersdeno lint, but isnot Deno specific and can be used to write linters for Node as well.

Supportsrecommended set of rules from ESLint and@typescript-eslint out ofthe box with no config.

Seethe roadmap


Supported rules

Visithttps://lint.deno.land for the list of available rules.

Performance

Blazing fast, see comparison with ESLint:

[  {"name":"deno_lint","totalMs":105.3750100000002,"runsCount":5,"measuredRunsAvgMs":21.07500200000004,"measuredRunsMs": [24.79783199999997,19.563640000000078,20.759051999999883,19.99068000000011,20.26380600000016    ]  },  {"name":"eslint","totalMs":11845.073306000002,"runsCount":5,"measuredRunsAvgMs":2369.0146612000003,"measuredRunsMs": [2686.1039550000005,2281.501061,2298.6185210000003,2279.5962849999996,2299.2534840000008    ]  }]

Benchmarks are run during CI on Ubuntu, using the same set of rules for bothlinters. Test subject isoak serverconsisting of about 50 files. See./benchmarks/ directory formore info.

Node.js bindings

If you want to usedeno_lint with Node, please refer to@node-rs/deno-lint packagewhich provides programmatic API as well as Webpack loader fordeno_lint.

Example

examples/dlint/main.rs provides a minimal standalone binary demonstrating howdeno_lint can be used as a crate.

# Build standalone binary$ cargo build --example dlint$ ./target/debug/examples/dlint --helpdlintUSAGE:    dlint<SUBCOMMAND>FLAGS:    -h, --help       Printshelp information    -V, --version    Prints version informationSUBCOMMANDS:help     Prints this message or thehelp 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 {}|               ^^|(no-empty) Empty block statement   --> ../deno/std/http/server.ts:111:44|111|while((await body.read(buf))!== null) {}|                                             ^^|(no-empty) Empty block statement   --> ../deno/std/http/server.ts:120:41|120|   constructor(public listener: Listener) {}|                                          ^^|(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.| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|(ban-untagged-todo) TODO should be tagged with (@username) or (#issue) --> ../deno/std/http/file_server.ts:6:0|6| // TODO Add tests like these:| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|(ban-untagged-todo) TODO should be tagged with (@username) or (#issue)   --> ../deno/std/http/file_server.ts:137:0|137| // TODO: simplify this after deno.stat and deno.readDir are fixed| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|(no-empty) Empty block statement   --> ../deno/std/http/file_server.ts:155:16|155|     } catch (e) {}|                 ^^|Found 7 problems

For more concrete implementation visitdeno

Developing

Make sure to have latest stable version of Rust installed (1.56.0).

// check version$ rustc --versionrustc 1.56.0 (09c42c458 2021-10-18)// build all targets$ cargo build --all-targets//test it$ cargotest

Generating flamegraph (Linux)

Prerequisites:

$ RUSTFLAGS='-g' cargo build --release --all-targets# build target$ sudo perf record --call-graph dwarf ./target/release/examples/dlint benchmarks/oak/**.ts# create performance profile$ perf script| stackcollapse-perf| c++filt| flamegraph> flame.svg# generate flamegraph

You can userust-unmangleorrustfilt instead of c++filt.

These commands can take a few minutes to run.

Contributing

Submitting a Pull Request

Before submitting, please make sure the following is done:

  1. That there is a related issue and it is referenced in the PR text.
  2. There are tests that cover the changes.
  3. Ensurecargo test passes.
  4. Format your code withdeno run --allow-run tools/format.ts
  5. Make suredeno run --allow-run --allow-env tools/lint.ts passes.
  6. If you've added a new rule, open a PR tohttps://github.com/denoland/deno-docs with a documentation for a rule.

[8]ページ先頭

©2009-2025 Movatter.jp