Skip to content

generator-star fails when function expressions have params #1677

@btmills

Description

@btmills

These test cases should be valid:

{
    code: "var foo = function* ( arg1 ){};",
    args: [1, "start"],
    ecmaFeatures: { "generators": true }
},
{
    code: "var foo = function *( arg1 ){};",
    args: [1, "end"],
    ecmaFeatures: { "generators": true }
}

Here are the errors:

  1) generator-star var foo = function* ( arg1 ){};:
     AssertionError: Should have no errors but had 1: [ { ruleId: 'generator-star',
    severity: 1,
    node:
     { type: 'FunctionExpression',
       id: null,
       params: [Object],
       defaults: [],
       body: [Object],
       rest: null,
       generator: true,
       expression: false,
       range: [Object],
       loc: [Object],
       parent: [Object] },
    message: 'Expected no space before *.',
    line: 1,
    column: 10,
    source: 'function* ( arg1 ){}' } ]: expected 1 to equal 0

  2) generator-star var foo = function *( arg1 ){};:
     AssertionError: Should have no errors but had 1: [ { ruleId: 'generator-star',
    severity: 1,
    node:
     { type: 'FunctionExpression',
       id: null,
       params: [Object],
       defaults: [],
       body: [Object],
       rest: null,
       generator: true,
       expression: false,
       range: [Object],
       loc: [Object],
       parent: [Object] },
    message: 'Expected a space before *.',
    line: 1,
    column: 10,
    source: 'function *( arg1 ){}' } ]: expected 1 to equal 0

Metadata

Metadata

Assignees

No one assigned

    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 discussionbugESLint is working incorrectlyruleRelates 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