@putout/plugin-split-nested-destructuring

putout plugin adds ability to split nested destructuring

Usage no npm install needed!

<script type="module">
  import putoutPluginSplitNestedDestructuring from 'https://cdn.skypack.dev/@putout/plugin-split-nested-destructuring';
</script>

README

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

putout plugin adds ability to split nested destructuring.

Install

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

Rule

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

❌ Incorrect code example

const {a: {b}} = c;

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

✅ Correct code Example

const {a} = c;
const {b} = a;

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

License

MIT