What version of Oxlint are you using?
1.59.0
What command did you run?
oxlint -c oxlint.json test.tsx
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
What happened?
react/no-array-index-key flags array index usage inside template literal expressions like key={`${item.type + index}`}. ESLint only flags direct usage like key={index} or simple expressions like key={1 + index}.
Minimal reproduction
test.tsx:
function List({items}: {items: {type: string; text: string}[]}) {
return (
<ul>
{items.map((item, index) => (
<li key={`${item.type + index}`}>{item.text}</li>
))}
</ul>
)
}
Expected: No error. The key combines item.type with index via string concatenation inside a template literal, producing a composite key.
Actual:
x eslint-plugin-react(no-array-index-key): Usage of Array index in keys is not allowed
,-[test.tsx:5:9]
4 | {items.map((item, index) => (
5 | <li key={`${item.type + index}`}>{item.text}</li>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What version of Oxlint are you using?
1.59.0
What command did you run?
oxlint -c oxlint.json test.tsx
What does your
.oxlintrc.json(oroxlint.config.ts) config file look like?{ "plugins": ["react"], "rules": { "react/no-array-index-key": "error" } }What happened?
react/no-array-index-keyflags array index usage inside template literal expressions likekey={`${item.type + index}`}. ESLint only flags direct usage likekey={index}or simple expressions likekey={1 + index}.Minimal reproduction
test.tsx:Expected: No error. The key combines
item.typewithindexvia string concatenation inside a template literal, producing a composite key.Actual: