Skip to content

Rule proposal: no-useless-iterator-to-array #2830

@fisker

Description

@fisker

Description

Very similar to no-useless-spread, but I don't think it make sense to add to no-useless-spread

Examples

// ❌
const set = new Set(iterator.toArray());

// ✅
const set = new Set(iterator);
// ❌
for (const foo of iterator.toArray());

// ✅
for (const foo of iterator);

More examples see no-useless-spread, replace ... to .toArray()

Proposed rule name

no-useless-iterator-to-array

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions