3.0.0 β€’ Published 11 months ago

@putout/plugin-split-nested-destructuring v3.0.0

Weekly downloads
2,711
License
MIT
Repository
github
Last release
11 months ago

@putout/plugin-split-nested-destructuring NPM version

  • Don't use nested destructuring on data that comes from any external data sources (such as REST APIs, GraphQL endpoints or files).
  • Don't use nested destructuring on function arguments that have long or complicated signatures.

(c) Destructuring in JavaScript: the not so good parts

🐊Putout plugin adds ability to split nested destructuring.

Install

npm i @putout/plugin-split-nested-destructuring -D

Rule

{
    "rules": {
        "split-nested-destructuring": "on"
    }
}

❌ Example of incorrect code

const {
    a: {
        b,
    },
    a: {
        b: x,
    },
} = c;

function f({a: {b}}) {
    console.log(b);
}

βœ… Example of correct code

const {a} = c;
const {b, b: x} = a;

function f({a}) {
    const {b} = a;
    console.log(b);
}

License

MIT

3.0.0

11 months ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.1.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago