General Logic & Style
Rules for code quality, control flow, and common pitfalls.Browse all 27 rules in this category.
Showing 27 rules
No Recursive
General Logic & Styleno-recursive<MISSING-DESCRIPTION>
- Suggestion
Directive Disable Enable Pair
General Logic & Styledirective-disable-enable-pairRequire a matching enable comment for every `oxlint-disable` or `eslint-disable` block directive.
- Suggestion
Directive No Aggregating Enable
General Logic & Styledirective-no-aggregating-enableDisallow aggregating `oxlint-enable` or `eslint-enable` comments across multiple disable directives.
- Suggestion
Directive No Duplicate Disable
General Logic & Styledirective-no-duplicate-disableDisallow duplicate `oxlint-disable` or `eslint-disable` comments.
- Problem
Directive No Restricted Disable
General Logic & Styledirective-no-restricted-disableDisallow `oxlint-disable` or `eslint-disable` comments for configured rules.
- Suggestion
Directive No Unlimited Disable
General Logic & Styledirective-no-unlimited-disableDisallow `oxlint-disable` or `eslint-disable` comments without rule names.
- Suggestion
Directive No Unused Enable
General Logic & Styledirective-no-unused-enableDisallow unused `oxlint-enable` or `eslint-enable` comments.
- Suggestion
Directive No Use
General Logic & Styledirective-no-useDisallow block ESLint/Oxlint directive comments.
- Suggestion
Directive Require Description
General Logic & Styledirective-require-descriptionRequire descriptions for `oxlint` and `eslint` disable/enable directives.
- Suggestion
No Async Constructor
General Logic & Styleno-async-constructorDisallow 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 & Styleno-commented-codeDisallow commented-out code
- Suggestion
- Editor suggestions
No Constant Condition With Break
General Logic & Styleno-constant-condition-with-breakDisallow constant conditions, but allow constant loops that include loop exits such as break, return, or configured calls.
- Problem
No Error
General Logic & Styleno-errorUse throw instead of error().
- Problem
No Identity Map
General Logic & Styleno-identity-mapDisallow pointless identity `.map()` calls that return the parameter unchanged
- Suggestion
- Automatic fix
No Increment Decrement
General Logic & Styleno-increment-decrementDisallow standalone `++` and `--` statements and for-loop update clauses.
- Suggestion
- Automatic fix
No Restricted Property Assignment
General Logic & Styleno-restricted-property-assignmentDisallow assignment to restricted object properties.
- Problem
No Unused Imports
General Logic & Styleno-unused-importsDisallow unused imports
- Problem
- Automatic fix
No Useless Constants
General Logic & Styleno-useless-constantsDisallow constants that do not add value.
- Problem
- Automatic fix
Only Type Imports
General Logic & Styleonly-type-importsRequire 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 & Styleprefer-class-propertiesPrefer class properties to assignment of literals in constructors.
- Suggestion
Prefer Early Return
General Logic & Styleprefer-early-returnPrefer early returns over full-body conditional wrapping.
- Suggestion
Prefer Expect Assertions
General Logic & Styleprefer-expect-assertionsEnforce 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 & Styleprefer-module-scope-constantsPrefer screaming snake case constants at module scope or the allowed top-level wrapper scope.
- Suggestion
Require Paired Calls
General Logic & Stylerequire-paired-callsEnforces balanced opener/closer function calls across all execution paths
- Problem
Require Switch Case Braces
General Logic & Stylerequire-switch-case-bracesRequire braces around switch case bodies selected by line span or statement count.
- Problem
- Automatic fix
Require Throw Error Capture
General Logic & Stylerequire-throw-error-captureRequire 'Error.captureStackTrace' before directly throwing new Error instances in named functions.
- Suggestion
- Automatic fix
Require Unicode Regex
General Logic & Stylerequire-unicode-regexRequire the 'u' or 'v' unicode flag on calls named regex().
- Problem