File tree 2 files changed +17
-11
lines changed
2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
16
16
17
17
### Changed
18
18
* [ Refactor] ` propTypes ` : extract type params to var ([ #3634 ] [ ] @HenryBrown0 )
19
+ * [ Refactor] [ ` boolean-prop-naming ` ] : invert if statement ([ #3634 ] [ ] @HenryBrown0 )
19
20
20
21
[ #3638 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3638
21
22
[ #3634 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3634
Original file line number Diff line number Diff line change @@ -240,19 +240,24 @@ module.exports = {
240
240
}
241
241
242
242
if (
243
- component . node . parent
244
- && component . node . parent . type === 'VariableDeclarator'
245
- && component . node . parent . id
246
- && component . node . parent . id . type === 'Identifier'
247
- && component . node . parent . id . typeAnnotation
248
- && component . node . parent . id . typeAnnotation . typeAnnotation
249
- && component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters
250
- && (
251
- component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TSTypeParameterInstantiation'
252
- || component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . type === 'TypeParameterInstantiation'
243
+ ! component . node . parent
244
+ || component . node . parent . type !== 'VariableDeclarator'
245
+ || ! component . node . parent . id
246
+ || component . node . parent . id . type !== 'Identifier'
247
+ || ! component . node . parent . id . typeAnnotation
248
+ || ! component . node . parent . id . typeAnnotation . typeAnnotation
249
+ ) {
250
+ return ;
251
+ }
252
+
253
+ const annotationTypeParams = component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters ;
254
+ if (
255
+ annotationTypeParams && (
256
+ annotationTypeParams . type === 'TSTypeParameterInstantiation'
257
+ || annotationTypeParams . type === 'TypeParameterInstantiation'
253
258
)
254
259
) {
255
- return component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . params . find (
260
+ return annotationTypeParams . params . find (
256
261
( param ) => param . type === 'TSTypeReference' || param . type === 'GenericTypeAnnotation'
257
262
) ;
258
263
}
You can’t perform that action at this time.
0 commit comments