Use leading underscore solhint rule for private constants (#4542)

Co-authored-by: Francisco Giordano <fg@frang.io>
This commit is contained in:
Vladislav Volosnikov
2023-08-29 23:25:35 +02:00
committed by GitHub
parent a5ed318634
commit 812404cee8
12 changed files with 37 additions and 39 deletions

View File

@ -48,9 +48,9 @@ module.exports = [
VariableDeclaration(node) {
if (node.isDeclaredConst) {
if (/^_/.test(node.name)) {
// TODO: re-enable and fix
// this.error(node, 'Constant variables should not have leading underscore');
// TODO: expand visibility and fix
if (node.visibility === 'private' && /^_/.test(node.name)) {
this.error(node, 'Constant variables should not have leading underscore');
}
} else if (node.visibility === 'private' && !/^_/.test(node.name)) {
this.error(node, 'Non-constant private variables must have leading underscore');