File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -47,23 +47,19 @@ module.exports = [
47
47
static ruleId = 'leading-underscore' ;
48
48
49
49
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
- }
50
+ if ( node . isDeclaredConst || node . isImmutable ) {
51
+ if ( / ^ _ / . test ( node . name ) ) {
52
+ this . error ( node , 'Constant and immutable variables should not have leading underscore' ) ;
54
53
}
55
- else {
56
- if ( node . isStateVar ) {
57
- if ( node . visibility === 'private' || node . visibility === 'internal' ) {
58
- if ( ! / ^ _ / . test ( node . name ) ) {
59
- this . error ( node , 'Private and internal state variables must have leading underscore' ) ;
60
- }
61
- }
62
- else {
63
- if ( / ^ _ / . test ( node . name ) ) {
64
- this . error ( node , 'Public state variables should not have leading underscore' ) ;
65
- }
66
- }
54
+ } else if ( node . isStateVar ) {
55
+ if ( node . visibility === 'private' || node . visibility === 'internal' ) {
56
+ if ( ! / ^ _ / . test ( node . name ) ) {
57
+ this . error ( node , 'Private and internal state variables must have leading underscore' ) ;
58
+ }
59
+ } else {
60
+ if ( / ^ _ / . test ( node . name ) ) {
61
+ this . error ( node , 'Public state variables should not have leading underscore' ) ;
62
+ }
67
63
}
68
64
}
69
65
}
You can’t perform that action at this time.
0 commit comments