Private and internal names must start with a single underscore.
This rule accepts an array of options:
Index | Description | Default Value |
---|---|---|
0 | Rule severity. Must be one of “error”, “warn”, “off”. | warn |
1 | A JSON object with a single property “strict” specifying if the rule should apply to non state variables. Default: { strict: false }. | {“strict”:false} |
{
"rules": {
"private-vars-leading-underscore": ["warn",{"strict":false}]
}
}
function _thisIsInternal() internal {}
function _thisIsPrivate() private {}
uint256 internal _thisIsInternalVariable;
{strict: false}
, memory variables starting with an underscore is not considered an errorfunction foo(uint256 _bar) public {}
uint256 _thisIsInternalVariable;
{strict: true}
, memory variables starting with an underscore are considered an errorfunction foo(uint256 _bar) public {}
function _foo() public {}
function thisIsInternal() internal {}
function thisIsPrivate() private {}
uint256 internal thisIsInternalVariable;
uint256 thisIsInternalVariable;
This rule was introduced in Solhint 3.0.0-rc.3