sonarjs/non-existent-operator
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/non-existent-operator": "error",
},
},
];Non-existent operators '=+', '=-' and '=!' should not be used
let target =-5;
let num = 3;
target =- num; // Noncompliant; target = -3. Is that really what's meant?
target =+ num; // Noncompliant; target = 3let target = -5;
let num = 3;
target = -num; // Compliant; intent to assign inverse value of num is clear
target += num;Examples from the ESLint documentation.
sonarjs/non-existent-operator
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/non-existent-operator": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Properties of variables with "null" or "undefined" values should not be accessed
"<object>" tags should provide an alternative content
Similar tests should be grouped in a single Parameterized test