Skip to content

Commit ca30f77

Browse files
HenryBrown0ljharb
authored andcommitted
[Refactor] jsx-props-no-multi-spaces: extract type parameters to var
1 parent aef6e7d commit ca30f77

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1818
* [Refactor] `propTypes`: extract type params to var ([#3634][] @HenryBrown0)
1919
* [Refactor] [`boolean-prop-naming`]: invert if statement ([#3634][] @HenryBrown0)
2020
* [Refactor] [`function-component-definition`]: exit early if no type params ([#3634][] @HenryBrown0)
21+
* [Refactor] [`jsx-props-no-multi-spaces`]: extract type parameters to var ([#3634][] @HenryBrown0)
2122

2223
[#3638]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3638
2324
[#3634]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3634

lib/rules/jsx-props-no-multi-spaces.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ module.exports = {
9898
}
9999

100100
function containsGenericType(node) {
101-
const containsTypeParams = typeof node.typeParameters !== 'undefined';
102-
return containsTypeParams && node.typeParameters.type === 'TSTypeParameterInstantiation';
101+
const nodeTypeParams = node.typeParameters;
102+
if (typeof nodeTypeParams === 'undefined') {
103+
return false;
104+
}
105+
106+
return nodeTypeParams.type === 'TSTypeParameterInstantiation';
103107
}
104108

105109
function getGenericNode(node) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy