πPutout plugin adds ability to remove useless delete
npm install @putout/plugin-remove-useless-delete[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-assign.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-assign "npm"
> The delete operator removes a property from an object. If the property's value is an object and there are no more references to the object, the object held by that property is eventually released automatically.
>
> (c) MDN
πPutout plugin adds ability to remove useless delete.
Check it out in πPutout Editor.
Fixes syntax error:
> SyntaxError: Delete of an unqualified identifier in strict mode.
>
> (c) MDN
```
npm i @putout/plugin-remove-useless-delete
`json`
{
"rules": {
"remove-useless-assign": "on"
}
}
`js`
delete x;
delete x.x;
delete x[1];
`js`
delete x.x;
delete x[1];
Linter | Rule | Fix
--------|-------|------------|
π Putout | remove-useless-delete | β
β£ ESLint | no-delete-var | β
π¦ Deno | no-delete-var` | β
MIT