solhint

no-global-import

Recommended Badge Category Badge Default Severity Badge warn

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 of rule severity. Must be one of “error”, “warn”, “off”. Default 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 3.4.0

Resources