Skip to content

False positive in prefer-rest-params when checking arguments.length #5990

@mik01aj

Description

@mik01aj

ESLint version: 2.8.0

What parser are you using?

    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {"jsx": true},
    },

When linting this code:

function makeTree(rootPath, branches) {
    console.assert(arguments.length === 2);
    console.assert(_.isArray(rootPath));
    console.assert(_.isArray(branches) && _.isArray(branches[0]));
    return _.map(branches, branch => rootPath.concat(branch));
}

I get this warning:

Use the rest parameters instead of 'arguments'  prefer-rest-params

I believe this to be a false positive. Imho just checking arguments.length should be an exception to this rule (possibly configurable).

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions