@putout/plugin-split-nested-destructuring
v3.0.0
Published
šPutout plugin adds ability to split nested destructuring
Downloads
64,318
Maintainers
Readme
@putout/plugin-split-nested-destructuring
- Don't use nested destructuring on data that comes from any external data sources (such as
REST API
s,GraphQL
endpoints or files).- Don't use nested destructuring on function arguments that have long or complicated signatures.
š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