type-coverage-core
Advanced tools
Comparing version 2.14.9 to 2.15.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readCache = exports.saveCache = exports.getFileHash = void 0; | ||
const tslib_1 = require("tslib"); | ||
const path = tslib_1.__importStar(require("path")); | ||
const fs = tslib_1.__importStar(require("fs")); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const util_1 = require("util"); | ||
@@ -8,0 +7,0 @@ const crypto_1 = require("crypto"); |
@@ -1,3 +0,3 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
import { FileContext } from './interfaces'; | ||
export declare function checkNode(node: ts.Node | undefined, context: FileContext): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkNode = void 0; | ||
const tslib_1 = require("tslib"); | ||
const typescript_1 = tslib_1.__importDefault(require("typescript")); | ||
const ts = require("typescript"); | ||
function collectAny(node, context, kind) { | ||
@@ -11,3 +10,3 @@ const { file, sourceFile, typeCheckResult, ingoreMap, ignoreUnreadAnys, debug, processAny } = context; | ||
} | ||
const { line, character } = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile)); | ||
const { line, character } = ts.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile)); | ||
if (ingoreMap[file] && ingoreMap[file].has(line)) { | ||
@@ -33,3 +32,3 @@ return false; | ||
if (debug) { | ||
const { line, character } = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile)); | ||
const { line, character } = ts.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile)); | ||
console.log(`type !== any: ${file}:${line + 1}:${character + 1}: ${node.getText(sourceFile)} ${node.kind}(kind) ${type.flags}(flag) ${type.intrinsicName || ''}`); | ||
@@ -63,6 +62,6 @@ } | ||
function typeIsStrictAny(type, strict) { | ||
if (type.flags === typescript_1.default.TypeFlags.Any) { | ||
if (type.flags === ts.TypeFlags.Any) { | ||
return type.intrinsicName === 'any'; | ||
} | ||
if (strict && type.flags === typescript_1.default.TypeFlags.Object) { | ||
if (strict && type.flags === ts.TypeFlags.Object) { | ||
const typeArguments = type.typeArguments; | ||
@@ -78,9 +77,9 @@ if (typeArguments) { | ||
const { parent } = node; | ||
if (typescript_1.default.isVariableDeclaration(parent)) { | ||
if (ts.isVariableDeclaration(parent)) { | ||
// Match "let foo" and "let foo = null" but not "let foo: any". | ||
return !parent.type; | ||
} | ||
if (typescript_1.default.isBinaryExpression(parent)) { | ||
if (ts.isBinaryExpression(parent)) { | ||
// Match "foo = 123". | ||
return parent.operatorToken.kind === typescript_1.default.SyntaxKind.EqualsToken; | ||
return parent.operatorToken.kind === ts.SyntaxKind.EqualsToken; | ||
} | ||
@@ -100,9 +99,9 @@ return false; | ||
// include `foo as any` and `<any>foo` | ||
if ((typescript_1.default.isAsExpression(node) || typescript_1.default.isTypeAssertion(node)) && node.type.kind !== typescript_1.default.SyntaxKind.AnyKeyword) { | ||
if ((ts.isAsExpression(node) || ts.isTypeAssertion(node)) && node.type.kind !== ts.SyntaxKind.AnyKeyword) { | ||
// exclude `foo as const` and `<const>foo` | ||
if (typescript_1.default.isTypeReferenceNode(node.type) && node.type.getText() === 'const') { | ||
if (ts.isTypeReferenceNode(node.type) && node.type.getText() === 'const') { | ||
return; | ||
} | ||
// exclude `foo as unknown` and `<unknown>foo` | ||
if (node.type.kind === typescript_1.default.SyntaxKind.UnknownKeyword) { | ||
if (node.type.kind === ts.SyntaxKind.UnknownKeyword) { | ||
return; | ||
@@ -128,3 +127,3 @@ } | ||
if (context.debug) { | ||
const { line, character } = typescript_1.default.getLineAndCharacterOfPosition(context.sourceFile, node.getStart(context.sourceFile)); | ||
const { line, character } = ts.getLineAndCharacterOfPosition(context.sourceFile, node.getStart(context.sourceFile)); | ||
console.log(`node: ${context.file}:${line + 1}:${character + 1}: ${node.getText(context.sourceFile)} ${node.kind}(kind)`); | ||
@@ -137,7 +136,7 @@ } | ||
} | ||
if (node.kind === typescript_1.default.SyntaxKind.ThisKeyword) { | ||
if (node.kind === ts.SyntaxKind.ThisKeyword) { | ||
collectData(node, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIdentifier(node)) { | ||
if (ts.isIdentifier(node)) { | ||
if (context.catchVariables[node.escapedText]) { | ||
@@ -149,3 +148,3 @@ return; | ||
} | ||
if (typescript_1.default.isQualifiedName(node)) { | ||
if (ts.isQualifiedName(node)) { | ||
checkNode(node.left, context); | ||
@@ -155,7 +154,7 @@ checkNode(node.right, context); | ||
} | ||
if (typescript_1.default.isComputedPropertyName(node)) { | ||
if (ts.isComputedPropertyName(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeParameterDeclaration(node)) { | ||
if (ts.isTypeParameterDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -167,3 +166,3 @@ checkNode(node.default, context); | ||
} | ||
if (typescript_1.default.isParameter(node)) { | ||
if (ts.isParameter(node)) { | ||
checkNode(node.dotDotDotToken, context); | ||
@@ -176,8 +175,8 @@ checkNode(node.name, context); | ||
} | ||
if (typescript_1.default.isDecorator(node)) { | ||
if (ts.isDecorator(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPropertySignature(node) | ||
|| typescript_1.default.isPropertyDeclaration(node)) { | ||
if (ts.isPropertySignature(node) | ||
|| ts.isPropertyDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -189,6 +188,6 @@ checkNode(node.questionToken, context); | ||
} | ||
if (typescript_1.default.isMethodSignature(node) | ||
|| typescript_1.default.isCallSignatureDeclaration(node) | ||
|| typescript_1.default.isConstructSignatureDeclaration(node) | ||
|| typescript_1.default.isIndexSignatureDeclaration(node)) { | ||
if (ts.isMethodSignature(node) | ||
|| ts.isCallSignatureDeclaration(node) | ||
|| ts.isConstructSignatureDeclaration(node) | ||
|| ts.isIndexSignatureDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -201,4 +200,4 @@ checkNodes(node.parameters, context); | ||
} | ||
if (typescript_1.default.isFunctionTypeNode(node) | ||
|| typescript_1.default.isConstructorTypeNode(node)) { | ||
if (ts.isFunctionTypeNode(node) | ||
|| ts.isConstructorTypeNode(node)) { | ||
checkNode(node.name, context); | ||
@@ -210,9 +209,9 @@ checkNodes(node.parameters, context); | ||
} | ||
if (typescript_1.default.isMethodDeclaration(node) | ||
|| typescript_1.default.isConstructorDeclaration(node) | ||
|| typescript_1.default.isGetAccessorDeclaration(node) | ||
|| typescript_1.default.isSetAccessorDeclaration(node) | ||
|| typescript_1.default.isFunctionExpression(node) | ||
|| typescript_1.default.isArrowFunction(node) | ||
|| typescript_1.default.isFunctionDeclaration(node)) { | ||
if (ts.isMethodDeclaration(node) | ||
|| ts.isConstructorDeclaration(node) | ||
|| ts.isGetAccessorDeclaration(node) | ||
|| ts.isSetAccessorDeclaration(node) | ||
|| ts.isFunctionExpression(node) | ||
|| ts.isArrowFunction(node) | ||
|| ts.isFunctionDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -227,3 +226,3 @@ checkNodes(node.parameters, context); | ||
} | ||
if (typescript_1.default.isTypePredicateNode(node)) { | ||
if (ts.isTypePredicateNode(node)) { | ||
checkNode(node.type, context); | ||
@@ -233,3 +232,3 @@ checkNode(node.parameterName, context); | ||
} | ||
if (typescript_1.default.isTypeReferenceNode(node)) { | ||
if (ts.isTypeReferenceNode(node)) { | ||
checkNode(node.typeName, context); | ||
@@ -239,15 +238,15 @@ checkNodes(node.typeArguments, context); | ||
} | ||
if (typescript_1.default.isTypeQueryNode(node)) { | ||
if (ts.isTypeQueryNode(node)) { | ||
checkNode(node.exprName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeLiteralNode(node)) { | ||
if (ts.isTypeLiteralNode(node)) { | ||
checkNodes(node.members, context); | ||
return; | ||
} | ||
if (typescript_1.default.isArrayTypeNode(node)) { | ||
if (ts.isArrayTypeNode(node)) { | ||
checkNode(node.elementType, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTupleTypeNode(node)) { | ||
if (ts.isTupleTypeNode(node)) { | ||
checkNodes(node.elements, context); | ||
@@ -258,9 +257,9 @@ // for typescript < 4 | ||
} | ||
if (typescript_1.default.isUnionTypeNode(node) | ||
|| typescript_1.default.isIntersectionTypeNode(node) | ||
|| typescript_1.default.isHeritageClause(node)) { | ||
if (ts.isUnionTypeNode(node) | ||
|| ts.isIntersectionTypeNode(node) | ||
|| ts.isHeritageClause(node)) { | ||
checkNodes(node.types, context); | ||
return; | ||
} | ||
if (typescript_1.default.isConditionalTypeNode(node)) { | ||
if (ts.isConditionalTypeNode(node)) { | ||
checkNode(node.checkType, context); | ||
@@ -272,12 +271,12 @@ checkNode(node.extendsType, context); | ||
} | ||
if (typescript_1.default.isInferTypeNode(node)) { | ||
if (ts.isInferTypeNode(node)) { | ||
checkNode(node.typeParameter, context); | ||
return; | ||
} | ||
if (typescript_1.default.isParenthesizedTypeNode(node) | ||
|| typescript_1.default.isTypeOperatorNode(node)) { | ||
if (ts.isParenthesizedTypeNode(node) | ||
|| ts.isTypeOperatorNode(node)) { | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIndexedAccessTypeNode(node)) { | ||
if (ts.isIndexedAccessTypeNode(node)) { | ||
checkNode(node.objectType, context); | ||
@@ -287,3 +286,3 @@ checkNode(node.indexType, context); | ||
} | ||
if (typescript_1.default.isMappedTypeNode(node)) { | ||
if (ts.isMappedTypeNode(node)) { | ||
checkNode(node.questionToken, context); | ||
@@ -295,7 +294,7 @@ checkNode(node.readonlyToken, context); | ||
} | ||
if (typescript_1.default.isLiteralTypeNode(node)) { | ||
if (ts.isLiteralTypeNode(node)) { | ||
checkNode(node.literal, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportTypeNode(node)) { | ||
if (ts.isImportTypeNode(node)) { | ||
checkNode(node.qualifier, context); | ||
@@ -306,11 +305,11 @@ checkNode(node.argument, context); | ||
} | ||
if (typescript_1.default.isObjectBindingPattern(node) | ||
|| typescript_1.default.isArrayBindingPattern(node) | ||
|| typescript_1.default.isArrayLiteralExpression(node) | ||
|| typescript_1.default.isNamedImports(node) | ||
|| typescript_1.default.isNamedExports(node)) { | ||
if (ts.isObjectBindingPattern(node) | ||
|| ts.isArrayBindingPattern(node) | ||
|| ts.isArrayLiteralExpression(node) | ||
|| ts.isNamedImports(node) | ||
|| ts.isNamedExports(node)) { | ||
checkNodes(node.elements, context); | ||
return; | ||
} | ||
if (typescript_1.default.isBindingElement(node)) { | ||
if (ts.isBindingElement(node)) { | ||
checkNode(node.name, context); | ||
@@ -322,11 +321,11 @@ checkNode(node.initializer, context); | ||
} | ||
if (typescript_1.default.isObjectLiteralExpression(node) | ||
|| typescript_1.default.isJsxAttributes(node)) { | ||
if (ts.isObjectLiteralExpression(node) | ||
|| ts.isJsxAttributes(node)) { | ||
checkNodes(node.properties, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPropertyAccessExpression(node) | ||
|| typescript_1.default.isExportAssignment(node) | ||
|| typescript_1.default.isJsxSpreadAttribute(node) | ||
|| typescript_1.default.isSpreadAssignment(node)) { | ||
if (ts.isPropertyAccessExpression(node) | ||
|| ts.isExportAssignment(node) | ||
|| ts.isJsxSpreadAttribute(node) | ||
|| ts.isSpreadAssignment(node)) { | ||
checkNode(node.expression, context); | ||
@@ -336,3 +335,3 @@ checkNode(node.name, context); | ||
} | ||
if (typescript_1.default.isElementAccessExpression(node)) { | ||
if (ts.isElementAccessExpression(node)) { | ||
checkNode(node.expression, context); | ||
@@ -342,4 +341,4 @@ checkNode(node.argumentExpression, context); | ||
} | ||
if (typescript_1.default.isCallExpression(node) | ||
|| typescript_1.default.isNewExpression(node)) { | ||
if (ts.isCallExpression(node) | ||
|| ts.isNewExpression(node)) { | ||
checkNode(node.expression, context); | ||
@@ -350,3 +349,3 @@ checkNodes(node.arguments, context); | ||
} | ||
if (typescript_1.default.isTypeAssertion(node)) { | ||
if (ts.isTypeAssertion(node)) { | ||
checkTypeAssertion(node, context, 4 /* unsafeTypeAssertion */); | ||
@@ -357,26 +356,26 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isParenthesizedExpression(node) | ||
|| typescript_1.default.isDeleteExpression(node) | ||
|| typescript_1.default.isTypeOfExpression(node) | ||
|| typescript_1.default.isVoidExpression(node) | ||
|| typescript_1.default.isAwaitExpression(node) | ||
|| typescript_1.default.isYieldExpression(node) | ||
|| typescript_1.default.isSpreadElement(node) | ||
|| typescript_1.default.isExpressionStatement(node) | ||
|| typescript_1.default.isReturnStatement(node) | ||
|| typescript_1.default.isThrowStatement(node) | ||
|| typescript_1.default.isExternalModuleReference(node)) { | ||
if (ts.isParenthesizedExpression(node) | ||
|| ts.isDeleteExpression(node) | ||
|| ts.isTypeOfExpression(node) | ||
|| ts.isVoidExpression(node) | ||
|| ts.isAwaitExpression(node) | ||
|| ts.isYieldExpression(node) | ||
|| ts.isSpreadElement(node) | ||
|| ts.isExpressionStatement(node) | ||
|| ts.isReturnStatement(node) | ||
|| ts.isThrowStatement(node) | ||
|| ts.isExternalModuleReference(node)) { | ||
checkNode(node.expression, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTaggedTemplateExpression(node)) { | ||
if (ts.isTaggedTemplateExpression(node)) { | ||
checkNode(node.template, context); | ||
return; | ||
} | ||
if (typescript_1.default.isPrefixUnaryExpression(node) | ||
|| typescript_1.default.isPostfixUnaryExpression(node)) { | ||
if (ts.isPrefixUnaryExpression(node) | ||
|| ts.isPostfixUnaryExpression(node)) { | ||
checkNode(node.operand, context); | ||
return; | ||
} | ||
if (typescript_1.default.isBinaryExpression(node)) { | ||
if (ts.isBinaryExpression(node)) { | ||
checkNode(node.left, context); | ||
@@ -387,3 +386,3 @@ checkNode(node.right, context); | ||
} | ||
if (typescript_1.default.isConditionalExpression(node)) { | ||
if (ts.isConditionalExpression(node)) { | ||
checkNode(node.condition, context); | ||
@@ -396,9 +395,9 @@ checkNode(node.colonToken, context); | ||
} | ||
if (typescript_1.default.isTemplateExpression(node)) { | ||
if (ts.isTemplateExpression(node)) { | ||
checkNodes(node.templateSpans, context); | ||
return; | ||
} | ||
if (typescript_1.default.isClassExpression(node) | ||
|| typescript_1.default.isClassDeclaration(node) | ||
|| typescript_1.default.isInterfaceDeclaration(node)) { | ||
if (ts.isClassExpression(node) | ||
|| ts.isClassDeclaration(node) | ||
|| ts.isInterfaceDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -410,3 +409,3 @@ checkNodes(node.typeParameters, context); | ||
} | ||
if (typescript_1.default.isExpressionWithTypeArguments(node)) { | ||
if (ts.isExpressionWithTypeArguments(node)) { | ||
checkNode(node.expression, context); | ||
@@ -416,3 +415,3 @@ checkNodes(node.typeArguments, context); | ||
} | ||
if (typescript_1.default.isAsExpression(node)) { | ||
if (ts.isAsExpression(node)) { | ||
checkTypeAssertion(node, context, 3 /* unsafeAs */); | ||
@@ -423,3 +422,3 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isNonNullExpression(node)) { | ||
if (ts.isNonNullExpression(node)) { | ||
checkTypeAssertion(node, context, 5 /* unsafeNonNull */); | ||
@@ -429,11 +428,11 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isMetaProperty(node) | ||
|| typescript_1.default.isSemicolonClassElement(node) | ||
|| typescript_1.default.isNamespaceExportDeclaration(node) | ||
|| typescript_1.default.isNamespaceImport(node) | ||
|| typescript_1.default.isMissingDeclaration(node)) { | ||
if (ts.isMetaProperty(node) | ||
|| ts.isSemicolonClassElement(node) | ||
|| ts.isNamespaceExportDeclaration(node) | ||
|| ts.isNamespaceImport(node) | ||
|| ts.isMissingDeclaration(node)) { | ||
checkNode(node.name, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTemplateSpan(node)) { | ||
if (ts.isTemplateSpan(node)) { | ||
checkNode(node.expression, context); | ||
@@ -443,13 +442,13 @@ checkNode(node.literal, context); | ||
} | ||
if (typescript_1.default.isBlock(node) | ||
|| typescript_1.default.isModuleBlock(node) | ||
|| typescript_1.default.isDefaultClause(node)) { | ||
if (ts.isBlock(node) | ||
|| ts.isModuleBlock(node) | ||
|| ts.isDefaultClause(node)) { | ||
checkNodes(node.statements, context); | ||
return; | ||
} | ||
if (typescript_1.default.isVariableStatement(node)) { | ||
if (ts.isVariableStatement(node)) { | ||
checkNode(node.declarationList, context); | ||
return; | ||
} | ||
if (typescript_1.default.isIfStatement(node)) { | ||
if (ts.isIfStatement(node)) { | ||
checkNode(node.expression, context); | ||
@@ -460,5 +459,5 @@ checkNode(node.thenStatement, context); | ||
} | ||
if (typescript_1.default.isDoStatement(node) | ||
|| typescript_1.default.isWhileStatement(node) | ||
|| typescript_1.default.isWithStatement(node)) { | ||
if (ts.isDoStatement(node) | ||
|| ts.isWhileStatement(node) | ||
|| ts.isWithStatement(node)) { | ||
checkNode(node.expression, context); | ||
@@ -468,3 +467,3 @@ checkNode(node.statement, context); | ||
} | ||
if (typescript_1.default.isForStatement(node)) { | ||
if (ts.isForStatement(node)) { | ||
checkNode(node.initializer, context); | ||
@@ -476,3 +475,3 @@ checkNode(node.condition, context); | ||
} | ||
if (typescript_1.default.isForInStatement(node)) { | ||
if (ts.isForInStatement(node)) { | ||
checkNode(node.initializer, context); | ||
@@ -483,3 +482,3 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isForOfStatement(node)) { | ||
if (ts.isForOfStatement(node)) { | ||
checkNode(node.initializer, context); | ||
@@ -491,3 +490,3 @@ checkNode(node.statement, context); | ||
} | ||
if (typescript_1.default.isSwitchStatement(node)) { | ||
if (ts.isSwitchStatement(node)) { | ||
checkNode(node.expression, context); | ||
@@ -497,3 +496,3 @@ checkNode(node.caseBlock, context); | ||
} | ||
if (typescript_1.default.isLabeledStatement(node)) { | ||
if (ts.isLabeledStatement(node)) { | ||
checkNode(node.label, context); | ||
@@ -503,3 +502,3 @@ checkNode(node.statement, context); | ||
} | ||
if (typescript_1.default.isTryStatement(node)) { | ||
if (ts.isTryStatement(node)) { | ||
checkNode(node.tryBlock, context); | ||
@@ -510,3 +509,3 @@ checkNode(node.catchClause, context); | ||
} | ||
if (typescript_1.default.isVariableDeclaration(node)) { | ||
if (ts.isVariableDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -517,7 +516,7 @@ checkNode(node.type, context); | ||
} | ||
if (typescript_1.default.isVariableDeclarationList(node)) { | ||
if (ts.isVariableDeclarationList(node)) { | ||
checkNodes(node.declarations, context); | ||
return; | ||
} | ||
if (typescript_1.default.isTypeAliasDeclaration(node)) { | ||
if (ts.isTypeAliasDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -528,3 +527,3 @@ checkNode(node.type, context); | ||
} | ||
if (typescript_1.default.isEnumDeclaration(node)) { | ||
if (ts.isEnumDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -534,3 +533,3 @@ checkNodes(node.members, context); | ||
} | ||
if (typescript_1.default.isModuleDeclaration(node)) { | ||
if (ts.isModuleDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -540,7 +539,7 @@ checkNode(node.body, context); | ||
} | ||
if (typescript_1.default.isCaseBlock(node)) { | ||
if (ts.isCaseBlock(node)) { | ||
checkNodes(node.clauses, context); | ||
return; | ||
} | ||
if (typescript_1.default.isImportEqualsDeclaration(node)) { | ||
if (ts.isImportEqualsDeclaration(node)) { | ||
checkNode(node.name, context); | ||
@@ -550,3 +549,3 @@ checkNode(node.moduleReference, context); | ||
} | ||
if (typescript_1.default.isImportDeclaration(node)) { | ||
if (ts.isImportDeclaration(node)) { | ||
checkNode(node.importClause, context); | ||
@@ -556,3 +555,3 @@ checkNode(node.moduleSpecifier, context); | ||
} | ||
if (typescript_1.default.isImportClause(node)) { | ||
if (ts.isImportClause(node)) { | ||
checkNode(node.name, context); | ||
@@ -562,4 +561,4 @@ checkNode(node.namedBindings, context); | ||
} | ||
if (typescript_1.default.isImportSpecifier(node) | ||
|| typescript_1.default.isExportSpecifier(node)) { | ||
if (ts.isImportSpecifier(node) | ||
|| ts.isExportSpecifier(node)) { | ||
checkNode(node.name, context); | ||
@@ -569,3 +568,3 @@ checkNode(node.propertyName, context); | ||
} | ||
if (typescript_1.default.isExportDeclaration(node)) { | ||
if (ts.isExportDeclaration(node)) { | ||
checkNode(node.exportClause, context); | ||
@@ -576,3 +575,3 @@ checkNode(node.name, context); | ||
} | ||
if (typescript_1.default.isJsxElement(node)) { | ||
if (ts.isJsxElement(node)) { | ||
checkNode(node.openingElement, context); | ||
@@ -583,4 +582,4 @@ checkNode(node.closingElement, context); | ||
} | ||
if (typescript_1.default.isJsxSelfClosingElement(node) | ||
|| typescript_1.default.isJsxOpeningElement(node)) { | ||
if (ts.isJsxSelfClosingElement(node) | ||
|| ts.isJsxOpeningElement(node)) { | ||
checkNode(node.attributes, context); | ||
@@ -590,7 +589,7 @@ checkNode(node.tagName, context); | ||
} | ||
if (typescript_1.default.isJsxClosingElement(node)) { | ||
if (ts.isJsxClosingElement(node)) { | ||
checkNode(node.tagName, context); | ||
return; | ||
} | ||
if (typescript_1.default.isJsxFragment(node)) { | ||
if (ts.isJsxFragment(node)) { | ||
checkNode(node.openingFragment, context); | ||
@@ -601,3 +600,3 @@ checkNode(node.closingFragment, context); | ||
} | ||
if (typescript_1.default.isJsxAttribute(node)) { | ||
if (ts.isJsxAttribute(node)) { | ||
checkNode(node.name, context); | ||
@@ -607,3 +606,3 @@ checkNode(node.initializer, context); | ||
} | ||
if (typescript_1.default.isJsxExpression(node)) { | ||
if (ts.isJsxExpression(node)) { | ||
checkNode(node.dotDotDotToken, context); | ||
@@ -613,3 +612,3 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isCaseClause(node)) { | ||
if (ts.isCaseClause(node)) { | ||
checkNodes(node.statements, context); | ||
@@ -619,3 +618,3 @@ checkNode(node.expression, context); | ||
} | ||
if (typescript_1.default.isCatchClause(node)) { | ||
if (ts.isCatchClause(node)) { | ||
if (context.ignoreCatch) { | ||
@@ -626,3 +625,3 @@ const copyContext = Object.assign({}, context); | ||
const decl = node.variableDeclaration; | ||
if (decl.name.kind === typescript_1.default.SyntaxKind.Identifier) { | ||
if (decl.name.kind === ts.SyntaxKind.Identifier) { | ||
copyContext.catchVariables[decl.name.escapedText] = true; | ||
@@ -639,3 +638,3 @@ } | ||
} | ||
if (typescript_1.default.isPropertyAssignment(node)) { | ||
if (ts.isPropertyAssignment(node)) { | ||
checkNode(node.name, context); | ||
@@ -646,3 +645,3 @@ checkNode(node.questionToken, context); | ||
} | ||
if (typescript_1.default.isShorthandPropertyAssignment(node)) { | ||
if (ts.isShorthandPropertyAssignment(node)) { | ||
checkNode(node.name, context); | ||
@@ -654,7 +653,7 @@ checkNode(node.questionToken, context); | ||
} | ||
if (node.kind === typescript_1.default.SyntaxKind.RestType) { | ||
if (node.kind === ts.SyntaxKind.RestType) { | ||
checkNode(node.type, context); | ||
return; | ||
} | ||
if (typescript_1.default.isNamedTupleMember(node)) { | ||
if (ts.isNamedTupleMember(node)) { | ||
checkNode(node.name, context); | ||
@@ -664,3 +663,3 @@ checkNode(node.type, context); | ||
} | ||
if (typescript_1.default.isTemplateLiteralTypeNode(node)) { | ||
if (ts.isTemplateLiteralTypeNode(node)) { | ||
checkNode(node.head, context); | ||
@@ -670,3 +669,3 @@ checkNodes(node.templateSpans, context); | ||
} | ||
if (typescript_1.default.isTemplateLiteralTypeSpan(node)) { | ||
if (ts.isTemplateLiteralTypeSpan(node)) { | ||
checkNode(node.literal, context); | ||
@@ -676,3 +675,3 @@ checkNode(node.type, context); | ||
} | ||
if (typescript_1.default.isNamespaceExport(node)) { | ||
if (ts.isNamespaceExport(node)) { | ||
checkNode(node.name, context); | ||
@@ -685,185 +684,185 @@ return; | ||
const skippedNodeKinds = new Set([ | ||
typescript_1.default.SyntaxKind.Unknown, | ||
typescript_1.default.SyntaxKind.EndOfFileToken, | ||
typescript_1.default.SyntaxKind.SingleLineCommentTrivia, | ||
typescript_1.default.SyntaxKind.MultiLineCommentTrivia, | ||
typescript_1.default.SyntaxKind.NewLineTrivia, | ||
typescript_1.default.SyntaxKind.WhitespaceTrivia, | ||
typescript_1.default.SyntaxKind.ShebangTrivia, | ||
typescript_1.default.SyntaxKind.ConflictMarkerTrivia, | ||
typescript_1.default.SyntaxKind.NumericLiteral, | ||
typescript_1.default.SyntaxKind.StringLiteral, | ||
typescript_1.default.SyntaxKind.JsxText, | ||
typescript_1.default.SyntaxKind.JsxTextAllWhiteSpaces, | ||
typescript_1.default.SyntaxKind.RegularExpressionLiteral, | ||
typescript_1.default.SyntaxKind.NoSubstitutionTemplateLiteral, | ||
typescript_1.default.SyntaxKind.TemplateHead, | ||
typescript_1.default.SyntaxKind.TemplateMiddle, | ||
typescript_1.default.SyntaxKind.TemplateTail, | ||
typescript_1.default.SyntaxKind.OpenBraceToken, | ||
typescript_1.default.SyntaxKind.CloseBraceToken, | ||
typescript_1.default.SyntaxKind.OpenParenToken, | ||
typescript_1.default.SyntaxKind.CloseParenToken, | ||
typescript_1.default.SyntaxKind.OpenBracketToken, | ||
typescript_1.default.SyntaxKind.CloseBracketToken, | ||
typescript_1.default.SyntaxKind.DotToken, | ||
typescript_1.default.SyntaxKind.DotDotDotToken, | ||
typescript_1.default.SyntaxKind.SemicolonToken, | ||
typescript_1.default.SyntaxKind.CommaToken, | ||
typescript_1.default.SyntaxKind.LessThanToken, | ||
typescript_1.default.SyntaxKind.LessThanSlashToken, | ||
typescript_1.default.SyntaxKind.GreaterThanToken, | ||
typescript_1.default.SyntaxKind.LessThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.ExclamationEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.ExclamationEqualsEqualsToken, | ||
typescript_1.default.SyntaxKind.EqualsGreaterThanToken, | ||
typescript_1.default.SyntaxKind.PlusToken, | ||
typescript_1.default.SyntaxKind.MinusToken, | ||
typescript_1.default.SyntaxKind.AsteriskToken, | ||
typescript_1.default.SyntaxKind.AsteriskAsteriskToken, | ||
typescript_1.default.SyntaxKind.SlashToken, | ||
typescript_1.default.SyntaxKind.PercentToken, | ||
typescript_1.default.SyntaxKind.PlusPlusToken, | ||
typescript_1.default.SyntaxKind.MinusMinusToken, | ||
typescript_1.default.SyntaxKind.LessThanLessThanToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, | ||
typescript_1.default.SyntaxKind.AmpersandToken, | ||
typescript_1.default.SyntaxKind.BarToken, | ||
typescript_1.default.SyntaxKind.CaretToken, | ||
typescript_1.default.SyntaxKind.ExclamationToken, | ||
typescript_1.default.SyntaxKind.TildeToken, | ||
typescript_1.default.SyntaxKind.AmpersandAmpersandToken, | ||
typescript_1.default.SyntaxKind.BarBarToken, | ||
typescript_1.default.SyntaxKind.QuestionToken, | ||
typescript_1.default.SyntaxKind.ColonToken, | ||
typescript_1.default.SyntaxKind.AtToken, | ||
typescript_1.default.SyntaxKind.QuestionQuestionToken, | ||
typescript_1.default.SyntaxKind.EqualsToken, | ||
typescript_1.default.SyntaxKind.PlusEqualsToken, | ||
typescript_1.default.SyntaxKind.MinusEqualsToken, | ||
typescript_1.default.SyntaxKind.AsteriskEqualsToken, | ||
typescript_1.default.SyntaxKind.AsteriskAsteriskEqualsToken, | ||
typescript_1.default.SyntaxKind.SlashEqualsToken, | ||
typescript_1.default.SyntaxKind.PercentEqualsToken, | ||
typescript_1.default.SyntaxKind.LessThanLessThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, | ||
typescript_1.default.SyntaxKind.AmpersandEqualsToken, | ||
typescript_1.default.SyntaxKind.BarEqualsToken, | ||
typescript_1.default.SyntaxKind.CaretEqualsToken, | ||
typescript_1.default.SyntaxKind.BreakKeyword, | ||
typescript_1.default.SyntaxKind.CaseKeyword, | ||
typescript_1.default.SyntaxKind.CatchKeyword, | ||
typescript_1.default.SyntaxKind.ClassKeyword, | ||
typescript_1.default.SyntaxKind.ConstKeyword, | ||
typescript_1.default.SyntaxKind.ContinueKeyword, | ||
typescript_1.default.SyntaxKind.DebuggerKeyword, | ||
typescript_1.default.SyntaxKind.DefaultKeyword, | ||
typescript_1.default.SyntaxKind.DeleteKeyword, | ||
typescript_1.default.SyntaxKind.DoKeyword, | ||
typescript_1.default.SyntaxKind.ElseKeyword, | ||
typescript_1.default.SyntaxKind.EnumKeyword, | ||
typescript_1.default.SyntaxKind.ExportKeyword, | ||
typescript_1.default.SyntaxKind.ExtendsKeyword, | ||
typescript_1.default.SyntaxKind.FalseKeyword, | ||
typescript_1.default.SyntaxKind.FinallyKeyword, | ||
typescript_1.default.SyntaxKind.ForKeyword, | ||
typescript_1.default.SyntaxKind.FunctionKeyword, | ||
typescript_1.default.SyntaxKind.IfKeyword, | ||
typescript_1.default.SyntaxKind.ImportKeyword, | ||
typescript_1.default.SyntaxKind.InKeyword, | ||
typescript_1.default.SyntaxKind.InstanceOfKeyword, | ||
typescript_1.default.SyntaxKind.NewKeyword, | ||
typescript_1.default.SyntaxKind.NullKeyword, | ||
typescript_1.default.SyntaxKind.ReturnKeyword, | ||
typescript_1.default.SyntaxKind.SuperKeyword, | ||
typescript_1.default.SyntaxKind.SwitchKeyword, | ||
typescript_1.default.SyntaxKind.ThrowKeyword, | ||
typescript_1.default.SyntaxKind.TrueKeyword, | ||
typescript_1.default.SyntaxKind.TryKeyword, | ||
typescript_1.default.SyntaxKind.TypeOfKeyword, | ||
typescript_1.default.SyntaxKind.VarKeyword, | ||
typescript_1.default.SyntaxKind.VoidKeyword, | ||
typescript_1.default.SyntaxKind.WhileKeyword, | ||
typescript_1.default.SyntaxKind.WithKeyword, | ||
typescript_1.default.SyntaxKind.ImplementsKeyword, | ||
typescript_1.default.SyntaxKind.InterfaceKeyword, | ||
typescript_1.default.SyntaxKind.LetKeyword, | ||
typescript_1.default.SyntaxKind.PackageKeyword, | ||
typescript_1.default.SyntaxKind.PrivateKeyword, | ||
typescript_1.default.SyntaxKind.ProtectedKeyword, | ||
typescript_1.default.SyntaxKind.PublicKeyword, | ||
typescript_1.default.SyntaxKind.StaticKeyword, | ||
typescript_1.default.SyntaxKind.YieldKeyword, | ||
typescript_1.default.SyntaxKind.AbstractKeyword, | ||
typescript_1.default.SyntaxKind.AsKeyword, | ||
typescript_1.default.SyntaxKind.AnyKeyword, | ||
typescript_1.default.SyntaxKind.AsyncKeyword, | ||
typescript_1.default.SyntaxKind.AwaitKeyword, | ||
typescript_1.default.SyntaxKind.BooleanKeyword, | ||
typescript_1.default.SyntaxKind.ConstructorKeyword, | ||
typescript_1.default.SyntaxKind.DeclareKeyword, | ||
typescript_1.default.SyntaxKind.GetKeyword, | ||
typescript_1.default.SyntaxKind.IsKeyword, | ||
typescript_1.default.SyntaxKind.KeyOfKeyword, | ||
typescript_1.default.SyntaxKind.ModuleKeyword, | ||
typescript_1.default.SyntaxKind.NamespaceKeyword, | ||
typescript_1.default.SyntaxKind.NeverKeyword, | ||
typescript_1.default.SyntaxKind.ReadonlyKeyword, | ||
typescript_1.default.SyntaxKind.RequireKeyword, | ||
typescript_1.default.SyntaxKind.NumberKeyword, | ||
typescript_1.default.SyntaxKind.ObjectKeyword, | ||
typescript_1.default.SyntaxKind.SetKeyword, | ||
typescript_1.default.SyntaxKind.StringKeyword, | ||
typescript_1.default.SyntaxKind.SymbolKeyword, | ||
typescript_1.default.SyntaxKind.TypeKeyword, | ||
typescript_1.default.SyntaxKind.UndefinedKeyword, | ||
typescript_1.default.SyntaxKind.UniqueKeyword, | ||
typescript_1.default.SyntaxKind.UnknownKeyword, | ||
typescript_1.default.SyntaxKind.FromKeyword, | ||
typescript_1.default.SyntaxKind.GlobalKeyword, | ||
typescript_1.default.SyntaxKind.BigIntKeyword, | ||
typescript_1.default.SyntaxKind.OfKeyword, | ||
typescript_1.default.SyntaxKind.OptionalType, | ||
typescript_1.default.SyntaxKind.ThisType, | ||
typescript_1.default.SyntaxKind.OmittedExpression, | ||
typescript_1.default.SyntaxKind.EmptyStatement, | ||
typescript_1.default.SyntaxKind.ContinueStatement, | ||
typescript_1.default.SyntaxKind.BreakStatement, | ||
typescript_1.default.SyntaxKind.DebuggerStatement, | ||
typescript_1.default.SyntaxKind.JsxOpeningFragment, | ||
typescript_1.default.SyntaxKind.JsxClosingFragment, | ||
typescript_1.default.SyntaxKind.EnumMember, | ||
typescript_1.default.SyntaxKind.SourceFile, | ||
typescript_1.default.SyntaxKind.Bundle, | ||
typescript_1.default.SyntaxKind.JSDocTypeExpression, | ||
typescript_1.default.SyntaxKind.JSDocAllType, | ||
typescript_1.default.SyntaxKind.JSDocUnknownType, | ||
typescript_1.default.SyntaxKind.JSDocNullableType, | ||
typescript_1.default.SyntaxKind.JSDocNonNullableType, | ||
typescript_1.default.SyntaxKind.JSDocOptionalType, | ||
typescript_1.default.SyntaxKind.JSDocFunctionType, | ||
typescript_1.default.SyntaxKind.JSDocVariadicType, | ||
typescript_1.default.SyntaxKind.JSDocComment, | ||
typescript_1.default.SyntaxKind.JSDocTag, | ||
typescript_1.default.SyntaxKind.JSDocAugmentsTag, | ||
typescript_1.default.SyntaxKind.JSDocClassTag, | ||
typescript_1.default.SyntaxKind.JSDocParameterTag, | ||
typescript_1.default.SyntaxKind.JSDocReturnTag, | ||
typescript_1.default.SyntaxKind.JSDocTypeTag, | ||
typescript_1.default.SyntaxKind.JSDocTemplateTag, | ||
typescript_1.default.SyntaxKind.JSDocTypedefTag, | ||
typescript_1.default.SyntaxKind.JSDocPropertyTag, | ||
typescript_1.default.SyntaxKind.JSDocTypeLiteral, | ||
typescript_1.default.SyntaxKind.SyntaxList, | ||
typescript_1.default.SyntaxKind.NotEmittedStatement, | ||
typescript_1.default.SyntaxKind.PartiallyEmittedExpression, | ||
typescript_1.default.SyntaxKind.CommaListExpression, | ||
typescript_1.default.SyntaxKind.MergeDeclarationMarker, | ||
typescript_1.default.SyntaxKind.EndOfDeclarationMarker, | ||
typescript_1.default.SyntaxKind.Count, | ||
ts.SyntaxKind.Unknown, | ||
ts.SyntaxKind.EndOfFileToken, | ||
ts.SyntaxKind.SingleLineCommentTrivia, | ||
ts.SyntaxKind.MultiLineCommentTrivia, | ||
ts.SyntaxKind.NewLineTrivia, | ||
ts.SyntaxKind.WhitespaceTrivia, | ||
ts.SyntaxKind.ShebangTrivia, | ||
ts.SyntaxKind.ConflictMarkerTrivia, | ||
ts.SyntaxKind.NumericLiteral, | ||
ts.SyntaxKind.StringLiteral, | ||
ts.SyntaxKind.JsxText, | ||
ts.SyntaxKind.JsxTextAllWhiteSpaces, | ||
ts.SyntaxKind.RegularExpressionLiteral, | ||
ts.SyntaxKind.NoSubstitutionTemplateLiteral, | ||
ts.SyntaxKind.TemplateHead, | ||
ts.SyntaxKind.TemplateMiddle, | ||
ts.SyntaxKind.TemplateTail, | ||
ts.SyntaxKind.OpenBraceToken, | ||
ts.SyntaxKind.CloseBraceToken, | ||
ts.SyntaxKind.OpenParenToken, | ||
ts.SyntaxKind.CloseParenToken, | ||
ts.SyntaxKind.OpenBracketToken, | ||
ts.SyntaxKind.CloseBracketToken, | ||
ts.SyntaxKind.DotToken, | ||
ts.SyntaxKind.DotDotDotToken, | ||
ts.SyntaxKind.SemicolonToken, | ||
ts.SyntaxKind.CommaToken, | ||
ts.SyntaxKind.LessThanToken, | ||
ts.SyntaxKind.LessThanSlashToken, | ||
ts.SyntaxKind.GreaterThanToken, | ||
ts.SyntaxKind.LessThanEqualsToken, | ||
ts.SyntaxKind.GreaterThanEqualsToken, | ||
ts.SyntaxKind.EqualsEqualsToken, | ||
ts.SyntaxKind.ExclamationEqualsToken, | ||
ts.SyntaxKind.EqualsEqualsEqualsToken, | ||
ts.SyntaxKind.ExclamationEqualsEqualsToken, | ||
ts.SyntaxKind.EqualsGreaterThanToken, | ||
ts.SyntaxKind.PlusToken, | ||
ts.SyntaxKind.MinusToken, | ||
ts.SyntaxKind.AsteriskToken, | ||
ts.SyntaxKind.AsteriskAsteriskToken, | ||
ts.SyntaxKind.SlashToken, | ||
ts.SyntaxKind.PercentToken, | ||
ts.SyntaxKind.PlusPlusToken, | ||
ts.SyntaxKind.MinusMinusToken, | ||
ts.SyntaxKind.LessThanLessThanToken, | ||
ts.SyntaxKind.GreaterThanGreaterThanToken, | ||
ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, | ||
ts.SyntaxKind.AmpersandToken, | ||
ts.SyntaxKind.BarToken, | ||
ts.SyntaxKind.CaretToken, | ||
ts.SyntaxKind.ExclamationToken, | ||
ts.SyntaxKind.TildeToken, | ||
ts.SyntaxKind.AmpersandAmpersandToken, | ||
ts.SyntaxKind.BarBarToken, | ||
ts.SyntaxKind.QuestionToken, | ||
ts.SyntaxKind.ColonToken, | ||
ts.SyntaxKind.AtToken, | ||
ts.SyntaxKind.QuestionQuestionToken, | ||
ts.SyntaxKind.EqualsToken, | ||
ts.SyntaxKind.PlusEqualsToken, | ||
ts.SyntaxKind.MinusEqualsToken, | ||
ts.SyntaxKind.AsteriskEqualsToken, | ||
ts.SyntaxKind.AsteriskAsteriskEqualsToken, | ||
ts.SyntaxKind.SlashEqualsToken, | ||
ts.SyntaxKind.PercentEqualsToken, | ||
ts.SyntaxKind.LessThanLessThanEqualsToken, | ||
ts.SyntaxKind.GreaterThanGreaterThanEqualsToken, | ||
ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, | ||
ts.SyntaxKind.AmpersandEqualsToken, | ||
ts.SyntaxKind.BarEqualsToken, | ||
ts.SyntaxKind.CaretEqualsToken, | ||
ts.SyntaxKind.BreakKeyword, | ||
ts.SyntaxKind.CaseKeyword, | ||
ts.SyntaxKind.CatchKeyword, | ||
ts.SyntaxKind.ClassKeyword, | ||
ts.SyntaxKind.ConstKeyword, | ||
ts.SyntaxKind.ContinueKeyword, | ||
ts.SyntaxKind.DebuggerKeyword, | ||
ts.SyntaxKind.DefaultKeyword, | ||
ts.SyntaxKind.DeleteKeyword, | ||
ts.SyntaxKind.DoKeyword, | ||
ts.SyntaxKind.ElseKeyword, | ||
ts.SyntaxKind.EnumKeyword, | ||
ts.SyntaxKind.ExportKeyword, | ||
ts.SyntaxKind.ExtendsKeyword, | ||
ts.SyntaxKind.FalseKeyword, | ||
ts.SyntaxKind.FinallyKeyword, | ||
ts.SyntaxKind.ForKeyword, | ||
ts.SyntaxKind.FunctionKeyword, | ||
ts.SyntaxKind.IfKeyword, | ||
ts.SyntaxKind.ImportKeyword, | ||
ts.SyntaxKind.InKeyword, | ||
ts.SyntaxKind.InstanceOfKeyword, | ||
ts.SyntaxKind.NewKeyword, | ||
ts.SyntaxKind.NullKeyword, | ||
ts.SyntaxKind.ReturnKeyword, | ||
ts.SyntaxKind.SuperKeyword, | ||
ts.SyntaxKind.SwitchKeyword, | ||
ts.SyntaxKind.ThrowKeyword, | ||
ts.SyntaxKind.TrueKeyword, | ||
ts.SyntaxKind.TryKeyword, | ||
ts.SyntaxKind.TypeOfKeyword, | ||
ts.SyntaxKind.VarKeyword, | ||
ts.SyntaxKind.VoidKeyword, | ||
ts.SyntaxKind.WhileKeyword, | ||
ts.SyntaxKind.WithKeyword, | ||
ts.SyntaxKind.ImplementsKeyword, | ||
ts.SyntaxKind.InterfaceKeyword, | ||
ts.SyntaxKind.LetKeyword, | ||
ts.SyntaxKind.PackageKeyword, | ||
ts.SyntaxKind.PrivateKeyword, | ||
ts.SyntaxKind.ProtectedKeyword, | ||
ts.SyntaxKind.PublicKeyword, | ||
ts.SyntaxKind.StaticKeyword, | ||
ts.SyntaxKind.YieldKeyword, | ||
ts.SyntaxKind.AbstractKeyword, | ||
ts.SyntaxKind.AsKeyword, | ||
ts.SyntaxKind.AnyKeyword, | ||
ts.SyntaxKind.AsyncKeyword, | ||
ts.SyntaxKind.AwaitKeyword, | ||
ts.SyntaxKind.BooleanKeyword, | ||
ts.SyntaxKind.ConstructorKeyword, | ||
ts.SyntaxKind.DeclareKeyword, | ||
ts.SyntaxKind.GetKeyword, | ||
ts.SyntaxKind.IsKeyword, | ||
ts.SyntaxKind.KeyOfKeyword, | ||
ts.SyntaxKind.ModuleKeyword, | ||
ts.SyntaxKind.NamespaceKeyword, | ||
ts.SyntaxKind.NeverKeyword, | ||
ts.SyntaxKind.ReadonlyKeyword, | ||
ts.SyntaxKind.RequireKeyword, | ||
ts.SyntaxKind.NumberKeyword, | ||
ts.SyntaxKind.ObjectKeyword, | ||
ts.SyntaxKind.SetKeyword, | ||
ts.SyntaxKind.StringKeyword, | ||
ts.SyntaxKind.SymbolKeyword, | ||
ts.SyntaxKind.TypeKeyword, | ||
ts.SyntaxKind.UndefinedKeyword, | ||
ts.SyntaxKind.UniqueKeyword, | ||
ts.SyntaxKind.UnknownKeyword, | ||
ts.SyntaxKind.FromKeyword, | ||
ts.SyntaxKind.GlobalKeyword, | ||
ts.SyntaxKind.BigIntKeyword, | ||
ts.SyntaxKind.OfKeyword, | ||
ts.SyntaxKind.OptionalType, | ||
ts.SyntaxKind.ThisType, | ||
ts.SyntaxKind.OmittedExpression, | ||
ts.SyntaxKind.EmptyStatement, | ||
ts.SyntaxKind.ContinueStatement, | ||
ts.SyntaxKind.BreakStatement, | ||
ts.SyntaxKind.DebuggerStatement, | ||
ts.SyntaxKind.JsxOpeningFragment, | ||
ts.SyntaxKind.JsxClosingFragment, | ||
ts.SyntaxKind.EnumMember, | ||
ts.SyntaxKind.SourceFile, | ||
ts.SyntaxKind.Bundle, | ||
ts.SyntaxKind.JSDocTypeExpression, | ||
ts.SyntaxKind.JSDocAllType, | ||
ts.SyntaxKind.JSDocUnknownType, | ||
ts.SyntaxKind.JSDocNullableType, | ||
ts.SyntaxKind.JSDocNonNullableType, | ||
ts.SyntaxKind.JSDocOptionalType, | ||
ts.SyntaxKind.JSDocFunctionType, | ||
ts.SyntaxKind.JSDocVariadicType, | ||
ts.SyntaxKind.JSDocComment, | ||
ts.SyntaxKind.JSDocTag, | ||
ts.SyntaxKind.JSDocAugmentsTag, | ||
ts.SyntaxKind.JSDocClassTag, | ||
ts.SyntaxKind.JSDocParameterTag, | ||
ts.SyntaxKind.JSDocReturnTag, | ||
ts.SyntaxKind.JSDocTypeTag, | ||
ts.SyntaxKind.JSDocTemplateTag, | ||
ts.SyntaxKind.JSDocTypedefTag, | ||
ts.SyntaxKind.JSDocPropertyTag, | ||
ts.SyntaxKind.JSDocTypeLiteral, | ||
ts.SyntaxKind.SyntaxList, | ||
ts.SyntaxKind.NotEmittedStatement, | ||
ts.SyntaxKind.PartiallyEmittedExpression, | ||
ts.SyntaxKind.CommaListExpression, | ||
ts.SyntaxKind.MergeDeclarationMarker, | ||
ts.SyntaxKind.EndOfDeclarationMarker, | ||
ts.SyntaxKind.Count, | ||
]); |
@@ -1,2 +0,2 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
import { AnyInfo, LintOptions, FileTypeCheckResult } from './interfaces'; | ||
@@ -3,0 +3,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lintSync = exports.lint = void 0; | ||
const tslib_1 = require("tslib"); | ||
const typescript_1 = tslib_1.__importDefault(require("typescript")); | ||
const path = tslib_1.__importStar(require("path")); | ||
const minimatch_1 = tslib_1.__importDefault(require("minimatch")); | ||
const ts = require("typescript"); | ||
const path = require("path"); | ||
const minimatch_1 = require("minimatch"); | ||
const ts_lib_utils_1 = require("ts-lib-utils"); | ||
@@ -19,3 +18,3 @@ const checker_1 = require("./checker"); | ||
const { rootNames, compilerOptions } = await ts_lib_utils_1.getProjectRootNamesAndCompilerOptions(project); | ||
const program = typescript_1.default.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram); | ||
const program = ts.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram); | ||
const checker = program.getTypeChecker(); | ||
@@ -146,3 +145,3 @@ const allFiles = new Set(); | ||
const lintOptions = { ...defaultLintOptions, ...options }; | ||
const program = typescript_1.default.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram); | ||
const program = ts.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram); | ||
const checker = program.getTypeChecker(); | ||
@@ -149,0 +148,0 @@ const allFiles = new Set(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.clearCacheOfDependencies = exports.collectDependencies = void 0; | ||
const tslib_1 = require("tslib"); | ||
const typescript_1 = tslib_1.__importDefault(require("typescript")); | ||
const path = tslib_1.__importStar(require("path")); | ||
const ts = require("typescript"); | ||
const path = require("path"); | ||
function collectDependencies(sourceFileInfos, allFiles) { | ||
@@ -12,6 +11,6 @@ const dependencies = []; | ||
let source; | ||
if (typescript_1.default.isImportEqualsDeclaration(node)) { | ||
if (ts.isImportEqualsDeclaration(node)) { | ||
source = node.name.text; | ||
} | ||
else if (typescript_1.default.isImportDeclaration(node) && typescript_1.default.isIdentifier(node.moduleSpecifier)) { | ||
else if (ts.isImportDeclaration(node) && ts.isIdentifier(node.moduleSpecifier)) { | ||
source = node.moduleSpecifier.text; | ||
@@ -18,0 +17,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
export declare function collectIgnoreMap(sourceFile: ts.SourceFile, file: string): { | ||
[file: string]: Set<number>; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.collectIgnoreMap = void 0; | ||
const tslib_1 = require("tslib"); | ||
const typescript_1 = tslib_1.__importDefault(require("typescript")); | ||
const utils = tslib_1.__importStar(require("tsutils/util")); | ||
const ts = require("typescript"); | ||
const utils = require("tsutils/util"); | ||
function collectIgnoreMap(sourceFile, file) { | ||
const ingoreMap = {}; | ||
utils.forEachComment(sourceFile, (_, comment) => { | ||
const commentText = comment.kind === typescript_1.default.SyntaxKind.SingleLineCommentTrivia | ||
const commentText = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia | ||
? sourceFile.text.substring(comment.pos + 2, comment.end).trim() | ||
@@ -17,3 +16,3 @@ : sourceFile.text.substring(comment.pos + 2, comment.end - 2).trim(); | ||
} | ||
const line = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, comment.pos).line; | ||
const line = ts.getLineAndCharacterOfPosition(sourceFile, comment.pos).line; | ||
ingoreMap[file].add(line + 1); | ||
@@ -25,3 +24,3 @@ } | ||
} | ||
const line = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, comment.pos).line; | ||
const line = ts.getLineAndCharacterOfPosition(sourceFile, comment.pos).line; | ||
ingoreMap[file].add(line); | ||
@@ -28,0 +27,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
/** | ||
@@ -3,0 +3,0 @@ * @public |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.14.9", | ||
"version": "2.15.0", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -12,3 +12,3 @@ "main": "dist/index.js", | ||
"minimatch": "3", | ||
"ts-lib-utils": "^2.14.8", | ||
"ts-lib-utils": "^2.15.0", | ||
"tslib": "1 || 2", | ||
@@ -15,0 +15,0 @@ "tsutils": "3" |
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
45223
1297
Updatedts-lib-utils@^2.15.0