Skip to content

Commit f859dd7

Browse files
authored
Update index.js
1 parent bee7bc3 commit f859dd7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scripts/solhint-custom/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ module.exports = [
4747
static ruleId = 'leading-underscore';
4848

4949
VariableDeclaration(node) {
50-
if (node.isDeclaredConst || node.isImmutable) {
51-
if (/^_/.test(node.name)) {
52-
this.error(node, 'Constant and immutable variables should not have leading underscore');
53-
}
54-
} else if (node.isStateVar) {
55-
if (node.visibility === 'private' && !/^_/.test(node.name))
56-
this.error(node, 'Private state variables must have leading underscore');
57-
}
58-
if (node.visibility === 'internal' && !/^_/.test(node.name)) {
59-
this.error(node, 'Internal state variables must have leading underscore');
60-
}
61-
if (node.visibility === 'public' && /^_/.test(node.name)) {
62-
this.error(node, 'Public state variables should not have leading underscore');
63-
}
50+
if (node.isDeclaredConst && /^_/.test(node.name)) {
51+
this.error(node, 'Constant variables should not have leading underscore');
52+
}
53+
if (node.isImmutable && /^_/.test(node.name)) {
54+
this.error(node, 'Immutable variables should not have leading underscore');
55+
}
56+
if (node.isStateVar && node.visibility === 'private' && !/^_/.test(node.name)) {
57+
this.error(node, 'Private state variables must have leading underscore');
58+
}
59+
if (node.isStateVar && node.visibility === 'internal' && !/^_/.test(node.name)) {
60+
this.error(node, 'Internal state variables must have leading underscore');
61+
}
62+
if (node.isStateVar && node.visibility === 'public' && /^_/.test(node.name)) {
63+
this.error(node, 'Public state variables should not have leading underscore');
6464
}
6565
}
6666

0 commit comments

Comments
 (0)