I am populating an Array and using it to map onto a sequence of React components
return (
<div className={style}>
<Header title="INVENTORY" />
{Array(slots)
.fill(0)
.map((_, i) => (
<ItemSlot />
))}
</div>
)
this line .map((_, i) => ( shows warnings
'_' is defined but never used.eslint@typescript-eslint/no-unused-vars
'i' is defined but never used.eslint@typescript-eslint/no-unused-vars
I attempt to add the /* tslint:disable:no-unused-variable */ comment, but it doesn't seem to work anywhere I've tried to put it. For example
.fill(0) /* tslint:disable:no-unused-variable */
.map((_, i) => (
<ItemSlot />
))}
has no effect.
How can I add tslint comment overrides on methods being chained?
If you aren't using the variables you can just omit them: