Skip to content

Only-Delete-Object-Properties

Sourcery rule id: only-delete-object-properties

Description

Delete should only be used for object properties.

Match

var q = 1;
delete q;

Explanation

The delete operator is intended for use in deleting the properties of objects, and does not have meaningful behaviour otherwise.

See the MDN docs for delete.