Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 1.65 KB

imports-order.md

File metadata and controls

43 lines (35 loc) · 1.65 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
imports-order | Solhint

imports-order

Category Badge Default Severity Badge warn

Description

Order the imports of the contract to follow a certain hierarchy (read "Notes section")

Options

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

Example Config

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

Notes

  • Paths starting with "@" like "@openzeppelin/" and urls ("http" and "https") will go first
  • Order by hierarchy of directories first, e.g. ./../../ comes before ./../, which comes before ./, which comes before ./foo
  • Direct imports come before relative imports
  • Order alphabetically for each path at the same level, e.g. ./contract/Zbar.sol comes before ./interface/Ifoo.sol
  • Rule does NOT support this kind of import "import * as Alias from "./filename.sol"
  • When "--fix", rule will re-write this notation "../folder/file.sol" or this one "../file.sol" to "./../folder/file.sol" or this one "./../file.sol"

Examples

This rule does not have examples.

Version

This rule is introduced in the latest version.

Resources