List of rules
These lint rules are provided by the deno lint command. You can enable sets of rules in deno.json(c) by adding their tags (e.g. recommended, react) to the lint.rules.tags array.
If no tag is provided, then the recommended set of rules will be enabled by default.
Recommended
Fresh
JSX
React
JSR
Workspace
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.
Stringthe object is a wrapper ofstringthe primitive) in addition to the non-explicitFunctiontype and the misunderstoodObjecttype. Details about undefinedWarns the usage of unknown rule codes in ignore directives. Details about undefined
Requires
deno-lint-ignoreto 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
Enforces 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
forloop 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-inloops to include anifstatement. Details about undefinedEnforce a consistent JSX boolean value style. Passing
trueas the boolean value can be omitted with the shorthand syntax. Details about undefinedEnforce
<button>elements to have atypeattribute. 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
keyattribute 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 elementarticle 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
awaitis not used in a for loop body. Details about undefinedDisallow
awaitkeyword inside a non-async function. Details about undefinedRequires all functions called with any amount of
booleanliterals as parameters to use a self-documenting constant instead. Details about undefinedRequires lexical declarations (
let,const,functionandclass) in switchcaseordefaultclauses 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
consoleglobal. 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
debuggerstatement. 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 ifstatement. 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
anytype. 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
assertkeyword for import attributes. Details about undefinedDisallows reassignment of imported module bindings. Details about undefined
Ensure that all dependencies are declared in either
deno.jsonorpackage.json. Details about undefinedDisallows 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
constructors for interfaces ornewfor classes Details about undefinedDisallows the use of
namespaceandmodulekeywords in TypeScript code. Details about undefinedDisallows the use of
newoperators with built-inSymbols. 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
processglobal. Details about undefinedDisallows the use of
Object.prototypebuiltins 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
thisorsuperbefore 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
finallyblocks. 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
Ensure that inline dependency imports have a version specifier. 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
constandletkeywords. Details about undefinedDisallows the use of the
windowobject. Details about undefinedDisallows the use of Web APIs via the
windowobject. Details about undefinedDisallows the usage of
withstatements. 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
namespacekeyword overmodulekeyword when declaring TypeScript module. Details about undefinedSuggests using frozen intrinsics from
primordialsrather than the default globals. Details about undefinedPrevent the use of
dangerouslySetInnerHTMLwhich can lead to XSS vulnerabilities if used incorrectly. Details about undefinedUsing JSX children together with
dangerouslySetInnerHTMLis 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
typeofoperator to a specific set of string literals. Details about undefinedEnforces type imports to be declared as type imports. Details about undefined