prefer-arrow-callback
Configuration
rslint.config.ts
Rule Details
Requires using arrow functions for callbacks when the function expression can be
replaced without changing this, super, arguments, or new.target
semantics.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
This rule accepts an options object with the following properties:
allowNamedFunctionsdefaults tofalse. Whentrue, named function expressions are allowed.allowUnboundThisdefaults totrue. Whenfalse, callbacks that reference their ownthisare still reported, but they are not automatically fixed.
Examples of correct code for this rule with { "allowNamedFunctions": true }:
Examples of incorrect code for this rule with { "allowUnboundThis": false }: