Skip to content
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

Merged
merged 1 commit into from Aug 12, 2016

Conversation

mysticatea
Copy link
Member

Fixes #5990.

This PR makes prefer-rest-params rule relaxing.
New behavior ignores arguments which is accessing non-computed property (e.g. arguments.length).

  • Ignores:
    • arguments.length
    • arguments.callee
  • Still errors:
    • arguments
    • foo(arguments)
    • arguments[0]
    • arguments[i]
    • arguments[Symbol.iterator]

@mention-bot
Copy link

@mysticatea, thanks for your PR! By analyzing the annotation information on this pull request, we identified @vitorbal, @nzakas and @lencioni to be potential reviewers

@eslintbot
Copy link

LGTM

* - arguments .... true // not member access
* - arguments[i] .... true // computed member access
* - arguments[0] .... true // computed member access
* - arguments.length .... false // normal member access
Copy link
Member

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?

Copy link
Member Author

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]).

@platinumazure
Copy link
Member

platinumazure commented Aug 10, 2016

LGTM except:

  • Left a question about whether arguments["length"] (computed property, but with string literal) should also be relaxed under this rule.
  • AppVeyor failed-- probably due to the too many arguments issue that gyandeeps fixed. Hopefully if this is rebased or updated, we'll see AppVeyor pass.

Thanks for submitting this PR!

@eslintbot
Copy link

LGTM

@mysticatea
Copy link
Member Author

Rebased for #6870.

@vitorbal
Copy link
Member

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.
Waiting for other to review though, as that's just my opinion!

@platinumazure
Copy link
Member

I don't feel strongly about it, and this is a positive incremental change, so LGTM as well.

@ilyavolodin
Copy link
Member

LGTM

@ilyavolodin ilyavolodin merged commit ebf8441 into master Aug 12, 2016
@mysticatea mysticatea deleted the issue5990 branch August 18, 2016 22:45
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants