List of rules
These lint rules are provided by the deno lint
command.
Recommended
Fresh
JSX
React
JSR
Requires overload signatures to be adjacent to each other. Details about undefined
Disallows the use of Typescript directives without a comment. Details about undefined
Bans the use of primitive wrapper objects (e.g.
String
the object is a wrapper ofstring
the primitive) in addition to the non-explicitFunction
type and the misunderstoodObject
type. Details about undefinedWarns the usage of unknown rule codes in ignore directives. Details about undefined
Requires
deno-lint-ignore
to be annotated with one or more rule names. Details about undefinedRequires TODOs to be annotated with either a user tag (
@user
) or an issue reference (#issue
). Details about undefinedWarns unused ignore directives. Details about undefined
Checks that a
<button>
JSX element has a validtype
attribute. The default value is"submit"
which is often not the desired behavior. Details about undefinedEnforces the use of camelCase in variable names. Details about undefined
Verifies the correct usage of constructors and calls to
super()
. Details about undefinedEnforces default parameter(s) to be last in the function signature. Details about undefined
Enforces the use of type-safe equality operators
===
and!==
instead of the more error prone==
and!=
operators. Details about undefinedRequires all functions to have explicit return types. Details about undefined
Requires all module exports to have fully typed declarations. Details about undefined
Requires
for
loop control variables to increment in the correct direction. Details about undefinedChecks correct naming for named fresh middleware export. Details about undefined
Disallows event handlers in fresh server components. Details about undefined
Requires all property getter functions to return a value. Details about undefined
Require
for-in
loops to include anif
statement. Details about undefinedEnforce a consistent JSX boolean value style. Passing
true
as the boolean value can be omitted with the shorthand syntax. Details about undefinedEnforce
<button>
elements to have atype
attribute. If a<button>
is placed inside a<form>
element it will act as a submit button by default which can be unexpected. Details about undefinedEnsure consistent use of curly braces around JSX expressions. Details about undefined
Ensure the
key
attribute is present when passing iterables into JSX. It allows frameworks to optimize checking the order of elements. Details about undefinedPass children as JSX children instead of as an attribute. Details about undefined
JavaScript comments inside text nodes are rendered as plain text in JSX. This is often unexpected. Details about undefined
Disallow duplicated JSX props. Later props will always overwrite earlier props often leading to unexpected results. Details about undefined
Leaving the
>
or}
character in JSX is often undesired and difficult to spot. Enforce that these characters must be passed as strings. Details about undefinedFragments are only necessary at the top of a JSX "block" and only when there are multiple children. Fragments are not needed in other scenarios. Details about undefined
Spreading the same expression twice is typically a mistake and causes unnecessary computations. Details about undefined
Ensure that void elements in HTML don't have any children as that is not valid HTML. See
Void element
article on MDN for more information. Details about undefinedEnforce conventional usage of array construction. Details about undefined
Requires that async promise executor functions are not used. Details about undefined
Requires
await
is not used in a for loop body. Details about undefinedDisallow
await
keyword inside a non-async function. Details about undefinedRequires all functions called with any amount of
boolean
literals as parameters to use a self-documenting constant instead. Details about undefinedRequires lexical declarations (
let
,const
,function
andclass
) in switchcase
ordefault
clauses to be scoped with brackets. Details about undefinedDisallows modifying variables of class declarations. Details about undefined
Disallows comparing against negative zero (
-0
). Details about undefinedDisallows the use of the assignment operator,
=
, in conditional statements. Details about undefinedDisallows the use of the
console
global. Details about undefinedDisallows modifying a variable declared as
const
. Details about undefinedDisallows the use of a constant expression in conditional test. Details about undefined
Disallows the use ASCII control characters in regular expressions. Details about undefined
Disallows the use of the
debugger
statement. Details about undefinedDisallows the deletion of variables. Details about undefined
Warns the usage of the deprecated - Deno APIs. Details about undefined
Disallows using an argument name more than once in a function signature. Details about undefined
Disallows using a class member function name more than once. Details about undefined
Disallows using the same condition twice in an
if
/else if
statement. Details about undefinedDisallows duplicate keys in object literals. Details about undefined
Disallows using the same case clause in a switch statement more than once. Details about undefined
Disallows the use of empty block statements. Details about undefined
Disallows using the empty character class in a regular expression. Details about undefined
Disallows the declaration of an empty enum. Details about undefined
Disallows the declaration of an empty interface. Details about undefined
Disallows the use of empty patterns in destructuring. Details about undefined
Disallows the use of
eval
. Details about undefinedDisallows the reassignment of exception parameters. Details about undefined
Disallows use of the
any
type. Details about undefinedDisallows the use of external imports. Details about undefined
Disallows unnecessary boolean casts. Details about undefined
Disallows unnecessary non-null assertions. Details about undefined
Disallows the implicit fallthrough of case statements. Details about undefined
Disallows the overwriting/reassignment of an existing function. Details about undefined
Disallows assignment to native Javascript objects. Details about undefined
Disallows the use of implicit exports in ["ambient" namespaces]. Details about undefined
Disallows the
assert
keyword for import attributes. Details about undefinedDisallows reassignment of imported module bindings. Details about undefined
Disallows easily inferrable types. Details about undefined
Disallows variable or function definitions in nested blocks. Details about undefined
Disallows specifying invalid regular expressions in RegExp constructors. Details about undefined
Warns the wrong usage of triple-slash reference directives. Details about undefined
Disallows the use of non-space or non-tab whitespace characters. Details about undefined
Disallows defining
constructor
s for interfaces ornew
for classes Details about undefinedDisallows the use of
namespace
andmodule
keywords in TypeScript code. Details about undefinedDisallows the use of
new
operators with built-inSymbol
s. Details about undefinedDisallows the use of NodeJS global objects. Details about undefined
Disallow non-null assertions after an optional chain expression. Details about undefined
Disallow non-null assertions using the
!
postfix operator. Details about undefinedDisallows calling built-in global objects like functions. Details about undefined
Disallows expressing octal numbers via numeric literals beginning with
0
. Details about undefinedDisallows the use of NodeJS
process
global. Details about undefinedDisallows the use of
Object.prototype
builtins directly. Details about undefinedDisallows redeclaration of variables, functions, parameters with the same name. Details about undefined
Disallows multiple spaces in regular expression literals. Details about undefined
Disallows self assignments. Details about undefined
Disallows comparisons where both sides are exactly the same. Details about undefined
Disallows returning values from setters. Details about undefined
Disallows shadowing of restricted names. Details about undefined
Enforces specifying explicit references to paths in module specifiers. Details about undefined
Enforces using types that are explicit or can be simply inferred. Details about undefined
Disallows sparse arrays. Details about undefined
Disallow sync function inside async function. Details about undefined
Disallows assigning variables to
this
. Details about undefinedDisallows use of
this
orsuper
before callingsuper()
in constructors. Details about undefinedDisallow throwing literals as exceptions. Details about undefined
Disallows the use of top level await expressions. Details about undefined
Disallow the use of undeclared variables. Details about undefined
Disallows the unreachable code after the control flow statements. Details about undefined
Disallows the use of control flow statements within
finally
blocks. Details about undefinedDisallows the usage of negation operator
!
as the left operand of relational operators. Details about undefinedDisallows unused labels. Details about undefined
Enforces all variables are used at least once. Details about undefined
Disallow useless rename operations where both the original and new name are exactly the same. This is often a leftover from a refactoring procedure and can be safely removed. Details about undefined
Enforces the use of block scoped variables over more error prone function scoped variables. Block scoped variables are defined using
const
andlet
keywords. Details about undefinedDisallows the use of the
window
object. Details about undefinedDisallows the use of Web APIs via the
window
object. Details about undefinedDisallows the usage of
with
statements. Details about undefinedRecommends using const assertion (
as const
) over explicitly specifying literal types or using type assertion. Details about undefinedEnsures that the code is fully written in ASCII characters. Details about undefined
Recommends declaring variables with [
const
] over [let
]. Details about undefinedRecommends the use of
namespace
keyword overmodule
keyword when declaring TypeScript module. Details about undefinedSuggests using frozen intrinsics from
primordials
rather than the default globals. Details about undefinedPrevent the use of
dangerouslySetInnerHTML
which can lead to XSS vulnerabilities if used incorrectly. Details about undefinedUsing JSX children together with
dangerouslySetInnerHTML
is invalid as they will be ignored. Details about undefinedEnsure that hooks are called correctly in React/Preact components. They must be called at the top level of a component and not inside a conditional statement or a loop. Details about undefined
Disallows async functions that have no await expression or await using declaration. Details about undefined
Disallows generator functions that have no
yield
. Details about undefinedDisallows multiple variable definitions in the same declaration statement. Details about undefined
Disallow certain triple slash directives in favor of ES6-style import declarations. Details about undefined
Disallows comparisons to
NaN
. Details about undefinedRestricts the use of the
typeof
operator to a specific set of string literals. Details about undefinedEnforces type imports to be declared as type imports. Details about undefined