Pular para o conteúdo

JavaScript Rules

Este conteúdo não está disponível em sua língua ainda.

Below the list of rules supported by Biome, divided by group. Here’s a legend of the emojis:

  • The icon indicates that the rule is part of the recommended rules.
  • The icon indicates that the rule provides a code action (fix) that is safe to apply.
  • The icon indicates that the rule provides a code action (fix) that is unsafe to apply.
  • The icon indicates that the rule has been implemented and scheduled for the next release.
Rule name Description Properties
noAccessKey Enforce that the accessKey attribute is not used on any HTML element.
noAmbiguousAnchorText Disallow ambiguous anchor descriptions.
noAriaHiddenOnFocusable Enforce that aria-hidden=“true” is not set on focusable elements.
noAriaUnsupportedElements Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
noAutofocus Enforce that autoFocus prop is not used on elements.
noDistractingElements Enforces that no distracting elements are used.
noHeaderScope The scope prop should be used only on <th> elements.
noInteractiveElementToNoninteractiveRole Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements.
noLabelWithoutControl Enforce that a label element or component has a text label and an associated input.
noNoninteractiveElementInteractions Disallow use event handlers on non-interactive elements.
noNoninteractiveElementToInteractiveRole Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.
noNoninteractiveTabindex Enforce that tabIndex is not assigned to non-interactive HTML elements.
noPositiveTabindex Disallow positive values for the tabIndex property.
noRedundantAlt Enforce img alt prop does not contain the word “image”, “picture”, or “photo”.
noRedundantRoles Enforce explicit role property is not the same as implicit/default role property on an element.
noStaticElementInteractions Enforce that static, visible elements (such as <div>) that have click handlers use the valid role attribute.
noSvgWithoutTitle Enforces the usage of the title element for the svg element.
useAltText Enforce that all elements that require alternative text have meaningful information to relay back to the end user.
useAnchorContent Enforce that anchors have content and that the content is accessible to screen readers.
useAriaActivedescendantWithTabindex Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant.
useAriaPropsForRole Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
useAriaPropsSupportedByRole Enforce that ARIA properties are valid for the roles that are supported by the element.
useButtonType Enforces the usage of the attribute type for the element button
useFocusableInteractive Elements with an interactive role and interaction handlers must be focusable.
useHeadingContent Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop.
useHtmlLang Enforce that html element has lang attribute.
useIframeTitle Enforces the usage of the attribute title for the element iframe.
useKeyWithClickEvents Enforce elements with a click event handler to also have at least one keyboard event handler.
useKeyWithMouseEvents Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur.
useMediaCaption Enforces that audio and video elements must have a track for captions.
useSemanticElements Enforces using semantic DOM elements over the ARIA role property.
useValidAnchor Enforce that all anchors are valid, and they are navigable elements.
useValidAriaProps Disallow unknown aria-* attributes.
useValidAriaRole Elements with ARIA roles must use a valid, non-abstract ARIA role.
useValidAriaValues Enforce that ARIA state and property values are valid.
useValidAutocomplete Use valid values for the autocomplete attribute on input elements.
useValidLang Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.
Rule name Description Properties
noAdjacentSpacesInRegex Disallow unclear usage of consecutive space characters in regular expression literals
noArguments Disallow the use of arguments.
noBannedTypes Disallow primitive type aliases and misleading types.
noCommaOperator Disallow comma operator.
noDivRegex Disallow equal signs explicitly at the beginning of regular expressions.
noEmptyTypeParameters Disallow empty type parameters in type aliases and interfaces.
noExcessiveCognitiveComplexity Disallow functions that exceed a given Cognitive Complexity score.
noExcessiveLinesPerFunction Restrict the number of lines of code in a function.
noExcessiveNestedCallbacks Enforce a maximum depth that callbacks can be nested.
noExcessiveNestedTestSuites This rule enforces a maximum depth to nested describe() in test files.
noExtraBooleanCast Disallow unnecessary boolean casts
noFlatMapIdentity Disallow to use unnecessary callback on flatMap.
noForEach Prefer for...of statement instead of Array.forEach.
noImplicitCoercions Encourage use of explicit type conversion functions over their shorthand counterparts.
noPlaywrightUselessAwait Disallow unnecessary await for Playwright methods that don’t return promises.
noRedundantDefaultExport Checks if a default export exports the same symbol as a named export.
noStaticOnlyClass This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace.
noThisInStatic Disallow this and super in static contexts.
noUnnecessaryTemplateExpression Disallow unnecessary template expressions.
noUselessCatch Disallow unnecessary catch clauses.
noUselessCatchBinding Disallow unused error parameters in catch clauses.
noUselessConstructor Disallow unnecessary constructors.
noUselessContinue Avoid using unnecessary continue.
noUselessEmptyExport Disallow empty exports that don’t change anything in a module file.
noUselessEscapeInRegex Disallow unnecessary escape sequence in regular expression literals.
noUselessFragments Disallow unnecessary JSX fragments.
noUselessLabel Disallow unnecessary labels.
noUselessLoneBlockStatements Disallow unnecessary nested block statements.
noUselessRename Disallow renaming import, export, and destructured assignments to the same name.
noUselessReturn Disallow redundant return statements.
noUselessStringConcat Disallow unnecessary concatenation of string or template literals.
noUselessStringRaw Disallow unnecessary String.raw function in template string literals without any escape sequence.
noUselessSwitchCase Disallow useless case in switch statements.
noUselessTernary Disallow ternary operators when simpler alternatives exist.
noUselessThisAlias Disallow aliases for this when this can be used directly.
noUselessTypeConstraint Disallow using any or unknown as type constraint.
noUselessUndefined Disallow the use of useless undefined.
noUselessUndefinedInitialization Disallow initializing variables to undefined.
noVoid Disallow the use of void operators, which is not a familiar operator.
useArrayFind Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result.
useArraySome Prefer Array.prototype.some() over verbose existence checks.
useArrowFunction Use arrow functions over function expressions.
useDateNow Use Date.now() to get the number of milliseconds since the Unix Epoch.
useFlatMap Promotes the use of .flatMap() when map().flat() are used together.
useIndexOf Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item.
useLiteralKeys Enforce the usage of a literal access to properties over computed property access.
useMathMinMax Prefer Math.min() and Math.max() over ternaries for simple comparisons.
useMaxParams Enforce a maximum number of parameters in function definitions.
useNumericLiterals Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
useOptionalChain Enforce using concise optional chain instead of chained logical expressions.
useRegexLiterals Enforce the use of the regular expression literals instead of the RegExp constructor if possible.
useRegexpTest Enforce the use of RegExp.prototype.test() over String.prototype.match() and RegExp.prototype.exec() in boolean contexts.
useSimpleNumberKeys Disallow number literal object member names which are not base 10 or use underscore as separator.
useSimplifiedLogicExpression Discard redundant terms from logical expressions.
useWhile Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed.
Rule name Description Properties
noBeforeInteractiveScriptOutsideDocument Prevent usage of next/script’s beforeInteractive strategy outside of pages/_document.js in a Next.js project.
noChildrenProp Prevent passing of children as props.
noComponentHookFactories Disallows defining React components or custom hooks inside other functions.
noConstAssign Prevents from having const variables being re-assigned.
noConstantCondition Disallow constant expressions in conditions
noConstantMathMinMaxClamp Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant.
noConstructorReturn Disallow returning a value from a constructor.
noEmptyCharacterClassInRegex Disallow empty character classes in regular expression literals.
noEmptyPattern Disallow empty object and array destructuring patterns.
noGlobalDirnameFilename Disallow the use of __dirname and __filename in the global scope.
noGlobalObjectCalls Disallow calling global object properties as functions
noInnerDeclarations Disallow function and var declarations that are accessible outside their block.
noInvalidBuiltinInstantiation Ensure that builtins are correctly instantiated.
noInvalidConstructorSuper Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.
noInvalidUseBeforeDeclaration Disallow the use of variables, function parameters, classes, and enums before their declaration
noJsxNamespace Disallow JSX namespace syntax.
noNestedComponentDefinitions Disallows defining React components inside other components.
noNextAsyncClientComponent Prevent client components from being async functions.
noNodejsModules Forbid the use of Node.js builtin modules.
noNonoctalDecimalEscape Disallow \8 and \9 escape sequences in string literals.
noPlaywrightMissingAwait Enforce Playwright async APIs to be awaited or returned.
noPrecisionLoss Disallow literal numbers that lose precision
noPrivateImports Restrict imports of private exports.
noProcessGlobal Disallow the use of process global.
noQwikUseVisibleTask Disallow useVisibleTask$() functions in Qwik components.
noReactNativeRawText Disallow raw text outside <Text> components in React Native.
noReactPropAssignments Disallow assigning to React component props.
noRenderReturnValue Prevent the usage of the return value of React.render.
noRestrictedElements Disallow the use of configured elements.
noSelfAssign Disallow assignments where both sides are exactly the same.
noSetterReturn Disallow returning a value from a setter
noSolidDestructuredProps Disallow destructuring props inside JSX components in Solid projects.
noStringCaseMismatch Disallow comparison of expressions modifying the string case with non-compliant value.
noSwitchDeclarations Disallow declarations directly inside switch clauses.
noUndeclaredDependencies Disallow the use of dependencies that aren’t specified in the package.json.
noUndeclaredVariables Prevents the usage of variables that haven’t been declared inside the document.
noUnreachable Disallow code that can never run.
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
noUnresolvedImports Warn when importing non-existing exports.
noUnsafeFinally Disallow control flow statements in finally blocks.
noUnsafeOptionalChaining Disallow optional chaining where undefined is not a valid result.
noUnusedFunctionParameters Disallow unused function parameters.
noUnusedImports Disallow unused imports.
noUnusedInstantiation Disallow new operators outside of assignments or comparisons.
noUnusedLabels Disallow unused labels.
noUnusedPrivateClassMembers Disallow unused private class members
noUnusedVariables Disallow unused variables.
noVoidElementsWithChildren Disallow children on HTML void elements.
noVoidTypeReturn Disallow returning a value from a function with the return type ‘void’
noVueDataObjectDeclaration Enforce that Vue component data options are declared as functions.
noVueDuplicateKeys Disallow duplicate keys in Vue component data, methods, computed properties, and other options.
noVueImportCompilerMacros Disallow importing Vue compiler macros.
noVueRefAsOperand Disallow the use of value wrapped by ref()(Composition API) as operand
noVueReservedKeys Disallow reserved keys in Vue component data and computed properties.
noVueReservedProps Disallow reserved names to be used as props.
noVueSetupPropsReactivityLoss Disallow destructuring of props passed to setup in Vue projects.
useExhaustiveDependencies Enforce correct dependency usage within React hooks.
useHookAtTopLevel Enforce that all React hooks are being called from the Top Level component functions.
useImageSize Enforces that <img> elements have both width and height attributes.
useImportExtensions Enforce file extensions for relative imports.
useInlineScriptId Enforce id attribute on next/script components with inline content or dangerouslySetInnerHTML.
useIsNan Require calls to isNaN() when checking for NaN.
useJsonImportAttributes Enforces the use of with { type: "json" } for JSON module imports.
useJsxKeyInIterable Disallow missing key props in iterators/collection literals.
useParseIntRadix Enforce the consistent use of the radix argument when using parseInt().
usePlaywrightValidDescribeCallback Enforce valid describe() callback.
useQwikClasslist Prefer using the class prop as a classlist over the classnames helper.
useQwikLoaderLocation Enforce that Qwik loader functions are declared in the correct location.
useQwikMethodUsage Disallow use* hooks outside of component$ or other use* hooks in Qwik applications.
useQwikValidLexicalScope Disallow unserializable expressions in Qwik dollar ($) scopes.
useReactAsyncServerFunction Require functions with the “use server” directive to be async.
useReactNativePlatformComponents Ensure that platform-specific React Native components are only
useSingleJsDocAsterisk Enforce JSDoc comment lines to start with a single asterisk, except for the first one.
useUniqueElementIds Disallow static id values on elements outside SVG contexts.
useValidForDirection Enforce “for” loop update clause moving the counter in the right direction.
useValidTypeof This rule checks that the result of a typeof expression is compared to a valid value.
useYield Require generator functions to contain yield.
Rule name Description Properties
noAccidentalBitwiseOperators Disallow bitwise operators where a logical operator was likely intended.
noArgumentsCallerOrCallee Disallow the use of arguments.caller and arguments.callee.
noArrayForEach Disallow the forEach() method in favor of for...of loops.
noArrayMethodsOnArguments Disallow calling array methods on the arguments object.
noArraySortForMinMax Disallow sorting an array only to read its smallest or largest value.
noAstroConflictingSetDirectives Disallow conflicting content sources on Astro elements.
noAstroSetHtmlDirective Disallow the use of Astro’s set:html directive.
noAwaitInPromiseMethods Disallow using await inside the array passed to Promise.all(), Promise.allSettled(), Promise.any(), or Promise.race().
noBaseToString Require stringification to avoid values that only use the default object representation.
noBooleanSortComparator Disallow sort comparators that return a boolean.
noBunModules Forbid the use of Bun builtin modules.
noChainedComparison Disallow chaining comparisons, as in a < b < c.
noConsoleSpaces Disallow leading and trailing spaces in console method arguments.
noConstantComparisons Disallow conditions that are always true, can never be true, or contain a check with no effect.
noDanglingUnderscore Disallow names that start or end with an underscore.
noDoubleComparison Disallow two comparisons of the same values that can be combined into one.
noDynamicDelete Disallow using the delete operator with a property name that is computed at runtime.
noEagerArrayMethodsInLoops Disallow .map() and .filter() calls in the header of for...of loops.
noErasingOperation Disallow operations with zero that always result in zero.
noExcessiveNestedBlocks Enforce a maximum depth that blocks can be nested.
noExcessiveStatementsPerFunction Enforce a maximum number of statements allowed in a function.
noExtendNative Disallow extending the prototype of built-in objects.
noFloatingPromises Require Promise-like statements to be handled appropriately.
noImpliedEval Disallow the use of eval()-like methods.
noInvalidFileInputAccept Disallow invalid accept values on file inputs.
noInvalidRemoveEventListener Disallow passing a newly created function to removeEventListener().
noInvalidThis Disallow this in places where it is undefined.
noJsRestrictedProperties Disallow specific object properties.
noLateEventControl Disallow calling preventDefault(), stopPropagation(), or stopImmediatePropagation() after the browser has finished handling the event.
noMagicArrayFlatDepth Disallow unexplained numbers as the depth argument of Array.prototype.flat().
noMapSpread Disallow spreading objects or arrays in the values returned by map() and flatMap() callbacks.
noMeaninglessVoidOperator Disallow void when it does not discard a call’s return value or a thenable.
noMisleadingReturnType Detect return type annotations that are misleadingly wider than what
noMismatchedMapKey Disallow checking a map for one key and then using a different key.
noMisplacedListElements Require <li> elements with an HTML element parent to be children of <ul>, <ol>, or <menu>.
noMissingThrow Disallow creating an error with new without throwing it.
noMisusedPromises Disallow Promises to be used in places where they are almost certainly a
noNegatedArrayPredicate Disallow negating the result of Array#some() or Array#every().
noNegationInEqualityCheck Disallow negated expressions on the left side of an equality check.
noNestedSwitch Disallow switch statements inside other switch statements.
noNestedTemplateLiterals Disallow template literals inside other template literals.
noNewRequire Disallow calling require with the new operator.
noNonScalableViewport Disallow disabling zoom with user-scalable=no in the <meta name="viewport"> element.
noNull Disallow the use of the null literal.
noNumberArgumentOutOfRange Disallow number method arguments that are outside the range the method accepts.
noObjectConstructor Disallow calling Object without arguments to create an empty object.
noObjectLiteralComparison Disallow comparing a value with an empty object {} or an empty array [].
noObsoleteAttributes Disallow obsolete attributes on HTML elements.
noObsoleteTags Disallow obsolete HTML elements.
noOctal Disallow numbers written with an extra leading zero.
noPathConcat Disallow building file paths and URLs by joining strings to __dirname, __filename, or import.meta values.
noPlaywrightNthMethods Disallow selecting Playwright elements by position with first(), last(), and nth().
noPlaywrightUnsafeReferences Disallow using variables from outside the function passed to page.evaluate() and page.addInitScript().
noProcessExit Disallow the use of process.exit().
noPromiseExecutorReturn Disallow returning values from the function passed to new Promise().
noReactObjectTypeAsDefaultProp Disallow array, object, and function values as default props in React components.
noRestrictedDependencies Disallow dependencies that are known to have better alternatives.
noReturnArrayPush Disallow using the return value of Array.prototype.push() and Array.prototype.unshift().
noReturnInFinally Disallow return statements in Promise.prototype.finally() callbacks.
noSelfImport Forbid a module from importing itself.
noSharedBranchCode Disallow the same code at the start or end of every branch of an if statement.
noSinglePromiseInPromiseMethods Disallow passing an array with a single element to Promise.all(), Promise.any(), or Promise.race().
noSubtractionComparison Disallow subtracting two values only to compare the result with 0.
noSvelteAddEventListener Disallow addEventListener in Svelte files.
noSvelteExportLet Disallow declaring Svelte component props with export let.
noSvelteIgnoredUnsubscribe Disallow ignoring the function returned by a store’s subscribe() method.
noSvelteInspect Disallow the use of the $inspect rune.
noSvelteInternal Disallow importing from svelte/internal.
noSvelteObjectInTextMustaches Disallow objects, arrays, functions, and classes in Svelte text mustaches.
noSvelteUnnecessaryStateWrap Disallow unnecessary $state wrapping of reactive classes.
noSvelteUselessDerivedBy Disallow $derived.by() when $derived() is sufficient.
noSyncMethods Disallow calling synchronous methods, such as fs.readFileSync().
noTailwindArbitraryValue Disallow arbitrary values in Tailwind CSS utility classes.
noTailwindLegacyUtilities Disallow Tailwind CSS utility classes that Tailwind CSS only keeps for backward compatibility.
noTailwindRawColors Disallow Tailwind CSS utility classes that use raw palette colors.
noTailwindRestyledComponents Disallow Tailwind utilities that override the appearance of components.
noTanstackQueryRestDestructuring Disallow rest destructuring and object spread on TanStack Query results.
noTanstackQueryVoidQueryFn Disallow TanStack Query functions that don’t return any data.
noThisOutsideOfClass Disallow this outside of classes.
noUndeclaredClasses Reports CSS class names in JSX className or class attributes that are not defined
noUndeclaredCustomProperties Reports custom properties used with var() that have no visible declaration.
noUninvokedArrayCallback Disallow array methods with callbacks on arrays that only have empty slots.
noUnmodifiedLoopCondition Disallow loop conditions whose variables are never modified in the loop.
noUnnecessaryStringTrim Disallow trim() before startsWith() or endsWith() when only one side of the string matters.
noUnreadableForOfExpression Disallow complex expressions as the value that a for...of loop goes through.
noUnreadableIife Disallow immediately called arrow functions whose body is wrapped in parentheses.
noUnsafeIframeSandbox Disallow an unsafe combination of the sandbox attribute.
noUnsafePlusOperands Disallow + operations with operands that are known to be unsafe.
noUnsafeReturn Disallow returning a value typed as any from a function.
noUnsafeTypeAssertion Disallow TypeScript type assertions other than const assertions.
noUnsafeUnaryMinus Require the operand of unary - to be a number or a bigint.
noUselessAssignment Disallow assignments whose value is never read.
noUselessAwait Disallow await on values that are never promises.
noUselessCall Disallow unnecessary .call() and .apply().
noUselessDateGetTime Disallow calling .getTime() on a date before passing it to the Date constructor.
noUselessLengthCheck Disallow checking the length of an array when the result doesn’t depend on it.
noUselessRecursion Disallow functions that return a call to themselves when a loop can do the same work.
noUselessSplice Disallow splice() calls that have a simpler alternative.
noUselessTypeAssertion Disallow type assertions that don’t change the type of an expression.
noUselessTypeConversion Disallow type conversions that do not change the type of an expression.
noVueBooleanDefault Disallow default values for Boolean props in Vue components.
noVueComputedPropertiesInData Disallow using computed properties inside the data function of a Vue component.
noVueDeprecatedConfigKeyCodes Disallow the deprecated Vue.config.keyCodes option.
noVueDeprecatedDeleteSet Disallow the $set and $delete functions that Vue 3 removed.
noVueDeprecatedDestroyedLifecycle Disallow the deprecated destroyed and beforeDestroy lifecycle hooks in Vue components.
noVueDeprecatedEventsApi Disallow the Vue $on, $off, and $once instance methods.
noVueDeprecatedListeners Disallow the deprecated Vue $listeners API.
noVueDeprecatedModelDefinition Disallow the deprecated model option in Vue components.
noVueDeprecatedPropsDefaultThis Disallow this in the default value function of a Vue prop.
noVueDeprecatedScopedSlots Disallow the deprecated Vue $scopedSlots API.
noVueExcessiveProps Limit the number of props a Vue component can declare.
noVueLifecycleAfterAwait Disallow registering Vue lifecycle hooks after an await in setup().
noVueMixin Disallow the mixins option in Vue components.
noVueMultipleObjectsInClass Disallow more than one object in an array passed to :class.
noVueMultipleSlotArgs Disallow passing more than one argument to a Vue slot.
noVueMutatingProps Disallow changing the props of a Vue component.
noVueRefObjectReactivityLoss Disallow reading the value of a Vue ref in a place where the read runs only once.
noVueRequiredPropWithDefault Disallow props that are both required and have a default value.
noVueRestrictedCallAfterAwait Disallow calling configured functions after an await in setup().
noVueShadowNativeEvents Disallow Vue component events named after built-in browser events.
noVueSideEffectsInComputed Disallow changing state inside Vue computed properties.
noVueThisInBeforeRouteEnter Disallow this in the beforeRouteEnter navigation guard of a Vue component.
noVueThisInTemplate Disallow this in Vue templates.
noVueUndeclaredEmits Require Vue components to declare the events they emit.
noVueUndeclaredProperties Disallow using properties that a Vue component doesn’t declare.
noVueUnusedEmitDeclarations Disallow declaring events that a Vue component never emits.
noVueWatchAfterAwait Disallow creating Vue watchers after an await in setup().
noXorAsExponentiation Disallow the bitwise XOR operator where exponentiation was likely intended.
noZeroFractions Disallow number literals with zero fractions or dangling dots.
useAccessorPairs Require a getter for every setter in objects and classes.
useAwaitThenable Enforce that await is only used on Promise values.
useBetterDomTraversing Prefer modern DOM traversal APIs over positional indexes and chained walks.
useBigintLiterals Enforce the use of bigint literals over the BigInt() constructor.
useBlockStatementOverIife Prefer block statements over functions that are called immediately only to create a scope.
useCapitalizedConstructors Require constructor names to begin with a capital letter.
useConsistentFunctionStyle Enforce consistent use of function declarations or expressions assigned to variables.
useConsistentJsonFileRead Enforce a consistent way of reading JSON files before passing them to JSON.parse().
useConsistentUnicodeBom Require or disallow a Unicode byte order mark at the beginning of a file.
useControlLabel Enforce that interactive control elements have an accessible label.
useDisposables Detects a disposable object assigned to a variable without using or await using syntax.
useExhaustiveSwitchCases Require switch-case statements to be exhaustive.
useExpectToContain Enforce using toContain() to check whether an array or string contains a value.
useExplicitReturnType Require explicit return types on functions and class methods.
useExplicitType Enforce types in functions, methods, variables, and parameters.
useFlatMathMinMax Prefer flat Math.min() and Math.max() calls over nested calls of the same method.
useIncludes Prefer Array#includes() over Array#indexOf(), Array#lastIndexOf(), and Array#some() when checking for existence or non-existence.
useIteratorZip Prefer Iterator.zip() over reading several arrays with the same index.
useLowercaseTestTitle Require test and test suite titles to start with a lowercase letter.
useMatchingFunctionName Require function names to match the name of the variable or property they are assigned to.
useMathAbs Prefer Math.abs() over manual absolute value calculations and range checks.
useMathTrunc Require Math.trunc() instead of tricks that remove the decimal part of a number.
useModernMathApis Use modern Math APIs for common mathematical operations.
useNamedFunction Require function expressions to have a name.
useNextScriptForGoogleAnalytics Enforce the use of the @next/third-parties/google components to load Google Analytics and Google Tag Manager.
useNullishCoalescing Enforce using the nullish coalescing operator (??) instead of logical or (`
useObjectFromEntries Enforce using Object.fromEntries() to build an object from a list of key-value pairs.
usePromiseRejectErrors Require Error objects as Promise rejection reasons.
useReactCompiler Validate files with React Compiler.
useReactFunctionComponentDefinition Enforce a specific function type for React function components.
useReactNamingConvention Enforces naming conventions for React createContext, useId, and useRef.
useReactNativeValidPlatformColors Require PlatformColor() and DynamicColorIOS() calls to use values written directly in the call.
useRegexpExec Enforce RegExp#exec over String#match if no global flag is provided.
useSetSize Prefer reading the size property of a Set over converting the Set to an array to read its length.
useSimplifiedBooleanReturn Return conditions directly instead of using if statements that only return true or false.
useStrictBooleanExpressions Require unambiguous boolean expressions in conditions.
useStringStartsEndsWith Prefer String#startsWith() and String#endsWith() over verbose prefix and suffix checks.
useSvelteEventDispatcherTypes Require createEventDispatcher calls to declare the types of their events.
useSvelteKitResolve Require internal navigation in SvelteKit apps to use paths built with resolve().
useSvelteKitRuneImports Require importing SvelteKit’s app state from $app/state instead of $app/stores.
useSvelteReactiveClasses Require the reactive classes from svelte/reactivity instead of built-in objects that are
useSvelteStoreInitialValue Require Svelte stores to be created with an initial value.
useTailwindShorthandClasses Enforce using fewer Tailwind utilities instead of multiple utilities that are functionally the same.
useTailwindSortedClasses Enforce the sorting of Tailwind CSS classes.
useTailwindStaticClassStrings Require complete, statically written class names.
useTailwindVariablesShorthand Enforce the shorthand syntax for CSS variables in Tailwind CSS classes.
useTanstackQueryInfiniteQueryPropertyOrder Enforce a consistent property order in the options of TanStack Query infinite query functions.
useTanstackQueryStableQueryClient Require the TanStack Query QueryClient to be created once, not on every render.
useUnaryMinus Enforce the use of the unary minus operator over multiplying or dividing by -1.
useValidTestTitle Enforce valid titles for unit test cases and test suites.
useVueBaseImport Enforce importing Vue’s public entry point instead of internal Vue packages.
useVueBooleanPropTypeFirst Require Boolean to be the first type of Vue props that accept several types.
useVueComputedPropertyReturn Require computed properties in Vue components to return a value.
useVueConsistentDefineEmitsDeclaration Enforce a consistent declaration style for Vue’s defineEmits macro.
useVueConsistentPropNameCasing Enforce a consistent casing style for prop names in Vue components.
useVueDefaultExport Require the <script> block of a Vue component to have a default export.
useVueDefaultProp Require a default value for optional props in Vue components.
useVueDefineOptions Enforce defineOptions() instead of a default export in components that use <script setup>.
useVueDefinePropsDestructuring Require destructuring the props returned by Vue’s defineProps macro.
useVueEmitValidator Require a validator function for each event declared in the emits option or in defineEmits().
useVueEmitsValidatorReturn Require the validator function of a Vue event to return a true value when the event is valid.
useVueMacroVariableName Require specific variable names for the results of defineProps(), defineEmits(), defineSlots(), useSlots() and useAttrs().
useVueMatchingComponentFileName Enforce that the name of a Vue component matches its file name.
useVueOneComponentPerFile Enforce that each file defines at most one Vue component.
useVuePropTypeConstructor Require the type of a Vue prop to be a constructor.
useVueRenderReturn Require the render function of a Vue component to return a value.
useVueSeparateStaticClass Require static class names to be in a separate class attribute.
useVueSingleEventPayload Require Vue component events to carry at most one value.
useVueSlotsAsFunctions Require the slots in this.$slots to be called as functions.
useVueTemplateRef Require useTemplateRef() instead of ref() or shallowRef() to access elements of the template.
useVueTypedObjectProps Require a TypeScript type for Vue props declared with Object or Array.
useVueTypedProps Require a type for every prop of a Vue component.
useVueTypedRef Require a type for refs created with ref() or shallowRef() in TypeScript.
useVueValidDefaultProp Require the default value of a Vue prop to match the type of the prop.
useVueValidDefineEmits Enforce valid usage of Vue’s defineEmits macro.
useVueValidDefineOptions Enforce valid usage of Vue’s defineOptions() macro.
useVueValidDefineProps Enforce valid defineProps() calls in Vue components.
useVueValidNextTick Enforce valid calls to Vue’s nextTick function.
useVueValidVMemo Enforce valid v-memo Vue directives.
useWhileLoopCondition Require the condition that ends a loop to be written in the while statement.
Rule name Description Properties
noAccumulatingSpread Disallow the use of spread (...) syntax on accumulators.
noAwaitInLoops Disallow await inside loops.
noBarrelFile Disallow the use of barrel file.
noDelete Disallow the use of the delete operator.
noDynamicNamespaceImportAccess Disallow accessing namespace imports dynamically.
noImgElement Prevent usage of <img> element in a Next.js project.
noJsxPropsBind Disallow .bind(), arrow functions, or function expressions in JSX props
noNamespaceImport Disallow the use of namespace imports.
noReExportAll Avoid re-export all.
noSyncScripts Prevent the usage of synchronous scripts.
noUnwantedPolyfillio Prevent duplicate polyfills from Polyfill.io.
useDomNodeTextContent Prefer .textContent over .innerText for DOM node text.
useGoogleFontPreconnect Ensure the preconnect attribute is used when using Google Fonts.
useSolidForComponent Enforce using Solid’s <For /> component for mapping an array to JSX elements.
useTopLevelRegex Require regex literals to be declared at the top level.
Rule name Description Properties
noBlankTarget Disallow target="_blank" attribute without rel="noopener".
noDangerouslySetInnerHtml Disallow React’s dangerouslySetInnerHTML property.
noDangerouslySetInnerHtmlWithChildren Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop.
noGlobalEval Disallow the use of global eval().
noScriptUrl Disallow javascript: URLs.
noSecrets Disallow usage of sensitive data such as API keys and tokens.
useIframeSandbox Enforce the ‘sandbox’ attribute for ‘iframe’ elements.
Rule name Description Properties
noCommonJs Disallow use of CommonJs module system in favor of ESM style imports.
noContinue Disallow continue statements.
noDefaultExport Disallow default exports.
noDoneCallback Disallow using a callback in asynchronous tests and hooks.
noEnum Disallow TypeScript enum.
noExcessiveClassesPerFile Enforce a maximum number of classes per file.
noExcessiveLinesPerFile Restrict the number of lines in a file.
noExportedImports Disallow exporting an imported variable.
noHeadElement Prevent usage of <head> element in a Next.js project.
noImplicitBoolean Disallow implicit true values on JSX boolean attributes
noIncrementDecrement Disallows the usage of the unary operators ++ and –.
noInferrableTypes Disallow type annotations for variables, parameters, and class properties initialized with a literal expression.
noInlineStyles Disallow the use of inline styles.
noJsxLiterals Disallow string literals inside JSX elements.
noMagicNumbers Reports usage of “magic numbers” — numbers used directly instead of being assigned to named constants.
noMultiAssign Disallow use of chained assignment expressions
noMultilineString Disallow creating multiline strings by escaping newlines.
noNamespace Disallow the use of TypeScript’s namespaces.
noNegationElse Disallow negation in the condition of an if statement if it has an else clause.
noNestedTernary Disallow nested ternary expressions.
noNonNullAssertion Disallow non-null assertions using the ! postfix operator.
noParameterAssign Disallow reassigning function parameters.
noParameterProperties Disallow the use of parameter properties in class constructors.
noPlaywrightElementHandle Disallow usage of element handles (page.$() and page.$$()).
noPlaywrightEval Disallow usage of page.$eval() and page.$$eval().
noPlaywrightWaitForSelector Disallow using page.waitForSelector().
noProcessEnv Disallow the use of process.env.
noReactNativeLiteralColors Disallow color literals in React Native styles.
noRestrictedGlobals This rule allows you to specify global variable names that you don’t want to use in your application.
noRestrictedImports Disallow specified modules when loaded by import or require.
noRestrictedTypes Disallow user defined types.
noShoutyConstants Disallow constants whose string value is the same as their uppercase name.
noSubstr Enforce the use of String.slice() over String.substr() and String.substring().
noTernary Disallow ternary operators.
noUnusedTemplateLiteral Disallow template literals if interpolation and special-character handling are not needed
noUselessElse Disallow else block when the if block breaks early.
noVueOptionsApi Disallow the use of Vue Options API.
noYodaExpression Disallow the use of yoda expressions.
useArrayLiterals Disallow Array constructors.
useAsConstAssertion Enforce the use of as const over literal type and type annotation.
useAtIndex Use at() instead of integer index access.
useBlockStatements Requires following curly brace conventions.
useCollapsedElseIf Enforce using else if instead of nested if in else clauses.
useCollapsedIf Enforce using single if instead of nested if clauses.
useComponentExportOnlyModules Enforce declaring components only within modules that export React Components exclusively.
useConsistentArrayType Require consistently using either T[] or Array<T>
useConsistentArrowReturn Enforce consistent arrow function bodies.
useConsistentBuiltinInstantiation Enforce the use of new for all builtins, except String, Number and Boolean.
useConsistentCurlyBraces This rule enforces consistent use of curly braces inside JSX attributes and JSX children.
useConsistentEnumValueType Disallow enums from having both number and string members.
useConsistentMemberAccessibility Require consistent accessibility modifiers on class properties and methods.
useConsistentMethodSignatures Enforce one syntax for functions declared in interfaces and type aliases.
useConsistentObjectDefinitions Require the consistent declaration of object literals.
useConsistentTestIt Enforce consistent use of it or test for test functions.
useConsistentTypeDefinitions Enforce type definitions to consistently use either interface or type.
useConst Require const declarations for variables that are only assigned once.
useDefaultParameterLast Enforce default function parameters and optional function parameters to be last.
useDefaultSwitchClause Require the default clause in switch statements.
useDestructuring Require destructuring from arrays and/or objects
useDomQuerySelector Prefer querySelector() and querySelectorAll() over older DOM query APIs.
useEnumInitializers Require that each enum member value be explicitly initialized.
useErrorCause Enforce that new Error() is thrown with the original error as cause.
useExplicitLengthCheck Enforce explicitly comparing the length, size, byteLength or byteOffset property of a value.
useExponentiationOperator Disallow the use of Math.pow in favor of the ** operator.
useExportType Promotes the use of export type for types.
useExportsLast Require that all exports are declared after all non-export statements.
useFilenamingConvention Enforce naming conventions for JavaScript and TypeScript filenames.
useForOf Prefer using for...of loops over standard for loops where possible.
useFragmentSyntax This rule enforces the use of <>...</> over <Fragment>...</Fragment>.
useGlobalThis Enforce the use of globalThis over window, self, and global.
useGroupedAccessorPairs Enforce that getters and setters for the same property are adjacent in class and object definitions.
useImportType Promotes the use of import type for types.
useImportsFirst Enforce that all imports appear at the top of the module.
useLiteralEnumMembers Require all enum members to be literal values.
useNamedCaptureGroup Enforce using named capture groups in regular expression.
useNamingConvention Enforce naming conventions for everything across a codebase.
useNodeAssertStrict Prefer node:assert/strict over node:assert.
useNodejsImportProtocol Enforces using the node: protocol for Node.js builtin modules.
useNumberNamespace Use the Number properties instead of global ones.
useNumericSeparators Enforce the use of numeric separators in numeric literals.
useObjectSpread Prefer object spread over Object.assign() when constructing new objects.
useReactFunctionComponents Enforce that components are defined as functions and never as classes.
useReadonlyClassProperties Enforce marking instance properties as readonly if they are never modified outside the
useReduceTypeParameter Enforce using a type parameter on Array#reduce instead of casting the initial value.
useSelfClosingElements Prevent extra closing tags for components without children.
useShorthandAssign Require assignment operator shorthand where possible.
useShorthandFunctionType Enforce using function types instead of object type with call signatures.
useSingleVarDeclarator Disallow multiple variable declarations in the same variable statement
useSpreadOverApply Enforce the use of the spread operator over .apply().
useSymbolDescription Require a description parameter for the Symbol().
useTemplate Prefer template literals over string concatenation.
useTestHooksInOrder Enforce that test lifecycle hooks are declared in the order they execute.
useTestHooksOnTop Enforce that lifecycle hooks appear before any test cases in the same block.
useThisInClassMethods Enforce that class methods utilize this.
useThrowNewError Require new when throwing an error.
useThrowOnlyError Disallow throwing non-Error values.
useTrimStartEnd Enforce the use of String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight().
useUnicodeRegex Enforce the use of the u or v flag for regular expressions.
useUnifiedTypeSignatures Disallow overload signatures that can be unified into a single signature.
useVarsOnTop Require var declarations to appear at the top of their containing scope.
useVueConsistentDefinePropsDeclaration Enforce a consistent declaration style for Vue’s defineProps macro.
useVueDefineMacrosOrder Enforce specific order of Vue compiler macros.
useVueMultiWordComponentNames Enforce multi-word component names in Vue components.
useVueNextTickPromise Enforces Promise syntax when using Vue nextTick.
Rule name Description Properties
noAlert Disallow the use of alert, confirm, and prompt.
noApproximativeNumericConstant Use standard constants instead of approximated literals.
noArrayIndexKey Discourage the usage of Array index in keys.
noAssignInExpressions Disallow assignments in expressions.
noAsyncPromiseExecutor Disallows using an async function as a Promise executor.
noBitwiseOperators Disallow bitwise operators.
noCatchAssign Disallow reassigning exceptions in catch clauses.
noClassAssign Disallow reassigning class members.
noCommentText Prevent comments from being inserted as text nodes
noCompareNegZero Disallow comparing against -0
noConditionalExpect Disallow conditional expect() calls inside tests.
noConfusingLabels Disallow labeled statements that are not loops.
noConfusingVoidType Disallow void type outside of generic or return types.
noConsole Disallow the use of console.
noConstEnum Disallow TypeScript const enum
noConstantBinaryExpressions Disallow expressions where the operation doesn’t affect the value
noControlCharactersInRegex Prevents from having control characters and some escape sequences that match control characters in regular expression literals.
noDebugger Disallow the use of debugger
noDeprecatedImports Restrict imports of deprecated exports.
noDocumentCookie Disallow direct assignments to document.cookie.
noDocumentImportInPage Prevents importing next/document outside of pages/_document.jsx in Next.js projects.
noDoubleEquals Require the use of === and !==.
noDrizzleDeleteWithoutWhere Require .where() to be called when using .delete() with Drizzle ORM.
noDrizzleUpdateWithoutWhere Require .where() to be called when using .update() with Drizzle ORM.
noDuplicateCase Disallow duplicate case labels.
noDuplicateClassMembers Disallow duplicate class members.
noDuplicateElseIf Disallow duplicate conditions in if-else-if chains
noDuplicateEnumValues Disallow duplicate enum member values.
noDuplicateJsxProps Disallow duplicate JSX properties.
noDuplicateObjectKeys Disallow two keys with the same name inside objects.
noDuplicateParameters Disallow duplicate function parameter name.
noDuplicateTestHooks A describe block should not contain duplicate hooks.
noDuplicatedSpreadProps Disallow JSX prop spreading the same identifier multiple times.
noEmptyBlockStatements Disallow empty block statements and static blocks.
noEmptyInterface Disallow the declaration of empty interfaces.
noEmptySource Disallow empty sources.
noEqualsToNull Require the use of === or !== for comparison with null.
noEvolvingTypes Disallow variables from evolving into any type through reassignments.
noExplicitAny Disallow the any type usage.
noExportsInTest Disallow using export or module.exports in files containing tests
noExtraNonNullAssertion Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files.
noFallthroughSwitchClause Disallow fallthrough of switch clauses.
noFocusedTests Disallow focused tests.
noForIn Disallow iterating using a for-in loop.
noFunctionAssign Disallow reassigning function declarations.
noGlobalAssign Disallow assignments to native objects and read-only global variables.
noGlobalIsFinite Use Number.isFinite instead of global isFinite.
noGlobalIsNan Use Number.isNaN instead of global isNaN.
noHeadImportInDocument Prevent using the next/head module in pages/_document.js on Next.js projects.
noIdenticalTestTitle Disallow identical titles in test suites and test cases.
noImplicitAnyLet Disallow use of implicit any type on variable declarations.
noImportAssign Disallow assigning a new value to an imported variable.
noImportCycles Prevent import cycles.
noIrregularWhitespace Disallows the use of irregular whitespace characters.
noJsxLeakedDollar Flags text nodes with a trailing $ before a JSX expression.
noLabelVar Disallow labels that share a name with a variable
noLeakedRender Prevent problematic leaked values from being rendered.
noLoopFunc Disallow functions created inside loops when they use variables that can change.
noMisleadingCharacterClass Disallow characters made with multiple code points in character class syntax.
noMisleadingInstantiator Enforce proper usage of new and constructor.
noMisplacedAssertion Checks that the assertion function, for example expect, is placed inside an it() function call.
noMisrefactoredShorthandAssign Disallow shorthand assign when variable appears on both sides.
noNestedPromises Disallow nested .then() or .catch() promise calls.
noNonNullAssertedOptionalChain Disallow non-null assertions after optional chaining expressions.
noOctalEscape Disallow octal escape sequences in string literals
noParametersOnlyUsedInRecursion Disallow function parameters that are only used in recursive calls.
noPlaywrightForceOption Disallow usage of the { force: true } option.
noPlaywrightNetworkidle Disallow usage of the networkidle option.
noPlaywrightPagePause Disallow using page.pause().
noPlaywrightWaitForNavigation Disallow using page.waitForNavigation().
noPlaywrightWaitForTimeout Disallow using page.waitForTimeout().
noProto Disallow the use of the deprecated __proto__ object property.
noPrototypeBuiltins Disallow direct use of Object.prototype builtins.
noReactForwardRef Replaces usages of forwardRef with passing ref as a prop.
noReactNativeDeepImports Disallow deep imports from the react-native package.
noReactSpecificProps Prevents React-specific JSX properties from being used.
noReactStringRefs Disallow string refs in React components.
noRedeclare Disallow variable, function, class, and type redeclarations in the same scope.
noRedundantUseStrict Prevents from having redundant "use strict".
noReturnAssign Disallow assignments in return statements.
noSelfCompare Disallow comparisons where both sides are exactly the same.
noShadow Disallow variable declarations from shadowing variables declared in the outer scope.
noShadowRestrictedNames Disallow identifiers from shadowing restricted names.
noSkippedTests Disallow disabled tests.
noSparseArray Prevents the use of sparse arrays (arrays with holes).
noSuspiciousSemicolonInJsx It detects possible “wrong” semicolons inside JSX elements.
noTemplateCurlyInString Disallow template literal placeholder syntax in regular strings.
noThenProperty Disallow then property.
noTsIgnore Prevents the use of the TypeScript directive @ts-ignore.
noUnassignedVariables Disallow let or var variables that are read but never assigned.
noUndeclaredEnvVars Disallow the use of undeclared environment variables.
noUnknownAttribute Disallow unknown DOM properties.
noUnnecessaryConditions Disallow conditions that always evaluate to the same value.
noUnsafeDeclarationMerging Disallow unsafe declaration merging between interfaces and classes.
noUnsafeNegation Disallow using unsafe negation.
noUnusedExpressions Disallow expression statements that are neither a function call nor an
noUselessEscapeInString Disallow unnecessary escapes in string literals.
noUselessRegexBackrefs Disallow useless backreferences in regular expression literals that always match an empty string.
noVar Disallow the use of var
noVueArrowFuncInWatch Disallows using arrow functions when defining a watcher.
noWith Disallow with statements in non-strict contexts.
useAdjacentOverloadSignatures Disallow the use of overload signatures that are not next to each other.
useArraySortCompare Require Array#sort and Array#toSorted calls to always provide a compareFunction.
useAwait Ensure async functions utilize await.
useDefaultSwitchClauseLast Enforce default clauses in switch statements to be last
useErrorMessage Enforce passing a message value when creating a built-in error.
useExpect Ensure that test functions contain at least one expect() or similar assertion.
useGetterReturn Enforce get methods to always return a value.
useGoogleFontDisplay Enforces the use of a recommended display strategy with Google Fonts.
useGuardForIn Require for-in loops to include an if statement.
useIsArray Use Array.isArray() instead of instanceof Array.
useIterableCallbackReturn Enforce consistent return values in iterable callbacks.
useNamespaceKeyword Require using the namespace keyword over the module keyword to declare TypeScript namespaces.
useNumberToFixedDigitsArgument Enforce using the digits argument with Number#toFixed().
useStaticResponseMethods Use static Response methods instead of new Response() constructor when possible.
useStrictMode Enforce the use of the directive "use strict" in script files.

Missing a rule? Help us by contributing to the analyzer or create a rule suggestion here.