no-global-import
March 24, 2025 ยท View on GitHub
The {"extends": "solhint:recommended"} property in a configuration file enables this rule.
Description
Import statement includes an entire file instead of selected symbols.
Options
This rule accepts a string option for rule severity. Must be one of "error", "warn", "off". Defaults to warn.
Example Config
{
"rules": {
"no-global-import": "warn"
}
}
Examples
๐ Examples of correct code for this rule
import names explicitly
import {A} from "./A.sol"
import entire file into a name
import "./A.sol" as A
import entire file into a name
import * as A from "./A.sol"
๐ Examples of incorrect code for this rule
import all members from a file
import * from "foo.sol"
import an entire file
import "foo.sol"
Version
This rule was introduced in Solhint 5.0.4