Skip to content

Commit

Permalink
fix: use type args in jsx props multi space rule
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryBrown0 committed Sep 4, 2023
1 parent da67123 commit 0377afb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/rules/jsx-props-no-multi-spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ module.exports = {
}

function containsGenericType(node) {
const containsTypeParams = typeof node.typeParameters !== 'undefined';
return containsTypeParams && node.typeParameters.type === 'TSTypeParameterInstantiation';
const nodeType = node.typeArguments || node.typeParameters;
if (typeof nodeType === 'undefined') {
return false;
}

return nodeType.type === 'TSTypeParameterInstantiation';
}

function getGenericNode(node) {
const name = node.name;
if (containsGenericType(node)) {
const type = node.typeParameters;
const type = node.typeArguments || node.typeParameters;

return Object.assign(
{},
Expand Down

0 comments on commit 0377afb

Please sign in to comment.