Linter

Rules

Accessibility

Rules focused on preventing accessibility problems.

noAutofocus recommended

Avoid the autoFocus attribute

noBlankTarget recommended

Disallow target=“_blank” attribute without rel=“noreferrer”

noPositiveTabindex recommended

Prevent the usage of positive integers on tabIndex property

useAltText recommended

It asserts that alternative text to images or areas, help to rely on to screen readers to understand the purpose and the context of the image.

useAnchorContent recommended

Enforce that anchor elements have content and that the content is accessible to screen readers.

useButtonType recommended

Enforces the usage of the attribute type for the element button

useHtmlLang recommended

Enforce that html element has lang attribute. This allows users to choose a language other than the default.

useKeyWithClickEvents recommended

Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

useKeyWithMouseEvents recommended

Enforce that onMouseOver/onMouseOut are accompanied by onFocus/onBlur for keyboard-only users. It is important to take into account users with physical disabilities who cannot use a mouse, who use assistive technology or screenreader.

useValidAnchor recommended

Enforce that all anchors are valid, and they are navigable elements.

Complexity

Rules that focus on inspecting complex code that could be simplified.

noExtraBooleanCast recommended

Disallow unnecessary boolean casts

noMultipleSpacesInRegularExpressionLiterals recommended

Disallow unclear usage of multiple space characters in regular expression literals

noUselessFragments

Disallow unnecessary fragments

useFlatMap recommended

Promotes the use of .flatMap() when map().flat() are used together.

useOptionalChain recommended

Enforce using concise optional chain instead of chained logical expressions.

useSimplifiedLogicExpression recommended

Discard redundant terms from logical expressions.

Correctness

Rules that detect code that is guaranteed to be incorrect or useless.

noChildrenProp recommended

Prevent passing of children as props.

noConstAssign recommended

Prevents from having const variables being re-assigned.

noEmptyPattern recommended

Disallows empty destructuring patterns.

noNewSymbol recommended

Disallow new operators with the Symbol object

noRenderReturnValue recommended

Prevent the usage of the return value of React.render.

noUndeclaredVariables

Prevents the usage of variables that haven’t been declared inside the document

noUnnecessaryContinue recommended

Avoid using unnecessary continue.

noUnreachable recommended

Disallow unreachable code

noUnusedVariables

Disallow unused variables.

noVoidElementsWithChildren recommended

This rules prevents void elements (AKA self-closing elements) from having children.

useValidForDirection recommended

Enforce “for” loop update clause moving the counter in the right direction.

Performance

Rules catching ways your code could be written to run faster, or generally be more efficient.

noDelete recommended

Disallow the use of the delete operator

Security

Rules that detect potential security flaws.

noDangerouslySetInnerHtml recommended

Prevent the usage of dangerous JSX props

noDangerouslySetInnerHtmlWithChildren recommended

Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop.

Style

Rules enforcing a consistent and idiomatic way of writing your code.

noArguments recommended

Disallow the use of arguments

noImplicitBoolean

Disallow implicit true values on JSX boolean attributes

noNegationElse

Disallow negation in the condition of an if statement if it has an else clause

noShoutyConstants

Disallow the use of constants which its value is the upper-case version of its name.

noUnusedTemplateLiteral recommended

Disallow template literals if interpolation and special-character handling are not needed

useBlockStatements

Requires following curly brace conventions. JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because it can lead to bugs and reduces code clarity.

useFragmentSyntax

This rule enforces the use of <>…</> over <Fragment>…</Fragment>.

useSelfClosingElements recommended

Prevent extra closing tags for components without children

useShorthandArrayType

When expressing array types, this rule promotes the usage of T[] shorthand instead of Array<T>.

useSingleCaseStatement

Enforces case clauses have a single statement, emits a quick fix wrapping the statements in a block

useSingleVarDeclarator recommended

Disallow multiple variable declarations in the same variable statement

useTemplate recommended

Template literals are preferred over string concatenation.

useWhile recommended

Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed

Suspicious

Rules that detect code that is likely to be incorrect or useless.

noArrayIndexKey recommended

Discourage the usage of Array index in keys.

noAsyncPromiseExecutor recommended

Disallows using an async function as a Promise executor.

noCatchAssign recommended

Disallow reassigning exceptions in catch clauses

noCommentText recommended

Prevent comments from being inserted as text nodes

noCompareNegZero recommended

Disallow comparing against -0

noDebugger recommended

Disallow the use of debugger

noDoubleEquals recommended

Require the use of === and !==

noDuplicateParameters recommended

Disallow duplicate function arguments name.

noExplicitAny recommended

Disallow the any type usage.

noFunctionAssign recommended

Disallow reassigning function declarations.

noImportAssign recommended

Disallow assigning to imported bindings

noLabelVar recommended

Disallow labels that share a name with a variable

noShadowRestrictedNames recommended

Disallow identifiers from shadowing restricted names.

noSparseArray recommended

Disallow sparse arrays

noUnsafeNegation recommended

Disallow using unsafe negation.

useValidTypeof recommended

This rule verifies the result of typeof $expr unary expressions is being compared to valid values, either string literals containing valid type names or other typeof expressions

Nursery

New rules that are still under development.

Nursery rules require explicit opt-in via configuration on stable versions because they may still have bugs or performance problems. They are enabled by default on nightly builds, but as they are unstable their diagnostic severity may be set to either error or warning, depending on whether we intend for the rule to be recommended or not when it eventually gets stabilized. Nursery rules get promoted to other groups once they become stable or may be removed.

Rules that belong to this group are not subject to semantic version.

noAccessKey

Enforce that the accessKey attribute is not used on any HTML element.

noAssignInExpressions

Disallow assignments in expressions.

noBannedTypes

Disallow certain types.

noClassAssign

Disallow reassigning class members.

noCommaOperator

Disallow comma operator.

noConstEnum

Disallow TypeScript const enum

noConstructorReturn

Disallow returning a value from a constructor.

noDistractingElements

Enforces that no distracting elements are used.

noDuplicateCase

Disallow duplicate case labels. If a switch statement has duplicate test expressions in case clauses, it is likely that a programmer copied a case clause but forgot to change the test expression.

noDuplicateJsxProps

Prevents JSX properties to be assigned multiple times.

noDuplicateObjectKeys

Prevents object literals having more than one property declaration for the same name. If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored, which is likely a mistake.

noEmptyInterface

Disallow the declaration of empty interfaces.

noExtraNonNullAssertion

Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files.

noExtraSemicolons

Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

noGlobalObjectCalls

Disallow calling global object properties as functions

noHeaderScope

Check that the scope attribute is only used on th elements.

noInnerDeclarations

Disallow function and var declarations in nested blocks.

noInvalidConstructorSuper

Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.

noNonNullAssertion

Disallow non-null assertions using the ! postfix operator.

noNoninteractiveElementToInteractiveRole

Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.

noPrecisionLoss

Disallow literal numbers that lose precision

noPrototypeBuiltins

Disallow direct use of Object.prototype builtins.

noRedundantAlt

Enforce img alt prop does not contain the word “image”, “picture”, or “photo”.

noRedundantUseStrict

Prevents from having redundant “use strict”.

noRestrictedGlobals

This rule allows you to specify global variable names that you don’t want to use in your application.

noSelfCompare

Disallow comparisons where both sides are exactly the same.

noSetterReturn

Disallow returning a value from a setter

noStringCaseMismatch

Disallow comparison of expressions modifying the string case with non-compliant value.

noUnreachableSuper

Ensures the super() constructor is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass

noUnsafeFinally

Disallow control flow statements in finally blocks.

noUnusedLabels

Disallow unused labels.

noUselessSwitchCase

Disallow useless case in switch statements.

noVar

Disallow the use of var

noVoidTypeReturn

Disallow returning a value from a function with the return type ‘void’

noWith

Disallow with statements in non-strict contexts.

useAriaPropTypes

Enforce that ARIA state and property values are valid.

useAriaPropsForRole

Enforce that elements with ARIA roles must have all required ARIA attributes for that role.

useCamelCase

Enforce camel case naming convention.

useConst

Require const declarations for variables that are never reassigned after declared.

useDefaultParameterLast

Enforce default function parameters and optional parameters to be last.

useDefaultSwitchClauseLast

Enforce default clauses in switch statements to be last

useEnumInitializers

Require that each enum member value be explicitly initialized.

useExhaustiveDependencies

Enforce all dependencies are correctly specified.

useExponentiationOperator

Disallow the use of Math.pow in favor of the ** operator.

useHookAtTopLevel

Enforce that all React hooks are being called from the Top Level component functions.

useIframeTitle

Enforces the usage of the attribute title for the element iframe

useIsNan

Require calls to isNaN() when checking for NaN.

useMediaCaption

Enforces that audio and video elements must have a track for captions.

useNumericLiterals

Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals

useValidAriaProps

Ensures that ARIA properties aria-* are all valid.

useValidLang

Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.

useYield

Require generator functions to contain yield.