Skip to main content

avoid-unnecessary-statements

effort: 2m
has auto-fix
teams+

Warns when a statement is unnecessary and can be removed.

Example

❌ Bad:

const _value = 1;

void someFunction() {
someOtherFunction();
// LINT: This statement is unnecessary. Try removing it.
if (_value == 2) return;
}

✅ Good:

void someFunction() {
someOtherFunction();
if (_value == 2) return;

// some other code
}