File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
17
17
### Changed
18
18
* [ Refactor] ` propTypes ` : extract type params to var ([ #3634 ] [ ] @HenryBrown0 )
19
19
* [ Refactor] [ ` boolean-prop-naming ` ] : invert if statement ([ #3634 ] [ ] @HenryBrown0 )
20
+ * [ Refactor] [ ` function-component-definition ` ] : exit early if no type params ([ #3634 ] [ ] @HenryBrown0 )
20
21
21
22
[ #3638 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3638
22
23
[ #3634 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3634
Original file line number Diff line number Diff line change @@ -33,14 +33,12 @@ const UNNAMED_FUNCTION_TEMPLATES = {
33
33
} ;
34
34
35
35
function hasOneUnconstrainedTypeParam ( node ) {
36
- if ( node . typeParameters ) {
37
- return (
38
- node . typeParameters . params . length === 1
39
- && ! node . typeParameters . params [ 0 ] . constraint
40
- ) ;
41
- }
36
+ const nodeTypeParams = node . typeParameters ;
42
37
43
- return false ;
38
+ return nodeTypeParams
39
+ && nodeTypeParams . params
40
+ && nodeTypeParams . params . length === 1
41
+ && ! nodeTypeParams . params [ 0 ] . constraint ;
44
42
}
45
43
46
44
function hasName ( node ) {
You can’t perform that action at this time.
0 commit comments