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

Rule Proposal: `prefer-rest-params` #4108

mysticatea opened this Issue Oct 10, 2015 · 2 comments


None yet
2 participants
Copy link

mysticatea commented Oct 10, 2015

There is rest parameters in ES2015 features.
We can use that instead of the arguments variable.
The arguments does not have methods of Array.prototype, so it's inconvenience a bit.

So I propose a rule that suggests a use of rest parameters instead of the implicit arguments variable.

This rule considers the following patterns are problem.

function foo() {

function foo(action) {
    var args = [], 1);
    action.apply(null, args);

This rule considers the following patterns are not problem.

function foo(...args) {

function foo(action, ...args) {
    action.apply(null, args); // or `action(...args)`, related with the `prefer-spread` rule.

// Note: the implicit arguments can be overwritten.
function foo(arguments) {
    console.log(arguments); // This is the first argument.
function foo() {
    var arguments = 0;
    console.log(arguments); // This is a local variable.

I guessed this rule merely checks whether or not the variable of arguments has any references.
It's similar to


This comment has been minimized.

Copy link

nzakas commented Oct 11, 2015

Sounds good!

@mysticatea mysticatea self-assigned this Nov 23, 2015


This comment has been minimized.

Copy link
Member Author

mysticatea commented Nov 23, 2015

I'm working on this.

mysticatea added a commit to mysticatea/eslint that referenced this issue Nov 23, 2015

@nzakas nzakas closed this in #4524 Dec 1, 2015

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.