sonarjs/no-uniq-key
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-uniq-key": "error",
},
},
];function generateButtons(props) {
return props.buttons.map((button, index) => {
<Button key={Math.random()}>{button.number}</Button>
});
}function generateButtons(props) {
return props.buttons.map((button, index) => {
<Button key={button.number}>{button.number}</Button>
});
}Examples from the ESLint documentation.
sonarjs/no-uniq-key
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-uniq-key": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Multiline blocks should be enclosed in curly braces
Errors should not be created without being thrown
"undefined" should not be passed as the value of optional parameters
Promise rejections should not be caught by "try" blocks
Unused local variables and functions should be removed