sonarjs/no-primitive-wrappers
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-primitive-wrappers": "error",
},
},
];let x = new Number("0");
if (x) {
alert('hi'); // Shows 'hi'.
}let x = Number("0");
if (x) {
alert('hi');
}Examples from the ESLint documentation.
sonarjs/no-primitive-wrappers
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-primitive-wrappers": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Initial values of parameters, caught exceptions, and loop variables should not be ignored
OS commands should not rely on PATH resolution
Boolean literals should not be used in comparisons