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.

no-undef: 'arguments' is undefined when used inside function parameters destructuring assignment

See original GitHub issue
  • ESLint Version: 5.2.0
  • Node Version: 10.6.0
  • npm Version: 6.1.0
Configuration
{
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "script",
        "ecmaFeatures": {}
    },
    "rules": {
        "no-undef": 2
    },
    "env": {}
}
(function test({url = arguments[0]} = {}) {
  return url;
})('foo')

Expected: no errors Observed: 'arguments' is not defined. (no-undef)

P.S. (function test({url} = {}) { return arguments[0] })() is ok.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ljharbcommented, Dec 11, 2018

This is still a bug, and should be reopened.

1reaction
tophfcommented, Jul 21, 2018

Native implementation both in node’s repl and in a browser’s devtools.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle destructuring of function argument with ...
Note:- default parameters will come into picture only when there is no arguments passed or undefined is passed as argument, so if you...
Read more >
Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >
Extract Functions Arguments using Destructure in JavaScript
Destructuring is terrific at extracting value from your arguments. So swap out those bracket ... Parameter: is the variable in the function declaration....
Read more >
Rules - JavaScript Standard Style
Use single quotes for strings except to avoid escaping. ... Always handle the err function parameter. ... Add spaces inside single line blocks....
Read more >
Disallow Use of undefined Variable (no-undefined) - ESLint
While ECMAScript 5 disallows overwriting undefined , it's still possible to shadow undefined , such as: function doSomething(data) { var undefined ...
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