deno_lint 0.1.7

lint for deno
Documentation

Deno linter

NOTE Very much work-in-progress

Supported rules

  • ban-ts-ignore
  • ban-untagged-todo
  • constructor-super
  • default-param-last
  • eqeqeq
  • explicit-function-return-type
  • for-direction
  • getter-return
  • no-array-constructor
  • no-async-promise-executor
  • no-case-declarations
  • no-class-assign
  • no-compare-neg-zero
  • no-cond-assign
  • no-debugger
  • no-delete-var
  • no-dupe-args
  • no-dupe-keys
  • no-duplicate-case
  • no-empty-character-class
  • no-empty-function
  • no-empty-interface
  • no-empty
  • no-eval
  • no-ex-assign
  • no-explicit-any
  • no-func-assign
  • no-namespace
  • no-new-symbol
  • no-obj-call
  • no-octal
  • no-prototype-builtins
  • no-setter-return
  • no-sparse-array
  • no-throw-literal
  • no-unsafe-finally
  • no-unsafe-negation
  • no-var
  • no-with
  • prefer-namespace-keyword
  • require-yield
  • single-var-declarator
  • use-isnan
  • valid-typeof

Ignores

Only single line ignores are supported:

// deno-lint-ignore noExplicitAny
function foo(): any {
  // ...
}

// deno-lint-ignore noExplicitAny explicitFunctionReturnType
function bar(a: any) {
  // ...
}

Example output

$ ▶ target/debug/examples/dlint ../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