Arrow Functions For Callbacks
When the function is anonymous and passed inline as an argument or assigned to a binding, use an arrow function.…
$ prime install @web-style/rule-arrow-functions-for-callbacks Projection
Always in _index.xml · the agent never has to ask for this.
ArrowFunctionsForCallbacks [rule] v0.1.0
When the function is anonymous and passed inline as an argument or assigned to a binding, use an arrow function. Arrow functions inherit this from the enclosing scope, are terser, and signal "this is not a method, just a value-returning expression" at the call site.
Loaded when retrieval picks the atom as adjacent / supporting.
ArrowFunctionsForCallbacks [rule] v0.1.0
When the function is anonymous and passed inline as an argument or assigned to a binding, use an arrow function. Arrow functions inherit this from the enclosing scope, are terser, and signal "this is not a method, just a value-returning expression" at the call site.
Checks
-
array.map((x) => x.id)rather thanarray.map(function (x) { return x.id }). - Single-expression arrow bodies omit braces and
return:(x) => x.id, not(x) => { return x.id }. - Use parentheses around the parameter list whenever there are zero, two-or-more, or destructured parameters; many teams require parens always for consistency (Airbnb does).
- ESLint
prefer-arrow-callbackandarrow-body-styleare configured.
Label
Use arrow functions for anonymous callbacks
Loaded when retrieval picks the atom as a focal / direct hit.
ArrowFunctionsForCallbacks [rule] v0.1.0
When the function is anonymous and passed inline as an argument or assigned to a binding, use an arrow function. Arrow functions inherit this from the enclosing scope, are terser, and signal "this is not a method, just a value-returning expression" at the call site.
Checks
-
array.map((x) => x.id)rather thanarray.map(function (x) { return x.id }). - Single-expression arrow bodies omit braces and
return:(x) => x.id, not(x) => { return x.id }. - Use parentheses around the parameter list whenever there are zero, two-or-more, or destructured parameters; many teams require parens always for consistency (Airbnb does).
- ESLint
prefer-arrow-callbackandarrow-body-styleare configured.
Label
Use arrow functions for anonymous callbacks
Label
Use arrow functions for anonymous callbacks
Source
prime-system/examples/web-style/primes/compiled/@web-style/rule-arrow-functions-for-callbacks/atom.yaml