In my test, I have the following code:
const {
id,
date_created,
date_updated,
...hashItem,
} = body
t.deepEqual(hashItem, {
hash: '1712c2e67fe25e0eb9248633264cf8e32ca0fc3416deb74210d67fb7f4ee91be',
url: 'http://someurl.com',
})
Which gives me an unused var error because of id, date_created, date_updated. I think it's pretty clear that what I'm interested in is the "rest" of the object (hashItem). I was wondering if there could be an exception to this rule when using object rest to omit properties from an object.
Since object spread/rest is not yet standard (still stage 2, iirc), eslint nor our style guide support it, and we do not recommend its use.
When it becomes stage 3 or 4, and when the relevant eslint rule is updated to support this case, we can reevaluate it (it would be dangerous to endorse this use case imo, without this linter rule fully enabled).
eslint v3.16.0 adds this rule, and the next release of eslint-config-airbnb-base will support it.
FYI the new rule is here - https://eslint.org/docs/rules/no-unused-vars#ignorerestsiblings
Most helpful comment
eslint v3.16.0 adds this rule, and the next release of eslint-config-airbnb-base will support it.