This rule auto-fixes f || function () {} to f || () => {}, which is syntactically invalid. Since an arrow function has lower precedence than a function expression, the auto-fix needs to parenthesize it when it’s an operand of most operators: f || (() => {}).
The exceptions are that an unparenthesized arrow function is allowed on the right side of an assignment =, augmenting assignment +=, -=, …, another arrow =>, yield, yield*, spread ..., the middle or right side of a ternary ? :, or either side of a comma ,.
This rule auto-fixes
f || function () {}
tof || () => {}
, which is syntactically invalid. Since an arrow function has lower precedence than afunction
expression, the auto-fix needs to parenthesize it when it’s an operand of most operators:f || (() => {})
.The exceptions are that an unparenthesized arrow function is allowed on the right side of an assignment
=
, augmenting assignment+=
,-=
, …, another arrow=>
,yield
,yield*
, spread...
, the middle or right side of a ternary? :
, or either side of a comma,
.