Linter

Rules

Accessibility

Rules focused on preventing accessibility problems.

noAutofocus recommended

Avoid the autoFocus attribute

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.

useBlankTarget recommended

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

useButtonType recommended

Enforces the usage of the attribute type for the element button

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

useSimplifiedLogicExpression recommended

Discard redundant terms from logical expressions.

Correctness

Rules that detect incorrect or useless code.

noArguments recommended

Disallow the use of arguments

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

noChildrenProp recommended

Prevent passing of children as props.

noCommentText recommended

Prevent comments from being inserted as text nodes

noCompareNegZero recommended

Disallow comparing against -0

noDebugger recommended

Disallow the use of debugger

noDelete recommended

Disallow the use of the delete operator

noDoubleEquals recommended

Require the use of === and !==

noDupeArgs recommended

Disallow duplicate function arguments name.

noEmptyPattern recommended

Disallows empty destructuring patterns.

noFunctionAssign recommended

Disallow reassigning function declarations.

noImportAssign recommended

Disallow assigning to imported bindings

noLabelVar recommended

Disallow labels that share a name with a variable

noMultipleSpacesInRegularExpressionLiterals recommended

Disallow unclear usage of multiple space characters in regular expression literals

noNewSymbol recommended

Disallow new operators with the Symbol object

noRenderReturnValue recommended

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

noRestrictedGlobals

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

noShadowRestrictedNames recommended

Disallow identifiers from shadowing restricted names.

noSparseArray recommended

Disallow sparse arrays

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

noUnsafeNegation recommended

Disallow using unsafe negation.

noUnusedVariables

Disallow unused variables.

noUselessFragments

Disallow unnecessary fragments

noVoidElementsWithChildren recommended

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

useSingleCaseStatement recommended

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

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

useWhile recommended

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

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 way of writing your code.

noImplicitBoolean recommended

Disallow implicit true values on JSX boolean attributes

noNegationElse recommended

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

noShoutyConstants recommended

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 recommended

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>.

useOptionalChain recommended

Enforce using concise optional chain instead of chained logical expressions.

useSelfClosingElements recommended

Prevent extra closing tags for components without children

useShorthandArrayType recommended

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

useSingleVarDeclarator recommended

Disallow multiple variable declarations in the same variable statement

useTemplate recommended

Template literals are preferred over string concatenation.

Nursery

New rules that are still under development.

Nursery rules require explicit opt-in via configuration because they may still have bugs or performance problems. 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 recommended

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

noBannedTypes

Disallow certain types.

noConditionalAssignment

Disallow assignment operators in conditional expressions.

noConstAssign

Prevents from having const variables being re-assigned.

noConstEnum

Disallow TypeScript const enum

noConstructorReturn

Disallow returning a value from a constructor

noDistractingElements

Enforces that no distracting elements are used.

noDupeKeys

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.

noExplicitAny

Disallow the any type usage

noExtraNonNullAssertion

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

noHeaderScope

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

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.

noPrecisionLoss

Disallow literal numbers that lose precision

noRedundantUseStrict

Prevents from having redundant “use strict”.

noSetterReturn

Disallow returning a value from a setter

noStringCaseMismatch

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

noUnsafeFinally

Disallow control flow statements in finally blocks.

noVar

Disallow the use of var

noVoidTypeReturn

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

useAriaPropTypes

Enforce that ARIA state and property values are valid.

useAriaPropsForRole

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

useCamelCase

Enforce camel case naming convention.

useConst

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

useDefaultSwitchClauseLast

Enforce default clauses in switch statements to be last

useExhaustiveDependencies

Enforce all dependencies are correctly specified.

useFlatMap

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

useNumericLiterals

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

useValidForDirection

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