sonarjs/conditional-indentation
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/conditional-indentation": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
A conditionally executed single line should be denoted by indentation
if (condition) // Noncompliant
doTheThing();
doTheOtherThing();
somethingElseEntirely();
foo();if (condition)
doTheThing();
doTheOtherThing();
somethingElseEntirely();
foo();Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/conditional-indentation
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/conditional-indentation": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Cyclomatic Complexity of functions should not be too high
Class methods should be used instead of "prototype" assignments
Variables and functions should not be declared in the global scope
Optional boolean parameters should have default value