Skip to content

Phase out some overly prescriptive code rules: prefer-destructuring for array and object #957

@monfera

Description

@monfera

I think

const [r0] = r;

is less preferable than

const r0 = r[0];

and even if not, it doesn't buy anything. Also, while we should transition to ES2015, I don't see a reason for practically enforcing ES2015-only constructs, and currently, the resulting polyfill, where an ES5 construct exists which is often no worse and sometimes better.

I'm eager to learn if there's some justification. The rule description itself lists no benefits but points to clear drawbacks eg. when indexing arrays. I'm not fond of raising an info or warning for language constructs that seem perfectly legit, so such rules should ideally be activated upon shared conviction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussTo be discussedenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions