1.0.4 β’ Published 10 months ago
@putout/plugin-remove-useless-delete v1.0.4
@putout/plugin-remove-useless-delete 
The
delete
operator removes aproperty
from anobject
. If theproperty
's value is anobject
and there are no more references to theobject
, theobject
held by thatproperty
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
Install
npm i @putout/plugin-remove-useless-delete
Rule
{
"rules": {
"remove-useless-assign": "on"
}
}
β Example of incorrect code
delete x;
delete x.x;
delete x[1];
β Example of correct code
delete x.x;
delete x[1];
Comparison
Linter | Rule | Fix |
---|---|---|
π Putout | remove-useless-delete | β |
β£ ESLint | no-delete-var | β |
π¦ Deno | no-delete-var | β |
License
MIT