Skip to content

no-array-reduce - doesn't report optional chaining #2720

@ipanasenko

Description

@ipanasenko

Title is pretty self-explanatory. no-array-reduce doesn't report optional chaining calls of reduce, e.g. array?.reduce()

Rule: no-array-reduce

array.reduce((str, item) => str += item, "") // reports correctly as error
array?.reduce((str, item) => str += item, "") // doesn't report this one

I see in rule's code optionalMember: false is explicitly passed. So, is this really a bug or an intended behaviour?
I've created a PR with new test cases - they fail: #2721

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions