Skip to content

General Logic & Style

Rules for code quality, control flow, and common pitfalls. Browse all 35 rules in this category.

Showing 35 rules

No Recursive

General Logic & Style
no-recursive

Disallow recursive function calls to prevent stack overflow.

  • Suggestion

Directive Disable Enable Pair

General Logic & Style
directive-disable-enable-pair

Require a matching enable comment for every `oxlint-disable` or `eslint-disable` block directive.

  • Suggestion

Directive No Aggregating Enable

General Logic & Style
directive-no-aggregating-enable

Disallow aggregating `oxlint-enable` or `eslint-enable` comments across multiple disable directives.

  • Suggestion

Directive No Duplicate Disable

General Logic & Style
directive-no-duplicate-disable

Disallow duplicate `oxlint-disable` or `eslint-disable` comments.

  • Problem

Directive No Restricted Disable

General Logic & Style
directive-no-restricted-disable

Disallow `oxlint-disable` or `eslint-disable` comments for configured rules.

  • Suggestion

Directive No Unlimited Disable

General Logic & Style
directive-no-unlimited-disable

Disallow `oxlint-disable` or `eslint-disable` comments without rule names.

  • Suggestion

Directive No Unused Enable

General Logic & Style
directive-no-unused-enable

Disallow unused `oxlint-enable` or `eslint-enable` comments.

  • Suggestion

Directive No Use

General Logic & Style
directive-no-use

Disallow block ESLint/Oxlint directive comments.

  • Suggestion

Directive Require Description

General Logic & Style
directive-require-description

Require descriptions for `oxlint` and `eslint` disable/enable directives.

  • Suggestion

No Async Constructor

General Logic & Style
no-async-constructor

Disallow asynchronous operations inside class constructors. Constructors return immediately, so async work causes race conditions, unhandled rejections, and incomplete object states.

  • Problem

No Commented Code

General Logic & Style
no-commented-code

Disallow commented-out code

  • Suggestion
  • Editor suggestions

No Constant Condition With Break

General Logic & Style
no-constant-condition-with-break

Disallow constant conditions, but allow constant loops that include loop exits such as break, return, or configured calls.

  • Problem

Isolated Functions

General Logic & Style
isolated-functions

Prevent usage of variables from outside the scope of isolated functions.

  • Problem

No Dead Store

General Logic & Style
no-dead-store

Disallow assignments whose value is never read.

  • Problem

No Error

General Logic & Style
no-error

Use throw instead of error().

  • Problem

No Filter Map Chain

General Logic & Style
no-filter-map-chain

Disallow map(...) directly after filter(...).

  • Suggestion

No Floating Point Equality

General Logic & Style
no-floating-point-equality

Disallow exact comparisons involving inexact floating-point values.

  • Problem

No Identity Map

General Logic & Style
no-identity-map

Disallow pointless identity `.map()` calls that return the parameter unchanged

  • Suggestion
  • Automatic fix

No Increment Decrement

General Logic & Style
no-increment-decrement

Disallow standalone `++` and `--` statements and for-loop update clauses.

  • Suggestion
  • Automatic fix

No Loop Iterable Mutation

General Logic & Style
no-loop-iterable-mutation

Disallow mutating a loop iterable during iteration.

  • Problem

No Restricted Property Assignment

General Logic & Style
no-restricted-property-assignment

Disallow assignment to restricted object properties.

  • Problem

No Trivial Assertions

General Logic & Style
no-trivial-assertions

Disallow assertions that always succeed or compare against freshly created values.

  • Problem

No Unused Imports

General Logic & Style
no-unused-imports

Disallow unused imports

  • Problem
  • Automatic fix

No Use Of Empty Return Value

General Logic & Style
no-use-of-empty-return-value

Disallow using the return value of functions that do not return anything.

  • Problem

No Useless Constants

General Logic & Style
no-useless-constants

Disallow constants that do not add value.

  • Problem
  • Automatic fix

No Variadic Spread

General Logic & Style
no-variadic-spread

Disallow spreading a potentially unbounded array into a variadic call, because every element becomes a stack-allocated argument.

  • Problem

Only Type Imports

General Logic & Style
only-type-imports

Require all imports to be type-only imports. Benchmarks cannot import non-types because the benchmarker plugin will throw an error.

  • Problem

Prefer Class Properties

General Logic & Style
prefer-class-properties

Prefer class properties to assignment of literals in constructors.

  • Suggestion

Prefer Early Return

General Logic & Style
prefer-early-return

Prefer early returns over full-body conditional wrapping.

  • Suggestion

Prefer Expect Assertions

General Logic & Style
prefer-expect-assertions

Enforce expect assertion guards in tests and prefer expect.assertions(n) over expect.hasAssertions() when the count is known.

  • Suggestion
  • Automatic fix and editor suggestions

Prefer Module Scope Constants

General Logic & Style
prefer-module-scope-constants

Prefer screaming snake case constants at module scope or the allowed top-level wrapper scope.

  • Suggestion

Require Paired Calls

General Logic & Style
require-paired-calls

Enforces balanced opener/closer function calls across all execution paths

  • Problem

Require Switch Case Braces

General Logic & Style
require-switch-case-braces

Require braces around switch case bodies selected by line span or statement count.

  • Problem
  • Automatic fix

Require Throw Error Capture

General Logic & Style
require-throw-error-capture

Require 'Error.captureStackTrace' before directly throwing new Error instances in named functions.

  • Suggestion
  • Automatic fix

Require Unicode Regex

General Logic & Style
require-unicode-regex

Require the 'u' or 'v' unicode flag on calls named regex().

  • Problem