solhint

explicit-types

Recommended Badge Category Badge Default Severity Badge warn

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

Description

Forbid or enforce explicit types (like uint256) that have an alias (like uint).

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of “error”, “warn”, “off”. warn
1 Options need to be one of “explicit”, “implicit” explicit

Example Config

{
  "rules": {
    "explicit-types": ["warn","explicit"]
  }
}

Notes

Examples

👍 Examples of correct code for this rule

If explicit is selected

uint256 public variableName

If implicit is selected

uint public variableName

If explicit is selected

uint256 public variableName = uint256(5)

👎 Examples of incorrect code for this rule

If explicit is selected

uint public variableName

If implicit is selected

uint256 public variableName

At any setting

uint public variableName = uint256(5)

Version

This rule was introduced in Solhint 3.5.1

Resources