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
Update: prefer-rest-params
relax for member accesses (fixes #5990)
#6871
Conversation
@mysticatea, thanks for your PR! By analyzing the annotation information on this pull request, we identified @vitorbal, @nzakas and @lencioni to be potential reviewers |
LGTM |
* - arguments .... true // not member access | ||
* - arguments[i] .... true // computed member access | ||
* - arguments[0] .... true // computed member access | ||
* - arguments.length .... false // normal member access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about arguments["length"]
(with a string literal)? Should we relax the rule in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will warn arguments["length"]
since this distinguishes by computed or not. We can avoid warning by arguments.length
, so I thought this does not need a complex check (e.g. arguments["0"]
is same as arguments[0]
).
LGTM except:
Thanks for submitting this PR! |
LGTM |
Rebased for #6870. |
LGTM. I dont think its a big deal that it wont relax the case arguments["length"], eapecially if it lets us avoid some added code complexity. |
I don't feel strongly about it, and this is a positive incremental change, so LGTM as well. |
LGTM |
Fixes #5990.
This PR makes
prefer-rest-params
rule relaxing.New behavior ignores
arguments
which is accessing non-computed property (e.g.arguments.length
).arguments.length
arguments.callee
arguments
foo(arguments)
arguments[0]
arguments[i]
arguments[Symbol.iterator]