Enforce return statements in callbacks of array methods
đĄ Suggestions
Rules in ESLint are grouped by type to help you understand their purpose. Each rule has emojis denoting:
Using the recommended config from @eslint/js in a configuration file
enables this rule
Some problems reported by this rule are automatically fixable by the --fix command line option
Some problems reported by this rule are manually fixable by editor suggestions
This rule is currently frozen and is not accepting feature requests.
These rules relate to possible logic errors in code:
Enforce return statements in callbacks of array methods
đĄ Suggestions
Require super() calls in constructors
â Extends
Enforce for loop update clause moving the counter in the right direction
â Extends
Enforce return statements in getters
â Extends
Disallow using an async function as a Promise executor
â Extends
Disallow await inside of loops
Disallow reassigning class members
â Extends
Disallow comparing against -0
â Extends
Disallow assignment operators in conditional expressions
â Extends
Disallow reassigning const variables
â Extends
Disallow expressions where the operation doesnât affect the value
â Extends
Disallow constant expressions in conditions
â Extends
Disallow returning value from constructor
Disallow control characters in regular expressions
â Extends
Disallow the use of debugger
â Extends
Disallow duplicate arguments in function definitions
â Extends
Disallow duplicate class members
â Extends
Disallow duplicate conditions in if-else-if chains
â Extends
Disallow duplicate keys in object literals
â Extends
Disallow duplicate case labels
â Extends
Disallow duplicate module imports
Disallow empty character classes in regular expressions
â Extends
Disallow empty destructuring patterns
â Extends
Disallow reassigning exceptions in catch clauses
â Extends
Disallow fallthrough of case statements
â Extends
Disallow reassigning function declarations
â Extends
Disallow assigning to imported bindings
â Extends
Disallow variable or function declarations in nested blocks
Disallow invalid regular expression strings in RegExp constructors
â Extends
Disallow irregular whitespace
â Extends
Disallow literal numbers that lose precision
â Extends
Disallow characters which are made with multiple code points in character class syntax
â Extends
đĄ Suggestions
Disallow new operators with global non-constructor functions
â Extends
Disallow calling global object properties as functions
â Extends
Disallow returning values from Promise executor functions
đĄ Suggestions
Disallow calling some Object.prototype methods directly on objects
â Extends
đĄ Suggestions
Disallow assignments where both sides are exactly the same
â Extends
Disallow comparisons where both sides are exactly the same
Disallow returning values from setters
â Extends
Disallow sparse arrays
â Extends
Disallow template literal placeholder syntax in regular strings
Disallow this/super before calling super() in constructors
â Extends
Disallow the use of undeclared variables unless mentioned in /*global */ comments
â Extends
Disallow confusing multiline expressions
â Extends
Disallow unmodified loop conditions
Disallow unreachable code after return, throw, continue, and break statements
â Extends
Disallow loops with a body that allows only one iteration
Disallow control flow statements in finally blocks
â Extends
Disallow negating the left operand of relational operators
â Extends
đĄ Suggestions
Disallow use of optional chaining in contexts where the undefined value is not allowed
â Extends
Disallow unused private class members
â Extends
Disallow unused variables
â Extends
đĄ Suggestions
Disallow the use of variables before they are defined
Disallow variable assignments when the value is not used
Disallow useless backreferences in regular expressions
â Extends
Disallow assignments that can lead to race conditions due to usage of await or yield
Require calls to isNaN() when checking for NaN
â Extends
đĄ Suggestions
Enforce comparing typeof expressions against valid strings
â Extends
đĄ Suggestions
These rules suggest alternate ways of doing things:
Enforce getter and setter pairs in objects and classes
âī¸ Frozen
Require braces around arrow function bodies
đ§ Fix
Enforce the use of variables within the scope they are defined
âī¸ Frozen
Enforce camelcase naming convention
âī¸ Frozen
Enforce or disallow capitalization of the first letter of a comment
đ§ Fix
Enforce that class methods utilize this
Enforce a maximum cyclomatic complexity allowed in a program
Require return statements to either always or never specify values
âī¸ Frozen
Enforce consistent naming when capturing the current execution context
âī¸ Frozen
Enforce consistent brace style for all control statements
đ§ Fix
Require default cases in switch statements
Enforce default clauses in switch statements to be last
âī¸ Frozen
Enforce default parameters to be last
âī¸ Frozen
Enforce dot notation whenever possible
đ§ Fix
Require the use of === and !==
đ§ Fix
âī¸ Frozen
Require function names to match the name of the variable or property to which they are assigned
Require or disallow named function expressions
âī¸ Frozen
Enforce the consistent use of either function declarations or expressions assigned to variables
Require grouped accessor pairs in object literals and classes
Require for-in loops to include an if statement
âī¸ Frozen
Disallow specified identifiers
âī¸ Frozen
Enforce minimum and maximum identifier lengths
âī¸ Frozen
Require identifiers to match a specified regular expression
âī¸ Frozen
Require or disallow initialization in variable declarations
âī¸ Frozen
Require or disallow logical assignment operator shorthand
đ§ Fix
đĄ Suggestions
Enforce a maximum number of classes per file
Enforce a maximum depth that blocks can be nested
Enforce a maximum number of lines per file
Enforce a maximum number of lines of code in a function
Enforce a maximum depth that callbacks can be nested
Enforce a maximum number of parameters in function definitions
Enforce a maximum number of statements allowed in function blocks
Require constructor names to begin with a capital letter
Disallow the use of alert, confirm, and prompt
Disallow Array constructors
đĄ Suggestions
Disallow bitwise operators
Disallow the use of arguments.caller or arguments.callee
Disallow lexical declarations in case clauses
â Extends
đĄ Suggestions
Disallow the use of console
đĄ Suggestions
âī¸ Frozen
Disallow continue statements
Disallow deleting variables
â Extends
âī¸ Frozen
Disallow equal signs explicitly at the beginning of regular expressions
đ§ Fix
âī¸ Frozen
Disallow else blocks after return statements in if statements
đ§ Fix
Disallow empty block statements
â Extends
đĄ Suggestions
Disallow empty functions
Disallow empty static blocks
â Extends
Disallow null comparisons without type-checking operators
Disallow the use of eval()
Disallow extending native types
Disallow unnecessary calls to .bind()
đ§ Fix
âī¸ Frozen
Disallow unnecessary boolean casts
â Extends
đ§ Fix
âī¸ Frozen
Disallow unnecessary labels
đ§ Fix
Disallow assignments to native objects or read-only global variables
â Extends
âī¸ Frozen
Disallow shorthand type conversions
đ§ Fix
đĄ Suggestions
Disallow declarations in the global scope
Disallow the use of eval()-like methods
âī¸ Frozen
Disallow inline comments after code
Disallow use of this in contexts where the value of this is undefined
Disallow the use of the __iterator__ property
âī¸ Frozen
Disallow labels that share a name with a variable
âī¸ Frozen
Disallow labeled statements
Disallow unnecessary nested blocks
âī¸ Frozen
Disallow if statements as the only statement in else blocks
đ§ Fix
Disallow function declarations that contain unsafe references inside loop statements
âī¸ Frozen
Disallow magic numbers
Disallow use of chained assignment expressions
âī¸ Frozen
Disallow multiline strings
âī¸ Frozen
Disallow negated conditions
âī¸ Frozen
Disallow nested ternary expressions
Disallow new operators outside of assignments or comparisons
Disallow new operators with the Function object
Disallow new operators with the String, Number, and Boolean objects
Disallow \8 and \9 escape sequences in string literals
â Extends
đĄ Suggestions
Disallow calls to the Object constructor without an argument
đĄ Suggestions
Disallow octal literals
â Extends
Disallow octal escape sequences in string literals
Disallow reassigning function parameters
âī¸ Frozen
Disallow the unary operators ++ and --
Disallow the use of the __proto__ property
Disallow variable redeclaration
â Extends
Disallow multiple spaces in regular expressions
â Extends
đ§ Fix
Disallow specified names in exports
Disallow specified global variables
Disallow specified modules when loaded by import
Disallow certain properties on certain objects
Disallow specified syntax
Disallow assignment operators in return statements
Disallow javascript: URLs
Disallow comma operators
Disallow variable declarations from shadowing variables declared in the outer scope
Disallow identifiers from shadowing restricted names
â Extends
âī¸ Frozen
Disallow ternary operators
Disallow throwing literals as exceptions
âī¸ Frozen
Disallow initializing variables to undefined
đ§ Fix
âī¸ Frozen
Disallow the use of undefined as an identifier
âī¸ Frozen
Disallow dangling underscores in identifiers
âī¸ Frozen
Disallow ternary operators when simpler alternatives exist
đ§ Fix
Disallow unused expressions
Disallow unused labels
â Extends
đ§ Fix
Disallow unnecessary calls to .call() and .apply()
Disallow unnecessary catch clauses
â Extends
âī¸ Frozen
Disallow unnecessary computed property keys in objects and classes
đ§ Fix
âī¸ Frozen
Disallow unnecessary concatenation of literals or template literals
Disallow unnecessary constructors
đĄ Suggestions
Disallow unnecessary escape characters
â Extends
đĄ Suggestions
Disallow renaming import, export, and destructured assignments to the same name
đ§ Fix
Disallow redundant return statements
đ§ Fix
Require let or const instead of var
đ§ Fix
âī¸ Frozen
Disallow void operators
âī¸ Frozen
Disallow specified warning terms in comments
Disallow with statements
â Extends
âī¸ Frozen
Require or disallow method and property shorthand syntax for object literals
đ§ Fix
âī¸ Frozen
Enforce variables to be declared either together or separately in functions
đ§ Fix
âī¸ Frozen
Require or disallow assignment operator shorthand where possible
đ§ Fix
âī¸ Frozen
Require using arrow functions for callbacks
đ§ Fix
Require const declarations for variables that are never reassigned after declared
đ§ Fix
âī¸ Frozen
Require destructuring from arrays and/or objects
đ§ Fix
âī¸ Frozen
Disallow the use of Math.pow in favor of the ** operator
đ§ Fix
Enforce using named capture group in regular expression
đĄ Suggestions
âī¸ Frozen
Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
đ§ Fix
Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn()
đ§ Fix
âī¸ Frozen
Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead
đ§ Fix
Require using Error objects as Promise rejection reasons
Disallow use of the RegExp constructor in favor of regular expression literals
đĄ Suggestions
Require rest parameters instead of arguments
âī¸ Frozen
Require spread operators instead of .apply()
âī¸ Frozen
Require template literals instead of string concatenation
đ§ Fix
Enforce the consistent use of the radix argument when using parseInt()
đĄ Suggestions
Disallow async functions which have no await expression
đĄ Suggestions
Enforce the use of u or v flag on regular expressions
đĄ Suggestions
Require generator functions to contain yield
â Extends
âī¸ Frozen
Enforce sorted import declarations within modules
đ§ Fix
âī¸ Frozen
Require object keys to be sorted
âī¸ Frozen
Require variables within the same declaration block to be sorted
đ§ Fix
Require or disallow strict mode directives
đ§ Fix
Require symbol descriptions
âī¸ Frozen
Require var declarations be placed at the top of their containing scope
âī¸ Frozen
Require or disallow âYodaâ conditions
đ§ Fix
These rules care about how the code looks rather than how it executes:
Require or disallow Unicode byte order mark (BOM)
đ§ Fix
These rules have been deprecated in accordance with the deprecation policy, and replaced by newer rules:
array-bracket-newline deprecated
â
đ§ Fix
array-bracket-spacing deprecated
â
đ§ Fix
array-element-newline deprecated
â
đ§ Fix
arrow-parens deprecated
â
đ§ Fix
arrow-spacing deprecated
â
đ§ Fix
block-spacing deprecated
â
đ§ Fix
brace-style deprecated
â
đ§ Fix
callback-return deprecated
â
comma-dangle deprecated
â
đ§ Fix
comma-spacing deprecated
â
đ§ Fix
comma-style deprecated
â
đ§ Fix
computed-property-spacing deprecated
â
đ§ Fix
dot-location deprecated
â
đ§ Fix
eol-last deprecated
â
đ§ Fix
func-call-spacing deprecated
â
đ§ Fix
function-call-argument-newline deprecated
â
đ§ Fix
function-paren-newline deprecated
â
đ§ Fix
generator-star-spacing deprecated
â
đ§ Fix
global-require deprecated
â
handle-callback-err deprecated
â
id-blacklist deprecated
Replaced by id-denylist
â
implicit-arrow-linebreak deprecated
â
đ§ Fix
indent deprecated
â
đ§ Fix
indent-legacy deprecated
Replaced by indent
â
đ§ Fix
jsx-quotes deprecated
â
đ§ Fix
key-spacing deprecated
â
đ§ Fix
keyword-spacing deprecated
â
đ§ Fix
line-comment-position deprecated
â
linebreak-style deprecated
â
đ§ Fix
lines-around-comment deprecated
â
đ§ Fix
lines-around-directive deprecated
Replaced by padding-line-between-statements
â
đ§ Fix
lines-between-class-members deprecated
â
đ§ Fix
max-len deprecated
â
max-statements-per-line deprecated
â
multiline-comment-style deprecated
â
đ§ Fix
multiline-ternary deprecated
â
đ§ Fix
new-parens deprecated
â
đ§ Fix
newline-after-var deprecated
Replaced by padding-line-between-statements
â
đ§ Fix
newline-before-return deprecated
Replaced by padding-line-between-statements
â
đ§ Fix
newline-per-chained-call deprecated
â
đ§ Fix
no-buffer-constructor deprecated
â
no-catch-shadow deprecated
Replaced by no-shadow
â
no-confusing-arrow deprecated
â
đ§ Fix
no-extra-parens deprecated
â
đ§ Fix
no-extra-semi deprecated
â
đ§ Fix
no-floating-decimal deprecated
â
đ§ Fix
no-mixed-operators deprecated
â
no-mixed-requires deprecated
â
no-mixed-spaces-and-tabs deprecated
â
no-multi-spaces deprecated
â
đ§ Fix
no-multiple-empty-lines deprecated
â
đ§ Fix
no-native-reassign deprecated
Replaced by no-global-assign
â
no-negated-in-lhs deprecated
Replaced by no-unsafe-negation
â
no-new-object deprecated
Replaced by no-object-constructor
â
no-new-require deprecated
â
no-new-symbol deprecated
Replaced by no-new-native-nonconstructor
â
no-path-concat deprecated
â
no-process-env deprecated
â
no-process-exit deprecated
â
no-restricted-modules deprecated
â
no-return-await deprecated
â
đĄ Suggestions
no-spaced-func deprecated
Replaced by func-call-spacing
â
đ§ Fix
no-sync deprecated
â
no-tabs deprecated
â
no-trailing-spaces deprecated
â
đ§ Fix
no-whitespace-before-property deprecated
â
đ§ Fix
nonblock-statement-body-position deprecated
â
đ§ Fix
object-curly-newline deprecated
â
đ§ Fix
object-curly-spacing deprecated
â
đ§ Fix
object-property-newline deprecated
â
đ§ Fix
one-var-declaration-per-line deprecated
â
đ§ Fix
operator-linebreak deprecated
â
đ§ Fix
padded-blocks deprecated
â
đ§ Fix
padding-line-between-statements deprecated
â
đ§ Fix
prefer-reflect deprecated
â
quote-props deprecated
â
đ§ Fix
quotes deprecated
â
đ§ Fix
rest-spread-spacing deprecated
â
đ§ Fix
semi deprecated
â
đ§ Fix
semi-spacing deprecated
â
đ§ Fix
semi-style deprecated
â
đ§ Fix
space-before-blocks deprecated
â
đ§ Fix
space-before-function-paren deprecated
â
đ§ Fix
space-in-parens deprecated
â
đ§ Fix
space-infix-ops deprecated
â
đ§ Fix
space-unary-ops deprecated
â
đ§ Fix
spaced-comment deprecated
â
đ§ Fix
switch-colon-spacing deprecated
â
đ§ Fix
template-curly-spacing deprecated
â
đ§ Fix
template-tag-spacing deprecated
â
đ§ Fix
wrap-iife deprecated
â
đ§ Fix
wrap-regex deprecated
â
đ§ Fix
yield-star-spacing deprecated
â
đ§ Fix
These rules from older versions of ESLint (before the deprecation policy existed) have been replaced by newer rules:
generator-star removed
Replaced by generator-star-spacing
global-strict removed
Replaced by strict
no-arrow-condition removed
Replaced by no-confusing-arrowno-constant-condition
no-comma-dangle removed
Replaced by comma-dangle
no-empty-class removed
Replaced by no-empty-character-class
no-empty-label removed
Replaced by no-labels
no-extra-strict removed
Replaced by strict
no-reserved-keys removed
Replaced by quote-props
no-space-before-semi removed
Replaced by semi-spacing
no-wrap-func removed
Replaced by no-extra-parens
space-after-function-name removed
Replaced by space-before-function-paren
space-after-keywords removed
Replaced by keyword-spacing
space-before-function-parentheses removed
Replaced by space-before-function-paren
space-before-keywords removed
Replaced by keyword-spacing
space-in-brackets removed
Replaced by object-curly-spacingarray-bracket-spacing
space-return-throw-case removed
Replaced by keyword-spacing
space-unary-word-ops removed
Replaced by space-unary-ops
spaced-line-comment removed
Replaced by spaced-comment
valid-jsdoc removed
Replaced by
require-jsdoc removed
Replaced by