eslint-plugin-immutable
eslint-plugin-immutable copied to clipboard
no mutation error
Should this error on mutation?
const formattedQuery = {
...query,
}
delete formattedQuery['access-token']
Yes. delete
should be entirely forbidden.
You probably want const { 'access-token': unused, ...formattedQuery } = query;
instead.
Thanks! I don't see an error thrown for using delete
what am I missing in the config?
It probably just doesn't check for it yet, but it should.
I believe it should be possible to write a simple rule for this, by adding a visitor for the UnaryExpression
node, and checking that the node.operator === 'delete'