Unused require()
should be removed
- UNUSED_REQUIRE
- Code Quality
- Low
- nodejs
This rule applies when a variable holding a require()
result is not used.
For maintainability, it is recommended to remove unused module dependencies. If just module loading was intended, it is more explicit to require the module without variable assignment.
Noncompliant Code Example
View with compliant examples side by sidelet init = require("initialize"); // UNUSED_REQUIRE alarm
let foo = require("foo"); // UNUSED_REQUIRE alarm
module.exports = function () { }
Compliant Code Example
View with noncompliant examples side by siderequire("initialize");
module.exports = function () { }
Version
This rule was introduced in DeepScan 1.1.0-alpha.