Last 12 weeks · 26 commits
2 of 6 standards met
Second batch of oxc-correctness oxlint ports (the comparison family), following in denoland/deno_lint#1521. All three are purely syntactic, with tests ported from the upstream oxc fixtures. bad-char-at-comparison — flags comparing the result of against a string whose length is not 1. returns a single UTF-16 code unit, so the comparison can never be true. bad-object-literal-comparison — flags , and similar. An empty object/array literal is a fresh reference that is never equal to anything, so the comparison is always false (or always true for inequality). Only empty literals are flagged; is left alone. number-arg-out-of-range** — flags out-of-range radix/precision arguments to (2–36), / (0–20), and (1–21). Out-of-range values throw a at runtime. Handles both and . Docs for these (and the rest of the bucket) are in denoland/docs#3378. All three are tagged , matching oxc's classification. As with #1521, this is the same on-by-default question — happy to drop the tag and land them opt-in first if you prefer.
Ports the oxlint rule to deno_lint as a native Rust rule. The rule flags a passed to or when the is or (case-insensitive), since a body is not allowed for those methods and results in a at runtime. An absent defaults to , so a body with no method is also flagged. A of or is treated as absent and not reported. Method values are read from string and single-element template literals; values that cannot be read statically (variable references, member expressions, enums, type annotations, conditionals, call results) are treated as unknown and not flagged. Both calls and are covered, matching oxc. Reference: https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs This port intentionally only inspects the value when it is written as an inline string or single-element template literal. It does not resolve method values that come from another statement, a TypeScript enum member, or a typed function parameter. As a result, six of oxc's fixtures are deliberately not reproduced here (they would require cross-statement symbol resolution, enum member resolution, or parameter type-annotation analysis): `headfunction foo(method: "HEAD" | "GET") { return new Request(url, {method, body: ""}); }enum Method { Get = "GET" } ... fetch("/", { method: Method.Get, body: "" })enum Method { Foo = "GET" } ... fetch("/", { method: Method.Foo, body: "" })passas const`-, and member-expression-typed method cases. A less-capable rule simply flags fewer things, so no genuine valid case regresses. Tagged RECOMMENDED (on by default) — flagging for maintainer sign-off.
Ports the oxlint rule to deno_lint as a native Rust rule. It flags declaring an object or class member named , which makes the value accidentally "thenable" and can break when the value is used in an expression. The rule detects the following cases: Object literals with a property — shorthand, key/value, method, getter, or setter, whether the key is the identifier , the string , a `thenconstletvar"then"thenstatic#thenObject.defineProperty(foo, "then", ...)Reflect.defineProperty(foo, "then", ...)Object.fromEntries([["then", ...]])thenfoo.then = 1foo["then"] += 1thenexport const then = 1export function then() {}export class then {}export { then }export { x as then }`). The diagnostic message and help text, as well as the complete pass/fail fixture arrays, are ported from the oxc reference: https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/unicorn/no_thenable.rs Tagged RECOMMENDED (on by default) — flagging for maintainer sign-off.
This reverts the rule (#1306). The rule hardcodes its own copy of the Node.js built-in module list, which has to be kept in sync by hand and inevitably drifts from the set of modules Deno actually supports. That canonical list already lives in the Deno repo under (exposed as ), so the rule is being moved there and reimplemented on top of it. Keeping it in deno_lint would mean maintaining a second, divergent source of truth. The rule is reintroduced in denoland/deno as an extended CLI lint rule that reuses the existing built-in module list: denoland/deno#35628.
Adds a new lint rule that warns when a Node.js built-in module is imported with a bare specifier (e.g. ) instead of the required prefix (e.g. ). It covers both static imports and dynamic calls and ships an autofix that adds the prefix. The rule is tagged and emits diagnostics at warning severity rather than error, so existing code keeps working while nudging users toward the correct specifier. Warning severity is wired through the API added in #1487. Invalid: Valid: Documentation is added in denoland/docs#3366. Related https://github.com/denoland/deno/issues/24930
Repository: denoland/deno_lint. Description: Blazing fast linter for JavaScript and TypeScript written in Rust Stars: 1586, Forks: 188. Primary language: Rust. Languages: Rust (98.7%), TypeScript (1.1%), JavaScript (0.2%). License: MIT. Homepage: https://lint.deno.land/ Topics: deno, javascript, linters, typescript. Latest release: 0.84.1 (1mo ago). Open PRs: 45, open issues: 123. Last activity: 16h ago. Community health: 50%. Top contributors: bartlomieju, magurotuna, dsherret, denobot, lucacasonato, DzmitryRamaniuk, marvinhagemeister, disizali, petamoriken, cknight and others.