eslint-plugin-flowtype
Advanced tools
Comparing version 3.10.1 to 3.10.2
@@ -12,3 +12,25 @@ 'use strict'; | ||
}; | ||
var markTypeAsUsedWithGenericType = function markTypeAsUsedWithGenericType(node) { | ||
var typeId = void 0; | ||
var scope = void 0; | ||
var variable = void 0; | ||
if (node.id.type === 'Identifier') { | ||
typeId = node.id; | ||
} else if (node.id.type === 'QualifiedTypeIdentifier') { | ||
typeId = node.id; | ||
do { | ||
typeId = typeId.qualification; | ||
} while (typeId.qualification); | ||
} | ||
for (scope = context.getScope(); scope; scope = scope.upper) { | ||
variable = scope.set.get(typeId.name); | ||
if (variable && variable.defs.length) { | ||
context.markVariableAsUsed(typeId.name); | ||
break; | ||
} | ||
} | ||
}; | ||
return { | ||
@@ -19,23 +41,11 @@ DeclareClass: markTypeAsUsed, | ||
DeclareVariable: markTypeAsUsed, | ||
GenericTypeAnnotation(node) { | ||
var typeId = void 0; | ||
var scope = void 0; | ||
var variable = void 0; | ||
if (node.id.type === 'Identifier') { | ||
typeId = node.id; | ||
} else if (node.id.type === 'QualifiedTypeIdentifier') { | ||
typeId = node.id; | ||
do { | ||
typeId = typeId.qualification; | ||
} while (typeId.qualification); | ||
} | ||
for (scope = context.getScope(); scope; scope = scope.upper) { | ||
variable = scope.set.get(typeId.name); | ||
if (variable && variable.defs.length) { | ||
context.markVariableAsUsed(typeId.name); | ||
break; | ||
GenericTypeAnnotation: markTypeAsUsedWithGenericType, | ||
TypeParameterDeclaration(node) { | ||
node.params.forEach(function (param) { | ||
if (param.default && param.default.typeParameters) { | ||
param.default.typeParameters.params.forEach(function (typeParameterNode) { | ||
markTypeAsUsedWithGenericType(typeParameterNode); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -42,0 +52,0 @@ }; |
@@ -63,3 +63,3 @@ { | ||
}, | ||
"version": "3.10.1" | ||
"version": "3.10.2" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
479681
3301