File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
Expand file tree Collapse file tree 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
1616
1717### Changed
1818* [ Refactor] ` propTypes ` : extract type params to var ([ #3634 ] [ ] @HenryBrown0 )
19+ * [ Refactor] [ ` boolean-prop-naming ` ] : invert if statement ([ #3634 ] [ ] @HenryBrown0 )
1920
2021[ #3638 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3638
2122[ #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 = {
240240 }
241241
242242 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'
253258 )
254259 ) {
255- return component . node . parent . id . typeAnnotation . typeAnnotation . typeParameters . params . find (
260+ return annotationTypeParams . params . find (
256261 ( param ) => param . type === 'TSTypeReference' || param . type === 'GenericTypeAnnotation'
257262 ) ;
258263 }
You can’t perform that action at this time.
0 commit comments