Skip to content

prefer-set-size rule does not catch Array.from() usage for converting a set to an array #2843

@connorshea

Description

@connorshea

Array.from() on a Set doesn't get noticed by the prefer-set-size rule as a conversion from a set to an array

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/rules/prefer-set-size.js

// This passes when it shouldn't:
Array.from(new Set(array)).length

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions