Unused imported bindings should be removed

  • UNUSED_IMPORT
  • Code Quality
  • Low
  • es6

This rule applies when imported bindings are declared but not used.

For maintainability, it is recommended to remove unused code. Also, it might be a mistake that a programmer forgets to use declared imported bindings.

Note: Not applied when the binding name starts with _ (excluding _ itself) because we regard it as intentionally unused.

Noncompliant Code Example

View with compliant examples side by side
import {
    count,
    increment // UNUSED_IMPORT alarm
} from "my-counter";
console.log(count);

Compliant Code Example

View with noncompliant examples side by side
// In case when the imported binding is actually not used
import {
    count
} from "my-counter";
console.log(count);

Version

This rule was introduced in DeepScan 1.0.0-alpha.

Was this documentation helpful?