solhint

no-unused-import

Recommended Badge Category Badge Default Severity Badge warn

The {“extends”: “solhint:recommended”} property in a configuration file enables this rule.

Description

Imported object name is not being used by the contract.

Options

This rule accepts a string option of rule severity. Must be one of “error”, “warn”, “off”. Default to warn.

Example Config

{
  "rules": {
    "no-unused-import": "warn"
  }
}

Examples

👍 Examples of correct code for this rule

Imported object is being used


            import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
            contract MyToken is ERC20 {}
          

👎 Examples of incorrect code for this rule

Imported object is not being used


          import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
            contract B {}
          

Version

This rule was introduced in Solhint 3.5.1

Resources