duplicated-imports

July 4, 2025 ยท View on GitHub

Recommended Badge Category Badge Default Severity Badge warn

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

Description

Check if an import is done twice in the same file and there is no alias

Options

This rule accepts a string option for rule severity. Must be one of "error", "warn", "off". Defaults to warn.

Example Config

{
  "rules": {
    "duplicated-imports": "warn"
  }
}

Notes

  • Rule reports "(inline) duplicated" if the same object is imported more than once in the same import statement
  • Rule reports "(globalSamePath) duplicated" if the same object is imported on another import statement from same location
  • Rule reports "(globalDiffPath) duplicated" if the same object is imported on another import statement, from other location, but no alias
  • Rule does NOT support this kind of import "import * as Alias from "./filename.sol"

Examples

This rule does not have examples.

Version

This rule was introduced in Solhint 5.1.0

Resources