You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an inline function expression appears in a default parameter value, it can create a closure over the normally-indistinguishable "parameter scope", which is super confusing, and should almost always be avoided.
When an inline function expression appears in a default parameter value, it can create a closure over the normally-indistinguishable "parameter scope", which is super confusing, and should almost always be avoided.
For example:
The
x
parameter is in a separate scope from thevar x
in the function body, and in this case they are shown to have different values, via the closure.For more info: https://gist.github.com/getify/0978136c0c66c0357f611e2c7233f105
This is confusing enough for regular functions, but it's significantly more confusing for arrow functions.
This rule would forbid inline function expressions in an arrow function's parameter default value position. It will have 3 modes:
There would also be two additional flags (both default to
true
), in effect only for "all" and "closure" modes:The text was updated successfully, but these errors were encountered: