ES6 rest args triggers warnings
See original GitHub issueThis code
"use strict";
module.exports.b = function foo(...args) {
return args;
};
With this config
settings:
ecmascript: 6
env:
node: true
rules:
block-scoped-var: 1
Results in this
eslint-test.js
2:35 warning "args" used outside of binding context block-scoped-var
3:9 warning "args" used outside of binding context block-scoped-var
3:9 error 'args' is not defined no-undef
✖ 3 problems
The obvious problem here is that rest args just aren’t supported in these rules. (v0.11.0-alpha.0)
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Rest parameters and spread syntax
Here the first two arguments go into variables and the rest go into titles array: function showName(firstName, lastName, ...titles) { alert( ...
Read more >Rest parameters - JavaScript - MDN Web Docs
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic ......
Read more >How To Use ES6 Arguments And Parameters
We can now use rest parameters, default values and destructuring, among other new features. In this tutorial, we will explore arguments and ...
Read more >What is spread, default and rest parameters in JavaScript
Rest Operator: It allows a function to accept an indefinite number of arguments if we are not sure how many arguments will receive....
Read more >Destructuring and parameter handling in ECMAScript 6 - 2ality
ECMAScript 6 (ES6) supports destructuring, a convenient way to extract values ... The rest operator triggers the following destructuring:
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Willibaur The spread operator needs to be used on a defined variable. Usually, you would do so by declaring a rest parameter in the method definition.
Try this:
If you still have trouble or have any follow-ups, please create a new issue or stop by our Gitter chat. Thanks!
Awesome, thanks @platinumazure it worked straight away, thank you very much for you quick answer