solhint

no-console

Recommended Badge Category Badge Default Severity Badge error

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

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

Description

No console.log/logInt/logBytesX/logString/etc & No hardhat and forge-std console.sol import statements.

Options

This rule accepts a string option of rule severity. Must be one of “error”, “warn”, “off”. Default to error.

Example Config

{
  "rules": {
    "no-console": "error"
  }
}

Notes

Examples

👎 Examples of incorrect code for this rule

No console.logX statements

console.log('test')

No hardhat/console.sol import statements

import "hardhat/console.sol"

No forge-std console.sol & console2.sol import statements

import "forge-std/consoleN.sol"

Version

This rule was introduced in Solhint 3.4.0

Resources