sonarjs/no-duplicate-in-composite
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-duplicate-in-composite": "error",
},
},
];Union and intersection types should not include duplicated constituents
function padLeft(value: string, padding: string | number | string) { // Noncompliant; 'string' type is used twice in a union type declaration
// ...
}
function extend(p : Person) : Person & Person & Loggable { // Noncompliant; 'Person' is used twice
// ...
}function padLeft(value: string, padding: string | number | boolean) {
// ...
}
function extend(p : Person) : Person & Loggable {
// ...
}Examples from the ESLint documentation.
sonarjs/no-duplicate-in-composite
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-duplicate-in-composite": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
"delete" should be used only with object properties
Parameterized tests should not contain duplicate test cases
Default imports from modular utility libraries should not be used
Test titles should be unique within the same suite
UI test debug commands should not be committed to version control
Two branches in a conditional structure should not have exactly the same implementation