Please provide
- Operating system: Windows 11
- SonarQube for VS Code plugin version: 4.24.0
- Programming language you’re coding in: Typescript
- Is connected mode used: No
- SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?):
And a thorough description of the problem / question:
The following code:
function nodeMatches(spec: any, event: any) {
return spec?.includes(event.node.id) ||
spec?.includes(event.node.data?.id) ||
spec?.includes(event.node.title)
}
returns
Prefer using nullish coalescing operator (
??) instead of a logical or (
||), as it is a safer operator.sonarqube(typescript:S6606)
which is invalid as this will not return true/false based on a value in spec such as ‘[output]’ matching for example event.node.data?.id.