@@ -22,6 +22,10 @@ const ALWAYS = 'always';
22
22
const NEVER = 'never' ;
23
23
24
24
const errorData = new WeakMap ( ) ;
25
+ /**
26
+ * @param {object } exceptions
27
+ * @returns {object }
28
+ */
25
29
function getErrorData ( exceptions ) {
26
30
if ( ! errorData . has ( exceptions ) ) {
27
31
const exceptionProps = Array . from ( exceptions , ( name ) => `\`${ name } \`` ) . join ( ', ' ) ;
@@ -30,15 +34,25 @@ function getErrorData(exceptions) {
30
34
}
31
35
return errorData . get ( exceptions ) ;
32
36
}
33
-
37
+ /**
38
+ * @param {string } configuration
39
+ * @param {Set<string> } exceptions
40
+ * @param {string } propName
41
+ * @returns {boolean } propName
42
+ */
34
43
function isAlways ( configuration , exceptions , propName ) {
35
44
const isException = exceptions . has ( propName ) ;
36
45
if ( configuration === ALWAYS ) {
37
46
return ! isException ;
38
47
}
39
48
return isException ;
40
49
}
41
-
50
+ /**
51
+ * @param {string } configuration
52
+ * @param {Set<string> } exceptions
53
+ * @param {string } propName
54
+ * @returns {boolean } propName
55
+ */
42
56
function isNever ( configuration , exceptions , propName ) {
43
57
const isException = exceptions . has ( propName ) ;
44
58
if ( configuration === NEVER ) {
@@ -109,7 +123,10 @@ module.exports = {
109
123
const propName = node . name && node . name . name ;
110
124
const value = node . value ;
111
125
112
- if ( isAlways ( configuration , exceptions , propName ) && value === null ) {
126
+ if (
127
+ isAlways ( configuration , exceptions , propName )
128
+ && value === null
129
+ ) {
113
130
const data = getErrorData ( exceptions ) ;
114
131
const messageId = data . exceptionsMessage ? 'setBoolean' : 'setBoolean_noMessage' ;
115
132
report ( context , messages [ messageId ] , messageId , {
@@ -120,7 +137,12 @@ module.exports = {
120
137
} ,
121
138
} ) ;
122
139
}
123
- if ( isNever ( configuration , exceptions , propName ) && value && value . type === 'JSXExpressionContainer' && value . expression . value === true ) {
140
+ if (
141
+ isNever ( configuration , exceptions , propName )
142
+ && value
143
+ && value . type === 'JSXExpressionContainer'
144
+ && value . expression . value === true
145
+ ) {
124
146
const data = getErrorData ( exceptions ) ;
125
147
const messageId = data . exceptionsMessage ? 'omitBoolean' : 'omitBoolean_noMessage' ;
126
148
report ( context , messages [ messageId ] , messageId , {
0 commit comments