File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 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
1717### Changed
1818* [ Refactor] ` propTypes ` : extract type params to var ([ #3634 ] [ ] @HenryBrown0 )
1919* [ Refactor] [ ` boolean-prop-naming ` ] : invert if statement ([ #3634 ] [ ] @HenryBrown0 )
20+ * [ Refactor] [ ` function-component-definition ` ] : exit early if no type params ([ #3634 ] [ ] @HenryBrown0 )
2021
2122[ #3638 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3638
2223[ #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 = {
3333} ;
3434
3535function 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 ;
4237
43- return false ;
38+ return nodeTypeParams
39+ && nodeTypeParams . params
40+ && nodeTypeParams . params . length === 1
41+ && ! nodeTypeParams . params [ 0 ] . constraint ;
4442}
4543
4644function hasName ( node ) {
You can’t perform that action at this time.
0 commit comments