@@ -65,25 +65,17 @@ module.exports = [
65
65
}
66
66
67
67
FunctionDefinition ( node ) {
68
- if ( node . visibility === 'private' ) {
69
- if ( ! / ^ _ / . test ( node . name ) ) {
70
- this . error ( node , 'Private functions must have leading underscore' ) ;
71
- }
68
+ if ( node . visibility === 'private' && ! / ^ _ / . test ( node . name ) ) {
69
+ this . error ( node , 'Private functions must have leading underscore' ) ;
72
70
}
73
- if ( node . visibility === 'internal' && node . parent . kind !== 'library' ) {
74
- if ( ! / ^ _ / . test ( node . name ) ) {
75
- this . error ( node , 'Non-library internal functions must have leading underscore' ) ;
76
- }
71
+ if ( node . visibility === 'internal' && node . parent . kind !== 'library' && ! / ^ _ / . test ( node . name ) ) {
72
+ this . error ( node , 'Non-library internal functions must have leading underscore' ) ;
77
73
}
78
- if ( node . visibility === 'internal' && node . parent . kind === 'library' ) {
79
- if ( / ^ _ / . test ( node . name ) ) {
80
- this . error ( node , 'Library internal functions should not have leading underscore' ) ;
81
- }
74
+ if ( node . visibility === 'internal' && node . parent . kind === 'library' && / ^ _ / . test ( node . name ) ) {
75
+ this . error ( node , 'Library internal functions should not have leading underscore' ) ;
82
76
}
83
- if ( node . visibility === 'public' || node . visibility === 'external' ) {
84
- if ( / ^ _ / . test ( node . name ) ) {
85
- this . error ( node , 'Public and external functions should not have leading underscore' ) ;
86
- }
77
+ if ( node . visibility === 'public' || node . visibility === 'external' && / ^ _ / . test ( node . name ) ) {
78
+ this . error ( node , 'Public and external functions should not have leading underscore' ) ;
87
79
}
88
80
}
89
81
} ,
0 commit comments