question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mysticateacommented, Aug 4, 2016

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
0reactions
vitorbalcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

arguments.callee - JavaScript - MDN Web Docs
This is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous...
Read more >
False positive in prefer-rest-params when checking arguments ...
I get this warning: Use the rest parameters instead of 'arguments' prefer-rest-params. I believe this to be a false positive.
Read more >
Arguments.callee is deprecated - what should be used instead?
Avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself.
Read more >
Disallow Use of caller/callee (no-caller) - ESLint
This rule is aimed at discouraging the use of deprecated and sub-optimal code by disallowing the use of arguments.caller and arguments.callee . As...
Read more >
ReferenceError: deprecated caller or arguments usage
TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context (Edge) Warning: ReferenceError: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found