sonarjs/different-types-comparison
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/different-types-comparison": "error",
},
},
];Strict equality operators should not be used with dissimilar types
var a = 8;
var b = "8";
if (a === b) { // Noncompliant; always false
// ...
}var a = 8;
var b = "8";
if (a == b) {
// ...
}var a = 8;
var b = "8";
if (a === Number(b)) {
// ...
}Examples from the ESLint documentation.
sonarjs/different-types-comparison
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/different-types-comparison": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Auto-escaping in HTML template engines should not be disabled
Remote artifacts should not be used without integrity checks
Cross-Origin Resource Sharing (CORS) policy should be restricted to trusted origins