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

prefer-rest-params warns when using arguments.callee.name #6835

Closed
krainboltgreene opened this issue Aug 3, 2016 · 8 comments
Closed

prefer-rest-params warns when using arguments.callee.name #6835

krainboltgreene opened this issue Aug 3, 2016 · 8 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@krainboltgreene
Copy link

krainboltgreene commented Aug 3, 2016

What version of ESLint are you using? 2

What parser (default, Babel-ESLint, etc.) are you using? babel

Please show your full configuration: It's really long.

What did you do? Please include the actual source code causing the issue. I wrote the code:

export default function freeMemory () {
  return this.store.hset(arguments.callee.name, new Date(), os.freeMemory())
}

What did you expect to happen?

Nothing.

What actually happened? Please include the actual, raw output from ESLint.

I got a linter error from prefer-rest-params, because I was using arguments. I don't believe there's a way to write what I did without calling arguments.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 3, 2016
@vitorbal
Copy link
Member

vitorbal commented Aug 3, 2016

Hey @krainboltgreene, thanks for reaching out!

@mysticatea this seems similar to #5990, as in, it would also be a relaxing enhancement if accepted. What do you think?

@vitorbal vitorbal added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 3, 2016
@krainboltgreene
Copy link
Author

100%, that seems absolutely right. Should I close?

@vitorbal
Copy link
Member

vitorbal commented Aug 3, 2016

@krainboltgreene Sorry if I wasn't clear, I think this is another false-positive that needs to be taken care of, #5990 deals with a different false-positive, so we should keep this issue open.

Just wanted to loop @mysticatea in since he is championing #5990 and probably has an opinion on this issue as well.

@nzakas
Copy link
Member

nzakas commented Aug 3, 2016

@krainboltgreene is that the complete source code you used or was that in a function? (We need a complete example to verify.) Also, please provide the actual ESLint output, not just a description. Thanks!

@krainboltgreene
Copy link
Author

Updated with actual code, but I believe using that anywhere would get you the linter error.

@krainboltgreene
Copy link
Author

Looks like the no-caller has a similar situation, where it's thinking arguments.callee.name is similar to calling the function (like arguments.callee()).

@mysticatea
Copy link
Member

Yes, this is very similar to #5990.
I will make the rule ignoring arguments if it's to access the properties except numbers.
So, #5990 would fix this issue as well.

// ✘
arguments[1]    // ← a property access to a number.
arguments[v]    // ← a property access to a number possibly.
arguments       // ← a use of whole arguments.

// ✔ GOOD
arguments.length
arguments.callee
arguments.foo

@vitorbal
Copy link
Member

vitorbal commented Aug 4, 2016

@mysticatea thanks for the update! In that case, I think we can indeed close this issue in favor of #5990.

@krainboltgreene please follow #5990 for updates on the fix. Thanks for the report and your support!

Closing this, please re-open if anyone disagrees.

@vitorbal vitorbal closed this as completed Aug 4, 2016
@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 enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

5 participants