-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: "function-default-params" scope #34
Comments
Is this still something we want to do? |
I'm having a similar issue as estools/escope#130 without this. |
@mysticatea Can we close this issue if it's fixed in #33? |
I don't think this issue has been fixed. If I'm understanding correctly, #33 fixed estools/escope#130, which is a separate issue. |
@kaicataldo No. The #33 was a superficial fix because I avoided breaking changes. And this is a follow‐up issue to make the correct scope structure. But probably I should write an RFC. |
From #33, eslint/eslint#9335.
As the step 27.a of 9.2.12 FunctionDeclarationInstantiation( func, argumentsList ),
eslint-scope
should make new scope for the function body only if the parameters has any default value.It's similar to
function-expression-name
scope which separates the variable of function expression names from function bodies. So I propose newfunction-default-params
scope which separates the references in default parameters from function bodies.function-default-params
scope instead offunction
scope.function-default-params
scope has implicitarguments
variable except if the function is arrow function expression.function-default-params
scope is the child scope offunction-expression-name
scope if the function is function expression.function
scope.function-default-params
scope to thefunction
scope.function f(a = 1) { let a }
correctly.no-shadow
rule has to handle those copies as special.Variable#defs
andVariable#references
should be shared with both scopes butReference#resolved
property cannot have multiple variable objects. For example, infunction f(a, b = a) { g(a) }
case, the two references ofa
should be aggregated into oneVariable#references
array.function-default-params
andfunction
scopes at the end of the function.The text was updated successfully, but these errors were encountered: