aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
downloadwallet-core-bbff7403fbf46f9ad92240ac213df8d30ef31b64.tar.xz
update packages
Diffstat (limited to 'node_modules/tslint')
-rw-r--r--node_modules/tslint/CHANGELOG.md222
-rw-r--r--node_modules/tslint/README.md15
-rwxr-xr-xnode_modules/tslint/bin/tslint2
-rw-r--r--node_modules/tslint/lib/configs/all.d.ts21
-rw-r--r--node_modules/tslint/lib/configs/all.js5
-rw-r--r--node_modules/tslint/lib/configs/recommended.js2
-rw-r--r--node_modules/tslint/lib/configuration.d.ts43
-rw-r--r--node_modules/tslint/lib/configuration.js194
-rw-r--r--node_modules/tslint/lib/enableDisableRules.d.ts16
-rw-r--r--node_modules/tslint/lib/enableDisableRules.js2
-rw-r--r--node_modules/tslint/lib/error.d.ts19
-rw-r--r--node_modules/tslint/lib/error.js4
-rw-r--r--node_modules/tslint/lib/formatterLoader.d.ts16
-rw-r--r--node_modules/tslint/lib/formatterLoader.js46
-rw-r--r--node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts2
-rw-r--r--node_modules/tslint/lib/formatters/checkstyleFormatter.js6
-rw-r--r--node_modules/tslint/lib/formatters/codeFrameFormatter.js14
-rw-r--r--node_modules/tslint/lib/formatters/jsonFormatter.js4
-rw-r--r--node_modules/tslint/lib/formatters/junitFormatter.d.ts2
-rw-r--r--node_modules/tslint/lib/formatters/junitFormatter.js6
-rw-r--r--node_modules/tslint/lib/formatters/msbuildFormatter.d.ts16
-rw-r--r--node_modules/tslint/lib/formatters/pmdFormatter.js4
-rw-r--r--node_modules/tslint/lib/formatters/stylishFormatter.d.ts8
-rw-r--r--node_modules/tslint/lib/formatters/stylishFormatter.js22
-rw-r--r--node_modules/tslint/lib/formatters/tapFormatter.d.ts2
-rw-r--r--node_modules/tslint/lib/formatters/tapFormatter.js7
-rw-r--r--node_modules/tslint/lib/formatters/verboseFormatter.d.ts2
-rw-r--r--node_modules/tslint/lib/formatters/vsoFormatter.js4
-rw-r--r--node_modules/tslint/lib/index.d.ts4
-rw-r--r--node_modules/tslint/lib/index.js3
-rw-r--r--node_modules/tslint/lib/language/rule/abstractRule.d.ts2
-rw-r--r--node_modules/tslint/lib/language/rule/rule.d.ts32
-rw-r--r--node_modules/tslint/lib/language/utils.d.ts55
-rw-r--r--node_modules/tslint/lib/language/utils.js46
-rw-r--r--node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts4
-rw-r--r--node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js1
-rw-r--r--node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts4
-rw-r--r--node_modules/tslint/lib/language/walker/ruleWalker.d.ts10
-rw-r--r--node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts2
-rw-r--r--node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js2
-rw-r--r--node_modules/tslint/lib/linter.d.ts37
-rw-r--r--node_modules/tslint/lib/linter.js52
-rw-r--r--node_modules/tslint/lib/ruleLoader.d.ts17
-rw-r--r--node_modules/tslint/lib/ruleLoader.js50
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/alignRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/alignRule.js7
-rw-r--r--node_modules/tslint/lib/rules/arrayTypeRule.js4
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.js8
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.js15
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.js14
-rw-r--r--node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/banCommaOperatorRule.js21
-rw-r--r--node_modules/tslint/lib/rules/banRule.js4
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js5
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.js1
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.js8
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.js7
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/blockExclusion.js4
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts4
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/classExclusion.js8
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts4
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.d.ts50
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.js259
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.js18
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.js8
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.js10
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.js2
-rw-r--r--node_modules/tslint/lib/rules/eoflineRule.js2
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.d.ts1
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.js44
-rw-r--r--node_modules/tslint/lib/rules/forinRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/forinRule.js4
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.js8
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.js2
-rw-r--r--node_modules/tslint/lib/rules/indentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/indentRule.js8
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.js4
-rw-r--r--node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.js6
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.js4
-rw-r--r--node_modules/tslint/lib/rules/linebreakStyleRule.js4
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.js6
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.js8
-rw-r--r--node_modules/tslint/lib/rules/maxFileLineCountRule.js4
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.js63
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.js12
-rw-r--r--node_modules/tslint/lib/rules/memberOrderingRule.js204
-rw-r--r--node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noAnyRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noBitwiseRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.js11
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noDefaultExportRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateImportsRule.js30
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.js13
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.js12
-rw-r--r--node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.js35
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noForInArrayRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noImplicitDependenciesRule.js69
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noInternalModuleRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noMagicNumbersRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noNonNullAssertionRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noRedundantJsdocRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noReferenceImportRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReferenceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noRequireImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReturnAwaitRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.js84
-rw-r--r--node_modules/tslint/lib/rules/noSparseArraysRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noSubmoduleImportsRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts20
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noThisAssignmentRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.js7
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryClassRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js55
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.js50
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.js112
-rw-r--r--node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noVarRequiresRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noVoidExpressionRule.js9
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.js2
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.js4
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js36
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.js9
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js4
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js6
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.js8
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.js62
-rw-r--r--node_modules/tslint/lib/rules/preferConstRule.js20
-rw-r--r--node_modules/tslint/lib/rules/preferForOfRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js4
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.js4
-rw-r--r--node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.js13
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.js4
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js76
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.js4
-rw-r--r--node_modules/tslint/lib/rules/radixRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/radixRule.js33
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.js8
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.js8
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.js4
-rw-r--r--node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js9
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.js14
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts2
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js21
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.js28
-rw-r--r--node_modules/tslint/lib/rules/switchDefaultRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/switchFinalBreakRule.js47
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.js6
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.js6
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.js2
-rw-r--r--node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts18
-rw-r--r--node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js12
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.js4
-rw-r--r--node_modules/tslint/lib/rules/variableNameRule.js7
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.js7
-rw-r--r--node_modules/tslint/lib/runner.d.ts25
-rw-r--r--node_modules/tslint/lib/runner.js138
-rw-r--r--node_modules/tslint/lib/test.d.ts21
-rw-r--r--node_modules/tslint/lib/test.js61
-rw-r--r--node_modules/tslint/lib/tslint-cli.d.ts0
-rw-r--r--node_modules/tslint/lib/tslint-cli.js219
-rw-r--r--node_modules/tslint/lib/utils.d.ts5
-rw-r--r--node_modules/tslint/lib/utils.js18
-rw-r--r--node_modules/tslint/lib/verify/lines.js1
-rw-r--r--node_modules/tslint/lib/verify/lintError.js1
-rw-r--r--node_modules/tslint/lib/verify/parse.js1
-rw-r--r--node_modules/tslint/node_modules/chalk/index.js228
-rw-r--r--node_modules/tslint/node_modules/chalk/license9
-rw-r--r--node_modules/tslint/node_modules/chalk/package.json66
-rw-r--r--node_modules/tslint/node_modules/chalk/readme.md309
-rw-r--r--node_modules/tslint/node_modules/chalk/templates.js128
-rw-r--r--node_modules/tslint/node_modules/chalk/types/index.d.ts97
-rw-r--r--node_modules/tslint/node_modules/commander/CHANGELOG.md63
-rw-r--r--node_modules/tslint/node_modules/commander/Readme.md113
-rw-r--r--node_modules/tslint/node_modules/commander/index.js327
-rw-r--r--node_modules/tslint/node_modules/commander/package.json18
-rw-r--r--node_modules/tslint/node_modules/commander/typings/index.d.ts38
-rw-r--r--node_modules/tslint/node_modules/resolve/.editorconfig20
-rw-r--r--node_modules/tslint/node_modules/resolve/.eslintignore1
-rw-r--r--node_modules/tslint/node_modules/resolve/.eslintrc30
-rw-r--r--node_modules/tslint/node_modules/resolve/.travis.yml173
-rw-r--r--node_modules/tslint/node_modules/resolve/LICENSE18
-rw-r--r--node_modules/tslint/node_modules/resolve/appveyor.yml44
-rw-r--r--node_modules/tslint/node_modules/resolve/example/async.js5
-rw-r--r--node_modules/tslint/node_modules/resolve/example/sync.js3
-rw-r--r--node_modules/tslint/node_modules/resolve/index.js8
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/async.js203
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/caller.js8
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/core.js34
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/core.json43
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/node-modules-paths.js45
-rw-r--r--node_modules/tslint/node_modules/resolve/lib/sync.js93
-rw-r--r--node_modules/tslint/node_modules/resolve/package.json40
-rw-r--r--node_modules/tslint/node_modules/resolve/readme.markdown160
-rw-r--r--node_modules/tslint/node_modules/resolve/test/core.js36
-rw-r--r--node_modules/tslint/node_modules/resolve/test/dotdot.js29
-rw-r--r--node_modules/tslint/node_modules/resolve/test/dotdot/abc/index.js2
-rw-r--r--node_modules/tslint/node_modules/resolve/test/dotdot/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/faulty_basedir.js13
-rw-r--r--node_modules/tslint/node_modules/resolve/test/filter.js19
-rw-r--r--node_modules/tslint/node_modules/resolve/test/filter_sync.js16
-rw-r--r--node_modules/tslint/node_modules/resolve/test/mock.js143
-rw-r--r--node_modules/tslint/node_modules/resolve/test/mock_sync.js67
-rw-r--r--node_modules/tslint/node_modules/resolve/test/module_dir.js56
-rw-r--r--node_modules/tslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json3
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node-modules-paths.js93
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node_path.js49
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node_path/x/aaa/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node_path/x/ccc/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node_path/y/bbb/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/node_path/y/ccc/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/nonstring.js9
-rw-r--r--node_modules/tslint/node_modules/resolve/test/pathfilter.js42
-rw-r--r--node_modules/tslint/node_modules/resolve/test/pathfilter/deep_ref/main.js0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence.js23
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence/aaa.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence/aaa/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence/aaa/main.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence/bbb.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/precedence/bbb/main.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver.js349
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/baz/doom.js0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/baz/package.json3
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/baz/quux.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/cup.coffee1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/dot_main/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/dot_main/package.json3
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/package.json3
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/foo.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/index.js2
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/package.json3
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/mug.coffee0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/mug.js0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/other_path/root.js0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/quux/foo/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo/index.js1
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep0
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver/without_basedir/main.js5
-rw-r--r--node_modules/tslint/node_modules/resolve/test/resolver_sync.js267
-rw-r--r--node_modules/tslint/node_modules/resolve/test/subdirs.js13
-rw-r--r--node_modules/tslint/node_modules/resolve/test/symlinks.js54
-rw-r--r--node_modules/tslint/package.json24
381 files changed, 4548 insertions, 4540 deletions
diff --git a/node_modules/tslint/CHANGELOG.md b/node_modules/tslint/CHANGELOG.md
index e1190823d..71d1bf486 100644
--- a/node_modules/tslint/CHANGELOG.md
+++ b/node_modules/tslint/CHANGELOG.md
@@ -1,6 +1,226 @@
Change Log
===
+v5.11.0
+---
+
+## :warning: Deprecations
+
+- [deprecation] [`no-unused-variable`](https://palantir.github.io/tslint/rules/no-unused-variable/) is deprecated because typescript now covers most of its functionality (#3919)
+
+## :tada: Features
+- [new-rule] [`file-name-casing`](https://palantir.github.io/tslint/rules/file-name-casing/) (#3978)
+- [new-fixer] Add fixer for [`switch-final-break`](https://palantir.github.io/tslint/rules/switch-final-break/) (#3615)
+- [new-fixer] Implemented fixer for [`member-ordering`](https://palantir.github.io/tslint/rules/member-ordering/) and added corresponding tests. (#3935)
+- [new-rule-option] Add whitelist for [`no-implicit-dependencies`](https://palantir.github.io/tslint/rules/no-implicit-dependencies/) (#3979)
+
+## :hammer_and_wrench: Bugfixes & enhancements
+
+- [bugfix] [`no-use-before-declare`](https://palantir.github.io/tslint/rules/no-use-before-declare/) Fixes false positives when using the destructuring syntax (#3761) (#3876)
+- [bugfix] Fix Copyright: @license JSDoc tag was missing (#3879)
+- [bugfix] Fix missing newline at end of file (#3896)
+- [bugfix] allow-empty-functions option of [`no-empty`](https://palantir.github.io/tslint/rules/no-empty/) rule is now properly respecting empty methods (#3897)
+- [bugfix] [`no-magic-numbers`](https://palantir.github.io/tslint/rules/no-magic-numbers/) - support for negative zero (#3903)
+- [bugfix] Handle tsconfig.json errors without using JSON.stringify (#3908)
+- [bugfix] Fix CI: [`no-implicit-dependencies`](https://palantir.github.io/tslint/rules/no-implicit-dependencies/) test failure; typescript@next failure (#4019)
+- [bugfix] Fix edge case in [`no-console`](https://palantir.github.io/tslint/rules/no-console/) rule (#4041)
+- [docs] Fix typos in the [`no-floating-promises`](https://palantir.github.io/tslint/rules/no-floating-promises/) rule docs. (#3886)
+- [docs] Updated [`prefer-while`](https://palantir.github.io/tslint/rules/prefer-while/) docs to be semantically correct (#3888)
+- [docs] Fix link to configuration page (#3891)
+- [docs] Fix docs typo (#3898)
+- [docs] Fix docs typo (#3910)
+- [enhancement] Turn on strictPropertyInitialization for src/ and test/ (#3924)
+- [enhancement] Use Buffer.allocUnsafe instead of the deprecated new Buffer() (#3985)
+- [enhancement] Improve [`radix`](https://palantir.github.io/tslint/rules/radix/) rule checks (#3901)
+- [enhancement] Output +/- on diff so added/removed empty lines are visible. (#3973)
+- [rule-change] [`no-implicit-dependencies`](https://palantir.github.io/tslint/rules/no-implicit-dependencies/) now always considers peer dependencies (#3875)
+
+Thanks to our contributors!
+
+- Bowen Ni
+- Peter Safranek
+- Saugat Acharya
+- Jason Mendes
+- Ryan Waskiewicz
+- Dariusz Rumiński
+- Xinhu Liu
+- Rado Kirov
+- aervin_
+- Josh Goldberg
+- mertdeg2
+- Jason Killian
+- Adrian Leonhard
+- david-cannady
+- Andy Russell
+- Tibor Blenessy
+- Andrew Crites
+- Pavel Birukov
+- shalomdotnet
+
+
+v5.10.0
+---
+
+## :tada: Features
+
+- [new-rule] [`prefer-while`](https://palantir.github.io/tslint/rules/prefer-while/) (#3750)
+- [new-fixer] [`comment-format`](https://palantir.github.io/tslint/rules/comment-format/) (#3845)
+- [new-rule-option] `"allow-empty-functions"` for [`no-empty`](https://palantir.github.io/tslint/rules/no-empty/) rule (#3624)
+- [new-rule-option] New options for [`promise-function-async`](https://palantir.github.io/tslint/rules/promise-function-async/) specifying what kinds of functions to check (#3807)
+
+## :hammer_and_wrench: Bugfixes & enhancements
+
+- [bugfix] [`file-header`](https://palantir.github.io/tslint/rules/file-header/) rule plays nice with [`no-trailing-whitespace`](https://palantir.github.io/tslint/rules/no-trailing-whitespace/) rule (#3802)
+- [bugfix] [`no-unbound-method`](https://palantir.github.io/tslint/rules/no-unbound-method/) rule allows square bracket property access (#3610)
+- [bugfix] [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) no longer marks native JSX elements as unsafe (#3699)
+- [enhancement] [`file-header`](https://palantir.github.io/tslint/rules/file-header/) auto-fixes use '!' character to ensure header stays above imports (#3741)
+- [enhancement] Better error messages if a rule crashes (#3836)
+- [enhancement] Better error messages when no valid rules are specified (#3729)
+- [enhancement] Better lint messages for unused imports in [`no-unused-variable`](https://palantir.github.io/tslint/rules/no-unused-variable/) rule (#3831)
+- [docs] Improve documentation of cli flag --project (#3703)
+- [docs] Added short rationales for about thirty rules (#3734)
+- [docs] Added optional capability to provide code examples in rules' metadata (#3602)
+- [docs] Many small docs fixes and tweaks from many great contributors!
+
+Thanks to our contributors!
+
+- Achim Weimert
+- BB9z
+- Blair Zajac
+- Chia-Lun Wu (Leo)
+- Ethan
+- Janis Koehr
+- Josh Goldberg
+- Julian Verdurmen
+- Lucas Sloan
+- Mark Vincze
+- Martin Möhwald
+- Oliver Joseph Ash
+- Pichest Wongsiripiphat
+- Rafael Santana
+- Ruben Bridgewater
+- Ryan Waskiewicz
+- Sehrope Sarkuni
+- Suchan Lee
+- Victor Belozyorov
+- aervin_
+- cwgorman
+- felipeissa
+- jishi9
+
+
+v5.9.1
+---
+
+## :hammer_and_wrench: Bugfixes
+
+- [bugfix] Removed extraneous deprecation warning produced when using `tslint:recommended` or `tslint:latest` by disabling `typeof-compare` in these rulesets. (#3639)
+- [bugfix] Resolve directories as absolute paths when validating custom `rulesDirectory` paths, which fixes usage with tslint-loader. (#3640)
+
+v5.9.0
+---
+
+## :warning: Deprecations
+
+- [deprecation] Several utility functions from `src/language/utils.ts` have been deprecated (#3476)
+- [deprecation] Linting non-existent files now outputs a warning. This will be an error in TSLint 6. (#3313)
+
+## Configuration inheritance changes
+
+Significant changes have been made to configuration inheritance to address a long-standing UX issue around `defaultSeverity`: #2569.
+
+`defaultSeverity` defined in a `tslint.json` file will now override the `defaultSeverity` value defined in any configurations you are extending.
+This means that any rules specified in the base configurations can now take on a new `defaultSeverity` if you so choose. If you extend multiple
+configuration files, the `defaultSeverity` defined in the last one wins.
+
+In practice, this allows users to, for example, more easily use the built-in TSLint configurations (`tslint:recommended`, `tslint:latest`, `tslint:all`)
+and treat all errors as warnings instead of errors.
+
+For more details, see the relevant PRs:
+
+- Override `defaultSeverity` defined in extended configs (#3449)
+- Inherit defaultSeverity and apply it to preceding base configs (#3530)
+
+## :tada: Features
+
+- [feature] Support yaml configuration files (#1598) (#3433)
+- [new-fixer] [`file-header`](https://palantir.github.io/tslint/rules/file-header/) (#3475)
+- [new-rule] [`no-dynamic-delete`](https://palantir.github.io/tslint/rules/no-dynamic-delete/) (#3573)
+- [new-rule] [`prefer-readonly`](https://palantir.github.io/tslint/rules/prefer-readonly/) (#2896)
+- [new-rule] [`newline-per-chained-call`](https://palantir.github.io/tslint/rules/newline-per-chained-call/) (#3278)
+- [new-rule-option] `"temporalDeadZone"` for [`no-shadowed-variable`](https://palantir.github.io/tslint/rules/no-shadowed-variable/) to ignore shadowing in the temporal dead zone of classes, parameters, enums and variables declared with `let` or `const`
+(#3389)
+- [new-rule-option] `"shorthand-first"` for [`object-literal-sort-keys`](https://palantir.github.io/tslint/rules/object-literal-sort-keys/) (#3607)
+- [new-rule-option] Add support for an ignore pattern for [`max-line-length`](https://palantir.github.io/tslint/rules/max-line-length/) (#3099)
+
+## :hammer_and_wrench: Bugfixes & enhancements
+
+- [bugfix] Update commander.js dependency to prevent users from transitively installing a buggy 2.12.0 release (#3510)
+- [bugfix] `--project` excludes all files of external dependencies (#3320)
+- [bugfix] Show errors when `tsconfig.json` is invalid (#3410)
+- [bugfix] [`no-implicit-dependencies`](https://palantir.github.io/tslint/rules/no-implicit-dependencies/) don't crash on malformed package.json (#3373)
+- [bugfix] [`strict-type-predicates`](https://palantir.github.io/tslint/rules/strict-type-predicates/) allows comparing typeof result with non-literals (#3542)
+- [bugfix] [`no-redundant-jsdoc`](https://palantir.github.io/tslint/rules/no-redundant-jsdoc/) fixed crash on unhandled tag (#3414)
+- [bugfix] [`object-literal-sort-keys`](https://palantir.github.io/tslint/rules/object-literal-sort-keys/) fixed regression that effectively disabled the rule with `\r\n` line breaks (#3427)
+- [bugfix] [`curly`](https://palantir.github.io/tslint/rules/curly/) fixer now correctly handles comments (#3473)
+- [bugfix] [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) fixed false-positive with namespaced types (#3487)
+- [bugfix] Removed potentailly dangerous fixer for [`no-any`](https://palantir.github.io/tslint/rules/no-any/) (#3486)
+- [bugfix] [`no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/) fixed false negatives for types with numeric keys (#3468)
+- [bugfix] [`callable-types`](https://palantir.github.io/tslint/rules/callable-types/) adds parentheses when fixing a type literal inside an array type (#3440)
+- [bugfix] [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) allows spreading an `any` value into an object (#3439)
+- [bugfix] no unnecessary whitespace before argument in callback functions fixed with [`arrow-parens`](https://palantir.github.io/tslint/rules/arrow-parens) fixer (#3618)
+- [bugfix] [`prefer-const`](https://palantir.github.io/tslint/rules/prefer-const/) false negative with index signature named like a variable (#3385)
+- [bugfix] [`whitespace`](https://palantir.github.io/tslint/rules/whitespace) rule checks property declarations if `"check-decl"` is enabled (#3546)
+- [bugfix] Using ternary operator for calling super() now passes [`no-duplicate-super`](https://palantir.github.io/tslint/rules/no-duplicate-super) rule. (#3544)
+- [bugfix] [`no-shadowed-variable`](https://palantir.github.io/tslint/rules/no-shadowed-variable/) now excludes declaration files and ambient modules (#3387)
+- [bugfix] [`no-duplicate-imports`](https://palantir.github.io/tslint/rules/no-duplicate-imports) Allow duplicate imports from separate ambient module declarations (#3398)
+- [bugfix] [`await-promise`](https://palantir.github.io/tslint/rules/await-promise/) correctly recognises classes extending Promise (#3383)
+- [bugfix] [`prefer-conditional-expression`](https://palantir.github.io/tslint/rules/prefer-conditional-expression/): don't repeat error on nested if statements (#3528)
+- [bugfix] [`completed-docs`](https://palantir.github.io/tslint/rules/completed-docs/): don't require documentation on methods in object literals (#3532)
+- [bugfix] [`one-line`](https://palantir.github.io/tslint/rules/one-line/) fixed crash on syntax error in class or interface (#3538)
+- [bugfix] [`no-redundant-jsdoc`](https://palantir.github.io/tslint/rules/no-redundant-jsdoc/) allow `@template` tag if it has a description (#3415)
+- [bugfix] Fix condition for deprecation of [`typeof-compare`](https://palantir.github.io/tslint/rules/typeof-compare) (#3429)
+- [enhancement] Better error message for files not contained in the project (#3313)
+- [enhancement] `"properties"` option for [`completed-docs`](https://palantir.github.io/tslint/rules/completed-docs/) rule now checks getter and setter accessors. (#3497)
+- [enhancement] [`no-magic-numbers`](https://palantir.github.io/tslint/rules/no-magic-numbers) ignores parseInt radix parameter (#3536)
+- [enhancement] Avoid duplicate I/O when using `--project` option (#3313)
+- [enhancement] clicking the filename in `stylish`-formatter's output jumps to the first failure in that file. (#3491)
+- [enhancement] [`ban-comma-operator`](https://palantir.github.io/tslint/rules/ban-comma-operator/) ignores comma operator inside for-loop incrementor (#3485)
+- [enhancement] [`space-within-parens`](https://palantir.github.io/tslint/rules/space-within-parens/) updated to always allow empty parentheses `()`. (#3513)
+- [enhancement] Better error message syntax for [`completed-docs`](https://palantir.github.io/tslint/rules/completed-docs/) modifier lists (#3379)
+- [enhancement] Improve failure message & docs for [`ban-comma-operator`](https://palantir.github.io/tslint/rules/ban-comma-operator/) (#3384)
+- [enhancement] Output code warnings in yellow instead of red for codeFrame formatter (#3402)
+- [enhancement] Converted [`completed-docs`](https://palantir.github.io/tslint/rules/completed-docs) rule to use a function instead of a walker (#3466)
+- [docs] [`ban-comma-operator`](https://palantir.github.io/tslint/rules/ban-comma-operator/): fix metadata, list as "functionality" rule (#3612)
+- [docs] Enhance [`no-use-before-declare`](https://palantir.github.io/tslint/rules/no-use-before-declare/) documentation to clarify the rule's status (#3520)
+- [docs] Enhance [`await-promise`](https://palantir.github.io/tslint/rules/await-promise/) options documentation (#3519)
+- [docs] Add `hasFix` metadata for the [`indent`](https://palantir.github.io/tslint/rules/indent) rule (#3529)
+- [docs] Clearer rule description for [`no-irregular-whitespace`](https://palantir.github.io/tslint/rules/no-irregular-whitespace) (#3627)
+
+Thanks to our contributors!
+
+- Klaus Meinhardt
+- Josh Goldberg
+- Chris Barr
+- Nathan Shively-Sanders
+- Jeremy Morton
+- Sergey Koshechkin
+- Daniel Kucal
+- Eric Smekens
+- Johannes Choo
+- Elena Vilchik
+- Eugene Timokhov
+- Carlo Bottiglieri
+- reduckted
+- Glavin Wiechert
+- jbsingh
+- Mateusz Witkowski
+- HideDev
+- Bruno Lemos
+- aervin_
+- Roman
+- Ryan Waskiewicz
+
v5.8.0
---
@@ -1776,7 +1996,7 @@ v0.4.6
v0.4.5
---
-* [feature] `no-unused-variable` no longer checks parameters by defualt. Parameters are now only checked if the `check-parameters` option is set.
+* [feature] `no-unused-variable` no longer checks parameters by default. Parameters are now only checked if the `check-parameters` option is set.
* [bug] `no-unused-variable` parameter check no longer fails on variable argument parameters (like ...args) and on cases where the parameters are broken up by newlines.
v0.4.4
diff --git a/node_modules/tslint/README.md b/node_modules/tslint/README.md
index f9667ee14..5d58075f2 100644
--- a/node_modules/tslint/README.md
+++ b/node_modules/tslint/README.md
@@ -1,7 +1,6 @@
[![NPM version](https://badge.fury.io/js/tslint.svg)](http://badge.fury.io/js/tslint)
[![Downloads](http://img.shields.io/npm/dm/tslint.svg)](https://npmjs.org/package/tslint)
[![Circle CI](https://circleci.com/gh/palantir/tslint.svg?style=svg)](https://circleci.com/gh/palantir/tslint)
-[![Join the chat at https://gitter.im/palantir/tslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/palantir/tslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
TSLint
======
@@ -10,9 +9,10 @@ TSLint is an extensible static analysis tool that checks [TypeScript](https://gi
TSLint supports:
+- an extensive set of core rules
- custom lint rules
- custom formatters (failure reporters)
-- inline disabling and enabling of rules with comment flags
+- inline disabling and enabling of rules with comment flags in source code
- configuration presets (`tslint:latest`, `tslint-react`, etc.) and plugin composition
- automatic fixing of formatting & style violations
- integration with [MSBuild](https://github.com/joshuakgoldberg/tslint.msbuild), [Grunt](https://github.com/palantir/grunt-tslint), [Gulp](https://github.com/panuhorsmalahti/gulp-tslint), [Atom](https://github.com/AtomLinter/linter-tslint), [Eclipse](https://github.com/palantir/eclipse-tslint), [Emacs](http://flycheck.org), [Sublime](https://packagecontrol.io/packages/SublimeLinter-contrib-tslint), [Vim](https://github.com/scrooloose/syntastic), [Visual Studio 2015](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebAnalyzer), [Visual Studio 2017](https://marketplace.visualstudio.com/items?itemName=RichNewman.TypeScriptAnalyzer), [Visual Studio code](https://marketplace.visualstudio.com/items?itemName=eg2.tslint), [WebStorm](https://www.jetbrains.com/webstorm/help/tslint.html) and [more](https://palantir.github.io/tslint/usage/third-party-tools/)
@@ -45,14 +45,17 @@ If we don't have all the rules you're looking for, you can either write your own
- [vrsource-tslint-rules](https://github.com/vrsource/vrsource-tslint-rules)
- [tslint-immutable](https://github.com/jonaskello/tslint-immutable) - TSLint rules to disable mutation in TypeScript
- [tslint-consistent-codestyle](https://github.com/ajafff/tslint-consistent-codestyle) - TSLint rules to enforce consistent code style in TypeScript
+- [tslint-sonarts](https://github.com/SonarSource/SonarTS) - Bug-finding rules based on advanced code models to spot hard to find errors in TypeScript
+- [tslint-clean-code](https://github.com/Glavin001/tslint-clean-code) - A set of TSLint rules inspired by the Clean Code handbook
+- [rxjs-tslint-rules](https://github.com/cartant/rxjs-tslint-rules) - TSLint rules for RxJS
Development
-----------
-Requirements:
+Prerequisites:
-- `node` v7
-- `yarn` v0.23+
+- `node` v7+
+- `yarn` v1.0+
#### Quick Start
@@ -68,7 +71,7 @@ Creating a new release
1. Bump the version number in `package.json` and `src/linter.ts`
2. Add release notes in `CHANGELOG.md`
- - Use `./scripts/generate-changelog.js` (after building it with `tsc -p scripts`) to generate the changelog diff. This script expects a Github.com personal access token to exist at `~/github_token.txt` with "repo" permissions.
+ - Use `./scripts/generate-changelog.js` (after building it with `tsc -p scripts`) to generate the changelog diff. This script expects a [Github.com personal access token](https://github.com/settings/tokens) to exist at `~/github_token.txt` with "repo" permissions.
4. Commit with message `Prepare release <version>`
5. Push your branch to GitHub and make a PR
6. Once your PR is merged, wait for the tests to pass on CircleCI for develop
diff --git a/node_modules/tslint/bin/tslint b/node_modules/tslint/bin/tslint
index e052e09d9..da8d19efd 100755
--- a/node_modules/tslint/bin/tslint
+++ b/node_modules/tslint/bin/tslint
@@ -1,3 +1,3 @@
#!/usr/bin/env node
-require("../lib/tslint-cli");
+require("../lib/tslintCli");
diff --git a/node_modules/tslint/lib/configs/all.d.ts b/node_modules/tslint/lib/configs/all.d.ts
index 6c285be54..bcaf0a190 100644
--- a/node_modules/tslint/lib/configs/all.d.ts
+++ b/node_modules/tslint/lib/configs/all.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
export declare const rules: {
"adjacent-overload-signatures": boolean;
"ban-types": {
@@ -21,6 +37,7 @@ export declare const rules: {
"no-var-requires": boolean;
"only-arrow-functions": boolean;
"prefer-for-of": boolean;
+ "prefer-readonly": boolean;
"promise-function-async": boolean;
"typedef": (string | boolean)[];
"typedef-whitespace": (boolean | {
@@ -45,6 +62,7 @@ export declare const rules: {
"no-duplicate-super": boolean;
"no-duplicate-switch-case": boolean;
"no-duplicate-variable": (string | boolean)[];
+ "no-dynamic-delete": boolean;
"no-empty": boolean;
"no-eval": boolean;
"no-floating-promises": boolean;
@@ -110,6 +128,7 @@ export declare const rules: {
"completed-docs": boolean;
"deprecation": boolean;
"encoding": boolean;
+ "file-name-casing": (string | boolean)[];
"import-spacing": boolean;
"interface-name": boolean;
"interface-over-type-literal": boolean;
@@ -117,6 +136,7 @@ export declare const rules: {
"match-default-export-name": boolean;
"new-parens": boolean;
"newline-before-return": boolean;
+ "newline-per-chained-call": boolean;
"no-angle-bracket-type-assertion": boolean;
"no-boolean-literal-compare": boolean;
"no-consecutive-blank-lines": boolean;
@@ -142,6 +162,7 @@ export declare const rules: {
"prefer-object-spread": boolean;
"prefer-switch": boolean;
"prefer-template": boolean;
+ "prefer-while": boolean;
"quotemark": (string | boolean)[];
"return-undefined": boolean;
"semicolon": (string | boolean)[];
diff --git a/node_modules/tslint/lib/configs/all.js b/node_modules/tslint/lib/configs/all.js
index 73c78a011..2a5f24307 100644
--- a/node_modules/tslint/lib/configs/all.js
+++ b/node_modules/tslint/lib/configs/all.js
@@ -53,6 +53,7 @@ exports.rules = {
"no-var-requires": true,
"only-arrow-functions": true,
"prefer-for-of": true,
+ "prefer-readonly": true,
"promise-function-async": true,
"typedef": [
true,
@@ -102,6 +103,7 @@ exports.rules = {
true,
"check-parameters",
],
+ "no-dynamic-delete": true,
"no-empty": true,
"no-eval": true,
"no-floating-promises": true,
@@ -182,6 +184,7 @@ exports.rules = {
// "file-header": No sensible default
"deprecation": true,
"encoding": true,
+ "file-name-casing": [true, "camel-case"],
"import-spacing": true,
"interface-name": true,
"interface-over-type-literal": true,
@@ -189,6 +192,7 @@ exports.rules = {
"match-default-export-name": true,
"new-parens": true,
"newline-before-return": true,
+ "newline-per-chained-call": true,
"no-angle-bracket-type-assertion": true,
"no-boolean-literal-compare": true,
"no-consecutive-blank-lines": true,
@@ -221,6 +225,7 @@ exports.rules = {
"prefer-object-spread": true,
"prefer-switch": true,
"prefer-template": true,
+ "prefer-while": true,
"quotemark": [
true,
"double",
diff --git a/node_modules/tslint/lib/configs/recommended.js b/node_modules/tslint/lib/configs/recommended.js
index e1f7aec93..853115ccc 100644
--- a/node_modules/tslint/lib/configs/recommended.js
+++ b/node_modules/tslint/lib/configs/recommended.js
@@ -182,7 +182,7 @@ exports.rules = {
},
],
},
- "typeof-compare": true,
+ "typeof-compare": false,
"unified-signatures": true,
"use-isnan": true,
"variable-name": {
diff --git a/node_modules/tslint/lib/configuration.d.ts b/node_modules/tslint/lib/configuration.d.ts
index 552b5e807..ce2b61474 100644
--- a/node_modules/tslint/lib/configuration.d.ts
+++ b/node_modules/tslint/lib/configuration.d.ts
@@ -1,7 +1,26 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { IOptions, RuleSeverity } from "./language/rule/rule";
export interface IConfigurationFile {
/**
- * The severity that is applied to rules in _this_ config with `severity === "default"`.
+ * @deprecated property is never set
+ *
+ * The severity that is applied to rules in this config file as well as rules
+ * in any inherited config files which have their severity set to "default".
* Not inherited.
*/
defaultSeverity?: RuleSeverity;
@@ -32,7 +51,10 @@ export interface IConfigurationLoadResult {
path?: string;
results?: IConfigurationFile;
}
+export declare const JSON_CONFIG_FILENAME = "tslint.json";
+/** @deprecated use `JSON_CONFIG_FILENAME` or `CONFIG_FILENAMES` instead. */
export declare const CONFIG_FILENAME = "tslint.json";
+export declare const CONFIG_FILENAMES: string[];
export declare const DEFAULT_CONFIG: IConfigurationFile;
export declare const EMPTY_CONFIG: IConfigurationFile;
/**
@@ -51,7 +73,7 @@ export declare function findConfiguration(configFile: string, inputFilePath?: st
* the location of the config file is not known and you want to search for one.
* @param inputFilePath A path to the current file being linted. This is the starting location
* of the search for a configuration.
- * @returns An absolute path to a tslint.json file
+ * @returns An absolute path to a tslint.json or tslint.yml or tslint.yaml file
* or undefined if neither can be found.
*/
export declare function findConfigurationPath(suppliedConfigFilePath: string | null, inputFilePath: string): string | undefined;
@@ -63,11 +85,18 @@ export declare function findConfigurationPath(suppliedConfigFilePath: string, in
* './path/to/config' will be treated as a relative path
* 'path/to/config' will attempt to load a to/config file inside a node module named path
* @param configFilePath The configuration to load
- * @param originalFilePath The entry point configuration file
+ * @param originalFilePath (deprecated) The entry point configuration file
* @returns a configuration object for TSLint loaded from the file at configFilePath
*/
-export declare function loadConfigurationFromPath(configFilePath?: string, originalFilePath?: string | undefined): IConfigurationFile;
+export declare function loadConfigurationFromPath(configFilePath?: string, _originalFilePath?: string): IConfigurationFile;
+/** Reads the configuration file from disk and parses it as raw JSON, YAML or JS depending on the extension. */
+export declare function readConfigurationFile(filepath: string): RawConfigFile;
export declare function extendConfigurationFile(targetConfig: IConfigurationFile, nextConfigSource: IConfigurationFile): IConfigurationFile;
+/**
+ * returns the absolute path (contrary to what the name implies)
+ *
+ * @deprecated use `path.resolve` instead
+ */
export declare function getRelativePath(directory?: string | null, relativeTo?: string): string | undefined;
export declare function useAsPath(directory: string): boolean;
/**
@@ -94,12 +123,14 @@ export declare type RawRuleConfig = null | undefined | boolean | any[] | {
options?: any;
};
/**
- * Parses a config file and normalizes legacy config settings
+ * Parses a config file and normalizes legacy config settings.
+ * If `configFileDir` and `readConfig` are provided, this function will load all base configs and reduce them to the final configuration.
*
* @param configFile The raw object read from the JSON of a config file
* @param configFileDir The directory of the config file
+ * @param readConfig Will be used to load all base configurations while parsing. The function is called with the resolved path.
*/
-export declare function parseConfigFile(configFile: RawConfigFile, configFileDir?: string): IConfigurationFile;
+export declare function parseConfigFile(configFile: RawConfigFile, configFileDir?: string, readConfig?: (path: string) => RawConfigFile): IConfigurationFile;
/**
* Fills in default values for `IOption` properties and outputs an array of `IOption`
*/
diff --git a/node_modules/tslint/lib/configuration.js b/node_modules/tslint/lib/configuration.js
index a6064f015..1150d68da 100644
--- a/node_modules/tslint/lib/configuration.js
+++ b/node_modules/tslint/lib/configuration.js
@@ -17,11 +17,18 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
+var yaml = require("js-yaml");
+var os = require("os");
var path = require("path");
var resolve = require("resolve");
var error_1 = require("./error");
var utils_1 = require("./utils");
-exports.CONFIG_FILENAME = "tslint.json";
+// Note: eslint prefers yaml over json, while tslint prefers json over yaml
+// for backward-compatibility.
+exports.JSON_CONFIG_FILENAME = "tslint.json";
+/** @deprecated use `JSON_CONFIG_FILENAME` or `CONFIG_FILENAMES` instead. */
+exports.CONFIG_FILENAME = exports.JSON_CONFIG_FILENAME;
+exports.CONFIG_FILENAMES = [exports.JSON_CONFIG_FILENAME, "tslint.yaml", "tslint.yml"];
exports.DEFAULT_CONFIG = {
defaultSeverity: "error",
extends: ["tslint:recommended"],
@@ -75,14 +82,15 @@ function findConfigurationPath(suppliedConfigFilePath, inputFilePath) {
inputFilePath = path.dirname(inputFilePath);
}
// search for tslint.json from input file location
- var configFilePath = findup(exports.CONFIG_FILENAME, path.resolve(inputFilePath));
+ var configFilePath = findup(exports.CONFIG_FILENAMES, path.resolve(inputFilePath));
if (configFilePath !== undefined) {
return configFilePath;
}
// search for tslint.json in home directory
- var homeDir = getHomeDir();
- if (homeDir != undefined) {
- configFilePath = path.join(homeDir, exports.CONFIG_FILENAME);
+ var homeDir = os.homedir();
+ for (var _i = 0, CONFIG_FILENAMES_1 = exports.CONFIG_FILENAMES; _i < CONFIG_FILENAMES_1.length; _i++) {
+ var configFilename = CONFIG_FILENAMES_1[_i];
+ configFilePath = path.join(homeDir, configFilename);
if (fs.existsSync(configFilePath)) {
return path.resolve(configFilePath);
}
@@ -93,10 +101,11 @@ function findConfigurationPath(suppliedConfigFilePath, inputFilePath) {
}
exports.findConfigurationPath = findConfigurationPath;
/**
- * Find a file by name in a directory or any ancestory directory.
+ * Find a file by names in a directory or any ancestor directory.
+ * Will try each filename in filenames before recursing to a parent directory.
* This is case-insensitive, so it can find 'TsLiNt.JsOn' when searching for 'tslint.json'.
*/
-function findup(filename, directory) {
+function findup(filenames, directory) {
while (true) {
var res = findFile(directory);
if (res !== undefined) {
@@ -109,17 +118,27 @@ function findup(filename, directory) {
directory = parent;
}
function findFile(cwd) {
- if (fs.existsSync(path.join(cwd, filename))) {
- return filename;
- }
- // TODO: remove in v6.0.0
- // Try reading in the entire directory and looking for a file with different casing.
- var filenameLower = filename.toLowerCase();
- var result = fs.readdirSync(cwd).find(function (entry) { return entry.toLowerCase() === filenameLower; });
- if (result !== undefined) {
- error_1.showWarningOnce("Using mixed case tslint.json is deprecated. Found: " + path.join(cwd, result));
+ var dirFiles = fs.readdirSync(cwd);
+ var _loop_1 = function (filename) {
+ var index = dirFiles.indexOf(filename);
+ if (index > -1) {
+ return { value: filename };
+ }
+ // TODO: remove in v6.0.0
+ // Try reading in the entire directory and looking for a file with different casing.
+ var result = dirFiles.find(function (entry) { return entry.toLowerCase() === filename; });
+ if (result !== undefined) {
+ error_1.showWarningOnce("Using mixed case " + filename + " is deprecated. Found: " + path.join(cwd, result));
+ return { value: result };
+ }
+ };
+ for (var _i = 0, filenames_1 = filenames; _i < filenames_1.length; _i++) {
+ var filename = filenames_1[_i];
+ var state_1 = _loop_1(filename);
+ if (typeof state_1 === "object")
+ return state_1.value;
}
- return result;
+ return undefined;
}
}
/**
@@ -129,46 +148,53 @@ function findup(filename, directory) {
* './path/to/config' will be treated as a relative path
* 'path/to/config' will attempt to load a to/config file inside a node module named path
* @param configFilePath The configuration to load
- * @param originalFilePath The entry point configuration file
+ * @param originalFilePath (deprecated) The entry point configuration file
* @returns a configuration object for TSLint loaded from the file at configFilePath
*/
-function loadConfigurationFromPath(configFilePath, originalFilePath) {
- if (originalFilePath === void 0) { originalFilePath = configFilePath; }
+function loadConfigurationFromPath(configFilePath, _originalFilePath) {
if (configFilePath == undefined) {
return exports.DEFAULT_CONFIG;
}
else {
var resolvedConfigFilePath = resolveConfigurationPath(configFilePath);
- var rawConfigFile = void 0;
- if (path.extname(resolvedConfigFilePath) === ".json") {
- var fileContent = utils_1.stripComments(fs.readFileSync(resolvedConfigFilePath)
- .toString()
- .replace(/^\uFEFF/, ""));
- try {
- rawConfigFile = JSON.parse(fileContent);
+ var rawConfigFile = readConfigurationFile(resolvedConfigFilePath);
+ return parseConfigFile(rawConfigFile, path.dirname(resolvedConfigFilePath), readConfigurationFile);
+ }
+}
+exports.loadConfigurationFromPath = loadConfigurationFromPath;
+/** Reads the configuration file from disk and parses it as raw JSON, YAML or JS depending on the extension. */
+function readConfigurationFile(filepath) {
+ var resolvedConfigFileExt = path.extname(filepath);
+ if (/\.(json|ya?ml)/.test(resolvedConfigFileExt)) {
+ var fileContent = fs.readFileSync(filepath, "utf8").replace(/^\uFEFF/, "");
+ try {
+ if (resolvedConfigFileExt === ".json") {
+ return JSON.parse(utils_1.stripComments(fileContent));
}
- catch (e) {
- var error = e;
- // include the configuration file being parsed in the error since it may differ from the directly referenced config
- throw configFilePath === originalFilePath ? error : new Error(error.message + " in " + configFilePath);
+ else {
+ return yaml.safeLoad(fileContent, {
+ // Note: yaml.LoadOptions expects a schema value of type "any",
+ // but this trips up the no-unsafe-any rule.
+ // tslint:disable-next-line:no-unsafe-any
+ schema: yaml.JSON_SCHEMA,
+ strict: true,
+ });
}
}
- else {
- rawConfigFile = require(resolvedConfigFilePath);
- delete require.cache[resolvedConfigFilePath];
+ catch (e) {
+ var error = e;
+ // include the configuration file being parsed in the error since it may differ from the directly referenced config
+ throw new Error(error.message + " in " + filepath);
}
- var configFileDir_1 = path.dirname(resolvedConfigFilePath);
- var configFile = parseConfigFile(rawConfigFile, configFileDir_1);
- // load configurations, in order, using their identifiers or relative paths
- // apply the current configuration last by placing it last in this array
- var configs = configFile.extends.map(function (name) {
- var nextConfigFilePath = resolveConfigurationPath(name, configFileDir_1);
- return loadConfigurationFromPath(nextConfigFilePath, originalFilePath);
- }).concat([configFile]);
- return configs.reduce(extendConfigurationFile, exports.EMPTY_CONFIG);
+ }
+ else {
+ var rawConfigFile = require(filepath);
+ // tslint:disable-next-line no-dynamic-delete
+ delete require.cache[filepath];
+ return rawConfigFile;
}
}
-exports.loadConfigurationFromPath = loadConfigurationFromPath;
+exports.readConfigurationFile = readConfigurationFile;
/**
* Resolve configuration file path or node_module reference
* @param filePath Relative ("./path"), absolute ("/path"), node module ("path"), or built-in ("tslint:path")
@@ -244,23 +270,11 @@ function extendConfigurationFile(targetConfig, nextConfigSource) {
};
}
exports.extendConfigurationFile = extendConfigurationFile;
-function getHomeDir() {
- var environment = global.process.env;
- var paths = [
- environment.USERPROFILE,
- environment.HOME,
- environment.HOMEPATH,
- environment.HOMEDRIVE + environment.HOMEPATH,
- ];
- for (var _i = 0, paths_1 = paths; _i < paths_1.length; _i++) {
- var homePath = paths_1[_i];
- if (homePath !== undefined && fs.existsSync(homePath)) {
- return homePath;
- }
- }
- return undefined;
-}
-// returns the absolute path (contrary to what the name implies)
+/**
+ * returns the absolute path (contrary to what the name implies)
+ *
+ * @deprecated use `path.resolve` instead
+ */
function getRelativePath(directory, relativeTo) {
if (directory != undefined) {
var basePath = relativeTo !== undefined ? relativeTo : process.cwd();
@@ -293,15 +307,14 @@ function getRulesDirectories(directories, relativeTo) {
// swallow error and fallback to using directory as path
}
}
- var absolutePath = getRelativePath(dir, relativeTo);
+ var absolutePath = relativeTo === undefined ? path.resolve(dir) : path.resolve(relativeTo, dir);
if (absolutePath !== undefined) {
if (!fs.existsSync(absolutePath)) {
throw new error_1.FatalError("Could not find custom rule directory: " + dir);
}
}
return absolutePath;
- })
- .filter(function (dir) { return dir !== undefined; });
+ });
}
exports.getRulesDirectories = getRulesDirectories;
/**
@@ -375,36 +388,65 @@ function parseRuleOptions(ruleConfigValue, rawDefaultRuleSeverity) {
};
}
/**
- * Parses a config file and normalizes legacy config settings
+ * Parses a config file and normalizes legacy config settings.
+ * If `configFileDir` and `readConfig` are provided, this function will load all base configs and reduce them to the final configuration.
*
* @param configFile The raw object read from the JSON of a config file
* @param configFileDir The directory of the config file
+ * @param readConfig Will be used to load all base configurations while parsing. The function is called with the resolved path.
*/
-function parseConfigFile(configFile, configFileDir) {
- return {
- extends: utils_1.arrayify(configFile.extends),
- jsRules: parseRules(configFile.jsRules),
- linterOptions: parseLinterOptions(configFile.linterOptions),
- rules: parseRules(configFile.rules),
- rulesDirectory: getRulesDirectories(configFile.rulesDirectory, configFileDir),
- };
+function parseConfigFile(configFile, configFileDir, readConfig) {
+ var defaultSeverity = configFile.defaultSeverity;
+ if (readConfig === undefined || configFileDir === undefined) {
+ return parse(configFile, configFileDir);
+ }
+ return loadExtendsRecursive(configFile, configFileDir)
+ .map(function (_a) {
+ var dir = _a.dir, config = _a.config;
+ return parse(config, dir);
+ })
+ .reduce(extendConfigurationFile, exports.EMPTY_CONFIG);
+ /** Read files in order, depth first, and assign `defaultSeverity` (last config in extends wins). */
+ function loadExtendsRecursive(raw, dir) {
+ var configs = [];
+ for (var _i = 0, _a = utils_1.arrayify(raw.extends); _i < _a.length; _i++) {
+ var relativePath = _a[_i];
+ var resolvedPath = resolveConfigurationPath(relativePath, dir);
+ var extendedRaw = readConfig(resolvedPath);
+ configs.push.apply(configs, loadExtendsRecursive(extendedRaw, path.dirname(resolvedPath)));
+ }
+ if (raw.defaultSeverity !== undefined) {
+ defaultSeverity = raw.defaultSeverity;
+ }
+ configs.push({ dir: dir, config: raw });
+ return configs;
+ }
+ function parse(config, dir) {
+ return {
+ extends: utils_1.arrayify(config.extends),
+ jsRules: parseRules(config.jsRules),
+ linterOptions: parseLinterOptions(config.linterOptions, dir),
+ rules: parseRules(config.rules),
+ rulesDirectory: getRulesDirectories(config.rulesDirectory, dir),
+ };
+ }
function parseRules(config) {
var map = new Map();
if (config !== undefined) {
for (var ruleName in config) {
if (utils_1.hasOwnProperty(config, ruleName)) {
- map.set(ruleName, parseRuleOptions(config[ruleName], configFile.defaultSeverity));
+ map.set(ruleName, parseRuleOptions(config[ruleName], defaultSeverity));
}
}
}
return map;
}
- function parseLinterOptions(raw) {
+ function parseLinterOptions(raw, dir) {
if (raw === undefined || raw.exclude === undefined) {
return {};
}
return {
- exclude: utils_1.arrayify(raw.exclude).map(function (pattern) { return configFileDir === undefined ? path.resolve(pattern) : path.resolve(configFileDir, pattern); }),
+ exclude: utils_1.arrayify(raw.exclude).map(function (pattern) { return dir === undefined ? path.resolve(pattern) : path.resolve(dir, pattern); }),
};
}
}
diff --git a/node_modules/tslint/lib/enableDisableRules.d.ts b/node_modules/tslint/lib/enableDisableRules.d.ts
index 8c5a2e8aa..6a02db83c 100644
--- a/node_modules/tslint/lib/enableDisableRules.d.ts
+++ b/node_modules/tslint/lib/enableDisableRules.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2014 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import { RuleFailure } from "./language/rule/rule";
/**
diff --git a/node_modules/tslint/lib/enableDisableRules.js b/node_modules/tslint/lib/enableDisableRules.js
index 9d298b4c5..1b8d32715 100644
--- a/node_modules/tslint/lib/enableDisableRules.js
+++ b/node_modules/tslint/lib/enableDisableRules.js
@@ -83,7 +83,7 @@ function getDisableMap(sourceFile, failingRules) {
}
}
}
- else {
+ else { // disable
if (disableRanges === undefined) {
map.set(ruleName, [{ pos: start, end: end }]);
}
diff --git a/node_modules/tslint/lib/error.d.ts b/node_modules/tslint/lib/error.d.ts
index 2b87c5cb0..f7c3e798e 100644
--- a/node_modules/tslint/lib/error.d.ts
+++ b/node_modules/tslint/lib/error.d.ts
@@ -1,4 +1,20 @@
/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
* Generic error typing for EcmaScript errors
* Define `Error` here to avoid using `Error` from @types/node.
* Using the `node` version causes a compilation error when this code is used as an npm library if @types/node is not already imported.
@@ -14,9 +30,10 @@ export declare class Error {
*/
export declare class FatalError extends Error {
message: string;
- innerError: Error | undefined;
+ innerError?: Error | undefined;
static NAME: string;
constructor(message: string, innerError?: Error | undefined);
}
export declare function isError(possibleError: any): possibleError is Error;
export declare function showWarningOnce(message: string): void;
+export declare function showRuleCrashWarning(message: string, ruleName: string, fileName: string): void;
diff --git a/node_modules/tslint/lib/error.js b/node_modules/tslint/lib/error.js
index 95bc9f811..c69c35eb0 100644
--- a/node_modules/tslint/lib/error.js
+++ b/node_modules/tslint/lib/error.js
@@ -47,3 +47,7 @@ function showWarningOnce(message) {
}
}
exports.showWarningOnce = showWarningOnce;
+function showRuleCrashWarning(message, ruleName, fileName) {
+ console.warn("The '" + ruleName + "' rule threw an error in '" + fileName + "':\n" + message);
+}
+exports.showRuleCrashWarning = showRuleCrashWarning;
diff --git a/node_modules/tslint/lib/formatterLoader.d.ts b/node_modules/tslint/lib/formatterLoader.d.ts
index b596ed3f8..ccda37331 100644
--- a/node_modules/tslint/lib/formatterLoader.d.ts
+++ b/node_modules/tslint/lib/formatterLoader.d.ts
@@ -1,2 +1,18 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { FormatterConstructor } from "./index";
export declare function findFormatter(name: string | FormatterConstructor, formattersDirectory?: string): FormatterConstructor | undefined;
diff --git a/node_modules/tslint/lib/formatterLoader.js b/node_modules/tslint/lib/formatterLoader.js
index a117d7551..fa5c9c6f5 100644
--- a/node_modules/tslint/lib/formatterLoader.js
+++ b/node_modules/tslint/lib/formatterLoader.js
@@ -18,9 +18,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
var path = require("path");
+var resolve = require("resolve");
var utils_1 = require("./utils");
-var moduleDirectory = path.dirname(module.filename);
-var CORE_FORMATTERS_DIRECTORY = path.resolve(moduleDirectory, ".", "formatters");
+var CORE_FORMATTERS_DIRECTORY = path.resolve(__dirname, "formatters");
function findFormatter(name, formattersDirectory) {
if (typeof name === "function") {
return name;
@@ -29,7 +29,7 @@ function findFormatter(name, formattersDirectory) {
name = name.trim();
var camelizedName = utils_1.camelize(name + "Formatter");
// first check for core formatters
- var Formatter = loadFormatter(CORE_FORMATTERS_DIRECTORY, camelizedName);
+ var Formatter = loadFormatter(CORE_FORMATTERS_DIRECTORY, camelizedName, true);
if (Formatter !== undefined) {
return Formatter;
}
@@ -49,26 +49,40 @@ function findFormatter(name, formattersDirectory) {
}
}
exports.findFormatter = findFormatter;
-function loadFormatter() {
- var paths = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- paths[_i] = arguments[_i];
+function loadFormatter(directory, name, isCore) {
+ var formatterPath = path.resolve(path.join(directory, name));
+ var fullPath;
+ if (isCore) {
+ fullPath = formatterPath + ".js";
+ if (!fs.existsSync(fullPath)) {
+ return undefined;
+ }
}
- var formatterPath = paths.reduce(function (p, c) { return path.join(p, c); }, "");
- var fullPath = path.resolve(moduleDirectory, formatterPath);
- if (fs.existsSync(fullPath + ".js")) {
- var formatterModule = require(fullPath);
- return formatterModule.Formatter;
+ else {
+ // Resolve using node's path resolution to allow developers to write custom formatters in TypeScript which can be loaded by TS-Node
+ try {
+ fullPath = require.resolve(formatterPath);
+ }
+ catch (_a) {
+ return undefined;
+ }
}
- return undefined;
+ return require(fullPath).Formatter;
}
function loadFormatterModule(name) {
var src;
try {
- src = require.resolve(name);
+ // first try to find a module in the dependencies of the currently linted project
+ src = resolve.sync(name, { basedir: process.cwd() });
}
- catch (e) {
- return undefined;
+ catch (_a) {
+ try {
+ // if there is no local module, try relative to the installation of TSLint (might be global)
+ src = require.resolve(name);
+ }
+ catch (_b) {
+ return undefined;
+ }
}
return require(src).Formatter;
}
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
index 8c6b27056..c47404485 100644
--- a/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
@@ -20,5 +20,5 @@ import { RuleFailure } from "../language/rule/rule";
export declare class Formatter extends AbstractFormatter {
static metadata: IFormatterMetadata;
format(failures: RuleFailure[]): string;
- private escapeXml(str);
+ private escapeXml;
}
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.js b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
index ab7400fb7..ae9c0eb84 100644
--- a/node_modules/tslint/lib/formatters/checkstyleFormatter.js
+++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
@@ -66,11 +66,11 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "checkstyle",
description: "Formats errors as through they were Checkstyle output.",
- descriptionDetails: (_a = ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."], _a.raw = ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."], Utils.dedent(_a)),
- sample: (_b = ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"], _b.raw = ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"], Utils.dedent(_b)),
+ descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."], ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."]))),
+ sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"], ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"]))),
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.js b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
index c828c5700..906bdcde4 100644
--- a/node_modules/tslint/lib/formatters/codeFrameFormatter.js
+++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var codeFrame = require("babel-code-frame");
-var chalk = require("chalk");
+var chalk_1 = require("chalk");
var Utils = require("../utils");
var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
@@ -44,15 +44,15 @@ var Formatter = /** @class */ (function (_super) {
currentFile = fileName;
}
var failureString = failure.getFailure();
- failureString = chalk.red(failureString);
+ failureString = failure.getRuleSeverity() === "warning" ? chalk_1.default.yellow(failureString) : chalk_1.default.red(failureString);
// Rule
var ruleName = failure.getRuleName();
- ruleName = chalk.gray("(" + ruleName + ")");
+ ruleName = chalk_1.default.gray("(" + ruleName + ")");
// Frame
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
var frame = codeFrame(failure.getRawLines(), lineAndCharacter.line + 1, // babel-code-frame is 1 index
lineAndCharacter.character, {
- forceColor: chalk.enabled,
+ forceColor: chalk_1.default.enabled,
highlightCode: true,
});
// Ouput
@@ -70,11 +70,11 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "codeFrame",
description: "Framed formatter which creates a frame of error code.",
- descriptionDetails: (_a = ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], _a.raw = ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], Utils.dedent(_a)),
- sample: (_b = ["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"], _b.raw = ["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"], Utils.dedent(_b)),
+ descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."]))),
+ sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"], ["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"]))),
consumer: "human",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.js b/node_modules/tslint/lib/formatters/jsonFormatter.js
index 0965b25f0..8959636fa 100644
--- a/node_modules/tslint/lib/formatters/jsonFormatter.js
+++ b/node_modules/tslint/lib/formatters/jsonFormatter.js
@@ -33,10 +33,10 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "json",
description: "Formats errors as simple JSON.",
- sample: (_a = ["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"], _a.raw = ["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"], Utils.dedent(_a)),
+ sample: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"], ["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"]))),
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/formatters/junitFormatter.d.ts b/node_modules/tslint/lib/formatters/junitFormatter.d.ts
index 8c6b27056..c47404485 100644
--- a/node_modules/tslint/lib/formatters/junitFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/junitFormatter.d.ts
@@ -20,5 +20,5 @@ import { RuleFailure } from "../language/rule/rule";
export declare class Formatter extends AbstractFormatter {
static metadata: IFormatterMetadata;
format(failures: RuleFailure[]): string;
- private escapeXml(str);
+ private escapeXml;
}
diff --git a/node_modules/tslint/lib/formatters/junitFormatter.js b/node_modules/tslint/lib/formatters/junitFormatter.js
index 9e47ae89c..61b91a655 100644
--- a/node_modules/tslint/lib/formatters/junitFormatter.js
+++ b/node_modules/tslint/lib/formatters/junitFormatter.js
@@ -67,11 +67,11 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "junit",
description: "Formats errors as through they were JUnit output.",
- descriptionDetails: (_a = ["\n Imitates the JUnit XML Output"], _a.raw = ["\n Imitates the JUnit XML Output"], Utils.dedent(_a)),
- sample: (_b = ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"Line 1, Column 14: semicolon\">\n <failure type=\"warning\">Missing semicolon</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "], _b.raw = ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"Line 1, Column 14: semicolon\">\n <failure type=\"warning\">Missing semicolon</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "], Utils.dedent(_b)),
+ descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Imitates the JUnit XML Output"], ["\n Imitates the JUnit XML Output"]))),
+ sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"Line 1, Column 14: semicolon\">\n <failure type=\"warning\">Missing semicolon</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "], ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"Line 1, Column 14: semicolon\">\n <failure type=\"warning\">Missing semicolon</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "]))),
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
index 8f038f5ff..6227c2b8c 100644
--- a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";
diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.js b/node_modules/tslint/lib/formatters/pmdFormatter.js
index 040e51af2..a8aac2d6e 100644
--- a/node_modules/tslint/lib/formatters/pmdFormatter.js
+++ b/node_modules/tslint/lib/formatters/pmdFormatter.js
@@ -51,10 +51,10 @@ var Formatter = /** @class */ (function (_super) {
formatterName: "pmd",
description: "Formats errors as through they were PMD output.",
descriptionDetails: "Imitates the XML output from PMD. All errors have a priority of 1.",
- sample: (_a = ["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"], _a.raw = ["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"], Utils.dedent(_a)),
+ sample: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"], ["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"]))),
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.d.ts b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts
index f82a678dd..8d5789dca 100644
--- a/node_modules/tslint/lib/formatters/stylishFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts
@@ -20,8 +20,8 @@ import { RuleFailure } from "../language/rule/rule";
export declare class Formatter extends AbstractFormatter {
static metadata: IFormatterMetadata;
format(failures: RuleFailure[]): string;
- private mapToMessages(failures);
- private pad(str, len);
- private getPositionMaxSize(failures);
- private getRuleMaxSize(failures);
+ private mapToMessages;
+ private pad;
+ private getPositionMaxSize;
+ private getRuleMaxSize;
}
diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.js b/node_modules/tslint/lib/formatters/stylishFormatter.js
index d3a2603c1..fa039922b 100644
--- a/node_modules/tslint/lib/formatters/stylishFormatter.js
+++ b/node_modules/tslint/lib/formatters/stylishFormatter.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
-var chalk = require("chalk");
+var chalk_1 = require("chalk");
var Utils = require("../utils");
var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
@@ -46,25 +46,25 @@ var Formatter = /** @class */ (function (_super) {
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
var failure = failures_1[_i];
var fileName = failure.getFileName();
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var positionTuple = lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1);
// Output the name of each file once
if (currentFile !== fileName) {
outputLines.push("");
- outputLines.push(fileName);
+ outputLines.push("" + fileName + chalk_1.default.hidden(":" + positionTuple));
currentFile = fileName;
}
var failureString = failure.getFailure();
- failureString = chalk.yellow(failureString);
+ failureString = chalk_1.default.yellow(failureString);
// Rule
var ruleName = failure.getRuleName();
ruleName = this.pad(ruleName, ruleMaxSize);
- ruleName = chalk.grey(ruleName);
+ ruleName = chalk_1.default.grey(ruleName);
// Lines
- var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
- var positionTuple = lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1);
positionTuple = this.pad(positionTuple, positionMaxSize);
positionTuple = failure.getRuleSeverity() === "warning"
- ? chalk.blue(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple)
- : chalk.red(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple);
+ ? chalk_1.default.blue(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple)
+ : chalk_1.default.red(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple);
// Output
var output = positionTuple + " " + ruleName + " " + failureString;
outputLines.push(output);
@@ -102,11 +102,11 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "stylish",
description: "Human-readable formatter which creates stylish messages.",
- descriptionDetails: (_a = ["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."], _a.raw = ["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."], Utils.dedent(_a)),
- sample: (_b = ["\n myFile.ts\n 1:14 semicolon Missing semicolon"], _b.raw = ["\n myFile.ts\n 1:14 semicolon Missing semicolon"], Utils.dedent(_b)),
+ descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."], ["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."]))),
+ sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n myFile.ts\n 1:14 semicolon Missing semicolon"], ["\n myFile.ts\n 1:14 semicolon Missing semicolon"]))),
consumer: "human",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/formatters/tapFormatter.d.ts b/node_modules/tslint/lib/formatters/tapFormatter.d.ts
index b44fb7d11..f3b123e11 100644
--- a/node_modules/tslint/lib/formatters/tapFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/tapFormatter.d.ts
@@ -20,5 +20,5 @@ import { RuleFailure } from "../language/rule/rule";
export declare class Formatter extends AbstractFormatter {
static metadata: IFormatterMetadata;
format(failures: RuleFailure[]): string;
- private mapToMessages(failures);
+ private mapToMessages;
}
diff --git a/node_modules/tslint/lib/formatters/tapFormatter.js b/node_modules/tslint/lib/formatters/tapFormatter.js
index 65c1be6b2..f834f75f9 100644
--- a/node_modules/tslint/lib/formatters/tapFormatter.js
+++ b/node_modules/tslint/lib/formatters/tapFormatter.js
@@ -46,8 +46,7 @@ var Formatter = /** @class */ (function (_super) {
var failureSeverity = failure.getRuleSeverity();
var failureRaw = failure.getRawLines();
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
- return (_a = ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], _a.raw = ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], Utils.dedent(_a, String(i + 1), failureMessage, failureMessage, failureSeverity, ruleName, fileName, String(lineAndCharacter.line), String(lineAndCharacter.character), failureString, failureRaw));
- var _a;
+ return Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."])), String(i + 1), failureMessage, failureMessage, failureSeverity, ruleName, fileName, String(lineAndCharacter.line), String(lineAndCharacter.character), failureString, failureRaw);
});
};
/* tslint:disable:object-literal-sort-keys */
@@ -55,10 +54,10 @@ var Formatter = /** @class */ (function (_super) {
formatterName: "tap",
description: "Formats output as TAP stream.",
descriptionDetails: "Provides error messages output in TAP13 format which can be consumed by any TAP formatter.",
- sample: (_a = ["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."], _a.raw = ["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."], Utils.dedent(_a)),
+ sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."], ["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."]))),
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.d.ts b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts
index 94ee65563..e1f97432d 100644
--- a/node_modules/tslint/lib/formatters/verboseFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts
@@ -20,5 +20,5 @@ import { RuleFailure } from "../language/rule/rule";
export declare class Formatter extends AbstractFormatter {
static metadata: IFormatterMetadata;
format(failures: RuleFailure[]): string;
- private mapToMessages(failures);
+ private mapToMessages;
}
diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.js b/node_modules/tslint/lib/formatters/vsoFormatter.js
index b98fa428d..5ab0d3604 100644
--- a/node_modules/tslint/lib/formatters/vsoFormatter.js
+++ b/node_modules/tslint/lib/formatters/vsoFormatter.js
@@ -42,11 +42,11 @@ var Formatter = /** @class */ (function (_super) {
Formatter.metadata = {
formatterName: "vso",
description: "Formats output as VSO/TFS logging commands.",
- descriptionDetails: (_a = ["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."], _a.raw = ["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."], Utils.dedent(_a)),
+ descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."], ["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."]))),
sample: "##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon",
consumer: "machine",
};
return Formatter;
}(abstractFormatter_1.AbstractFormatter));
exports.Formatter = Formatter;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/index.d.ts b/node_modules/tslint/lib/index.d.ts
index 4c492c980..4486f9af8 100644
--- a/node_modules/tslint/lib/index.d.ts
+++ b/node_modules/tslint/lib/index.d.ts
@@ -18,11 +18,11 @@ import * as Configuration from "./configuration";
import * as Formatters from "./formatters";
import { FormatterConstructor } from "./language/formatter/formatter";
import { RuleFailure } from "./language/rule/rule";
-import * as Linter from "./linter";
import * as Rules from "./rules";
import * as Test from "./test";
import * as Utils from "./utils";
-export { Configuration, Formatters, Linter, Rules, Test, Utils };
+export { Configuration, Formatters, Rules, Test, Utils };
+export * from "./linter";
export * from "./language/rule/rule";
export * from "./enableDisableRules";
export * from "./formatterLoader";
diff --git a/node_modules/tslint/lib/index.js b/node_modules/tslint/lib/index.js
index 7b44a6f79..cb8ac2900 100644
--- a/node_modules/tslint/lib/index.js
+++ b/node_modules/tslint/lib/index.js
@@ -21,14 +21,13 @@ var Configuration = require("./configuration");
exports.Configuration = Configuration;
var Formatters = require("./formatters");
exports.Formatters = Formatters;
-var Linter = require("./linter");
-exports.Linter = Linter;
var Rules = require("./rules");
exports.Rules = Rules;
var Test = require("./test");
exports.Test = Test;
var Utils = require("./utils");
exports.Utils = Utils;
+tslib_1.__exportStar(require("./linter"), exports);
tslib_1.__exportStar(require("./language/rule/rule"), exports);
tslib_1.__exportStar(require("./enableDisableRules"), exports);
tslib_1.__exportStar(require("./formatterLoader"), exports);
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.d.ts b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
index a5c2b82ac..65ed4a1b9 100644
--- a/node_modules/tslint/lib/language/rule/abstractRule.d.ts
+++ b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
@@ -21,7 +21,7 @@ export declare type NoInfer<T> = T & {
[K in keyof T]: T[K];
};
export declare abstract class AbstractRule implements IRule {
- private options;
+ private readonly options;
static metadata: IRuleMetadata;
protected readonly ruleArguments: any[];
protected readonly ruleSeverity: RuleSeverity;
diff --git a/node_modules/tslint/lib/language/rule/rule.d.ts b/node_modules/tslint/lib/language/rule/rule.d.ts
index d1ba8ac58..e37861c36 100644
--- a/node_modules/tslint/lib/language/rule/rule.d.ts
+++ b/node_modules/tslint/lib/language/rule/rule.d.ts
@@ -73,9 +73,19 @@ export interface IRuleMetadata {
* Whether or not the rule use for TypeScript only. If `false`, this rule may be used with .js files.
*/
typescriptOnly: boolean;
+ /**
+ * Examples demonstrating what the lint rule will pass and fail
+ */
+ codeExamples?: ICodeExample[];
}
export declare type RuleType = "functionality" | "maintainability" | "style" | "typescript";
export declare type RuleSeverity = "warning" | "error" | "off";
+export interface ICodeExample {
+ config: string;
+ description: string;
+ pass: string;
+ fail?: string;
+}
export interface IOptions {
ruleArguments: any[];
ruleSeverity: RuleSeverity;
@@ -141,8 +151,8 @@ export declare class Replacement {
toJson(): ReplacementJson;
}
export declare class RuleFailurePosition {
- private position;
- private lineAndCharacter;
+ private readonly position;
+ private readonly lineAndCharacter;
constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
getPosition(): number;
getLineAndCharacter(): ts.LineAndCharacter;
@@ -152,14 +162,14 @@ export declare class RuleFailurePosition {
export declare type Fix = Replacement | Replacement[];
export declare type FixJson = ReplacementJson | ReplacementJson[];
export declare class RuleFailure {
- private sourceFile;
- private failure;
- private ruleName;
- private fix;
- private fileName;
- private startPosition;
- private endPosition;
- private rawLines;
+ private readonly sourceFile;
+ private readonly failure;
+ private readonly ruleName;
+ private readonly fix?;
+ private readonly fileName;
+ private readonly startPosition;
+ private readonly endPosition;
+ private readonly rawLines;
private ruleSeverity;
static compare(a: RuleFailure, b: RuleFailure): number;
constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string, fix?: Replacement | Replacement[] | undefined);
@@ -175,5 +185,5 @@ export declare class RuleFailure {
setRuleSeverity(value: RuleSeverity): void;
toJson(): IRuleFailureJson;
equals(ruleFailure: RuleFailure): boolean;
- private createFailurePosition(position);
+ private createFailurePosition;
}
diff --git a/node_modules/tslint/lib/language/utils.d.ts b/node_modules/tslint/lib/language/utils.d.ts
index ffdd0aabc..40b4aee16 100644
--- a/node_modules/tslint/lib/language/utils.d.ts
+++ b/node_modules/tslint/lib/language/utils.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import { IDisabledInterval, RuleFailure } from "./rule/rule";
export declare function getSourceFile(fileName: string, source: string): ts.SourceFile;
@@ -5,59 +21,86 @@ export declare function getSourceFile(fileName: string, source: string): ts.Sour
export declare function doesIntersect(failure: RuleFailure, disabledIntervals: IDisabledInterval[]): boolean;
/**
* @returns true if any modifier kinds passed along exist in the given modifiers array
+ *
+ * @deprecated use `hasModifier` from `tsutils`
*/
export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...modifierKinds: ts.SyntaxKind[]): boolean;
/**
* Determines if the appropriate bit in the parent (VariableDeclarationList) is set,
* which indicates this is a "let" or "const".
+ *
+ * @deprecated use `isBlockScopedVariableDeclarationList` from `tsutils`
*/
export declare function isBlockScopedVariable(node: ts.VariableDeclaration | ts.VariableStatement): boolean;
+/** @deprecated use `isBlockScopedVariableDeclarationList` and `getDeclarationOfBindingElement` from `tsutils` */
export declare function isBlockScopedBindingElement(node: ts.BindingElement): boolean;
+/** @deprecated use `getDeclarationOfBindingElement` from `tsutils` */
export declare function getBindingElementVariableDeclaration(node: ts.BindingElement): ts.VariableDeclaration | null;
/**
* Finds a child of a given node with a given kind.
* Note: This uses `node.getChildren()`, which does extra parsing work to include tokens.
+ *
+ * @deprecated use `getChildOfKind` from `tsutils`
*/
export declare function childOfKind(node: ts.Node, kind: ts.SyntaxKind): ts.Node | undefined;
/**
* @returns true if some ancestor of `node` satisfies `predicate`, including `node` itself.
+ *
+ * @deprecated no longer used, use a `while` loop instead
*/
export declare function someAncestor(node: ts.Node, predicate: (n: ts.Node) => boolean): boolean;
-export declare function ancestorWhere<T extends ts.Node>(node: ts.Node, predicate: (n: ts.Node) => n is T): T | undefined;
-export declare function ancestorWhere(node: ts.Node, predicate: (n: ts.Node) => boolean): ts.Node | undefined;
+export declare function ancestorWhere<T extends ts.Node = ts.Node>(node: ts.Node, predicate: ((n: ts.Node) => n is T) | ((n: ts.Node) => boolean)): T | undefined;
+/** @deprecated use `isBinaryExpression(node) && isAssignmentKind(node.operatorToken.kind)` with functions from `tsutils` */
export declare function isAssignment(node: ts.Node): boolean;
/**
* Bitwise check for node flags.
+ *
+ * @deprecated use `isNodeFlagSet` from `tsutils`
*/
export declare function isNodeFlagSet(node: ts.Node, flagToCheck: ts.NodeFlags): boolean;
/**
* Bitwise check for combined node flags.
+ *
+ * @deprecated no longer used
*/
export declare function isCombinedNodeFlagSet(node: ts.Node, flagToCheck: ts.NodeFlags): boolean;
/**
* Bitwise check for combined modifier flags.
+ *
+ * @deprecated no longer used
*/
export declare function isCombinedModifierFlagSet(node: ts.Node, flagToCheck: ts.ModifierFlags): boolean;
/**
* Bitwise check for type flags.
+ *
+ * @deprecated use `isTypeFlagSet` from `tsutils`
*/
export declare function isTypeFlagSet(type: ts.Type, flagToCheck: ts.TypeFlags): boolean;
/**
* Bitwise check for symbol flags.
+ *
+ * @deprecated use `isSymbolFlagSet` from `tsutils`
*/
export declare function isSymbolFlagSet(symbol: ts.Symbol, flagToCheck: ts.SymbolFlags): boolean;
/**
* Bitwise check for object flags.
* Does not work with TypeScript 2.0.x
+ *
+ * @deprecated use `isObjectFlagSet` from `tsutils`
*/
export declare function isObjectFlagSet(objectType: ts.ObjectType, flagToCheck: ts.ObjectFlags): boolean;
/**
* @returns true if decl is a nested module declaration, i.e. represents a segment of a dotted module path.
+ *
+ * @deprecated use `decl.parent!.kind === ts.SyntaxKind.ModuleDeclaration`
*/
export declare function isNestedModuleDeclaration(decl: ts.ModuleDeclaration): boolean;
export declare function unwrapParentheses(node: ts.Expression): ts.Expression;
+/** @deprecated use `isFunctionScopeBoundary` from `tsutils` */
export declare function isScopeBoundary(node: ts.Node): boolean;
+/** @deprecated use `isBlockScopeBoundary` from `tsutils` */
export declare function isBlockScopeBoundary(node: ts.Node): boolean;
+/** @deprecated use `isIterationStatement` from `tsutils` or `typescript` */
export declare function isLoop(node: ts.Node): node is ts.IterationStatement;
/**
* @returns Whether node is a numeric expression.
@@ -83,9 +126,15 @@ export declare type FilterCallback = (node: ts.Node) => boolean;
* @param skipTrivia If set to false all trivia preceeding `node` or any of its children is included
* @param cb Is called for every token of `node`. It gets the full text of the SourceFile and the position of the token within that text.
* @param filter If provided, will be called for every Node and Token found. If it returns false `cb` will not be called for this subtree.
+ *
+ * @deprecated use `forEachToken` or `forEachTokenWithTrivia` from `tsutils`
*/
export declare function forEachToken(node: ts.Node, skipTrivia: boolean, cb: ForEachTokenCallback, filter?: FilterCallback): void;
-/** Iterate over all comments owned by `node` or its children */
+/**
+ * Iterate over all comments owned by `node` or its children
+ *
+ * @deprecated use `forEachComment` from `tsutils`
+ */
export declare function forEachComment(node: ts.Node, cb: ForEachCommentCallback): void;
/**
* Checks if there are any comments between `position` and the next non-trivia token
diff --git a/node_modules/tslint/lib/language/utils.js b/node_modules/tslint/lib/language/utils.js
index e9ba81a48..aba50291f 100644
--- a/node_modules/tslint/lib/language/utils.js
+++ b/node_modules/tslint/lib/language/utils.js
@@ -35,6 +35,8 @@ function doesIntersect(failure, disabledIntervals) {
exports.doesIntersect = doesIntersect;
/**
* @returns true if any modifier kinds passed along exist in the given modifiers array
+ *
+ * @deprecated use `hasModifier` from `tsutils`
*/
function hasModifier(modifiers) {
var modifierKinds = [];
@@ -50,6 +52,8 @@ exports.hasModifier = hasModifier;
/**
* Determines if the appropriate bit in the parent (VariableDeclarationList) is set,
* which indicates this is a "let" or "const".
+ *
+ * @deprecated use `isBlockScopedVariableDeclarationList` from `tsutils`
*/
function isBlockScopedVariable(node) {
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
@@ -61,12 +65,14 @@ function isBlockScopedVariable(node) {
}
}
exports.isBlockScopedVariable = isBlockScopedVariable;
+/** @deprecated use `isBlockScopedVariableDeclarationList` and `getDeclarationOfBindingElement` from `tsutils` */
function isBlockScopedBindingElement(node) {
- var variableDeclaration = getBindingElementVariableDeclaration(node);
+ var variableDeclaration = getBindingElementVariableDeclaration(node); // tslint:disable-line:deprecation
// if no variable declaration, it must be a function param, which is block scoped
- return (variableDeclaration === null) || isBlockScopedVariable(variableDeclaration);
+ return (variableDeclaration === null) || isBlockScopedVariable(variableDeclaration); // tslint:disable-line:deprecation
}
exports.isBlockScopedBindingElement = isBlockScopedBindingElement;
+/** @deprecated use `getDeclarationOfBindingElement` from `tsutils` */
function getBindingElementVariableDeclaration(node) {
var currentParent = node.parent;
while (currentParent.kind !== ts.SyntaxKind.VariableDeclaration) {
@@ -83,6 +89,8 @@ exports.getBindingElementVariableDeclaration = getBindingElementVariableDeclarat
/**
* Finds a child of a given node with a given kind.
* Note: This uses `node.getChildren()`, which does extra parsing work to include tokens.
+ *
+ * @deprecated use `getChildOfKind` from `tsutils`
*/
function childOfKind(node, kind) {
return node.getChildren().find(function (child) { return child.kind === kind; });
@@ -90,9 +98,11 @@ function childOfKind(node, kind) {
exports.childOfKind = childOfKind;
/**
* @returns true if some ancestor of `node` satisfies `predicate`, including `node` itself.
+ *
+ * @deprecated no longer used, use a `while` loop instead
*/
function someAncestor(node, predicate) {
- return predicate(node) || (node.parent !== undefined && someAncestor(node.parent, predicate));
+ return predicate(node) || (node.parent !== undefined && someAncestor(node.parent, predicate)); // tslint:disable-line:deprecation
}
exports.someAncestor = someAncestor;
function ancestorWhere(node, predicate) {
@@ -106,6 +116,7 @@ function ancestorWhere(node, predicate) {
return undefined;
}
exports.ancestorWhere = ancestorWhere;
+/** @deprecated use `isBinaryExpression(node) && isAssignmentKind(node.operatorToken.kind)` with functions from `tsutils` */
function isAssignment(node) {
if (node.kind === ts.SyntaxKind.BinaryExpression) {
var binaryExpression = node;
@@ -119,6 +130,8 @@ function isAssignment(node) {
exports.isAssignment = isAssignment;
/**
* Bitwise check for node flags.
+ *
+ * @deprecated use `isNodeFlagSet` from `tsutils`
*/
function isNodeFlagSet(node, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -127,6 +140,8 @@ function isNodeFlagSet(node, flagToCheck) {
exports.isNodeFlagSet = isNodeFlagSet;
/**
* Bitwise check for combined node flags.
+ *
+ * @deprecated no longer used
*/
function isCombinedNodeFlagSet(node, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -135,6 +150,8 @@ function isCombinedNodeFlagSet(node, flagToCheck) {
exports.isCombinedNodeFlagSet = isCombinedNodeFlagSet;
/**
* Bitwise check for combined modifier flags.
+ *
+ * @deprecated no longer used
*/
function isCombinedModifierFlagSet(node, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -143,6 +160,8 @@ function isCombinedModifierFlagSet(node, flagToCheck) {
exports.isCombinedModifierFlagSet = isCombinedModifierFlagSet;
/**
* Bitwise check for type flags.
+ *
+ * @deprecated use `isTypeFlagSet` from `tsutils`
*/
function isTypeFlagSet(type, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -151,6 +170,8 @@ function isTypeFlagSet(type, flagToCheck) {
exports.isTypeFlagSet = isTypeFlagSet;
/**
* Bitwise check for symbol flags.
+ *
+ * @deprecated use `isSymbolFlagSet` from `tsutils`
*/
function isSymbolFlagSet(symbol, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -160,6 +181,8 @@ exports.isSymbolFlagSet = isSymbolFlagSet;
/**
* Bitwise check for object flags.
* Does not work with TypeScript 2.0.x
+ *
+ * @deprecated use `isObjectFlagSet` from `tsutils`
*/
function isObjectFlagSet(objectType, flagToCheck) {
// tslint:disable-next-line:no-bitwise
@@ -168,6 +191,8 @@ function isObjectFlagSet(objectType, flagToCheck) {
exports.isObjectFlagSet = isObjectFlagSet;
/**
* @returns true if decl is a nested module declaration, i.e. represents a segment of a dotted module path.
+ *
+ * @deprecated use `decl.parent!.kind === ts.SyntaxKind.ModuleDeclaration`
*/
function isNestedModuleDeclaration(decl) {
// in a declaration expression like 'module a.b.c' - 'a' is the top level module declaration node and 'b' and 'c'
@@ -183,6 +208,7 @@ function unwrapParentheses(node) {
return node;
}
exports.unwrapParentheses = unwrapParentheses;
+/** @deprecated use `isFunctionScopeBoundary` from `tsutils` */
function isScopeBoundary(node) {
return node.kind === ts.SyntaxKind.FunctionDeclaration
|| node.kind === ts.SyntaxKind.FunctionExpression
@@ -201,10 +227,11 @@ function isScopeBoundary(node) {
|| node.kind === ts.SyntaxKind.SourceFile && ts.isExternalModule(node);
}
exports.isScopeBoundary = isScopeBoundary;
+/** @deprecated use `isBlockScopeBoundary` from `tsutils` */
function isBlockScopeBoundary(node) {
- return isScopeBoundary(node)
+ return isScopeBoundary(node) // tslint:disable-line:deprecation
|| node.kind === ts.SyntaxKind.Block
- || isLoop(node)
+ || isLoop(node) // tslint:disable-line:deprecation
|| node.kind === ts.SyntaxKind.WithStatement
|| node.kind === ts.SyntaxKind.SwitchStatement
|| node.parent !== undefined
@@ -212,6 +239,7 @@ function isBlockScopeBoundary(node) {
|| node.parent.kind === ts.SyntaxKind.IfStatement);
}
exports.isBlockScopeBoundary = isBlockScopeBoundary;
+/** @deprecated use `isIterationStatement` from `tsutils` or `typescript` */
function isLoop(node) {
return node.kind === ts.SyntaxKind.DoStatement
|| node.kind === ts.SyntaxKind.WhileStatement
@@ -241,6 +269,8 @@ exports.isNumeric = isNumeric;
* @param skipTrivia If set to false all trivia preceeding `node` or any of its children is included
* @param cb Is called for every token of `node`. It gets the full text of the SourceFile and the position of the token within that text.
* @param filter If provided, will be called for every Node and Token found. If it returns false `cb` will not be called for this subtree.
+ *
+ * @deprecated use `forEachToken` or `forEachTokenWithTrivia` from `tsutils`
*/
function forEachToken(node, skipTrivia, cb, filter) {
// this function will most likely be called with SourceFile anyways, so there is no need for an additional parameter
@@ -305,7 +335,11 @@ function createTriviaHandler(sourceFile, cb) {
}
return handleTrivia;
}
-/** Iterate over all comments owned by `node` or its children */
+/**
+ * Iterate over all comments owned by `node` or its children
+ *
+ * @deprecated use `forEachComment` from `tsutils`
+ */
function forEachComment(node, cb) {
/* Visit all tokens and skip trivia.
Comment ranges between tokens are parsed without the need of a scanner.
diff --git a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts
index 92a61039d..0fd097cc7 100644
--- a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts
+++ b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts
@@ -24,7 +24,7 @@ import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";
* are a superset of regular scopes (new block scopes are created more frequently in a program).
*/
export declare abstract class BlockScopeAwareRuleWalker<T, U> extends ScopeAwareRuleWalker<T> {
- private blockScopeStack;
+ private readonly blockScopeStack;
constructor(sourceFile: ts.SourceFile, options: IOptions);
abstract createBlockScope(node: ts.Node): U;
getAllBlockScopes(): U[];
@@ -34,5 +34,5 @@ export declare abstract class BlockScopeAwareRuleWalker<T, U> extends ScopeAware
onBlockScopeEnd(): void;
findBlockScope(predicate: (scope: U) => boolean): U | undefined;
protected visitNode(node: ts.Node): void;
- private isBlockScopeBoundary(node);
+ private isBlockScopeBoundary;
}
diff --git a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
index 0b270d2cb..2bfe8865f 100644
--- a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
+++ b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var ts = require("typescript");
var utils_1 = require("../utils");
var scopeAwareRuleWalker_1 = require("./scopeAwareRuleWalker");
+// tslint:disable:deprecation (extends deprecated class and uses deprecated utils - doesn't matter because it's deprecated, too)
/**
* @deprecated See comment on ScopeAwareRuleWalker.
*
diff --git a/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts
index d0ae8af52..8f949a03a 100644
--- a/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts
+++ b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts
@@ -18,8 +18,8 @@ import * as ts from "typescript";
import { IOptions } from "../rule/rule";
import { RuleWalker } from "./ruleWalker";
export declare class ProgramAwareRuleWalker extends RuleWalker {
- private program;
- private typeChecker;
+ private readonly program;
+ private readonly typeChecker;
constructor(sourceFile: ts.SourceFile, options: IOptions, program: ts.Program);
getProgram(): ts.Program;
getTypeChecker(): ts.TypeChecker;
diff --git a/node_modules/tslint/lib/language/walker/ruleWalker.d.ts b/node_modules/tslint/lib/language/walker/ruleWalker.d.ts
index f78b4c0ed..9d27e8bcb 100644
--- a/node_modules/tslint/lib/language/walker/ruleWalker.d.ts
+++ b/node_modules/tslint/lib/language/walker/ruleWalker.d.ts
@@ -19,11 +19,11 @@ import { Fix, IOptions, Replacement, RuleFailure } from "../rule/rule";
import { SyntaxWalker } from "./syntaxWalker";
import { IWalker } from "./walker";
export declare class RuleWalker extends SyntaxWalker implements IWalker {
- private sourceFile;
- private limit;
- private options?;
- private failures;
- private ruleName;
+ private readonly sourceFile;
+ private readonly limit;
+ private readonly options?;
+ private readonly failures;
+ private readonly ruleName;
constructor(sourceFile: ts.SourceFile, options: IOptions);
getSourceFile(): ts.SourceFile;
getLineAndCharacterOfPosition(position: number): ts.LineAndCharacter;
diff --git a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts
index 64423e23b..dbb21a9f6 100644
--- a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts
+++ b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts
@@ -52,7 +52,7 @@ import { RuleWalker } from "./ruleWalker";
* }
*/
export declare abstract class ScopeAwareRuleWalker<T> extends RuleWalker {
- private scopeStack;
+ private readonly scopeStack;
constructor(sourceFile: ts.SourceFile, options: IOptions);
abstract createScope(node: ts.Node): T;
getCurrentScope(): T;
diff --git a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
index 2c9cb93a1..15cf26478 100644
--- a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
+++ b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
@@ -93,7 +93,7 @@ var ScopeAwareRuleWalker = /** @class */ (function (_super) {
}
};
ScopeAwareRuleWalker.prototype.isScopeBoundary = function (node) {
- return utils_1.isScopeBoundary(node);
+ return utils_1.isScopeBoundary(node); // tslint:disable-line:deprecation
};
return ScopeAwareRuleWalker;
}(ruleWalker_1.RuleWalker));
diff --git a/node_modules/tslint/lib/linter.d.ts b/node_modules/tslint/lib/linter.d.ts
index 2bd582ded..a5d54f758 100644
--- a/node_modules/tslint/lib/linter.d.ts
+++ b/node_modules/tslint/lib/linter.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import { findConfiguration, findConfigurationPath, getRulesDirectories, IConfigurationFile, loadConfigurationFromPath } from "./configuration";
import { ILinterOptions, LintResult } from "./index";
@@ -5,9 +21,9 @@ import { RuleFailure } from "./language/rule/rule";
/**
* Linter that can lint multiple files in consecutive runs.
*/
-declare class Linter {
- private options;
- private program;
+export declare class Linter {
+ private readonly options;
+ private program?;
static VERSION: string;
static findConfiguration: typeof findConfiguration;
static findConfigurationPath: typeof findConfigurationPath;
@@ -27,14 +43,11 @@ declare class Linter {
constructor(options: ILinterOptions, program?: ts.Program | undefined);
lint(fileName: string, source: string, configuration?: IConfigurationFile): void;
getResult(): LintResult;
- private getAllFailures(sourceFile, enabledRules);
- private applyAllFixes(enabledRules, fileFailures, sourceFile, sourceFileName);
+ private getAllFailures;
+ private applyAllFixes;
protected applyFixes(sourceFilePath: string, source: string, fixableFailures: RuleFailure[]): string;
- private updateProgram(sourceFilePath);
- private applyRule(rule, sourceFile);
- private getEnabledRules(configuration, isJs);
- private getSourceFile(fileName, source);
-}
-declare namespace Linter {
+ private updateProgram;
+ private applyRule;
+ private getEnabledRules;
+ private getSourceFile;
}
-export = Linter;
diff --git a/node_modules/tslint/lib/linter.js b/node_modules/tslint/lib/linter.js
index 7662ed8d4..4c642d922 100644
--- a/node_modules/tslint/lib/linter.js
+++ b/node_modules/tslint/lib/linter.js
@@ -15,6 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
var fs = require("fs");
var path = require("path");
var ts = require("typescript");
@@ -48,14 +50,32 @@ var Linter = /** @class */ (function () {
*/
Linter.createProgram = function (configFile, projectDirectory) {
if (projectDirectory === void 0) { projectDirectory = path.dirname(configFile); }
- var config = ts.readConfigFile(configFile, ts.sys.readFile).config;
+ var config = ts.readConfigFile(configFile, ts.sys.readFile);
+ if (config.error !== undefined) {
+ throw new error_1.FatalError(ts.formatDiagnostics([config.error], {
+ getCanonicalFileName: function (f) { return f; },
+ getCurrentDirectory: process.cwd,
+ getNewLine: function () { return "\n"; },
+ }));
+ }
var parseConfigHost = {
fileExists: fs.existsSync,
readDirectory: ts.sys.readDirectory,
readFile: function (file) { return fs.readFileSync(file, "utf8"); },
useCaseSensitiveFileNames: true,
};
- var parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, path.resolve(projectDirectory), { noEmit: true });
+ var parsed = ts.parseJsonConfigFileContent(config.config, parseConfigHost, path.resolve(projectDirectory), { noEmit: true });
+ if (parsed.errors !== undefined) {
+ // ignore warnings and 'TS18003: No inputs were found in config file ...'
+ var errors = parsed.errors.filter(function (d) { return d.category === ts.DiagnosticCategory.Error && d.code !== 18003; });
+ if (errors.length !== 0) {
+ throw new error_1.FatalError(ts.formatDiagnostics(errors, {
+ getCanonicalFileName: function (f) { return f; },
+ getCurrentDirectory: process.cwd,
+ getNewLine: function () { return "\n"; },
+ }));
+ }
+ }
var host = ts.createCompilerHost(parsed.options, true);
var program = ts.createProgram(parsed.fileNames, parsed.options, host);
return program;
@@ -65,7 +85,11 @@ var Linter = /** @class */ (function () {
* files and excludes declaration (".d.ts") files.
*/
Linter.getFileNames = function (program) {
- return program.getSourceFiles().map(function (s) { return s.fileName; }).filter(function (l) { return l.substr(-5) !== ".d.ts"; });
+ return utils_1.mapDefined(program.getSourceFiles(), function (file) {
+ return file.fileName.endsWith(".d.ts") || program.isSourceFileFromExternalLibrary(file)
+ ? undefined
+ : file.fileName;
+ });
};
Linter.prototype.lint = function (fileName, source, configuration) {
if (configuration === void 0) { configuration = configuration_1.DEFAULT_CONFIG; }
@@ -93,16 +117,12 @@ var Linter = /** @class */ (function () {
this.failures = this.failures.concat(fileFailures);
};
Linter.prototype.getResult = function () {
- var formatter;
- var formattersDirectory = configuration_1.getRelativePath(this.options.formattersDirectory);
var formatterName = this.options.formatter !== undefined ? this.options.formatter : "prose";
- var Formatter = formatterLoader_1.findFormatter(formatterName, formattersDirectory);
- if (Formatter !== undefined) {
- formatter = new Formatter();
- }
- else {
+ var Formatter = formatterLoader_1.findFormatter(formatterName, this.options.formattersDirectory);
+ if (Formatter === undefined) {
throw new Error("formatter '" + formatterName + "' not found");
}
+ var formatter = new Formatter();
var output = formatter.format(this.failures, this.fixes);
var errorCount = this.failures.filter(function (failure) { return failure.getRuleSeverity() === "error"; }).length;
return {
@@ -179,10 +199,10 @@ var Linter = /** @class */ (function () {
}
catch (error) {
if (error_1.isError(error) && error.stack !== undefined) {
- error_1.showWarningOnce(error.stack);
+ error_1.showRuleCrashWarning(error.stack, rule.getOptions().ruleName, sourceFile.fileName);
}
else {
- error_1.showWarningOnce(String(error));
+ error_1.showRuleCrashWarning(String(error), rule.getOptions().ruleName, sourceFile.fileName);
}
return [];
}
@@ -198,7 +218,7 @@ var Linter = /** @class */ (function () {
if (this.program !== undefined) {
var sourceFile = this.program.getSourceFile(fileName);
if (sourceFile === undefined) {
- var INVALID_SOURCE_ERROR = (_a = ["\n Invalid source file: ", ". Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.\n "], _a.raw = ["\n Invalid source file: ", ". Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.\n "], utils_1.dedent(_a, fileName));
+ var INVALID_SOURCE_ERROR = utils_1.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Invalid source file: ", ". Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.\n "], ["\n Invalid source file: ", ". Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.\n "])), fileName);
throw new error_1.FatalError(INVALID_SOURCE_ERROR);
}
return sourceFile;
@@ -206,15 +226,15 @@ var Linter = /** @class */ (function () {
else {
return utils.getSourceFile(fileName, source);
}
- var _a;
};
- Linter.VERSION = "5.8.0";
+ Linter.VERSION = "5.11.0";
Linter.findConfiguration = configuration_1.findConfiguration;
Linter.findConfigurationPath = configuration_1.findConfigurationPath;
Linter.getRulesDirectories = configuration_1.getRulesDirectories;
Linter.loadConfigurationFromPath = configuration_1.loadConfigurationFromPath;
return Linter;
}());
+exports.Linter = Linter;
function createMultiMap(inputs, getPair) {
var map = new Map();
for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {
@@ -233,4 +253,4 @@ function createMultiMap(inputs, getPair) {
}
return map;
}
-module.exports = Linter;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/ruleLoader.d.ts b/node_modules/tslint/lib/ruleLoader.d.ts
index 0ce93785e..731933c2a 100644
--- a/node_modules/tslint/lib/ruleLoader.d.ts
+++ b/node_modules/tslint/lib/ruleLoader.d.ts
@@ -1,3 +1,20 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { IOptions, IRule, RuleConstructor } from "./language/rule/rule";
export declare function loadRules(ruleOptionsList: IOptions[], rulesDirectories?: string | string[], isJs?: boolean): IRule[];
+/** @internal private API */
export declare function findRule(name: string, rulesDirectories?: string | string[]): RuleConstructor | undefined;
diff --git a/node_modules/tslint/lib/ruleLoader.js b/node_modules/tslint/lib/ruleLoader.js
index 5afc659c8..f0da87652 100644
--- a/node_modules/tslint/lib/ruleLoader.js
+++ b/node_modules/tslint/lib/ruleLoader.js
@@ -16,13 +16,12 @@
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
var fs = require("fs");
var path = require("path");
-var configuration_1 = require("./configuration");
var error_1 = require("./error");
var utils_1 = require("./utils");
-var moduleDirectory = path.dirname(module.filename);
-var CORE_RULES_DIRECTORY = path.resolve(moduleDirectory, ".", "rules");
+var CORE_RULES_DIRECTORY = path.resolve(__dirname, "rules");
var cachedRules = new Map();
function loadRules(ruleOptionsList, rulesDirectories, isJs) {
if (isJs === void 0) { isJs = false; }
@@ -54,20 +53,21 @@ function loadRules(ruleOptionsList, rulesDirectories, isJs) {
}
}
if (notFoundRules.length > 0) {
- var warning = (_a = ["\n Could not find implementations for the following rules specified in the configuration:\n ", "\n Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.\n If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.\n "], _a.raw = ["\n Could not find implementations for the following rules specified in the configuration:\n ", "\n Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.\n If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.\n "], utils_1.dedent(_a, notFoundRules.join("\n ")));
+ var warning = utils_1.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Could not find implementations for the following rules specified in the configuration:\n ", "\n Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.\n If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.\n "], ["\n Could not find implementations for the following rules specified in the configuration:\n ", "\n Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.\n If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.\n "])), notFoundRules.join("\n "));
error_1.showWarningOnce(warning);
}
if (notAllowedInJsRules.length > 0) {
- var warning = (_b = ["\n Following rules specified in configuration couldn't be applied to .js or .jsx files:\n ", "\n Make sure to exclude them from \"jsRules\" section of your tslint.json.\n "], _b.raw = ["\n Following rules specified in configuration couldn't be applied to .js or .jsx files:\n ", "\n Make sure to exclude them from \"jsRules\" section of your tslint.json.\n "], utils_1.dedent(_b, notAllowedInJsRules.join("\n ")));
+ var warning = utils_1.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Following rules specified in configuration couldn't be applied to .js or .jsx files:\n ", "\n Make sure to exclude them from \"jsRules\" section of your tslint.json.\n "], ["\n Following rules specified in configuration couldn't be applied to .js or .jsx files:\n ", "\n Make sure to exclude them from \"jsRules\" section of your tslint.json.\n "])), notAllowedInJsRules.join("\n "));
error_1.showWarningOnce(warning);
}
if (rules.length === 0) {
- error_1.showWarningOnce("No valid rules have been specified");
+ var fileType = isJs ? "JavaScript" : "TypeScript";
+ error_1.showWarningOnce("No valid rules have been specified for " + fileType + " files");
}
return rules;
- var _a, _b;
}
exports.loadRules = loadRules;
+/** @internal private API */
function findRule(name, rulesDirectories) {
var camelizedName = transformName(name);
// first check for core rules
@@ -91,28 +91,15 @@ function transformName(name) {
* @param ruleName - A name of a rule in filename format. ex) "someLintRule"
*/
function loadRule(directory, ruleName) {
- var ruleFullPath = getRuleFullPath(directory, ruleName);
- if (ruleFullPath !== undefined) {
- var ruleModule = require(ruleFullPath);
- if (ruleModule !== undefined) {
- return ruleModule.Rule;
- }
- }
- return "not-found";
-}
-/**
- * Returns the full path to a rule file. Path to rules are resolved using nodes path resolution.
- * This allows developers to write custom rules in TypeScript, which then can be loaded by TS-Node.
- * @param directory - An absolute path to a directory of rules
- * @param ruleName - A name of a rule in filename format. ex) "someLintRule"
- */
-function getRuleFullPath(directory, ruleName) {
+ var ruleFullPath;
try {
- return require.resolve(path.join(directory, ruleName));
+ // Resolve using node's path resolution to allow developers to write custom rules in TypeScript which can be loaded by TS-Node
+ ruleFullPath = require.resolve(path.join(directory, ruleName));
}
- catch (e) {
- return undefined;
+ catch (_a) {
+ return "not-found";
}
+ return require(ruleFullPath).Rule;
}
function loadCachedRule(directory, ruleName, isCustomPath) {
// use cached value if available
@@ -121,15 +108,16 @@ function loadCachedRule(directory, ruleName, isCustomPath) {
if (cachedRule !== undefined) {
return cachedRule === "not-found" ? undefined : cachedRule;
}
- // get absolute path
+ // treat directory as a relative path (which needs to be resolved) if it's a custom rule directory
var absolutePath = directory;
if (isCustomPath) {
- absolutePath = configuration_1.getRelativePath(directory);
- if (absolutePath !== undefined && !fs.existsSync(absolutePath)) {
- throw new error_1.FatalError("Could not find custom rule directory: " + directory);
+ absolutePath = path.resolve(directory);
+ if (!fs.existsSync(absolutePath)) {
+ throw new error_1.FatalError("Could not find custom rule directory: " + absolutePath);
}
}
- var Rule = absolutePath === undefined ? "not-found" : loadRule(absolutePath, ruleName);
+ var Rule = loadRule(absolutePath, ruleName);
cachedRules.set(fullPath, Rule);
return Rule === "not-found" ? undefined : Rule;
}
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
index 18d5df0d9..967655d2d 100644
--- a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
index da1303ba3..7bba51a80 100644
--- a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
@@ -111,7 +111,7 @@ function getOverloadKey(node) {
return undefined;
}
var _a = typeof info === "string" ? [false, info] : [info.computed, info.name], computed = _a[0], name = _a[1];
- var isStatic = Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword);
+ var isStatic = utils.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword);
return (computed ? "0" : "1") + (isStatic ? "0" : "1") + name;
}
exports.getOverloadKey = getOverloadKey;
diff --git a/node_modules/tslint/lib/rules/alignRule.d.ts b/node_modules/tslint/lib/rules/alignRule.d.ts
index 051a5bb15..78cc017cf 100644
--- a/node_modules/tslint/lib/rules/alignRule.d.ts
+++ b/node_modules/tslint/lib/rules/alignRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/alignRule.js b/node_modules/tslint/lib/rules/alignRule.js
index f2fbc169e..702711ffe 100644
--- a/node_modules/tslint/lib/rules/alignRule.js
+++ b/node_modules/tslint/lib/rules/alignRule.js
@@ -44,8 +44,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "align",
description: "Enforces vertical alignment.",
hasFix: true,
- rationale: "Helps maintain a readable, consistent style in your codebase.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks alignment of function parameters.\n * `\"", "\"` checks alignment of function call arguments.\n * `\"", "\"` checks alignment of statements.\n * `\"", "\"` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * `\"", "\"` checks alignment of elements of array iterals, array destructuring and tuple types."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks alignment of function parameters.\n * \\`\"", "\"\\` checks alignment of function call arguments.\n * \\`\"", "\"\\` checks alignment of statements.\n * \\`\"", "\"\\` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * \\`\"", "\"\\` checks alignment of elements of array iterals, array destructuring and tuple types."], Lint.Utils.dedent(_a, OPTION_PARAMETERS, OPTION_ARGUMENTS, OPTION_STATEMENTS, OPTION_MEMBERS, OPTION_ELEMENTS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps maintain a readable, consistent style in your codebase.\n\n Consistent alignment for code statements helps keep code readable and clear.\n Statements misaligned from the standard can be harder to read and understand."], ["\n Helps maintain a readable, consistent style in your codebase.\n\n Consistent alignment for code statements helps keep code readable and clear.\n Statements misaligned from the standard can be harder to read and understand."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks alignment of function parameters.\n * `\"", "\"` checks alignment of function call arguments.\n * `\"", "\"` checks alignment of statements.\n * `\"", "\"` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * `\"", "\"` checks alignment of elements of array iterals, array destructuring and tuple types."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks alignment of function parameters.\n * \\`\"", "\"\\` checks alignment of function call arguments.\n * \\`\"", "\"\\` checks alignment of statements.\n * \\`\"", "\"\\` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * \\`\"", "\"\\` checks alignment of elements of array iterals, array destructuring and tuple types."])), OPTION_PARAMETERS, OPTION_ARGUMENTS, OPTION_STATEMENTS, OPTION_MEMBERS, OPTION_ELEMENTS),
options: {
type: "array",
items: {
@@ -170,6 +170,7 @@ var AlignWalker = /** @class */ (function (_super) {
AlignWalker.prototype.getStart = function (node) {
return node.kind !== ts.SyntaxKind.OmittedExpression
? node.getStart(this.sourceFile)
+ // find the comma token following the OmmitedExpression
: tsutils_1.getNextToken(node, this.sourceFile).getStart(this.sourceFile);
};
return AlignWalker;
@@ -181,4 +182,4 @@ function getLineAndCharacterWithoutBom(sourceFile, pos) {
}
return result;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/arrayTypeRule.js b/node_modules/tslint/lib/rules/arrayTypeRule.js
index af92a8084..f04126edf 100644
--- a/node_modules/tslint/lib/rules/arrayTypeRule.js
+++ b/node_modules/tslint/lib/rules/arrayTypeRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "array-type",
description: "Requires using either 'T[]' or 'Array<T>' for arrays.",
hasFix: true,
- optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces use of `T[]` for all types T.\n * `\"", "\"` enforces use of `Array<T>` for all types T.\n * `\"", "\"` enforces use of `T[]` if `T` is a simple type (primitive or type reference)."], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces use of \\`T[]\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`Array<T>\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`T[]\\` if \\`T\\` is a simple type (primitive or type reference)."], Lint.Utils.dedent(_a, OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces use of `T[]` for all types T.\n * `\"", "\"` enforces use of `Array<T>` for all types T.\n * `\"", "\"` enforces use of `T[]` if `T` is a simple type (primitive or type reference)."], ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces use of \\`T[]\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`Array<T>\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`T[]\\` if \\`T\\` is a simple type (primitive or type reference)."])), OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE),
options: {
type: "string",
enum: [OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE],
@@ -151,4 +151,4 @@ function isSimpleType(nodeType) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.d.ts b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
index 32149f7ed..ebb24e383 100644
--- a/node_modules/tslint/lib/rules/arrowParensRule.d.ts
+++ b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.js b/node_modules/tslint/lib/rules/arrowParensRule.js
index 5af83227d..49f869560 100644
--- a/node_modules/tslint/lib/rules/arrowParensRule.js
+++ b/node_modules/tslint/lib/rules/arrowParensRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
description: "Requires parentheses around the parameters of arrow function definitions.",
hasFix: true,
rationale: "Maintains stylistic consistency with other arrow function definitions.",
- optionsDescription: (_a = ["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], _a.raw = ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], Lint.Utils.dedent(_a, BAN_SINGLE_ARG_PARENS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."])), BAN_SINGLE_ARG_PARENS),
options: {
type: "string",
enum: [BAN_SINGLE_ARG_PARENS],
@@ -69,8 +69,10 @@ function walk(ctx) {
}
else if (ctx.options.banSingleArgParens) {
var closeParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.CloseParenToken);
+ var charBeforeOpenParen = ctx.sourceFile.text.substring(openParen.pos - 1, openParen.pos);
+ var replaceValue = charBeforeOpenParen.match(/[a-z]/i) !== null ? " " : "";
ctx.addFailureAtNode(node.parameters[0], Rule.FAILURE_STRING_EXISTS, [
- Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), " "),
+ Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), replaceValue),
Lint.Replacement.deleteFromTo(node.parameters[0].end, closeParen.end),
]);
}
@@ -92,4 +94,4 @@ function isSimpleParameter(parameter) {
&& parameter.questionToken === undefined
&& parameter.type === undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
index 221a0b522..3cd37b60a 100644
--- a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
index 41ccb332e..3f869f765 100644
--- a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
@@ -40,7 +40,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "arrow-return-shorthand",
description: "Suggests to convert `() => { return x; }` to `() => x`.",
hasFix: true,
- optionsDescription: (_a = ["\n If `", "` is specified, then this will warn even if the function spans multiple lines."], _a.raw = ["\n If \\`", "\\` is specified, then this will warn even if the function spans multiple lines."], Lint.Utils.dedent(_a, OPTION_MULTILINE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then this will warn even if the function spans multiple lines."], ["\n If \\`", "\\` is specified, then this will warn even if the function spans multiple lines."])), OPTION_MULTILINE),
options: {
type: "string",
enum: [OPTION_MULTILINE],
@@ -49,6 +49,7 @@ var Rule = /** @class */ (function (_super) {
true,
[true, OPTION_MULTILINE],
],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It's unnecessary to include `return` and `{}` brackets in arrow lambdas.\n Leaving them out results in simpler and easier to read code.\n "], ["\n It's unnecessary to include \\`return\\` and \\`{}\\` brackets in arrow lambdas.\n Leaving them out results in simpler and easier to read code.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -70,11 +71,11 @@ function walk(ctx) {
}
function createFix(arrowFunction, body, expr, text) {
var statement = expr.parent;
- var returnKeyword = Lint.childOfKind(statement, ts.SyntaxKind.ReturnKeyword);
- var arrow = Lint.childOfKind(arrowFunction, ts.SyntaxKind.EqualsGreaterThanToken);
- var openBrace = Lint.childOfKind(body, ts.SyntaxKind.OpenBraceToken);
- var closeBrace = Lint.childOfKind(body, ts.SyntaxKind.CloseBraceToken);
- var semicolon = Lint.childOfKind(statement, ts.SyntaxKind.SemicolonToken);
+ var returnKeyword = utils.getChildOfKind(statement, ts.SyntaxKind.ReturnKeyword);
+ var arrow = utils.getChildOfKind(arrowFunction, ts.SyntaxKind.EqualsGreaterThanToken);
+ var openBrace = utils.getChildOfKind(body, ts.SyntaxKind.OpenBraceToken);
+ var closeBrace = utils.getChildOfKind(body, ts.SyntaxKind.CloseBraceToken);
+ var semicolon = utils.getChildOfKind(statement, ts.SyntaxKind.SemicolonToken);
var anyComments = hasComments(arrow) || hasComments(openBrace) || hasComments(statement) || hasComments(returnKeyword) ||
hasComments(expr) || (semicolon !== undefined && hasComments(semicolon)) || hasComments(closeBrace);
return anyComments ? undefined : (expr.kind === ts.SyntaxKind.ObjectLiteralExpression ? [
@@ -98,4 +99,4 @@ function getSimpleReturnExpression(block) {
? block.statements[0].expression
: undefined;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
index b5a31ed7b..e54ae8844 100644
--- a/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.js b/node_modules/tslint/lib/rules/awaitPromiseRule.js
index cb1c35b08..c6eef346f 100644
--- a/node_modules/tslint/lib/rules/awaitPromiseRule.js
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "await-promise",
description: "Warns for an awaited value that is not a Promise.",
- optionsDescription: (_a = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], _a.raw = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "], ["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "]))),
options: {
type: "list",
listType: {
@@ -42,6 +42,7 @@ var Rule = /** @class */ (function (_super) {
},
},
optionExamples: [true, [true, "Thenable"]],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "], ["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -70,8 +71,13 @@ function walk(ctx, tc) {
}
}
function containsType(type, predicate) {
- if (Lint.isTypeFlagSet(type, ts.TypeFlags.Any) ||
- tsutils_1.isTypeReference(type) && type.target.symbol !== undefined && predicate(type.target.symbol.name)) {
+ if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any)) {
+ return true;
+ }
+ if (tsutils_1.isTypeReference(type)) {
+ type = type.target;
+ }
+ if (type.symbol !== undefined && predicate(type.symbol.name)) {
return true;
}
if (tsutils_1.isUnionOrIntersectionType(type)) {
@@ -83,4 +89,4 @@ function containsType(type, predicate) {
function isAsyncIterable(name) {
return name === "AsyncIterable" || name === "AsyncIterableIterator";
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts b/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
+++ b/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/banCommaOperatorRule.js b/node_modules/tslint/lib/rules/banCommaOperatorRule.js
index 2a5bcede0..e81084295 100644
--- a/node_modules/tslint/lib/rules/banCommaOperatorRule.js
+++ b/node_modules/tslint/lib/rules/banCommaOperatorRule.js
@@ -28,26 +28,33 @@ var Rule = /** @class */ (function (_super) {
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk);
};
- /* tslint:disable:object-literal-sort-keys */
+ /* tslint:disable:object-literal-sort-keys max-line-length */
Rule.metadata = {
ruleName: "ban-comma-operator",
- description: "Bans the comma operator.",
+ description: "Disallows the comma operator to be used.",
+ descriptionDetails: "[Read more about the comma operator here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator).",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.\n\n ### Examples\n ```\n foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious\n ```\n\n ```\n switch (foo) {\n case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'\n return true;\n case 3:\n return false;\n }\n ```\n\n ```\n let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.\n ```\n "], ["\n Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.\n\n ### Examples\n \\`\\`\\`\n foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious\n \\`\\`\\`\n\n \\`\\`\\`\n switch (foo) {\n case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'\n return true;\n case 3:\n return false;\n }\n \\`\\`\\`\n\n \\`\\`\\`\n let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.\n \\`\\`\\`\n "]))),
options: null,
optionsDescription: "",
optionExamples: [true],
- type: "typescript",
- typescriptOnly: true,
+ type: "functionality",
+ typescriptOnly: false,
};
- /* tslint:enable:object-literal-sort-keys */
- Rule.FAILURE_STRING = "Don't use the comma operator.";
+ /* tslint:enable:object-literal-sort-keys max-line-length */
+ Rule.FAILURE_STRING = "Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs.";
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
- if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.CommaToken) {
+ if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.CommaToken && !isForLoopIncrementor(node)) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
+function isForLoopIncrementor(node) {
+ var parent = node.parent;
+ return parent.kind === ts.SyntaxKind.ForStatement && parent.incrementor === node;
+}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/banRule.js b/node_modules/tslint/lib/rules/banRule.js
index ab4e8b096..a87a1f3a7 100644
--- a/node_modules/tslint/lib/rules/banRule.js
+++ b/node_modules/tslint/lib/rules/banRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "ban",
description: "Bans the use of specific functions or global methods.",
- optionsDescription: (_a = ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: `\"functionName\"`\n * the name of the function in an array with one element: `[\"functionName\"]`\n * an object in the following format: `{\"name\": \"functionName\", \"message\": \"optional explanation message\"}`\n * banning methods:\n * an array with the object name, method name and optional message: `[\"functionName\", \"methodName\", \"optional message\"]`\n * an object in the following format: `{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}`\n * you can also ban deeply nested methods: `{\"name\": [\"foo\", \"bar\", \"baz\"]}` bans `foo.bar.baz()`\n * the first element can contain a wildcard (`*`) that matches everything. `{\"name\": [\"*\", \"forEach\"]}` bans `[].forEach(...)`, `$(...).forEach(...)`, `arr.forEach(...)`, etc.\n "], _a.raw = ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: \\`\"functionName\"\\`\n * the name of the function in an array with one element: \\`[\"functionName\"]\\`\n * an object in the following format: \\`{\"name\": \"functionName\", \"message\": \"optional explanation message\"}\\`\n * banning methods:\n * an array with the object name, method name and optional message: \\`[\"functionName\", \"methodName\", \"optional message\"]\\`\n * an object in the following format: \\`{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}\\`\n * you can also ban deeply nested methods: \\`{\"name\": [\"foo\", \"bar\", \"baz\"]}\\` bans \\`foo.bar.baz()\\`\n * the first element can contain a wildcard (\\`*\\`) that matches everything. \\`{\"name\": [\"*\", \"forEach\"]}\\` bans\\\n \\`[].forEach(...)\\`, \\`$(...).forEach(...)\\`, \\`arr.forEach(...)\\`, etc.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: `\"functionName\"`\n * the name of the function in an array with one element: `[\"functionName\"]`\n * an object in the following format: `{\"name\": \"functionName\", \"message\": \"optional explanation message\"}`\n * banning methods:\n * an array with the object name, method name and optional message: `[\"functionName\", \"methodName\", \"optional message\"]`\n * an object in the following format: `{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}`\n * you can also ban deeply nested methods: `{\"name\": [\"foo\", \"bar\", \"baz\"]}` bans `foo.bar.baz()`\n * the first element can contain a wildcard (`*`) that matches everything. `{\"name\": [\"*\", \"forEach\"]}` bans `[].forEach(...)`, `$(...).forEach(...)`, `arr.forEach(...)`, etc.\n "], ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: \\`\"functionName\"\\`\n * the name of the function in an array with one element: \\`[\"functionName\"]\\`\n * an object in the following format: \\`{\"name\": \"functionName\", \"message\": \"optional explanation message\"}\\`\n * banning methods:\n * an array with the object name, method name and optional message: \\`[\"functionName\", \"methodName\", \"optional message\"]\\`\n * an object in the following format: \\`{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}\\`\n * you can also ban deeply nested methods: \\`{\"name\": [\"foo\", \"bar\", \"baz\"]}\\` bans \\`foo.bar.baz()\\`\n * the first element can contain a wildcard (\\`*\\`) that matches everything. \\`{\"name\": [\"*\", \"forEach\"]}\\` bans\\\n \\`[].forEach(...)\\`, \\`$(...).forEach(...)\\`, \\`arr.forEach(...)\\`, etc.\n "]))),
options: {
type: "list",
listType: {
@@ -171,4 +171,4 @@ var BanFunctionWalker = /** @class */ (function (_super) {
};
return BanFunctionWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/banTypesRule.d.ts b/node_modules/tslint/lib/rules/banTypesRule.d.ts
index 35b876994..931ef3657 100644
--- a/node_modules/tslint/lib/rules/banTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/banTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/banTypesRule.js b/node_modules/tslint/lib/rules/banTypesRule.js
index 0e8fe73f1..bcb971f80 100644
--- a/node_modules/tslint/lib/rules/banTypesRule.js
+++ b/node_modules/tslint/lib/rules/banTypesRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "ban-types",
- description: (_a = ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], _a.raw = ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."]))),
options: {
type: "list",
listType: {
@@ -45,7 +45,7 @@ var Rule = /** @class */ (function (_super) {
maxLength: 2,
},
},
- optionsDescription: (_b = ["\n A list of `[\"regex\", \"optional explanation here\"]`, which bans\n types that match `regex`"], _b.raw = ["\n A list of \\`[\"regex\", \"optional explanation here\"]\\`, which bans\n types that match \\`regex\\`"], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A list of `[\"regex\", \"optional explanation here\"]`, which bans\n types that match `regex`"], ["\n A list of \\`[\"regex\", \"optional explanation here\"]\\`, which bans\n types that match \\`regex\\`"]))),
optionExamples: [[true, ["Object", "Use {} instead."], ["String"]]],
type: "typescript",
typescriptOnly: true,
@@ -72,4 +72,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
+++ b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
index b11273d40..87a6f2bed 100644
--- a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
+++ b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
@@ -32,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "binary-expression-operand-order",
- description: (_a = ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], _a.raw = ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Expressions like `1 + x` are sometimes referred to as \"Yoda\" expressions because they read\n opposite to how we would normally speak the expression.\n\n Sticking to a consistent grammar for conditions helps keep code readable and understandable.\n "], ["\n Expressions like \\`1 + x\\` are sometimes referred to as \"Yoda\" expressions because they read\n opposite to how we would normally speak the expression.\n\n Sticking to a consistent grammar for conditions helps keep code readable and understandable.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -90,4 +91,4 @@ function isLiteral(node) {
return false;
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.d.ts b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
index 46cb6b262..a731d581d 100644
--- a/node_modules/tslint/lib/rules/callableTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.js b/node_modules/tslint/lib/rules/callableTypesRule.js
index 8c4813225..3e569fe1c 100644
--- a/node_modules/tslint/lib/rules/callableTypesRule.js
+++ b/node_modules/tslint/lib/rules/callableTypesRule.js
@@ -97,6 +97,7 @@ function shouldWrapSuggestion(parent) {
switch (parent.kind) {
case ts.SyntaxKind.UnionType:
case ts.SyntaxKind.IntersectionType:
+ case ts.SyntaxKind.ArrayType:
return true;
default:
return false;
diff --git a/node_modules/tslint/lib/rules/classNameRule.d.ts b/node_modules/tslint/lib/rules/classNameRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/classNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/classNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/classNameRule.js b/node_modules/tslint/lib/rules/classNameRule.js
index cf9acbe33..3d72541e2 100644
--- a/node_modules/tslint/lib/rules/classNameRule.js
+++ b/node_modules/tslint/lib/rules/classNameRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "class-name",
description: "Enforces PascalCased class and interface names.",
- rationale: "Makes it easy to differentiate classes from regular variables at a glance.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Makes it easy to differentiate classes from regular variables at a glance.\n\n JavaScript and general programming convention is to refer to classes in PascalCase.\n It's confusing to use camelCase or other conventions for class names.\n "], ["\n Makes it easy to differentiate classes from regular variables at a glance.\n\n JavaScript and general programming convention is to refer to classes in PascalCase.\n It's confusing to use camelCase or other conventions for class names.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -49,13 +49,11 @@ function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isClassLikeDeclaration(node) && node.name !== undefined ||
tsutils_1.isInterfaceDeclaration(node)) {
- if (!isPascalCased(node.name.text)) {
+ if (!utils_1.isPascalCased(node.name.text)) {
ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING);
}
}
return ts.forEachChild(node, cb);
});
}
-function isPascalCased(name) {
- return utils_1.isUpperCase(name[0]) && !name.includes("_");
-}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.d.ts b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
index 5de68b5db..3f9d070dd 100644
--- a/node_modules/tslint/lib/rules/commentFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.js b/node_modules/tslint/lib/rules/commentFormatRule.js
index ca4027362..050a251dd 100644
--- a/node_modules/tslint/lib/rules/commentFormatRule.js
+++ b/node_modules/tslint/lib/rules/commentFormatRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "comment-format",
description: "Enforces formatting rules for single-line comments.",
rationale: "Helps maintain a consistent, readable style in your codebase.",
- optionsDescription: (_a = ["\n Three arguments may be optionally provided:\n\n * `\"check-space\"` requires that all single-line comments must begin with a space, as in `// comment`\n * note that for comments starting with multiple slashes, e.g. `///`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * `\"check-lowercase\"` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * `\"check-uppercase\"` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to `\"check-lowercase\"` or `\"check-uppercase\"` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * `\"ignore-words\"` - array of strings - words that will be ignored at the beginning of the comment.\n * `\"ignore-pattern\"` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], _a.raw = ["\n Three arguments may be optionally provided:\n\n * \\`\"check-space\"\\` requires that all single-line comments must begin with a space, as in \\`// comment\\`\n * note that for comments starting with multiple slashes, e.g. \\`///\\`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * \\`\"check-lowercase\"\\` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * \\`\"check-uppercase\"\\` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to \\`\"check-lowercase\"\\` or \\`\"check-uppercase\"\\` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * \\`\"ignore-words\"\\` - array of strings - words that will be ignored at the beginning of the comment.\n * \\`\"ignore-pattern\"\\` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Three arguments may be optionally provided:\n\n * `\"check-space\"` requires that all single-line comments must begin with a space, as in `// comment`\n * note that for comments starting with multiple slashes, e.g. `///`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * `\"check-lowercase\"` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * `\"check-uppercase\"` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to `\"check-lowercase\"` or `\"check-uppercase\"` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * `\"ignore-words\"` - array of strings - words that will be ignored at the beginning of the comment.\n * `\"ignore-pattern\"` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], ["\n Three arguments may be optionally provided:\n\n * \\`\"check-space\"\\` requires that all single-line comments must begin with a space, as in \\`// comment\\`\n * note that for comments starting with multiple slashes, e.g. \\`///\\`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * \\`\"check-lowercase\"\\` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * \\`\"check-uppercase\"\\` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to \\`\"check-lowercase\"\\` or \\`\"check-uppercase\"\\` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * \\`\"ignore-words\"\\` - array of strings - words that will be ignored at the beginning of the comment.\n * \\`\"ignore-pattern\"\\` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "]))),
options: {
type: "array",
items: {
@@ -79,6 +79,7 @@ var Rule = /** @class */ (function (_super) {
],
type: "style",
typescriptOnly: false,
+ hasFix: true,
};
/* tslint:enable:object-literal-sort-keys */
Rule.LOWERCASE_FAILURE = "comment must start with lowercase letter";
@@ -140,7 +141,7 @@ function walk(ctx) {
return;
}
if (ctx.options.space && commentText[0] !== " ") {
- ctx.addFailure(start, end, Rule.LEADING_SPACE_FAILURE);
+ ctx.addFailure(start, end, Rule.LEADING_SPACE_FAILURE, [Lint.Replacement.appendText(start, " ")]);
}
if (ctx.options.case === 0 /* None */ ||
ctx.options.exceptions !== undefined && ctx.options.exceptions.test(commentText) ||
@@ -162,4 +163,4 @@ function walk(ctx) {
}
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js b/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
index fdc7dabd0..99621fa18 100644
--- a/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
+++ b/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
@@ -17,8 +17,8 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
-var Lint = require("../../index");
var completedDocsRule_1 = require("../completedDocsRule");
var exclusion_1 = require("./exclusion");
var BlockExclusion = /** @class */ (function (_super) {
@@ -32,7 +32,7 @@ var BlockExclusion = /** @class */ (function (_super) {
if (this.visibilities.has(completedDocsRule_1.ALL)) {
return false;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
return !this.visibilities.has(completedDocsRule_1.VISIBILITY_EXPORTED);
}
return !this.visibilities.has(completedDocsRule_1.VISIBILITY_INTERNAL);
diff --git a/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts b/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
index a6f24bbe7..c2661a18d 100644
--- a/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
@@ -25,6 +25,6 @@ export declare class ClassExclusion extends Exclusion<IClassExclusionDescriptor>
readonly locations: Set<Location>;
readonly privacies: Set<Privacy>;
excludes(node: ts.Node): boolean;
- private shouldLocationBeDocumented(node);
- private shouldPrivacyBeDocumented(node);
+ private shouldLocationBeDocumented;
+ private shouldPrivacyBeDocumented;
}
diff --git a/node_modules/tslint/lib/rules/completed-docs/classExclusion.js b/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
index 4c8c8ec57..5fffc2e62 100644
--- a/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
+++ b/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
@@ -17,8 +17,8 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
-var Lint = require("../../index");
var completedDocsRule_1 = require("../completedDocsRule");
var exclusion_1 = require("./exclusion");
var ClassExclusion = /** @class */ (function (_super) {
@@ -37,7 +37,7 @@ var ClassExclusion = /** @class */ (function (_super) {
if (this.locations.has(completedDocsRule_1.ALL)) {
return true;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword)) {
return this.locations.has(completedDocsRule_1.LOCATION_STATIC);
}
return this.locations.has(completedDocsRule_1.LOCATION_INSTANCE);
@@ -46,10 +46,10 @@ var ClassExclusion = /** @class */ (function (_super) {
if (this.privacies.has(completedDocsRule_1.ALL)) {
return true;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword)) {
return this.privacies.has(completedDocsRule_1.PRIVACY_PRIVATE);
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword)) {
return this.privacies.has(completedDocsRule_1.PRIVACY_PROTECTED);
}
return this.privacies.has(completedDocsRule_1.PRIVACY_PUBLIC);
diff --git a/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts b/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
index aacf39d73..3148a1ee6 100644
--- a/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
@@ -1,8 +1,25 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { DocType } from "../completedDocsRule";
import { Exclusion } from "./exclusion";
import { IInputExclusionDescriptors } from "./exclusionDescriptors";
+export declare type ExclusionsMap = Map<DocType, Array<Exclusion<any>>>;
export declare class ExclusionFactory {
- constructExclusionsMap(ruleArguments: IInputExclusionDescriptors[]): Map<DocType, Array<Exclusion<any>>>;
- private addRequirements(exclusionsMap, descriptors);
- private createRequirementsForDocType(docType, descriptor);
+ constructExclusionsMap(ruleArguments: IInputExclusionDescriptors[]): ExclusionsMap;
+ private addRequirements;
+ private createRequirementsForDocType;
}
diff --git a/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts b/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
index d13121323..57fd0cf8d 100644
--- a/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
@@ -29,6 +29,6 @@ export declare class TagExclusion extends Exclusion<ITagExclusionDescriptor> {
private readonly contentTags;
private readonly existenceTags;
excludes(node: ts.Node): boolean;
- private getDocumentationNode(node);
- private parseTagsWithContents(nodeText);
+ private getDocumentationNode;
+ private parseTagsWithContents;
}
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.d.ts b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
index 67c76d562..d876d8c64 100644
--- a/node_modules/tslint/lib/rules/completedDocsRule.d.ts
+++ b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
import { IInputExclusionDescriptors } from "./completed-docs/exclusionDescriptors";
@@ -22,7 +38,7 @@ export declare const PRIVACY_PRIVATE = "private";
export declare const PRIVACY_PROTECTED = "protected";
export declare const PRIVACY_PUBLIC = "public";
export declare const TAGS_FOR_CONTENT = "content";
-export declare const TAGS_FOR_EXISTENCE = "exists";
+export declare const TAGS_FOR_EXISTENCE = "existence";
export declare const VISIBILITY_EXPORTED = "exported";
export declare const VISIBILITY_INTERNAL = "internal";
export declare type All = typeof ALL;
@@ -35,16 +51,23 @@ export declare class Rule extends Lint.Rules.TypedRule {
static defaultArguments: IInputExclusionDescriptors;
static ARGUMENT_DESCRIPTOR_BLOCK: {
properties: {
- [x: string]: {
+ [DESCRIPTOR_TAGS]: {
properties: {
- [x: string]: {
+ [TAGS_FOR_CONTENT]: {
+ items: {
+ type: string;
+ };
+ type: string;
+ };
+ [TAGS_FOR_EXISTENCE]: {
items: {
type: string;
};
type: string;
};
};
- } | {
+ };
+ [DESCRIPTOR_VISIBILITIES]: {
enum: string[];
type: string;
};
@@ -53,16 +76,27 @@ export declare class Rule extends Lint.Rules.TypedRule {
};
static ARGUMENT_DESCRIPTOR_CLASS: {
properties: {
- [x: string]: {
+ [DESCRIPTOR_TAGS]: {
properties: {
- [x: string]: {
+ [TAGS_FOR_CONTENT]: {
+ items: {
+ type: string;
+ };
+ type: string;
+ };
+ [TAGS_FOR_EXISTENCE]: {
items: {
type: string;
};
type: string;
};
};
- } | {
+ };
+ [DESCRIPTOR_LOCATIONS]: {
+ enum: string[];
+ type: string;
+ };
+ [DESCRIPTOR_PRIVACIES]: {
enum: string[];
type: string;
};
@@ -72,5 +106,5 @@ export declare class Rule extends Lint.Rules.TypedRule {
static metadata: Lint.IRuleMetadata;
private readonly exclusionFactory;
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
- private getExclusionsMap(ruleArguments);
+ private getExclusionsMap;
}
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.js b/node_modules/tslint/lib/rules/completedDocsRule.js
index d64315563..9333c44ac 100644
--- a/node_modules/tslint/lib/rules/completedDocsRule.js
+++ b/node_modules/tslint/lib/rules/completedDocsRule.js
@@ -17,7 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
-var tsutils_1 = require("tsutils");
+var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
var ts = require("typescript");
var Lint = require("../index");
var exclusionFactory_1 = require("./completed-docs/exclusionFactory");
@@ -42,7 +42,7 @@ exports.PRIVACY_PRIVATE = "private";
exports.PRIVACY_PROTECTED = "protected";
exports.PRIVACY_PUBLIC = "public";
exports.TAGS_FOR_CONTENT = "content";
-exports.TAGS_FOR_EXISTENCE = "exists";
+exports.TAGS_FOR_EXISTENCE = "existence";
exports.VISIBILITY_EXPORTED = "exported";
exports.VISIBILITY_INTERNAL = "internal";
var Rule = /** @class */ (function (_super) {
@@ -55,9 +55,8 @@ var Rule = /** @class */ (function (_super) {
}
Rule.prototype.applyWithProgram = function (sourceFile, program) {
var options = this.getOptions();
- var completedDocsWalker = new CompletedDocsWalker(sourceFile, options, program);
- completedDocsWalker.setExclusionsMap(this.getExclusionsMap(options.ruleArguments));
- return this.applyWithWalker(completedDocsWalker);
+ var exclusionsMap = this.getExclusionsMap(options.ruleArguments);
+ return this.applyWithFunction(sourceFile, walk, exclusionsMap, program.getTypeChecker());
};
Rule.prototype.getExclusionsMap = function (ruleArguments) {
if (ruleArguments.length === 0) {
@@ -162,8 +161,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "completed-docs",
- description: "Enforces documentation for important items be filled out.",
- optionsDescription: (_k = ["\n `true` to enable for [", "]],\n or an array with each item in one of two formats:\n\n * `string` to enable for that type\n * `object` keying types to when their documentation is required:\n * `\"", "\"` and `\"", "\"` may specify:\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * Other types may specify `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * All types may also provide `\"", "\"`\n with members specifying tags that allow the docs to not have a body.\n * `\"", "\"`: Object mapping tags to `RegExp` bodies content allowed to count as complete docs.\n * `\"", "\"`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`"], _k.raw = ["\n \\`true\\` to enable for [", "]],\n or an array with each item in one of two formats:\n\n * \\`string\\` to enable for that type\n * \\`object\\` keying types to when their documentation is required:\n * \\`\"", "\"\\` and \\`\"", "\"\\` may specify:\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * Other types may specify \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * All types may also provide \\`\"", "\"\\`\n with members specifying tags that allow the docs to not have a body.\n * \\`\"", "\"\\`: Object mapping tags to \\`RegExp\\` bodies content allowed to count as complete docs.\n * \\`\"", "\"\\`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`"], Lint.Utils.dedent(_k, Object.keys(Rule.defaultArguments).join(", "), exports.ARGUMENT_METHODS, exports.ARGUMENT_PROPERTIES, exports.DESCRIPTOR_PRIVACIES, exports.ALL, exports.PRIVACY_PRIVATE, exports.PRIVACY_PROTECTED, exports.PRIVACY_PUBLIC, exports.DESCRIPTOR_LOCATIONS, exports.ALL, exports.LOCATION_INSTANCE, exports.LOCATION_STATIC, exports.DESCRIPTOR_VISIBILITIES, exports.ALL, exports.VISIBILITY_EXPORTED, exports.VISIBILITY_INTERNAL, exports.DESCRIPTOR_TAGS, exports.TAGS_FOR_CONTENT, exports.TAGS_FOR_EXISTENCE, exports.ARGUMENT_CLASSES, exports.ARGUMENT_ENUMS, exports.ARGUMENT_ENUM_MEMBERS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_INTERFACES, exports.ARGUMENT_METHODS, exports.ARGUMENT_NAMESPACES, exports.ARGUMENT_PROPERTIES, exports.ARGUMENT_TYPES, exports.ARGUMENT_VARIABLES)),
+ description: "Enforces JSDoc comments for important items be filled out.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n `true` to enable for `[", "]`,\n or an array with each item in one of two formats:\n\n * `string` to enable for that type\n * `object` keying types to when their documentation is required:\n * `\"", "\"` and `\"", "\"` may specify:\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * Other types may specify `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * All types may also provide `\"", "\"`\n with members specifying tags that allow the docs to not have a body.\n * `\"", "\"`: Object mapping tags to `RegExp` bodies content allowed to count as complete docs.\n * `\"", "\"`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`"], ["\n \\`true\\` to enable for \\`[", "]\\`,\n or an array with each item in one of two formats:\n\n * \\`string\\` to enable for that type\n * \\`object\\` keying types to when their documentation is required:\n * \\`\"", "\"\\` and \\`\"", "\"\\` may specify:\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * Other types may specify \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * All types may also provide \\`\"", "\"\\`\n with members specifying tags that allow the docs to not have a body.\n * \\`\"", "\"\\`: Object mapping tags to \\`RegExp\\` bodies content allowed to count as complete docs.\n * \\`\"", "\"\\`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`"])), Object.keys(Rule.defaultArguments).join(", "), exports.ARGUMENT_METHODS, exports.ARGUMENT_PROPERTIES, exports.DESCRIPTOR_PRIVACIES, exports.ALL, exports.PRIVACY_PRIVATE, exports.PRIVACY_PROTECTED, exports.PRIVACY_PUBLIC, exports.DESCRIPTOR_LOCATIONS, exports.ALL, exports.LOCATION_INSTANCE, exports.LOCATION_STATIC, exports.DESCRIPTOR_VISIBILITIES, exports.ALL, exports.VISIBILITY_EXPORTED, exports.VISIBILITY_INTERNAL, exports.DESCRIPTOR_TAGS, exports.TAGS_FOR_CONTENT, exports.TAGS_FOR_EXISTENCE, exports.ARGUMENT_CLASSES, exports.ARGUMENT_ENUMS, exports.ARGUMENT_ENUM_MEMBERS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_INTERFACES, exports.ARGUMENT_METHODS, exports.ARGUMENT_NAMESPACES, exports.ARGUMENT_PROPERTIES, exports.ARGUMENT_TYPES, exports.ARGUMENT_VARIABLES),
options: {
type: "array",
items: {
@@ -184,18 +183,18 @@ var Rule = /** @class */ (function (_super) {
},
{
type: "object",
- properties: (_l = {},
- _l[exports.ARGUMENT_CLASSES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_ENUMS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_ENUM_MEMBERS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_FUNCTIONS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_INTERFACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_METHODS] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
- _l[exports.ARGUMENT_NAMESPACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_PROPERTIES] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
- _l[exports.ARGUMENT_TYPES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_VARIABLES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l),
+ properties: (_k = {},
+ _k[exports.ARGUMENT_CLASSES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_ENUMS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_ENUM_MEMBERS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_FUNCTIONS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_INTERFACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_METHODS] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _k[exports.ARGUMENT_NAMESPACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_PROPERTIES] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _k[exports.ARGUMENT_TYPES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_VARIABLES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k),
},
],
},
@@ -205,24 +204,27 @@ var Rule = /** @class */ (function (_super) {
[true, exports.ARGUMENT_ENUMS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_METHODS],
[
true,
- (_m = {},
- _m[exports.ARGUMENT_ENUMS] = true,
- _m[exports.ARGUMENT_FUNCTIONS] = (_o = {},
- _o[exports.DESCRIPTOR_VISIBILITIES] = [exports.VISIBILITY_EXPORTED],
+ (_l = {},
+ _l[exports.ARGUMENT_ENUMS] = true,
+ _l[exports.ARGUMENT_FUNCTIONS] = (_m = {},
+ _m[exports.DESCRIPTOR_VISIBILITIES] = [exports.VISIBILITY_EXPORTED],
+ _m),
+ _l[exports.ARGUMENT_METHODS] = (_o = {},
+ _o[exports.DESCRIPTOR_LOCATIONS] = exports.LOCATION_INSTANCE,
+ _o[exports.DESCRIPTOR_PRIVACIES] = [exports.PRIVACY_PUBLIC, exports.PRIVACY_PROTECTED],
_o),
- _m[exports.ARGUMENT_METHODS] = (_p = {},
- _p[exports.DESCRIPTOR_LOCATIONS] = exports.LOCATION_INSTANCE,
- _p[exports.DESCRIPTOR_PRIVACIES] = [exports.PRIVACY_PUBLIC, exports.PRIVACY_PROTECTED],
+ _l[exports.ARGUMENT_PROPERTIES] = (_p = {},
+ _p[exports.DESCRIPTOR_TAGS] = (_q = {},
+ _q[exports.TAGS_FOR_CONTENT] = {
+ see: ["#.*"],
+ },
+ _q[exports.TAGS_FOR_EXISTENCE] = ["inheritdoc"],
+ _q),
_p),
- _m[exports.DESCRIPTOR_TAGS] = (_q = {},
- _q[exports.TAGS_FOR_CONTENT] = {
- see: ["#.*"],
- },
- _q[exports.TAGS_FOR_EXISTENCE] = ["inheritdoc"],
- _q),
- _m),
+ _l),
],
],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Helps ensure important components are documented.\n\n Note: use this rule sparingly. It's better to have self-documenting names on components with single, consice responsibilities.\n Comments that only restate the names of variables add nothing to code, and can easily become outdated.\n "], ["\n Helps ensure important components are documented.\n\n Note: use this rule sparingly. It's better to have self-documenting names on components with single, consice responsibilities.\n Comments that only restate the names of variables add nothing to code, and can easily become outdated.\n "]))),
type: "style",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -230,63 +232,72 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-var CompletedDocsWalker = /** @class */ (function (_super) {
- tslib_1.__extends(CompletedDocsWalker, _super);
- function CompletedDocsWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+var modifierAliases = {
+ export: "exported",
+};
+function walk(context, typeChecker) {
+ return ts.forEachChild(context.sourceFile, cb);
+ function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ClassDeclaration:
+ checkNode(node, exports.ARGUMENT_CLASSES);
+ break;
+ case ts.SyntaxKind.EnumDeclaration:
+ checkNode(node, exports.ARGUMENT_ENUMS);
+ for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
+ var member = _a[_i];
+ // Enum members don't have modifiers, so use the parent
+ // enum declaration when checking the requirements.
+ checkNode(member, exports.ARGUMENT_ENUM_MEMBERS, node);
+ }
+ break;
+ case ts.SyntaxKind.FunctionDeclaration:
+ checkNode(node, exports.ARGUMENT_FUNCTIONS);
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ checkNode(node, exports.ARGUMENT_INTERFACES);
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ if (node.parent.kind !== ts.SyntaxKind.ObjectLiteralExpression) {
+ checkNode(node, exports.ARGUMENT_METHODS);
+ }
+ break;
+ case ts.SyntaxKind.ModuleDeclaration:
+ checkNode(node, exports.ARGUMENT_NAMESPACES);
+ break;
+ case ts.SyntaxKind.PropertyDeclaration:
+ checkNode(node, exports.ARGUMENT_PROPERTIES);
+ break;
+ case ts.SyntaxKind.TypeAliasDeclaration:
+ checkNode(node, exports.ARGUMENT_TYPES);
+ break;
+ case ts.SyntaxKind.VariableStatement:
+ // Only check variables at the namespace/module-level or file-level
+ // and not variables declared inside functions and other things.
+ switch (node.parent.kind) {
+ case ts.SyntaxKind.SourceFile:
+ case ts.SyntaxKind.ModuleBlock:
+ for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) {
+ var declaration = _c[_b];
+ checkNode(declaration, exports.ARGUMENT_VARIABLES, node);
+ }
+ }
+ break;
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ if (node.parent.kind !== ts.SyntaxKind.ObjectLiteralExpression) {
+ checkNode(node, exports.ARGUMENT_PROPERTIES);
+ }
+ }
+ return ts.forEachChild(node, cb);
}
- CompletedDocsWalker.prototype.setExclusionsMap = function (exclusionsMap) {
- this.exclusionsMap = exclusionsMap;
- };
- CompletedDocsWalker.prototype.visitClassDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_CLASSES);
- _super.prototype.visitClassDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitEnumDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_ENUMS);
- _super.prototype.visitEnumDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitEnumMember = function (node) {
- // Enum members don't have modifiers, so use the parent
- // enum declaration when checking the requirements.
- this.checkNode(node, exports.ARGUMENT_ENUM_MEMBERS, node.parent);
- _super.prototype.visitEnumMember.call(this, node);
- };
- CompletedDocsWalker.prototype.visitFunctionDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_FUNCTIONS);
- _super.prototype.visitFunctionDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitInterfaceDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_INTERFACES);
- _super.prototype.visitInterfaceDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitMethodDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_METHODS);
- _super.prototype.visitMethodDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitModuleDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_NAMESPACES);
- _super.prototype.visitModuleDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitPropertyDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_PROPERTIES);
- _super.prototype.visitPropertyDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitTypeAliasDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_TYPES);
- _super.prototype.visitTypeAliasDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitVariableDeclaration = function (node) {
- this.checkVariable(node);
- _super.prototype.visitVariableDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.checkNode = function (node, nodeType, requirementNode) {
+ function checkNode(node, nodeType, requirementNode) {
if (requirementNode === void 0) { requirementNode = node; }
var name = node.name;
if (name === undefined) {
return;
}
- var exclusions = this.exclusionsMap.get(nodeType);
+ var exclusions = context.options.get(nodeType);
if (exclusions === undefined) {
return;
}
@@ -296,62 +307,38 @@ var CompletedDocsWalker = /** @class */ (function (_super) {
return;
}
}
- var symbol = this.getTypeChecker().getSymbolAtLocation(name);
+ var symbol = typeChecker.getSymbolAtLocation(name);
if (symbol === undefined) {
return;
}
- var comments = symbol.getDocumentationComment();
- this.checkComments(node, this.describeNode(nodeType), comments, requirementNode);
- };
- CompletedDocsWalker.prototype.checkVariable = function (node) {
- // Only check variables in variable declaration lists
- // and not variables in catch clauses and for loops.
- var list = node.parent;
- if (!tsutils_1.isVariableDeclarationList(list)) {
- return;
- }
- var statement = list.parent;
- if (!tsutils_1.isVariableStatement(statement)) {
- return;
- }
- // Only check variables at the namespace/module-level or file-level
- // and not variables declared inside functions and other things.
- switch (statement.parent.kind) {
- case ts.SyntaxKind.SourceFile:
- case ts.SyntaxKind.ModuleBlock:
- this.checkNode(node, exports.ARGUMENT_VARIABLES, statement);
- }
- };
- CompletedDocsWalker.prototype.checkComments = function (node, nodeDescriptor, comments, requirementNode) {
+ var comments = symbol.getDocumentationComment(typeChecker);
+ checkComments(node, describeNode(nodeType), comments, requirementNode);
+ }
+ function checkComments(node, nodeDescriptor, comments, requirementNode) {
if (comments.map(function (comment) { return comment.text; }).join("").trim() === "") {
- this.addDocumentationFailure(node, nodeDescriptor, requirementNode);
+ addDocumentationFailure(node, nodeDescriptor, requirementNode);
}
- };
- CompletedDocsWalker.prototype.addDocumentationFailure = function (node, nodeType, requirementNode) {
+ }
+ function addDocumentationFailure(node, nodeType, requirementNode) {
var start = node.getStart();
var width = node.getText().split(/\r|\n/g)[0].length;
- var description = this.describeDocumentationFailure(requirementNode, nodeType);
- this.addFailureAt(start, width, description);
- };
- CompletedDocsWalker.prototype.describeDocumentationFailure = function (node, nodeType) {
- var _this = this;
- var description = Rule.FAILURE_STRING_EXIST;
- if (node.modifiers !== undefined) {
- description += node.modifiers.map(function (modifier) { return _this.describeModifier(modifier.kind); }).join(",") + " ";
- }
- return "" + description + nodeType + ".";
- };
- CompletedDocsWalker.prototype.describeModifier = function (kind) {
- var description = ts.SyntaxKind[kind].toLowerCase().split("keyword")[0];
- var alias = CompletedDocsWalker.modifierAliases[description];
- return alias !== undefined ? alias : description;
- };
- CompletedDocsWalker.prototype.describeNode = function (nodeType) {
- return nodeType.replace("-", " ");
- };
- CompletedDocsWalker.modifierAliases = {
- export: "exported",
- };
- return CompletedDocsWalker;
-}(Lint.ProgramAwareRuleWalker));
-var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
+ var description = describeDocumentationFailure(requirementNode, nodeType);
+ context.addFailureAt(start, width, description);
+ }
+}
+function describeDocumentationFailure(node, nodeType) {
+ var description = Rule.FAILURE_STRING_EXIST;
+ if (node.modifiers !== undefined) {
+ description += node.modifiers.map(function (modifier) { return describeModifier(modifier.kind); }).join(" ") + " ";
+ }
+ return "" + description + nodeType + ".";
+}
+function describeModifier(kind) {
+ var description = ts.SyntaxKind[kind].toLowerCase().split("keyword")[0];
+ var alias = modifierAliases[description];
+ return alias !== undefined ? alias : description;
+}
+function describeNode(nodeType) {
+ return nodeType.replace("-", " ");
+}
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/curlyRule.d.ts b/node_modules/tslint/lib/rules/curlyRule.d.ts
index 929f3f551..13fc07684 100644
--- a/node_modules/tslint/lib/rules/curlyRule.d.ts
+++ b/node_modules/tslint/lib/rules/curlyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/curlyRule.js b/node_modules/tslint/lib/rules/curlyRule.js
index 906201a12..c6421dd83 100644
--- a/node_modules/tslint/lib/rules/curlyRule.js
+++ b/node_modules/tslint/lib/rules/curlyRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var curly_examples_1 = require("./code-examples/curly.examples");
var OPTION_AS_NEEDED = "as-needed";
var OPTION_IGNORE_SAME_LINE = "ignore-same-line";
var Rule = /** @class */ (function (_super) {
@@ -42,8 +43,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "curly",
description: "Enforces braces for `if`/`for`/`do`/`while` statements.",
- rationale: (_a = ["\n ```ts\n if (foo === bar)\n foo++;\n bar++;\n ```\n\n In the code above, the author almost certainly meant for both `foo++` and `bar++`\n to be executed only if `foo === bar`. However, he forgot braces and `bar++` will be executed\n no matter what. This rule could prevent such a mistake."], _a.raw = ["\n \\`\\`\\`ts\n if (foo === bar)\n foo++;\n bar++;\n \\`\\`\\`\n\n In the code above, the author almost certainly meant for both \\`foo++\\` and \\`bar++\\`\n to be executed only if \\`foo === bar\\`. However, he forgot braces and \\`bar++\\` will be executed\n no matter what. This rule could prevent such a mistake."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One of the following options may be provided:\n\n * `\"", "\"` forbids any unnecessary curly braces.\n * `\"", "\"` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], _b.raw = ["\n One of the following options may be provided:\n\n * \\`\"", "\"\\` forbids any unnecessary curly braces.\n * \\`\"", "\"\\` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], Lint.Utils.dedent(_b, OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ```ts\n if (foo === bar)\n foo++;\n bar++;\n ```\n\n In the code above, the author almost certainly meant for both `foo++` and `bar++`\n to be executed only if `foo === bar`. However, they forgot braces and `bar++` will be executed\n no matter what. This rule could prevent such a mistake."], ["\n \\`\\`\\`ts\n if (foo === bar)\n foo++;\n bar++;\n \\`\\`\\`\n\n In the code above, the author almost certainly meant for both \\`foo++\\` and \\`bar++\\`\n to be executed only if \\`foo === bar\\`. However, they forgot braces and \\`bar++\\` will be executed\n no matter what. This rule could prevent such a mistake."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One of the following options may be provided:\n\n * `\"", "\"` forbids any unnecessary curly braces.\n * `\"", "\"` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], ["\n One of the following options may be provided:\n\n * \\`\"", "\"\\` forbids any unnecessary curly braces.\n * \\`\"", "\"\\` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "])), OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE),
options: {
type: "array",
items: {
@@ -62,6 +63,7 @@ var Rule = /** @class */ (function (_super) {
type: "functionality",
typescriptOnly: false,
hasFix: true,
+ codeExamples: curly_examples_1.codeExamples,
};
/* tslint:enable:object-literal-sort-keys */
Rule.FAILURE_STRING_AS_NEEDED = "Block contains only one statement; remove the curly braces.";
@@ -71,7 +73,7 @@ exports.Rule = Rule;
function walkAsNeeded(ctx) {
ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isBlock(node) && isBlockUnnecessary(node)) {
- ctx.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.OpenBraceToken), Rule.FAILURE_STRING_AS_NEEDED);
+ ctx.addFailureAt(node.statements.pos - 1, 1, Rule.FAILURE_STRING_AS_NEEDED);
}
ts.forEachChild(node, cb);
});
@@ -133,8 +135,8 @@ var CurlyWalker = /** @class */ (function (_super) {
CurlyWalker.prototype.createMissingBraceFix = function (statement, node, sameLine) {
if (sameLine) {
return [
- Lint.Replacement.appendText(statement.getStart(), "{ "),
- Lint.Replacement.appendText(statement.getEnd(), " }"),
+ Lint.Replacement.appendText(statement.pos, " {"),
+ Lint.Replacement.appendText(statement.end, " }"),
];
}
else {
@@ -145,11 +147,11 @@ var CurlyWalker = /** @class */ (function (_super) {
match[1].repeat(ts.getLineAndCharacterOfPosition(this.sourceFile, node.getStart(this.sourceFile)).character);
var maybeCarriageReturn = this.sourceFile.text[this.sourceFile.getLineEndOfPosition(node.pos) - 1] === "\r" ? "\r" : "";
return [
- Lint.Replacement.appendText(this.sourceFile.getLineEndOfPosition(statement.pos), " {"),
- Lint.Replacement.appendText(statement.getEnd(), maybeCarriageReturn + "\n" + indentation + "}"),
+ Lint.Replacement.appendText(statement.pos, " {"),
+ Lint.Replacement.appendText(statement.end, maybeCarriageReturn + "\n" + indentation + "}"),
];
}
};
return CurlyWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
index 25f7d9696..9ca72563a 100644
--- a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
index 91d6f9ead..80a665f47 100644
--- a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
@@ -54,9 +54,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "cyclomatic-complexity",
description: "Enforces a threshold of cyclomatic complexity.",
- descriptionDetails: (_a = ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * `catch`\n * `if` and `? :`\n * `||` and `&&` due to short-circuit evaluation\n * `for`, `for in` and `for of` loops\n * `while` and `do while` loops\n * `case` clauses that contain statements"], _a.raw = ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * \\`catch\\`\n * \\`if\\` and \\`? :\\`\n * \\`||\\` and \\`&&\\` due to short-circuit evaluation\n * \\`for\\`, \\`for in\\` and \\`for of\\` loops\n * \\`while\\` and \\`do while\\` loops\n * \\`case\\` clauses that contain statements"], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify."], _b.raw = ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], _c.raw = ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], Lint.Utils.dedent(_c, Rule.DEFAULT_THRESHOLD)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * `catch`\n * `if` and `? :`\n * `||` and `&&` due to short-circuit evaluation\n * `for`, `for in` and `for of` loops\n * `while` and `do while` loops\n * `case` clauses that contain statements"], ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * \\`catch\\`\n * \\`if\\` and \\`? :\\`\n * \\`||\\` and \\`&&\\` due to short-circuit evaluation\n * \\`for\\`, \\`for in\\` and \\`for of\\` loops\n * \\`while\\` and \\`do while\\` loops\n * \\`case\\` clauses that contain statements"]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify.\n\n It's better to have smaller, single-purpose functions with self-documenting names."], ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify.\n\n It's better to have smaller, single-purpose functions with self-documenting names."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."])), Rule.DEFAULT_THRESHOLD),
options: {
type: "number",
minimum: Rule.MINIMUM_THRESHOLD,
@@ -116,4 +116,4 @@ function increasesComplexity(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/deprecationRule.d.ts b/node_modules/tslint/lib/rules/deprecationRule.d.ts
index 790b1c9e9..cf627b138 100644
--- a/node_modules/tslint/lib/rules/deprecationRule.d.ts
+++ b/node_modules/tslint/lib/rules/deprecationRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/deprecationRule.js b/node_modules/tslint/lib/rules/deprecationRule.js
index bcd8a7da4..619783700 100644
--- a/node_modules/tslint/lib/rules/deprecationRule.js
+++ b/node_modules/tslint/lib/rules/deprecationRule.js
@@ -36,11 +36,11 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "deprecation",
description: "Warns when deprecated APIs are used.",
- descriptionDetails: (_a = ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], _a.raw = ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"]))),
rationale: "Deprecated APIs should be avoided, and usage updated.",
optionsDescription: "",
options: null,
- optionExamples: [],
+ optionExamples: [true],
type: "maintainability",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -137,7 +137,7 @@ function getDeprecation(node, tc) {
else {
symbol = tc.getSymbolAtLocation(node);
}
- if (symbol !== undefined && Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ if (symbol !== undefined && tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
symbol = tc.getAliasedSymbol(symbol);
}
if (symbol === undefined ||
@@ -152,7 +152,7 @@ function findDeprecationTag(tags) {
for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) {
var tag = tags_1[_i];
if (tag.name === "deprecated") {
- return tag.text;
+ return tag.text === undefined ? "" : tag.text;
}
}
return undefined;
@@ -226,4 +226,4 @@ function isFunctionOrMethod(declarations) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/encodingRule.d.ts b/node_modules/tslint/lib/rules/encodingRule.d.ts
index ad81e932d..e45243ff0 100644
--- a/node_modules/tslint/lib/rules/encodingRule.d.ts
+++ b/node_modules/tslint/lib/rules/encodingRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
import { Encoding } from "../utils";
diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js
index 156d157a0..3fcd46590 100644
--- a/node_modules/tslint/lib/rules/encodingRule.js
+++ b/node_modules/tslint/lib/rules/encodingRule.js
@@ -66,7 +66,7 @@ function showEncoding(encoding) {
function detectEncoding(fileName) {
var fd = fs.openSync(fileName, "r");
var maxBytesRead = 3; // Only need 3 bytes to detect the encoding.
- var buffer = new Buffer(maxBytesRead);
+ var buffer = Buffer.allocUnsafe(maxBytesRead);
var bytesRead = fs.readSync(fd, buffer, /*offset*/ 0, /*length*/ maxBytesRead, /*position*/ 0);
fs.closeSync(fd);
return utils_1.detectBufferEncoding(buffer, bytesRead);
diff --git a/node_modules/tslint/lib/rules/eoflineRule.js b/node_modules/tslint/lib/rules/eoflineRule.js
index 631b5fc28..a235ef7f2 100644
--- a/node_modules/tslint/lib/rules/eoflineRule.js
+++ b/node_modules/tslint/lib/rules/eoflineRule.js
@@ -41,7 +41,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "eofline",
description: "Ensures the file ends with a newline.",
descriptionDetails: "Fix for single-line files is not supported.",
- rationale: "It is a [standard convention](http://stackoverflow.com/q/729692/3124288) to end files with a newline.",
+ rationale: "It is a [standard convention](https://stackoverflow.com/q/729692/3124288) to end files with a newline.",
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.d.ts b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
index bd1fcddd6..e4cf6ec2c 100644
--- a/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
@@ -20,4 +20,5 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING: string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ private createComment;
}
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.js b/node_modules/tslint/lib/rules/fileHeaderRule.js
index 91d505d53..eca48adc5 100644
--- a/node_modules/tslint/lib/rules/fileHeaderRule.js
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.js
@@ -26,27 +26,58 @@ var Rule = /** @class */ (function (_super) {
}
Rule.prototype.apply = function (sourceFile) {
var text = sourceFile.text;
+ var headerFormat = new RegExp(this.ruleArguments[0]);
+ var textToInsert = this.ruleArguments[1];
// ignore shebang if it exists
var offset = text.startsWith("#!") ? text.indexOf("\n") : 0;
// returns the text of the first comment or undefined
var commentText = ts.forEachLeadingCommentRange(text, offset, function (pos, end, kind) { return text.substring(pos + 2, kind === ts.SyntaxKind.SingleLineCommentTrivia ? end : end - 2); });
- if (commentText === undefined || !new RegExp(this.ruleArguments[0]).test(commentText)) {
- if (offset !== 0) {
+ if (commentText === undefined || !headerFormat.test(commentText)) {
+ var isErrorAtStart = offset === 0;
+ if (!isErrorAtStart) {
++offset; // show warning in next line after shebang
}
- return [new Lint.RuleFailure(sourceFile, offset, offset, Rule.FAILURE_STRING, this.ruleName)];
+ var leadingNewlines = isErrorAtStart ? 0 : 1;
+ var trailingNewlines = isErrorAtStart ? 2 : 1;
+ var fix = textToInsert !== undefined
+ ? Lint.Replacement.appendText(offset, this.createComment(sourceFile, textToInsert, leadingNewlines, trailingNewlines))
+ : undefined;
+ return [new Lint.RuleFailure(sourceFile, offset, offset, Rule.FAILURE_STRING, this.ruleName, fix)];
}
return [];
};
+ Rule.prototype.createComment = function (sourceFile, commentText, leadingNewlines, trailingNewlines) {
+ if (leadingNewlines === void 0) { leadingNewlines = 1; }
+ if (trailingNewlines === void 0) { trailingNewlines = 1; }
+ var maybeCarriageReturn = sourceFile.text[sourceFile.getLineEndOfPosition(0)] === "\r" ? "\r" : "";
+ var lineEnding = maybeCarriageReturn + "\n";
+ return lineEnding.repeat(leadingNewlines) + [
+ "/*!"
+ ].concat(commentText.split(/\r?\n/g).map(function (line) { return (" * " + line).replace(/\s+$/, ""); }), [
+ " */",
+ ]).join(lineEnding) + lineEnding.repeat(trailingNewlines);
+ };
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "file-header",
description: "Enforces a certain header comment for all files, matched by a regular expression.",
- optionsDescription: "Regular expression to match the header.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The first option, which is mandatory, is a regular expression that all headers should match.\n The second argument, which is optional, is a string that should be inserted as a header comment\n if fixing is enabled and no header that matches the first argument is found."], ["\n The first option, which is mandatory, is a regular expression that all headers should match.\n The second argument, which is optional, is a string that should be inserted as a header comment\n if fixing is enabled and no header that matches the first argument is found."]))),
options: {
- type: "string",
+ type: "array",
+ items: [
+ {
+ type: "string",
+ },
+ {
+ type: "string",
+ },
+ ],
+ additionalItems: false,
+ minLength: 1,
+ maxLength: 2,
},
- optionExamples: [[true, "Copyright \\d{4}"]],
+ optionExamples: [[true, "Copyright \\d{4}", "Copyright 2017"]],
+ hasFix: true,
type: "style",
typescriptOnly: false,
};
@@ -55,3 +86,4 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/forinRule.d.ts b/node_modules/tslint/lib/rules/forinRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/forinRule.d.ts
+++ b/node_modules/tslint/lib/rules/forinRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/forinRule.js b/node_modules/tslint/lib/rules/forinRule.js
index 23cbddc86..dfeab4b10 100644
--- a/node_modules/tslint/lib/rules/forinRule.js
+++ b/node_modules/tslint/lib/rules/forinRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "forin",
description: "Requires a `for ... in` statement to be filtered with an `if` statement.",
- rationale: (_a = ["\n ```ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n ```\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's `for...in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about `for...in` loops."], _a.raw = ["\n \\`\\`\\`ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n \\`\\`\\`\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's \\`for...in\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about \\`for...in\\` loops."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ```ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n ```\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's `for...in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about `for...in` loops.\n\n Also consider using a [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n or [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\n if you're storing collections of objects.\n Using `Object`s can cause occasional edge case bugs, such as if a key is named \"hasOwnProperty\".\n "], ["\n \\`\\`\\`ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n \\`\\`\\`\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's \\`for...in\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about \\`for...in\\` loops.\n\n Also consider using a [\\`Map\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n or [\\`Set\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\n if you're storing collections of objects.\n Using \\`Object\\`s can cause occasional edge case bugs, such as if a key is named \"hasOwnProperty\".\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -65,4 +65,4 @@ function nodeIsContinue(node) {
return node.kind === ts.SyntaxKind.ContinueStatement ||
tsutils_1.isBlock(node) && node.statements.length === 1 && node.statements[0].kind === ts.SyntaxKind.ContinueStatement;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.d.ts b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
index 93cc48a7d..5c64ffe7a 100644
--- a/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.js b/node_modules/tslint/lib/rules/importBlacklistRule.js
index c79242cfa..eb1dce21f 100644
--- a/node_modules/tslint/lib/rules/importBlacklistRule.js
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.js
@@ -33,8 +33,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "import-blacklist",
- description: (_a = ["\n Disallows importing the specified modules directly via `import` and `require`.\n Instead only sub modules may be imported from that module."], _a.raw = ["\n Disallows importing the specified modules directly via \\`import\\` and \\`require\\`.\n Instead only sub modules may be imported from that module."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], _b.raw = ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing the specified modules directly via `import` and `require`.\n Instead only sub modules may be imported from that module."], ["\n Disallows importing the specified modules directly via \\`import\\` and \\`require\\`.\n Instead only sub modules may be imported from that module."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."]))),
optionsDescription: "A list of blacklisted modules.",
options: {
type: "array",
@@ -52,11 +52,11 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
if (ctx.options.indexOf(name.text) !== -1) {
ctx.addFailure(name.getStart(ctx.sourceFile) + 1, name.end - 1, Rule.FAILURE_STRING);
}
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.d.ts b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
index ffc41c23b..b1e1f6d7b 100644
--- a/node_modules/tslint/lib/rules/importSpacingRule.d.ts
+++ b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.js b/node_modules/tslint/lib/rules/importSpacingRule.js
index 14ed83607..51304ba3a 100644
--- a/node_modules/tslint/lib/rules/importSpacingRule.js
+++ b/node_modules/tslint/lib/rules/importSpacingRule.js
@@ -130,7 +130,7 @@ var Walker = /** @class */ (function (_super) {
this.addFailure(nodeStart, moduleSpecifierStart, Rule.TOO_MANY_SPACES_AFTER_IMPORT);
}
else if (nodeStart + "import".length === moduleSpecifierStart) {
- this.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.ImportKeyword), Rule.ADD_SPACE_AFTER_IMPORT);
+ this.addFailureAtNode(tsutils_1.getChildOfKind(node, ts.SyntaxKind.ImportKeyword, this.sourceFile), Rule.ADD_SPACE_AFTER_IMPORT);
}
if (LINE_BREAK_REGEX.test(node.getText())) {
this.addFailureAtNode(node, Rule.NO_LINE_BREAKS);
diff --git a/node_modules/tslint/lib/rules/indentRule.d.ts b/node_modules/tslint/lib/rules/indentRule.d.ts
index 49096c1b4..1355845f9 100644
--- a/node_modules/tslint/lib/rules/indentRule.d.ts
+++ b/node_modules/tslint/lib/rules/indentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/indentRule.js b/node_modules/tslint/lib/rules/indentRule.js
index 599ec98c3..13ebe62ad 100644
--- a/node_modules/tslint/lib/rules/indentRule.js
+++ b/node_modules/tslint/lib/rules/indentRule.js
@@ -41,8 +41,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "indent",
description: "Enforces indentation with tabs or spaces.",
- rationale: (_a = ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], _a.raw = ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One of the following arguments must be provided:\n\n * `", "` enforces consistent spaces.\n * `", "` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * `", "` enforces 2 space indentation.\n * `", "` enforces 4 space indentation.\n\n Indentation size is required for auto-fixing, but not for rule checking.\n "], _b.raw = ["\n One of the following arguments must be provided:\n\n * \\`", "\\` enforces consistent spaces.\n * \\`", "\\` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * \\`", "\\` enforces 2 space indentation.\n * \\`", "\\` enforces 4 space indentation.\n\n Indentation size is required for auto-fixing, but not for rule checking.\n "], Lint.Utils.dedent(_b, OPTION_USE_SPACES, OPTION_USE_TABS, OPTION_INDENT_SIZE_2.toString(), OPTION_INDENT_SIZE_4.toString())),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `", "` enforces consistent spaces.\n * `", "` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * `", "` enforces 2 space indentation.\n * `", "` enforces 4 space indentation.\n\n Indentation size is **required** for auto-fixing, but not for rule checking.\n\n **NOTE**: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.\n "], ["\n One of the following arguments must be provided:\n\n * \\`", "\\` enforces consistent spaces.\n * \\`", "\\` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * \\`", "\\` enforces 2 space indentation.\n * \\`", "\\` enforces 4 space indentation.\n\n Indentation size is **required** for auto-fixing, but not for rule checking.\n\n **NOTE**: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.\n "])), OPTION_USE_SPACES, OPTION_USE_TABS, OPTION_INDENT_SIZE_2.toString(), OPTION_INDENT_SIZE_4.toString()),
options: {
type: "array",
items: [
@@ -63,6 +63,7 @@ var Rule = /** @class */ (function (_super) {
[true, OPTION_USE_SPACES, OPTION_INDENT_SIZE_4],
[true, OPTION_USE_TABS, OPTION_INDENT_SIZE_2],
],
+ hasFix: true,
type: "maintainability",
typescriptOnly: false,
};
@@ -114,6 +115,7 @@ function createFix(lineStart, fullLeadingWhitespace, tabs, size) {
return undefined;
}
var replaceRegExp = tabs
+ // we want to find every group of `size` spaces, plus up to one 'incomplete' group
? new RegExp("^( {" + size + "})+( {1," + (size - 1) + "})?", "g")
: /\t/g;
var replacement = fullLeadingWhitespace.replace(replaceRegExp, function (match) {
@@ -121,4 +123,4 @@ function createFix(lineStart, fullLeadingWhitespace, tabs, size) {
});
return new Lint.Replacement(lineStart, fullLeadingWhitespace.length, replacement);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.d.ts b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
index 4e719997a..382e0ae01 100644
--- a/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.js b/node_modules/tslint/lib/rules/interfaceNameRule.js
index fe9958d0f..2255d3bf5 100644
--- a/node_modules/tslint/lib/rules/interfaceNameRule.js
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "interface-name",
description: "Requires interface names to begin with a capital 'I'",
rationale: "Makes it easy to differentiate interfaces from regular classes at a glance.",
- optionsDescription: (_a = ["\n One of the following two options must be provided:\n\n * `\"", "\"` requires interface names to start with an \"I\"\n * `\"", "\"` requires interface names to not have an \"I\" prefix"], _a.raw = ["\n One of the following two options must be provided:\n\n * \\`\"", "\"\\` requires interface names to start with an \"I\"\n * \\`\"", "\"\\` requires interface names to not have an \"I\" prefix"], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following two options must be provided:\n\n * `\"", "\"` requires interface names to start with an \"I\"\n * `\"", "\"` requires interface names to not have an \"I\" prefix"], ["\n One of the following two options must be provided:\n\n * \\`\"", "\"\\` requires interface names to start with an \"I\"\n * \\`\"", "\"\\` requires interface names to not have an \"I\" prefix"])), OPTION_ALWAYS, OPTION_NEVER),
options: {
type: "string",
enum: [OPTION_ALWAYS, OPTION_NEVER],
@@ -72,4 +72,4 @@ function hasPrefixI(name) {
// Allow IndexedDB interfaces
return name.length >= 2 && name[0] === "I" && utils_1.isUpperCase(name[1]) && !name.startsWith("IDB");
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
+++ b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
index 3bc191dae..e7f2a30fd 100644
--- a/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.js b/node_modules/tslint/lib/rules/jsdocFormatRule.js
index b75550a6d..e484d4d81 100644
--- a/node_modules/tslint/lib/rules/jsdocFormatRule.js
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.js
@@ -35,9 +35,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "jsdoc-format",
description: "Enforces basic format rules for JSDoc comments.",
- descriptionDetails: (_a = ["\n The following rules are enforced for JSDoc comments (comments starting with `/**`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with `/** ` and end with `*/`\n * multiline comments don't allow text after `/** ` in the first line (with option `\"", "\"`)\n "], _a.raw = ["\n The following rules are enforced for JSDoc comments (comments starting with \\`/**\\`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with \\`/** \\` and end with \\`*/\\`\n * multiline comments don't allow text after \\`/** \\` in the first line (with option \\`\"", "\"\\`)\n "], Lint.Utils.dedent(_a, OPTION_CHECK_MULTILINE_START)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The following rules are enforced for JSDoc comments (comments starting with `/**`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with `/** ` and end with `*/`\n * multiline comments don't allow text after `/** ` in the first line (with option `\"", "\"`)\n "], ["\n The following rules are enforced for JSDoc comments (comments starting with \\`/**\\`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with \\`/** \\` and end with \\`*/\\`\n * multiline comments don't allow text after \\`/** \\` in the first line (with option \\`\"", "\"\\`)\n "])), OPTION_CHECK_MULTILINE_START),
rationale: "Helps maintain a consistent, readable style for JSDoc comments.",
- optionsDescription: (_b = ["\n You can optionally specify the option `\"", "\"` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], _b.raw = ["\n You can optionally specify the option \\`\"", "\"\\` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], Lint.Utils.dedent(_b, OPTION_CHECK_MULTILINE_START)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You can optionally specify the option `\"", "\"` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], ["\n You can optionally specify the option \\`\"", "\"\\` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "])), OPTION_CHECK_MULTILINE_START),
options: {
type: "array",
minItems: 0,
@@ -108,4 +108,4 @@ function getAlignColumn(sourceFile, pos) {
? result.character - 1
: result.character;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.d.ts b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/labelPositionRule.d.ts
+++ b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.js b/node_modules/tslint/lib/rules/labelPositionRule.js
index 165e6efd8..ae8fdb6b6 100644
--- a/node_modules/tslint/lib/rules/labelPositionRule.js
+++ b/node_modules/tslint/lib/rules/labelPositionRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "label-position",
description: "Only allows labels in sensible locations.",
descriptionDetails: "This rule only allows labels to be on `do/for/while/switch` statements.",
- rationale: (_a = ["\n Labels in JavaScript only can be used in conjunction with `break` or `continue`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], _a.raw = ["\n Labels in JavaScript only can be used in conjunction with \\`break\\` or \\`continue\\`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Labels in JavaScript only can be used in conjunction with `break` or `continue`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], ["\n Labels in JavaScript only can be used in conjunction with \\`break\\` or \\`continue\\`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -66,4 +66,4 @@ function isLabelable(node) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/linebreakStyleRule.js b/node_modules/tslint/lib/rules/linebreakStyleRule.js
index bbbfb24aa..c32179dc8 100644
--- a/node_modules/tslint/lib/rules/linebreakStyleRule.js
+++ b/node_modules/tslint/lib/rules/linebreakStyleRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "linebreak-style",
description: "Enforces a consistent linebreak style.",
- optionsDescription: (_a = ["\n One of the following options must be provided:\n\n * `\"", "\"` requires LF (`\\n`) linebreaks\n * `\"", "\"` requires CRLF (`\\r\\n`) linebreaks"], _a.raw = ["\n One of the following options must be provided:\n\n * \\`\"", "\"\\` requires LF (\\`\\\\n\\`) linebreaks\n * \\`\"", "\"\\` requires CRLF (\\`\\\\r\\\\n\\`) linebreaks"], Lint.Utils.dedent(_a, OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following options must be provided:\n\n * `\"", "\"` requires LF (`\\n`) linebreaks\n * `\"", "\"` requires CRLF (`\\r\\n`) linebreaks"], ["\n One of the following options must be provided:\n\n * \\`\"", "\"\\` requires LF (\\`\\\\n\\`) linebreaks\n * \\`\"", "\"\\` requires CRLF (\\`\\\\r\\\\n\\`) linebreaks"])), OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF),
options: {
type: "string",
enum: [OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF],
@@ -64,4 +64,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
index b4f5e6391..d1a2e58b3 100644
--- a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
index f7df853f4..050a512b3 100644
--- a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "match-default-export-name",
- description: (_a = ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], _a.raw = ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -55,7 +55,7 @@ function walk(ctx, tc) {
}
var defaultImport = statement.importClause.name;
var symbol = tc.getSymbolAtLocation(defaultImport);
- if (symbol === undefined || !Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ if (symbol === undefined || !tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
continue;
}
var declarations = tc.getAliasedSymbol(symbol).declarations;
@@ -67,4 +67,4 @@ function walk(ctx, tc) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
index 18e914536..c698645cf 100644
--- a/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
index 74092147c..36963d30c 100644
--- a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
@@ -42,9 +42,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "max-classes-per-file",
- description: (_a = ["\n A file may not contain more than the specified number of classes"], _a.raw = ["\n A file may not contain more than the specified number of classes"], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], _b.raw = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument `\"exclude-class-expressions\"` can be provided to exclude class expressions\n from the overall class count."], _c.raw = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument \\`\"exclude-class-expressions\"\\` can be provided to exclude class expressions\n from the overall class count."], Lint.Utils.dedent(_c)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A file may not contain more than the specified number of classes"], ["\n A file may not contain more than the specified number of classes"]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument `\"exclude-class-expressions\"` can be provided to exclude class expressions\n from the overall class count."], ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument \\`\"exclude-class-expressions\"\\` can be provided to exclude class expressions\n from the overall class count."]))),
options: {
type: "array",
items: [
@@ -81,4 +81,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/maxFileLineCountRule.js b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
index 98a98cbb0..6bd801d8c 100644
--- a/node_modules/tslint/lib/rules/maxFileLineCountRule.js
+++ b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
@@ -44,7 +44,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "max-file-line-count",
description: "Requires files to remain under a certain number of lines",
- rationale: (_a = ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], _a.raw = ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."]))),
optionsDescription: "An integer indicating the maximum number of lines.",
options: {
type: "number",
@@ -57,4 +57,4 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
index 476a48d7f..15227fef4 100644
--- a/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -5,4 +21,5 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING_FACTORY(lineLimit: number): string;
isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ private getRuleOptions;
}
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.js b/node_modules/tslint/lib/rules/maxLineLengthRule.js
index b6b1ebfca..465efcbed 100644
--- a/node_modules/tslint/lib/rules/maxLineLengthRule.js
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.js
@@ -29,22 +29,57 @@ var Rule = /** @class */ (function (_super) {
return "Exceeds maximum line length of " + lineLimit;
};
Rule.prototype.isEnabled = function () {
- return _super.prototype.isEnabled.call(this) && this.ruleArguments[0] > 0;
+ var limit = this.getRuleOptions().limit;
+ return _super.prototype.isEnabled.call(this) && (limit > 0);
};
Rule.prototype.apply = function (sourceFile) {
- return this.applyWithFunction(sourceFile, walk, this.ruleArguments[0]);
+ return this.applyWithFunction(sourceFile, walk, this.getRuleOptions());
+ };
+ Rule.prototype.getRuleOptions = function () {
+ var argument = this.ruleArguments[0];
+ var options = { limit: 0 };
+ if (typeof argument === "number") {
+ options.limit = argument;
+ }
+ else {
+ options = argument;
+ var ignorePattern = argument["ignore-pattern"];
+ options.ignorePattern = (typeof ignorePattern === "string") ?
+ new RegExp((ignorePattern)) : undefined;
+ }
+ options.limit = Number(options.limit); // user can pass a string instead of number
+ return options;
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "max-line-length",
description: "Requires lines to be under a certain max length.",
- rationale: (_a = ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], _a.raw = ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], Lint.Utils.dedent(_a)),
- optionsDescription: "An integer indicating the max length of lines.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It can take one argument, which can be any of the following:\n * integer indicating maximum length of lines.\n * object with keys:\n * `limit` - number < 0 defining max line length\n * `ignore-pattern` - string defining ignore pattern for this rule, being parsed by `new RegExp()`.\n For example:\n * `// ` pattern will ignore all in-line comments.\n * `^import ` pattern will ignore all import statements.\n * `^export {(.*?)}` pattern will ignore all multiple export statements.\n * `class [a-zA-Z]+ implements ` pattern will ignore all class declarations implementing interfaces.\n * `^import |^export {(.*?)}|class [a-zA-Z]+ implements |// ` pattern will ignore all the cases listed above.\n "], ["\n It can take one argument, which can be any of the following:\n * integer indicating maximum length of lines.\n * object with keys:\n * \\`limit\\` - number < 0 defining max line length\n * \\`ignore-pattern\\` - string defining ignore pattern for this rule, being parsed by \\`new RegExp()\\`.\n For example:\n * \\`\\/\\/ \\` pattern will ignore all in-line comments.\n * \\`^import \\` pattern will ignore all import statements.\n * \\`^export \\{(.*?)\\}\\` pattern will ignore all multiple export statements.\n * \\`class [a-zA-Z]+ implements \\` pattern will ignore all class declarations implementing interfaces.\n * \\`^import |^export \\{(.*?)\\}|class [a-zA-Z]+ implements |// \\` pattern will ignore all the cases listed above.\n "]))),
options: {
- type: "number",
- minimum: "1",
+ type: "array",
+ items: {
+ oneOf: [
+ {
+ type: "number",
+ },
+ {
+ type: "object",
+ properties: {
+ "limit": { type: "number" },
+ "ignore-pattern": { type: "string" },
+ },
+ additionalProperties: false,
+ },
+ ],
+ },
+ minLength: 1,
+ maxLength: 2,
},
- optionExamples: [[true, 120]],
+ optionExamples: [[true, 120], [true, {
+ "limit": 120,
+ "ignore-pattern": "^import |^export \{(.*?)\}"
+ }]],
type: "maintainability",
typescriptOnly: false,
};
@@ -52,12 +87,18 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- var limit = ctx.options;
+ var limit = ctx.options.limit;
+ var ignorePattern = ctx.options.ignorePattern;
for (var _i = 0, _a = tsutils_1.getLineRanges(ctx.sourceFile); _i < _a.length; _i++) {
var line = _a[_i];
- if (line.contentLength > limit) {
- ctx.addFailureAt(line.pos, line.contentLength, Rule.FAILURE_STRING_FACTORY(limit));
+ if (line.contentLength <= limit) {
+ continue;
+ }
+ var lineContent = ctx.sourceFile.text.substr(line.pos, line.contentLength);
+ if (ignorePattern !== undefined && ignorePattern.test(lineContent)) {
+ continue;
}
+ ctx.addFailureAt(line.pos, line.contentLength, Rule.FAILURE_STRING_FACTORY(limit));
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.d.ts b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
index 5aa42a707..74b4e23b6 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.d.ts
+++ b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.js b/node_modules/tslint/lib/rules/memberAccessRule.js
index abb843b04..80b90dcad 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.js
+++ b/node_modules/tslint/lib/rules/memberAccessRule.js
@@ -58,8 +58,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "member-access",
description: "Requires explicit visibility declarations for class members.",
- rationale: "Explicit visibility declarations can make code more readable and accessible for those new to TS.",
- optionsDescription: (_a = ["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], _a.raw = ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to `private`, unlike TypeScript's default of `public`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "], ["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to \\`private\\`, unlike TypeScript's default of \\`public\\`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"]))),
options: {
type: "array",
items: {
@@ -115,15 +115,13 @@ function walk(ctx) {
}
}
function check(node) {
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
return;
}
var publicKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.PublicKeyword);
if (noPublic && publicKeyword !== undefined) {
- var readonlyKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.ReadonlyKeyword);
// public is not optional for parameter property without the readonly modifier
- var isPublicOptional = node.kind !== ts.SyntaxKind.Parameter || readonlyKeyword !== undefined;
- if (isPublicOptional) {
+ if (node.kind !== ts.SyntaxKind.Parameter || tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ReadonlyKeyword)) {
var start = publicKeyword.end - "public".length;
ctx.addFailure(start, publicKeyword.end, Rule.FAILURE_STRING_NO_PUBLIC, Lint.Replacement.deleteFromTo(start, tsutils_1.getNextToken(publicKeyword, ctx.sourceFile).getStart(ctx.sourceFile)));
}
@@ -159,4 +157,4 @@ function typeToString(node) {
throw new Error("unhandled node type " + ts.SyntaxKind[node.kind]);
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/memberOrderingRule.js b/node_modules/tslint/lib/rules/memberOrderingRule.js
index e2e35a548..a9752e3a4 100644
--- a/node_modules/tslint/lib/rules/memberOrderingRule.js
+++ b/node_modules/tslint/lib/rules/memberOrderingRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var error_1 = require("../error");
var Lint = require("../index");
@@ -96,7 +97,7 @@ var allMemberKindNames = utils_1.mapDefined(Object.keys(MemberKind), function (k
function namesMarkdown(names) {
return names.map(function (name) { return "* `" + name + "`"; }).join("\n ");
}
-var optionsDescription = (_a = ["\n One argument, which is an object, must be provided. It should contain an `order` property.\n The `order` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for `order` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], _a.raw = ["\n One argument, which is an object, must be provided. It should contain an \\`order\\` property.\n The \\`order\\` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for \\`order\\` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], Lint.Utils.dedent(_a, namesMarkdown(PRESET_NAMES), namesMarkdown(allMemberKindNames), OPTION_ALPHABETIZE));
+var optionsDescription = Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument, which is an object, must be provided. It should contain an `order` property.\n The `order` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for `order` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], ["\n One argument, which is an object, must be provided. It should contain an \\`order\\` property.\n The \\`order\\` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for \\`order\\` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."])), namesMarkdown(PRESET_NAMES), namesMarkdown(allMemberKindNames), OPTION_ALPHABETIZE);
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -124,7 +125,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "member-ordering",
description: "Enforces member ordering.",
- rationale: "A consistent ordering for class members can make classes easier to read, navigate, and edit.",
+ hasFix: true,
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A consistent ordering for class members can make classes easier to read, navigate, and edit.\n\n A common opposite practice to `member-ordering` is to keep related groups of classes together.\n Instead of creating classes with multiple separate groups, consider splitting class responsibilities\n apart across multiple single-responsibility classes.\n "], ["\n A consistent ordering for class members can make classes easier to read, navigate, and edit.\n\n A common opposite practice to \\`member-ordering\\` is to keep related groups of classes together.\n Instead of creating classes with multiple separate groups, consider splitting class responsibilities\n apart across multiple single-responsibility classes.\n "]))),
optionsDescription: optionsDescription,
options: {
type: "object",
@@ -187,11 +189,15 @@ exports.Rule = Rule;
var MemberOrderingWalker = /** @class */ (function (_super) {
tslib_1.__extends(MemberOrderingWalker, _super);
function MemberOrderingWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.fixes = [];
+ return _this;
}
MemberOrderingWalker.prototype.walk = function (sourceFile) {
var _this = this;
var cb = function (node) {
+ // NB: iterate through children first!
+ ts.forEachChild(node, cb);
switch (node.kind) {
case ts.SyntaxKind.ClassDeclaration:
case ts.SyntaxKind.ClassExpression:
@@ -199,13 +205,27 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.TypeLiteral:
_this.checkMembers(node.members);
}
- return ts.forEachChild(node, cb);
};
- return ts.forEachChild(sourceFile, cb);
+ ts.forEachChild(sourceFile, cb);
+ // assign Replacements which have not been merged into surrounding ones to their RuleFailures.
+ this.fixes.forEach(function (_a) {
+ var failure = _a[0], replacement = _a[1];
+ failure.getFix().push(replacement);
+ });
};
+ /**
+ * Check wether the passed members adhere to the configured order. If not, RuleFailures are generated and a single
+ * Lint.Replacement is generated, which replaces the entire NodeArray with a correctly sorted one. The Replacement
+ * is not immediately added to a RuleFailure, as incorrectly sorted nodes can be nested (e.g. a class declaration
+ * in a method implementation), but instead temporarily stored in `this.fixes`. Nested Replacements are manually
+ * merged, as TSLint doesn't handle overlapping ones. For this reason it is important that the recursion happens
+ * before the checkMembers call in this.walk().
+ */
MemberOrderingWalker.prototype.checkMembers = function (members) {
+ var _this = this;
var prevRank = -1;
var prevName;
+ var failureExists = false;
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var member = members_1[_i];
var rank = this.memberRank(member);
@@ -222,7 +242,9 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
: "at the beginning of the class/interface";
var errorLine1 = "Declaration of " + nodeType + " not allowed after declaration of " + prevNodeType + ". " +
("Instead, this should come " + locationHint + ".");
- this.addFailureAtNode(member, errorLine1);
+ // add empty array as fix so we can add a replacement later. (fix itself is readonly)
+ this.addFailureAtNode(member, errorLine1, []);
+ failureExists = true;
}
else {
if (this.options.alphabetize && member.name !== undefined) {
@@ -232,7 +254,8 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
}
var curName = nameString(member.name);
if (prevName !== undefined && caseInsensitiveLess(curName, prevName)) {
- this.addFailureAtNode(member.name, Rule.FAILURE_STRING_ALPHABETIZE(this.findLowerName(members, rank, curName), curName));
+ this.addFailureAtNode(member.name, Rule.FAILURE_STRING_ALPHABETIZE(this.findLowerName(members, rank, curName), curName), []);
+ failureExists = true;
}
else {
prevName = curName;
@@ -242,6 +265,56 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
prevRank = rank;
}
}
+ if (failureExists) {
+ var sortedMemberIndexes = members.map(function (_, i) { return i; }).sort(function (ai, bi) {
+ var a = members[ai];
+ var b = members[bi];
+ // first, sort by member rank
+ var rankDiff = _this.memberRank(a) - _this.memberRank(b);
+ if (rankDiff !== 0) {
+ return rankDiff;
+ }
+ // then lexicographically if alphabetize == true
+ if (_this.options.alphabetize && a.name !== undefined && b.name !== undefined) {
+ var aName = nameString(a.name);
+ var bName = nameString(b.name);
+ var nameDiff = aName.localeCompare(bName);
+ if (nameDiff !== 0) {
+ return nameDiff;
+ }
+ }
+ // finally, sort by position in original NodeArray so the sort remains stable.
+ return ai - bi;
+ });
+ var splits_1 = getSplitIndexes(members, this.sourceFile.text);
+ var sortedMembersText = sortedMemberIndexes.map(function (i) {
+ var start = splits_1[i];
+ var end = splits_1[i + 1];
+ var nodeText = _this.sourceFile.text.substring(start, end);
+ while (true) {
+ // check if there are previous fixes which we need to merge into this one
+ // if yes, remove it from the list so that we do not return overlapping Replacements
+ var fixIndex = arrayFindLastIndex(_this.fixes, function (_a) {
+ var r = _a[1];
+ return r.start >= start && r.start + r.length <= end;
+ });
+ if (fixIndex === -1) {
+ break;
+ }
+ var fix = _this.fixes.splice(fixIndex, 1)[0];
+ var replacement = fix[1];
+ nodeText = applyReplacementOffset(nodeText, replacement, start);
+ }
+ return nodeText;
+ });
+ // instead of assigning the fix immediately to the last failure, we temporarily store it in `this.fixes`,
+ // in case a containing node needs to be fixed too. We only "add" the fix to the last failure, although
+ // it fixes all failures in this NodeArray, as TSLint doesn't handle duplicate Replacements.
+ this.fixes.push([
+ arrayLast(this.failures),
+ Lint.Replacement.replaceFromTo(splits_1[0], arrayLast(splits_1), sortedMembersText.join("")),
+ ]);
+ }
};
/** Finds the lowest name higher than 'targetName'. */
MemberOrderingWalker.prototype.findLowerName = function (members, targetRank, targetName) {
@@ -303,8 +376,8 @@ function memberKindFromName(name) {
}
}
function getMemberKind(member) {
- var accessLevel = hasModifier(ts.SyntaxKind.PrivateKeyword) ? "private"
- : hasModifier(ts.SyntaxKind.ProtectedKeyword) ? "protected"
+ var accessLevel = tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.PrivateKeyword) ? "private"
+ : tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.ProtectedKeyword) ? "protected"
: "public";
switch (member.kind) {
case ts.SyntaxKind.Constructor:
@@ -320,12 +393,9 @@ function getMemberKind(member) {
return undefined;
}
function methodOrField(isMethod) {
- var membership = hasModifier(ts.SyntaxKind.StaticKeyword) ? "Static" : "Instance";
+ var membership = tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword) ? "Static" : "Instance";
return memberKindForMethodOrField(accessLevel, membership, isMethod ? "Method" : "Field");
}
- function hasModifier(kind) {
- return Lint.hasModifier(member.modifiers, kind);
- }
}
var MemberCategory = /** @class */ (function () {
function MemberCategory(name, kinds) {
@@ -436,4 +506,110 @@ function nameString(name) {
return "";
}
}
-var _a;
+/**
+ * Returns the last element of an array. (Or undefined).
+ */
+function arrayLast(array) {
+ return array[array.length - 1];
+}
+/**
+ * Array.prototype.findIndex, but the last index.
+ */
+function arrayFindLastIndex(array, predicate) {
+ for (var i = array.length; i-- > 0;) {
+ if (predicate(array[i], i, array)) {
+ return i;
+ }
+ }
+ return -1;
+}
+/**
+ * Applies a Replacement to a part of the text which starts at offset.
+ * See also Replacement.apply
+ */
+function applyReplacementOffset(content, replacement, offset) {
+ return content.substring(0, replacement.start - offset)
+ + replacement.text
+ + content.substring(replacement.start - offset + replacement.length);
+}
+/**
+ * Get the indexes of the boundaries between nodes in the node array. The following points must be taken into account:
+ * - Trivia should stay with its corresponding node (comments on the same line following the token belong to the
+ * previous token, the rest to the next).
+ * - Reordering the subtexts should not result in code being commented out due to being moved between a "//" and
+ * the following newline.
+ * - The end of one node must be the start of the next, otherwise the intravening whitespace will be lost when
+ * reordering.
+ *
+ * Hence, the boundaries are chosen to be _after_ the newline following the node, or the beginning of the next token,
+ * if that comes first.
+ */
+function getSplitIndexes(members, text) {
+ var result = members.map(function (member) { return getNextSplitIndex(text, member.getFullStart()); });
+ result.push(getNextSplitIndex(text, arrayLast(members).getEnd()));
+ return result;
+}
+/**
+ * Calculates the index after the newline following pos, or the beginning of the next token, whichever comes first.
+ * See also getSplitIndexes.
+ * This method is a modified version of TypeScript's internal iterateCommentRanges function.
+ */
+function getNextSplitIndex(text, pos) {
+ scan: while (pos >= 0 && pos < text.length) {
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 13 /* carriageReturn */:
+ if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
+ pos++;
+ }
+ // falls through
+ case 10 /* lineFeed */:
+ pos++;
+ // split is after new line
+ return pos;
+ case 9 /* tab */:
+ case 11 /* verticalTab */:
+ case 12 /* formFeed */:
+ case 32 /* space */:
+ // skip whitespace
+ pos++;
+ continue;
+ case 47 /* slash */:
+ var nextChar = text.charCodeAt(pos + 1);
+ if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) {
+ var isSingleLineComment = nextChar === 47 /* slash */;
+ pos += 2;
+ if (isSingleLineComment) {
+ while (pos < text.length) {
+ if (ts.isLineBreak(text.charCodeAt(pos))) {
+ // the comment ends here, go back to default logic to handle parsing new line and result
+ continue scan;
+ }
+ pos++;
+ }
+ }
+ else {
+ while (pos < text.length) {
+ if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
+ pos += 2;
+ continue scan;
+ }
+ pos++;
+ }
+ }
+ // if we arrive here, it's because pos == text.length
+ return pos;
+ }
+ break scan;
+ default:
+ // skip whitespace:
+ if (ch > 127 /* maxAsciiCharacter */ && (ts.isWhiteSpaceLike(ch))) {
+ pos++;
+ continue;
+ }
+ break scan;
+ }
+ }
+ return pos;
+}
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
+++ b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
index 2634398da..2cb4f24b6 100644
--- a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-angle-bracket-type-assertion",
description: "Requires the use of `as Type` for type assertions instead of `<Type>`.",
hasFix: true,
- rationale: (_a = ["\n Both formats of type assertions have the same effect, but only `as` type assertions\n work in `.tsx` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], _a.raw = ["\n Both formats of type assertions have the same effect, but only \\`as\\` type assertions\n work in \\`.tsx\\` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Both formats of type assertions have the same effect, but only `as` type assertions\n work in `.tsx` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], ["\n Both formats of type assertions have the same effect, but only \\`as\\` type assertions\n work in \\`.tsx\\` files. This rule ensures that you have a consistent type assertion style\n across your codebase."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -70,4 +70,4 @@ function needsParens(node) {
return tsutils_1.isBinaryExpression(parent) &&
(parent.operatorToken.kind === ts.SyntaxKind.AmpersandToken || parent.operatorToken.kind === ts.SyntaxKind.BarToken);
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noAnyRule.js b/node_modules/tslint/lib/rules/noAnyRule.js
index d438dabca..bd424bf9f 100644
--- a/node_modules/tslint/lib/rules/noAnyRule.js
+++ b/node_modules/tslint/lib/rules/noAnyRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-any",
description: "Disallows usages of `any` as a type declaration.",
hasFix: false,
- rationale: "Using `any` as a type declaration nullifies the compile-time benefits of the type system.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `any` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use `<T>` template types for generic type handling.\n\n Also see the `no-unsafe-any` rule.\n "], ["\n Using \\`any\\` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use \\`<T>\\` template types for generic type handling.\n\n Also see the \\`no-unsafe-any\\` rule.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -40,9 +40,7 @@ var Rule = /** @class */ (function (_super) {
typescriptOnly: true,
};
/* tslint:enable:object-literal-sort-keys */
- Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. " +
- "Consider replacing it with a more precise type, the empty type ('{}'), " +
- "or suppress this occurrence.";
+ Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.";
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
@@ -50,8 +48,9 @@ function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (node.kind === ts.SyntaxKind.AnyKeyword) {
var start = node.end - 3;
- return ctx.addFailure(start, node.end, Rule.FAILURE_STRING, new Lint.Replacement(start, 3, "{}"));
+ return ctx.addFailure(start, node.end, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noArgRule.d.ts b/node_modules/tslint/lib/rules/noArgRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noArgRule.d.ts
+++ b/node_modules/tslint/lib/rules/noArgRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noArgRule.js b/node_modules/tslint/lib/rules/noArgRule.js
index e5fe14932..6036f84dc 100644
--- a/node_modules/tslint/lib/rules/noArgRule.js
+++ b/node_modules/tslint/lib/rules/noArgRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-arg",
description: "Disallows use of `arguments.callee`.",
- rationale: (_a = ["\n Using `arguments.callee` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid `arguments.callee`."], _a.raw = ["\n Using \\`arguments.callee\\` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid \\`arguments.callee\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `arguments.callee` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid `arguments.callee`."], ["\n Using \\`arguments.callee\\` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid \\`arguments.callee\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -54,4 +54,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noBitwiseRule.js b/node_modules/tslint/lib/rules/noBitwiseRule.js
index 4a3d413a6..edd086133 100644
--- a/node_modules/tslint/lib/rules/noBitwiseRule.js
+++ b/node_modules/tslint/lib/rules/noBitwiseRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-bitwise",
description: "Disallows bitwise operators.",
- descriptionDetails: (_a = ["\n Specifically, the following bitwise operators are banned:\n `&`, `&=`, `|`, `|=`,\n `^`, `^=`, `<<`, `<<=`,\n `>>`, `>>=`, `>>>`, `>>>=`, and `~`.\n This rule does not ban the use of `&` and `|` for intersection and union types."], _a.raw = ["\n Specifically, the following bitwise operators are banned:\n \\`&\\`, \\`&=\\`, \\`|\\`, \\`|=\\`,\n \\`^\\`, \\`^=\\`, \\`<<\\`, \\`<<=\\`,\n \\`>>\\`, \\`>>=\\`, \\`>>>\\`, \\`>>>=\\`, and \\`~\\`.\n This rule does not ban the use of \\`&\\` and \\`|\\` for intersection and union types."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Bitwise operators are often typos - for example `bool1 & bool2` instead of `bool1 && bool2`.\n They also can be an indicator of overly clever code which decreases maintainability."], _b.raw = ["\n Bitwise operators are often typos - for example \\`bool1 & bool2\\` instead of \\`bool1 && bool2\\`.\n They also can be an indicator of overly clever code which decreases maintainability."], Lint.Utils.dedent(_b)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Specifically, the following bitwise operators are banned:\n `&`, `&=`, `|`, `|=`,\n `^`, `^=`, `<<`, `<<=`,\n `>>`, `>>=`, `>>>`, `>>>=`, and `~`.\n This rule does not ban the use of `&` and `|` for intersection and union types."], ["\n Specifically, the following bitwise operators are banned:\n \\`&\\`, \\`&=\\`, \\`|\\`, \\`|=\\`,\n \\`^\\`, \\`^=\\`, \\`<<\\`, \\`<<=\\`,\n \\`>>\\`, \\`>>=\\`, \\`>>>\\`, \\`>>>=\\`, and \\`~\\`.\n This rule does not ban the use of \\`&\\` and \\`|\\` for intersection and union types."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Bitwise operators are often typos - for example `bool1 & bool2` instead of `bool1 && bool2`.\n They also can be an indicator of overly clever code which decreases maintainability."], ["\n Bitwise operators are often typos - for example \\`bool1 & bool2\\` instead of \\`bool1 && bool2\\`.\n They also can be an indicator of overly clever code which decreases maintainability."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -70,4 +70,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
index 979552d6f..5f2dd1ccd 100644
--- a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
index cefd393ec..efe5027c1 100644
--- a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
@@ -40,6 +40,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Comparing boolean values to boolean literals is unnecessary, as those expressions will result in booleans too.\n Just use the boolean values directly or negate them.\n "], ["\n Comparing boolean values to boolean literals is unnecessary, as those expressions will result in booleans too.\n Just use the boolean values directly or negate them.\n "]))),
type: "style",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -60,7 +61,7 @@ function walk(ctx, checker) {
}
function getBooleanComparison(node, checker) {
var cmp = deconstructComparison(node);
- return cmp === undefined || !Lint.isTypeFlagSet(checker.getTypeAtLocation(cmp.expression), ts.TypeFlags.Boolean) ? undefined : cmp;
+ return cmp === undefined || !utils.isTypeFlagSet(checker.getTypeAtLocation(cmp.expression), ts.TypeFlags.Boolean) ? undefined : cmp;
}
function fix(node, _a) {
var negate = _a.negate, expression = _a.expression;
@@ -119,3 +120,4 @@ function booleanFromExpression(node) {
return undefined;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
index 30e77aa84..7e004cb58 100644
--- a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-conditional-assignment",
description: "Disallows any type of assignment in conditionals.",
descriptionDetails: "This applies to `do-while`, `for`, `if`, and `while` statements and conditional (ternary) expressions.",
- rationale: (_a = ["\n Assignments in conditionals are often typos:\n for example `if (var1 = var2)` instead of `if (var1 == var2)`.\n They also can be an indicator of overly clever code which decreases maintainability."], _a.raw = ["\n Assignments in conditionals are often typos:\n for example \\`if (var1 = var2)\\` instead of \\`if (var1 == var2)\\`.\n They also can be an indicator of overly clever code which decreases maintainability."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Assignments in conditionals are often typos:\n for example `if (var1 = var2)` instead of `if (var1 == var2)`.\n They also can be an indicator of overly clever code which decreases maintainability."], ["\n Assignments in conditionals are often typos:\n for example \\`if (var1 = var2)\\` instead of \\`if (var1 == var2)\\`.\n They also can be an indicator of overly clever code which decreases maintainability."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -115,4 +115,4 @@ function maybeCallback(cb, node) {
cb(node);
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
index 36668bc3f..9a2716053 100644
--- a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
index 8e6253ba5..a52a03d15 100644
--- a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
@@ -48,8 +48,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-consecutive-blank-lines",
description: "Disallows one or more blank lines in a row.",
hasFix: true,
- rationale: "Helps maintain a readable style in your codebase.",
- optionsDescription: (_a = ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], _a.raw = ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], Lint.Utils.dedent(_a, Rule.DEFAULT_ALLOWED_BLANKS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps maintain a readable style in your codebase.\n\n Extra blank lines take up extra space and add little to a semantic understanding of the code.\n It can be harder to read through files when fewer components can fit into the screen.\n If you find a file is so large you feel a need to split them up with extra blank lines or comments,\n consider splitting your file into smaller files.\n "], ["\n Helps maintain a readable style in your codebase.\n\n Extra blank lines take up extra space and add little to a semantic understanding of the code.\n It can be harder to read through files when fewer components can fit into the screen.\n If you find a file is so large you feel a need to split them up with extra blank lines or comments,\n consider splitting your file into smaller files.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."])), Rule.DEFAULT_ALLOWED_BLANKS),
options: {
type: "number",
minimum: "1",
@@ -125,4 +125,4 @@ function getTemplateRanges(sourceFile) {
return intervals;
}
exports.getTemplateRanges = getTemplateRanges;
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.d.ts b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
index 0e867ca96..44d692363 100644
--- a/node_modules/tslint/lib/rules/noConsoleRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.js b/node_modules/tslint/lib/rules/noConsoleRule.js
index 384154d12..0a2eeb42e 100644
--- a/node_modules/tslint/lib/rules/noConsoleRule.js
+++ b/node_modules/tslint/lib/rules/noConsoleRule.js
@@ -51,12 +51,11 @@ var Rule = /** @class */ (function (_super) {
exports.Rule = Rule;
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
- if (tsutils_1.isCallExpression(node) &&
- tsutils_1.isPropertyAccessExpression(node.expression) &&
- tsutils_1.isIdentifier(node.expression.expression) &&
- node.expression.expression.text === "console" &&
- (ctx.options.length === 0 || ctx.options.indexOf(node.expression.name.text) !== -1)) {
- ctx.addFailureAtNode(node.expression, Rule.FAILURE_STRING_FACTORY(node.expression.name.text));
+ if (tsutils_1.isPropertyAccessExpression(node) &&
+ tsutils_1.isIdentifier(node.expression) &&
+ node.expression.text === "console" &&
+ (ctx.options.length === 0 || ctx.options.indexOf(node.name.text) !== -1)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_FACTORY(node.name.text));
}
return ts.forEachChild(node, cb);
});
diff --git a/node_modules/tslint/lib/rules/noConstructRule.d.ts b/node_modules/tslint/lib/rules/noConstructRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noConstructRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConstructRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConstructRule.js b/node_modules/tslint/lib/rules/noConstructRule.js
index bc6130b24..9d7391b3a 100644
--- a/node_modules/tslint/lib/rules/noConstructRule.js
+++ b/node_modules/tslint/lib/rules/noConstructRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-construct",
description: "Disallows access to the constructors of `String`, `Number`, and `Boolean`.",
descriptionDetails: "Disallows constructor use such as `new Number(foo)` but does not disallow `Number(foo)`.",
- rationale: (_a = ["\n There is little reason to use `String`, `Number`, or `Boolean` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], _a.raw = ["\n There is little reason to use \\`String\\`, \\`Number\\`, or \\`Boolean\\` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n There is little reason to use `String`, `Number`, or `Boolean` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], ["\n There is little reason to use \\`String\\`, \\`Number\\`, or \\`Boolean\\` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -58,4 +58,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noDefaultExportRule.js b/node_modules/tslint/lib/rules/noDefaultExportRule.js
index da53773d5..099290b2d 100644
--- a/node_modules/tslint/lib/rules/noDefaultExportRule.js
+++ b/node_modules/tslint/lib/rules/noDefaultExportRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-default-export",
description: "Disallows default exports in ES6-style modules.",
descriptionDetails: "Use named exports instead.",
- rationale: (_a = ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], _a.raw = ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -62,4 +62,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
index 419acce16..37804b2d0 100644
--- a/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
index af7c741f8..d30d74b4c 100644
--- a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
+var ts = require("typescript");
var Lint = require("../index");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
@@ -33,8 +34,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-duplicate-imports",
- description: (_a = ["\n Disallows multiple import statements from the same module."], _a.raw = ["\n Disallows multiple import statements from the same module."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], _b.raw = ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows multiple import statements from the same module."], ["\n Disallows multiple import statements from the same module."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."]))),
optionsDescription: "Not configurable",
options: null,
optionExamples: [true],
@@ -45,15 +46,24 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- var seen = new Set();
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 1 /* ImportDeclaration */); _i < _a.length; _i++) {
- var _b = _a[_i], text = _b.text, parent = _b.parent;
- if (seen.has(text)) {
- ctx.addFailureAtNode(parent, Rule.FAILURE_STRING(text));
- }
- else {
+ walkWorker(ctx, ctx.sourceFile.statements, new Set());
+}
+function walkWorker(ctx, statements, seen) {
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
+ if (tsutils_1.isImportDeclaration(statement) && tsutils_1.isLiteralExpression(statement.moduleSpecifier)) {
+ var text = statement.moduleSpecifier.text;
+ if (seen.has(text)) {
+ ctx.addFailureAtNode(statement, Rule.FAILURE_STRING(text));
+ }
seen.add(text);
}
+ if (tsutils_1.isModuleDeclaration(statement) && statement.body !== undefined && statement.name.kind === ts.SyntaxKind.StringLiteral) {
+ // If this is a module augmentation, re-use `seen` since those imports could be moved outside.
+ // If this is an ambient module, create a fresh `seen`
+ // because they should have separate imports to avoid becoming augmentations.
+ walkWorker(ctx, statement.body.statements, ts.isExternalModule(ctx.sourceFile) ? seen : new Set());
+ }
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
index 33c7edd14..eb78370a5 100644
--- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
index 39e07d472..b1e545f48 100644
--- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
@@ -53,7 +53,7 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
function getSuperForNode(node) {
- if (Lint.isLoop(node)) {
+ if (tsutils_1.isIterationStatement(node)) {
var bodySuper = combineSequentialChildren(node);
if (typeof bodySuper === "number") {
return 0 /* NoSuper */;
@@ -77,8 +77,17 @@ function walk(ctx) {
return node.parent.kind === ts.SyntaxKind.CallExpression && node.parent.expression === node
? { node: node.parent, break: false }
: 0 /* NoSuper */;
+ case ts.SyntaxKind.ConditionalExpression: {
+ var _a = node, condition = _a.condition, whenTrue = _a.whenTrue, whenFalse = _a.whenFalse;
+ var inCondition = getSuperForNode(condition);
+ var inBranches = worse(getSuperForNode(whenTrue), getSuperForNode(whenFalse));
+ if (typeof inCondition !== "number" && typeof inBranches !== "number") {
+ addDuplicateFailure(inCondition.node, inBranches.node);
+ }
+ return worse(inCondition, inBranches);
+ }
case ts.SyntaxKind.IfStatement: {
- var _a = node, thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
+ var _b = node, thenStatement = _b.thenStatement, elseStatement = _b.elseStatement;
return worse(getSuperForNode(thenStatement), elseStatement !== undefined ? getSuperForNode(elseStatement) : 0 /* NoSuper */);
}
case ts.SyntaxKind.SwitchStatement:
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
index 117f46536..699da0464 100644
--- a/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
index f546ddfc4..54a053387 100644
--- a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
@@ -39,9 +39,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-duplicate-variable",
description: "Disallows duplicate variable declarations in the same block scope.",
- descriptionDetails: (_a = ["\n This rule is only useful when using the `var` keyword -\n the compiler will detect redeclarations of `let` and `const` variables."], _a.raw = ["\n This rule is only useful when using the \\`var\\` keyword -\n the compiler will detect redeclarations of \\`let\\` and \\`const\\` variables."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], _b.raw = ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], Lint.Utils.dedent(_b)),
- optionsDescription: "You can specify `\"" + OPTION_CHECK_PARAMETERS + "\"` to check for variables with the same name as a paramter.",
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule is only useful when using the `var` keyword -\n the compiler will detect redeclarations of `let` and `const` variables."], ["\n This rule is only useful when using the \\`var\\` keyword -\n the compiler will detect redeclarations of \\`let\\` and \\`const\\` variables."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."]))),
+ optionsDescription: "You can specify `\"" + OPTION_CHECK_PARAMETERS + "\"` to check for variables with the same name as a parameter.",
options: {
type: "string",
enum: [OPTION_CHECK_PARAMETERS],
@@ -59,7 +59,9 @@ exports.Rule = Rule;
var NoDuplicateVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoDuplicateVariableWalker, _super);
function NoDuplicateVariableWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Set();
+ return _this;
}
NoDuplicateVariableWalker.prototype.walk = function (sourceFile) {
var _this = this;
@@ -105,4 +107,4 @@ var NoDuplicateVariableWalker = /** @class */ (function (_super) {
};
return NoDuplicateVariableWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
index 0a098d7f6..99a5b06b6 100644
--- a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.d.ts b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noEmptyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.js b/node_modules/tslint/lib/rules/noEmptyRule.js
index 115875816..ee79f5f8b 100644
--- a/node_modules/tslint/lib/rules/noEmptyRule.js
+++ b/node_modules/tslint/lib/rules/noEmptyRule.js
@@ -21,6 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var ALLOW_EMPTY_CATCH = "allow-empty-catch";
+var ALLOW_EMPTY_FUNCTIONS = "allow-empty-functions";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -29,6 +30,7 @@ var Rule = /** @class */ (function (_super) {
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk, {
allowEmptyCatch: this.ruleArguments.indexOf(ALLOW_EMPTY_CATCH) !== -1,
+ allowEmptyFunctions: this.ruleArguments.indexOf(ALLOW_EMPTY_FUNCTIONS) !== -1,
});
};
/* tslint:disable:object-literal-sort-keys */
@@ -37,12 +39,28 @@ var Rule = /** @class */ (function (_super) {
description: "Disallows empty blocks.",
descriptionDetails: "Blocks with a comment inside are not considered empty.",
rationale: "Empty blocks are often indicators of missing code.",
- optionsDescription: (_a = ["\n If `", "` is specified, then catch blocks are allowed to be empty."], _a.raw = ["\n If \\`", "\\` is specified, then catch blocks are allowed to be empty."], Lint.Utils.dedent(_a, ALLOW_EMPTY_CATCH)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then catch blocks are allowed to be empty.\n If `", "` is specified, then function definitions are allowed to be empty."], ["\n If \\`", "\\` is specified, then catch blocks are allowed to be empty.\n If \\`", "\\` is specified, then function definitions are allowed to be empty."])), ALLOW_EMPTY_CATCH, ALLOW_EMPTY_FUNCTIONS),
options: {
- type: "string",
- enum: [ALLOW_EMPTY_CATCH],
+ type: "array",
+ items: {
+ anyOf: [
+ {
+ type: "string",
+ enum: [ALLOW_EMPTY_CATCH],
+ },
+ {
+ type: "string",
+ enum: [ALLOW_EMPTY_FUNCTIONS],
+ },
+ ],
+ },
},
- optionExamples: [true, [true, ALLOW_EMPTY_CATCH]],
+ optionExamples: [
+ true,
+ [true, ALLOW_EMPTY_CATCH],
+ [true, ALLOW_EMPTY_FUNCTIONS],
+ [true, ALLOW_EMPTY_CATCH, ALLOW_EMPTY_FUNCTIONS],
+ ],
type: "functionality",
typescriptOnly: false,
};
@@ -71,6 +89,13 @@ function isExcluded(node, options) {
if (options.allowEmptyCatch && node.kind === ts.SyntaxKind.CatchClause) {
return true;
}
+ if (options.allowEmptyFunctions &&
+ (node.kind === ts.SyntaxKind.MethodDeclaration ||
+ node.kind === ts.SyntaxKind.FunctionDeclaration ||
+ node.kind === ts.SyntaxKind.FunctionExpression ||
+ node.kind === ts.SyntaxKind.ArrowFunction)) {
+ return true;
+ }
return tsutils_1.isConstructorDeclaration(node) &&
(
/* If constructor is private or protected, the block is allowed to be empty.
@@ -80,4 +105,4 @@ function isExcluded(node, options) {
tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ProtectedKeyword) ||
node.parameters.some(tsutils_1.isParameterProperty));
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noEvalRule.d.ts b/node_modules/tslint/lib/rules/noEvalRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noEvalRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEvalRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEvalRule.js b/node_modules/tslint/lib/rules/noEvalRule.js
index 9067a3fd8..386914433 100644
--- a/node_modules/tslint/lib/rules/noEvalRule.js
+++ b/node_modules/tslint/lib/rules/noEvalRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-eval",
description: "Disallows `eval` function invocations.",
- rationale: (_a = ["\n `eval()` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for `eval()`."], _a.raw = ["\n \\`eval()\\` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for \\`eval()\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n `eval()` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for `eval()`."], ["\n \\`eval()\\` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for \\`eval()\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -53,4 +53,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
index 152a03eab..f6d8c1e0d 100644
--- a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
@@ -32,8 +32,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-floating-promises",
description: "Promises returned by functions must be handled appropriately.",
- descriptionDetails: "Use `no-unused-expression` in addition to this rule to reveal even more floating promises.",
- optionsDescription: (_a = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], _a.raw = ["\n A list of \\'string\\' names of any additional classes that should also be handled as Promises.\n "], Lint.Utils.dedent(_a)),
+ descriptionDetails: "Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], ["\n A list of \\'string\\' names of any additional classes that should also be handled as Promises.\n "]))),
options: {
type: "list",
listType: {
@@ -42,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
},
},
optionExamples: [true, [true, "JQueryPromise"]],
- rationale: "Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.",
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Creating a Promise and not storing or returning it may let other code run independently of its result.\n This can cause unexpected and/or non-deterministic behavior depending on external timing factors.\n\n It's typically better to return Promises from functions that start them, then handle them in calling code.\n\n Use `no-unused-expression` in addition to this rule to reveal even more floating promises.\n "], ["\n Creating a Promise and not storing or returning it may let other code run independently of its result.\n This can cause unexpected and/or non-deterministic behavior depending on external timing factors.\n\n It's typically better to return Promises from functions that start them, then handle them in calling code.\n\n Use \\`no-unused-expression\\` in addition to this rule to reveal even more floating promises.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -76,4 +76,4 @@ function isPromiseThenCallWithRejectionHandler(expression) {
expression.expression.name.text === "then" &&
expression.arguments.length >= 2;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noForInArrayRule.js b/node_modules/tslint/lib/rules/noForInArrayRule.js
index a5a2ad6b8..726001716 100644
--- a/node_modules/tslint/lib/rules/noForInArrayRule.js
+++ b/node_modules/tslint/lib/rules/noForInArrayRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-for-in-array",
description: "Disallows iterating over an array with a for-in loop.",
- descriptionDetails: (_a = ["\n A for-in loop (`for (var k in o)`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], _a.raw = ["\n A for-in loop (\\`for (var k in o)\\`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A for-in loop (`for (var k in o)`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], ["\n A for-in loop (\\`for (var k in o)\\`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -57,4 +57,4 @@ function walk(ctx, checker) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
index ac0e6994f..41a47d70a 100644
--- a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
index 212baf8ae..6aa697a33 100644
--- a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
+++ b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
@@ -35,27 +35,42 @@ var Rule = /** @class */ (function (_super) {
return "Module '" + module + "' is not listed as dependency in package.json";
};
Rule.prototype.apply = function (sourceFile) {
+ var whitelist = this.ruleArguments.find(function (arg) { return Array.isArray(arg); });
+ if (whitelist === null || whitelist === undefined) {
+ whitelist = [];
+ }
return this.applyWithFunction(sourceFile, walk, {
dev: this.ruleArguments.indexOf(OPTION_DEV) !== -1,
optional: this.ruleArguments.indexOf(OPTION_OPTIONAL) !== -1,
+ whitelist: whitelist,
});
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-implicit-dependencies",
description: "Disallows importing modules that are not listed as dependency in the project's package.json",
- descriptionDetails: (_a = ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], _a.raw = ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n By default the rule looks at `\"dependencies\"` and `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule looks at `\"devDependencies\"` instead of `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"optionalDependencies\"`.\n "], _b.raw = ["\n By default the rule looks at \\`\"dependencies\"\\` and \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule looks at \\`\"devDependencies\"\\` instead of \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"optionalDependencies\"\\`.\n "], Lint.Utils.dedent(_b, OPTION_DEV, OPTION_OPTIONAL)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n By default the rule looks at `\"dependencies\"` and `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"devDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"optionalDependencies\"`.\n An array of whitelisted modules can be added to skip checking their existence in package.json.\n "], ["\n By default the rule looks at \\`\"dependencies\"\\` and \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"devDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"optionalDependencies\"\\`.\n An array of whitelisted modules can be added to skip checking their existence in package.json.\n "])), OPTION_DEV, OPTION_OPTIONAL),
options: {
type: "array",
- items: {
- type: "string",
- enum: [OPTION_DEV, OPTION_OPTIONAL],
- },
+ items: [
+ {
+ type: "string",
+ enum: [OPTION_DEV, OPTION_OPTIONAL],
+ },
+ {
+ type: "array",
+ },
+ ],
minItems: 0,
- maxItems: 2,
+ maxItems: 3,
},
- optionExamples: [true, [true, OPTION_DEV], [true, OPTION_OPTIONAL]],
+ optionExamples: [
+ true,
+ [true, OPTION_DEV],
+ [true, OPTION_OPTIONAL],
+ [true, ["src", "app"]],
+ ],
type: "functionality",
typescriptOnly: false,
};
@@ -65,11 +80,12 @@ exports.Rule = Rule;
function walk(ctx) {
var options = ctx.options;
var dependencies;
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ var whitelist = new Set(options.whitelist);
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
if (!ts.isExternalModuleNameRelative(name.text)) {
var packageName = getPackageName(name.text);
- if (builtins.indexOf(packageName) === -1 && !hasDependency(packageName)) {
+ if (!whitelist.has(packageName) && builtins.indexOf(packageName) === -1 && !hasDependency(packageName)) {
ctx.addFailureAtNode(name, Rule.FAILURE_STRING_FACTORY(packageName));
}
}
@@ -92,20 +108,25 @@ function getDependencies(fileName, options) {
var result = new Set();
var packageJsonPath = findPackageJson(path.resolve(path.dirname(fileName)));
if (packageJsonPath !== undefined) {
- // don't use require here to avoid caching
- // remove BOM from file content before parsing
- var content = JSON.parse(fs.readFileSync(packageJsonPath, "utf8").replace(/^\uFEFF/, ""));
- if (content.dependencies !== undefined) {
- addDependencies(result, content.dependencies);
- }
- if (!options.dev && content.peerDependencies !== undefined) {
- addDependencies(result, content.peerDependencies);
- }
- if (options.dev && content.devDependencies !== undefined) {
- addDependencies(result, content.devDependencies);
+ try {
+ // don't use require here to avoid caching
+ // remove BOM from file content before parsing
+ var content = JSON.parse(fs.readFileSync(packageJsonPath, "utf8").replace(/^\uFEFF/, ""));
+ if (content.dependencies !== undefined) {
+ addDependencies(result, content.dependencies);
+ }
+ if (content.peerDependencies !== undefined) {
+ addDependencies(result, content.peerDependencies);
+ }
+ if (options.dev && content.devDependencies !== undefined) {
+ addDependencies(result, content.devDependencies);
+ }
+ if (options.optional && content.optionalDependencies !== undefined) {
+ addDependencies(result, content.optionalDependencies);
+ }
}
- if (options.optional && content.optionalDependencies !== undefined) {
- addDependencies(result, content.optionalDependencies);
+ catch (_a) {
+ // treat malformed package.json files as empty
}
}
return result;
@@ -129,4 +150,4 @@ function findPackageJson(current) {
} while (prev !== current);
return undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.js b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
index a2b6afb0a..104a8f0e2 100644
--- a/node_modules/tslint/lib/rules/noImportSideEffectRule.js
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a;
var utils = require("tsutils");
var Lint = require("../index");
var OPTION_IGNORE_MODULE = "ignore-module";
@@ -46,7 +47,7 @@ var Rule = /** @class */ (function (_super) {
minLength: 0,
type: "array",
},
- optionsDescription: (_b = ["\n One argument may be optionally provided:\n\n * `", "` allows to specify a regex and ignore modules which it matches."], _b.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows to specify a regex and ignore modules which it matches."], Lint.Utils.dedent(_b, OPTION_IGNORE_MODULE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows to specify a regex and ignore modules which it matches."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows to specify a regex and ignore modules which it matches."])), OPTION_IGNORE_MODULE),
rationale: "Imports with side effects may have behavior which is hard for static verification.",
ruleName: "no-import-side-effect",
type: "typescript",
@@ -72,4 +73,4 @@ function walk(ctx) {
}
}
}
-var _a, _b;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
index 38e1bc3a5..c8caca0f9 100644
--- a/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.js b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
index a9da20d83..dc87eb9ff 100644
--- a/node_modules/tslint/lib/rules/noInferrableTypesRule.js
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
@@ -42,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-inferrable-types",
description: "Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.",
rationale: "Explicit types where they can be easily inferred by the compiler make code more verbose.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `", "` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the `typedef` rule.\n * `", "` allows specifying an inferrable type annotation for class properties."], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the \\`typedef\\` rule.\n * \\`", "\\` allows specifying an inferrable type annotation for class properties."], Lint.Utils.dedent(_a, OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `", "` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the `typedef` rule.\n * `", "` allows specifying an inferrable type annotation for class properties."], ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the \\`typedef\\` rule.\n * \\`", "\\` allows specifying an inferrable type annotation for class properties."])), OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES),
options: {
type: "array",
items: {
@@ -121,4 +121,4 @@ function typeIsInferrable(type, initializer) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
index 1e9b27cc8..6103d1624 100644
--- a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
index df4b9304c..0d8bd858a 100644
--- a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
@@ -35,6 +35,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n When function or constructor may be called with a type parameter but one isn't supplied or inferrable,\n TypeScript defaults to `{}`.\n This is often undesirable as the call is meant to be of a more specific type.\n "], ["\n When function or constructor may be called with a type parameter but one isn't supplied or inferrable,\n TypeScript defaults to \\`{}\\`.\n This is often undesirable as the call is meant to be of a more specific type.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -101,3 +102,4 @@ var NoInferredEmptyObjectTypeRule = /** @class */ (function (_super) {
};
return NoInferredEmptyObjectTypeRule;
}(Lint.AbstractWalker));
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInternalModuleRule.js b/node_modules/tslint/lib/rules/noInternalModuleRule.js
index 06ed07e24..965b8c259 100644
--- a/node_modules/tslint/lib/rules/noInternalModuleRule.js
+++ b/node_modules/tslint/lib/rules/noInternalModuleRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var Rule = /** @class */ (function (_super) {
@@ -63,10 +64,10 @@ var NoInternalModuleWalker = /** @class */ (function (_super) {
NoInternalModuleWalker.prototype.checkModuleDeclaration = function (node, nested) {
if (!nested &&
node.name.kind === ts.SyntaxKind.Identifier &&
- !Lint.isNodeFlagSet(node, ts.NodeFlags.Namespace) &&
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.Namespace) &&
// augmenting global uses a special syntax that is allowed
// see https://github.com/Microsoft/TypeScript/pull/6213
- !Lint.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
var end = node.name.pos;
var start = end - "module".length;
this.addFailure(start, end, Rule.FAILURE_STRING, Lint.Replacement.replaceFromTo(start, end, "namespace"));
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
index 3fe553081..5dd00a4d3 100644
--- a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
@@ -31,11 +31,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-invalid-template-strings",
- // tslint:disable-next-line no-invalid-template-strings
- description: "Warns on use of `${` in non-template strings.",
+ description: "Warns on use of `\${` in non-template strings.",
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: "Interpolation will only work for template strings.",
type: "functionality",
typescriptOnly: false,
};
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
index a664f16a5..f3c779344 100644
--- a/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "..";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.js b/node_modules/tslint/lib/rules/noInvalidThisRule.js
index 49333d54f..1a427d9c2 100644
--- a/node_modules/tslint/lib/rules/noInvalidThisRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-invalid-this",
description: "Disallows using the `this` keyword outside of classes.",
rationale: "See [the rule's author's rationale here.](https://github.com/palantir/tslint/pull/1105#issue-147549402)",
- optionsDescription: (_a = ["\n One argument may be optionally provided:\n\n * `", "` disallows using the `this` keyword in functions within class methods."], _a.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` disallows using the \\`this\\` keyword in functions within class methods."], Lint.Utils.dedent(_a, OPTION_FUNCTION_IN_METHOD)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` disallows using the `this` keyword in functions within class methods."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` disallows using the \\`this\\` keyword in functions within class methods."])), OPTION_FUNCTION_IN_METHOD),
options: {
type: "array",
items: {
@@ -98,4 +98,4 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
index 4c0baeb89..d041cf4b4 100644
--- a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
@@ -29,7 +29,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-irregular-whitespace",
- description: "Disallow irregular whitespace outside of strings and comments",
+ description: "Disallow irregular whitespace within a file, including strings and comments.",
hasFix: true,
optionsDescription: "Not configurable.",
options: null,
diff --git a/node_modules/tslint/lib/rules/noMagicNumbersRule.js b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
index 483130dfe..4678c4f73 100644
--- a/node_modules/tslint/lib/rules/noMagicNumbersRule.js
+++ b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
+var tsutils_1 = require("tsutils");
var Lint = require("../index");
var utils_1 = require("../language/utils");
var Rule = /** @class */ (function (_super) {
@@ -26,14 +27,13 @@ var Rule = /** @class */ (function (_super) {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
- var allowedNumbers = this.ruleArguments.length > 0 ? this.ruleArguments : Rule.DEFAULT_ALLOWED;
- return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(allowedNumbers.map(String))));
+ return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, this.ruleArguments.length > 0 ? this.ruleArguments : Rule.DEFAULT_ALLOWED));
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-magic-numbers",
- description: (_a = ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], _a.raw = ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Magic numbers should be avoided as they often lack documentation, forcing\n them to be stored in variables gives them implicit documentation."], _b.raw = ["\n Magic numbers should be avoided as they often lack documentation, forcing\n them to be stored in variables gives them implicit documentation."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Magic numbers should be avoided as they often lack documentation.\n Forcing them to be stored in variables gives them implicit documentation.\n "], ["\n Magic numbers should be avoided as they often lack documentation.\n Forcing them to be stored in variables gives them implicit documentation.\n "]))),
optionsDescription: "A list of allowed numbers.",
options: {
type: "array",
@@ -72,6 +72,9 @@ var NoMagicNumbersWalker = /** @class */ (function (_super) {
NoMagicNumbersWalker.prototype.walk = function (sourceFile) {
var _this = this;
var cb = function (node) {
+ if (tsutils_1.isCallExpression(node) && tsutils_1.isIdentifier(node.expression) && node.expression.text === "parseInt") {
+ return node.arguments.length === 0 ? undefined : cb(node.arguments[0]);
+ }
if (node.kind === ts.SyntaxKind.NumericLiteral) {
return _this.checkNumericLiteral(node, node.text);
}
@@ -83,10 +86,12 @@ var NoMagicNumbersWalker = /** @class */ (function (_super) {
return ts.forEachChild(sourceFile, cb);
};
NoMagicNumbersWalker.prototype.checkNumericLiteral = function (node, num) {
- if (!Rule.ALLOWED_NODES.has(node.parent.kind) && !this.options.has(num)) {
+ /* Using Object.is() to differentiate between pos/neg zero */
+ if (!Rule.ALLOWED_NODES.has(node.parent.kind) &&
+ !this.options.some(function (allowedNum) { return Object.is(allowedNum, parseFloat(num)); })) {
this.addFailureAtNode(node, Rule.FAILURE_STRING);
}
};
return NoMagicNumbersWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
index ddc81e37c..9d47972ab 100644
--- a/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.js b/node_modules/tslint/lib/rules/noMisusedNewRule.js
index 4f166eb36..8a26af86c 100644
--- a/node_modules/tslint/lib/rules/noMisusedNewRule.js
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.js
@@ -35,6 +35,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Interfaces in TypeScript aren't meant to describe constructors on their implementations.\n The `new` descriptor is primarily for describing JavaScript libraries.\n If you're trying to describe a function known to be a class, it's typically better to `declare class`.\n "], ["\n Interfaces in TypeScript aren't meant to describe constructors on their implementations.\n The \\`new\\` descriptor is primarily for describing JavaScript libraries.\n If you're trying to describe a function known to be a class, it's typically better to \\`declare class\\`.\n "]))),
type: "functionality",
typescriptOnly: true,
};
@@ -72,3 +73,4 @@ function returnTypeMatchesParent(parent, decl) {
}
return decl.type.typeName.kind === ts.SyntaxKind.Identifier && decl.type.typeName.text === parent.name.text;
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.d.ts b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.js b/node_modules/tslint/lib/rules/noNamespaceRule.js
index 4afdb2ee4..602e49c91 100644
--- a/node_modules/tslint/lib/rules/noNamespaceRule.js
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.js
@@ -36,8 +36,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-namespace",
description: "Disallows use of internal \`module\`s and \`namespace\`s.",
descriptionDetails: "This rule still allows the use of `declare module ... {}`",
- rationale: (_a = ["\n ES6-style external modules are the standard way to modularize code.\n Using `module {}` and `namespace {}` are outdated ways to organize TypeScript code."], _a.raw = ["\n ES6-style external modules are the standard way to modularize code.\n Using \\`module {}\\` and \\`namespace {}\\` are outdated ways to organize TypeScript code."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One argument may be optionally provided:\n\n * `", "` allows `declare namespace ... {}` to describe external APIs."], _b.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows \\`declare namespace ... {}\\` to describe external APIs."], Lint.Utils.dedent(_b, OPTION_ALLOW_DECLARATIONS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ES6-style external modules are the standard way to modularize code.\n Using `module {}` and `namespace {}` are outdated ways to organize TypeScript code."], ["\n ES6-style external modules are the standard way to modularize code.\n Using \\`module {}\\` and \\`namespace {}\\` are outdated ways to organize TypeScript code."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows `declare namespace ... {}` to describe external APIs."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows \\`declare namespace ... {}\\` to describe external APIs."])), OPTION_ALLOW_DECLARATIONS),
options: {
type: "array",
items: {
@@ -73,4 +73,4 @@ function walk(ctx) {
}
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
index dc657fc53..f9b2b7857 100644
--- a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-non-null-assertion",
description: "Disallows non-null assertions using the `!` postfix operator.",
- rationale: "Using non-null assertion cancels the benefits of the strict null checking mode.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n ```\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n ```\n\n Either inform the strict type system that the object must exist:\n\n ```\n function foo(instance: MyClass) {\n instance.doWork();\n }\n ```\n\n Or verify that the instance exists, which will inform the type checker:\n\n ```\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n ```\n "], ["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n \\`\\`\\`\n\n Either inform the strict type system that the object must exist:\n\n \\`\\`\\`\n function foo(instance: MyClass) {\n instance.doWork();\n }\n \\`\\`\\`\n\n Or verify that the instance exists, which will inform the type checker:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n \\`\\`\\`\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -51,3 +51,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.js b/node_modules/tslint/lib/rules/noNullKeywordRule.js
index b54f9170c..5967586d1 100644
--- a/node_modules/tslint/lib/rules/noNullKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-null-keyword",
description: "Disallows use of the `null` keyword literal.",
- rationale: (_a = ["\n Instead of having the dual concepts of `null` and`undefined` in a codebase,\n this rule ensures that only `undefined` is used."], _a.raw = ["\n Instead of having the dual concepts of \\`null\\` and\\`undefined\\` in a codebase,\n this rule ensures that only \\`undefined\\` is used."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Instead of having the dual concepts of `null` and`undefined` in a codebase,\n this rule ensures that only `undefined` is used.\n\n JavaScript originally intended `undefined` to refer to a value that doesn't yet exist,\n while `null` was meant to refer to a value that does exist but points to nothing.\n That's confusing.\n `undefined` is the default value when object members don't exist, and is the return value\n for newer native collection APIs such as `Map.get` when collection values don't exist.\n\n ```\n const myObject = {};\n myObject.doesNotExist; // undefined\n ```\n\n ```\n const myMap = new Map<string, number>();\n myMap.get(\"doesNotExist\"); // undefined\n ```\n\n To remove confusion over the two similar values, it's better to stick with just `undefined`.\n "], ["\n Instead of having the dual concepts of \\`null\\` and\\`undefined\\` in a codebase,\n this rule ensures that only \\`undefined\\` is used.\n\n JavaScript originally intended \\`undefined\\` to refer to a value that doesn't yet exist,\n while \\`null\\` was meant to refer to a value that does exist but points to nothing.\n That's confusing.\n \\`undefined\\` is the default value when object members don't exist, and is the return value\n for newer native collection APIs such as \\`Map.get\\` when collection values don't exist.\n\n \\`\\`\\`\n const myObject = {};\n myObject.doesNotExist; // undefined\n \\`\\`\\`\n\n \\`\\`\\`\n const myMap = new Map<string, number>();\n myMap.get(\"doesNotExist\"); // undefined\n \\`\\`\\`\n\n To remove confusion over the two similar values, it's better to stick with just \\`undefined\\`.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -68,4 +68,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
index 1690165bd..1cad0a6d3 100644
--- a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-object-literal-type-assertion",
- description: (_a = ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to `any` is still allowed."], _a.raw = ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to \\`any\\` is still allowed."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Always prefer `const x: T = { ... };` to `const x = { ... } as T;`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: `const x: { foo: number } = {}` will fail to compile, but\n `const x = {} as { foo: number }` will succeed."], _b.raw = ["\n Always prefer \\`const x: T = { ... };\\` to \\`const x = { ... } as T;\\`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: \\`const x: { foo: number } = {}\\` will fail to compile, but\n \\`const x = {} as { foo: number }\\` will succeed."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Forbids an object literal to appear in a type assertion expression.\n Casting to `any` is still allowed."], ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to \\`any\\` is still allowed."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Always prefer `const x: T = { ... };` to `const x = { ... } as T;`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: `const x: { foo: number } = {}` will fail to compile, but\n `const x = {} as { foo: number }` will succeed."], ["\n Always prefer \\`const x: T = { ... };\\` to \\`const x = { ... } as T;\\`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: \\`const x: { foo: number } = {}\\` will fail to compile, but\n \\`const x = {} as { foo: number }\\` will succeed."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -53,4 +53,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
index c7e07066c..5fc47f394 100644
--- a/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
index c852cee9c..193a7f4d6 100644
--- a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-parameter-properties",
description: "Disallows parameter properties in class constructors.",
- rationale: (_a = ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members."], _a.raw = ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members.\n\n It can be cleaner to keep member variable declarations in one list directly only the class\n (instead of mixed between direct class members and constructor parameter properties).\n "], ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members.\n\n It can be cleaner to keep member variable declarations in one list directly only the class\n (instead of mixed between direct class members and constructor parameter properties).\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -59,4 +59,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
index 117f46536..db71bc3dc 100644
--- a/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts b/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
index 5d51fdd37..70451bcfa 100644
--- a/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
+++ b/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noRedundantJsdocRule.js b/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
index 398162132..3d6eaae71 100644
--- a/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
+++ b/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
@@ -76,20 +76,25 @@ function walk(ctx) {
case ts.SyntaxKind.JSDocAugmentsTag:
// OK
break;
- case ts.SyntaxKind.JSDocTemplateTag:
+ case ts.SyntaxKind.JSDocClassTag:
case ts.SyntaxKind.JSDocTypeTag:
case ts.SyntaxKind.JSDocTypedefTag:
case ts.SyntaxKind.JSDocPropertyTag:
// Always redundant
ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_REDUNDANT_TAG(tag.tagName.text));
break;
+ case ts.SyntaxKind.JSDocTemplateTag:
+ if (tag.comment === undefined || tag.comment === "") {
+ ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_NO_COMMENT(tag.tagName.text));
+ }
+ break;
case ts.SyntaxKind.JSDocReturnTag:
case ts.SyntaxKind.JSDocParameterTag: {
var _a = tag, typeExpression = _a.typeExpression, comment = _a.comment;
if (typeExpression !== undefined) {
ctx.addFailureAtNode(typeExpression, Rule.FAILURE_STRING_REDUNDANT_TYPE);
}
- if (comment === "") {
+ if (comment === undefined || comment === "") {
// Redundant if no documentation
ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_NO_COMMENT(tag.tagName.text));
}
diff --git a/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
index 65d573ba8..eeda34db8 100644
--- a/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
+++ b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReferenceRule.js b/node_modules/tslint/lib/rules/noReferenceRule.js
index e3325e20a..5fec96c3b 100644
--- a/node_modules/tslint/lib/rules/noReferenceRule.js
+++ b/node_modules/tslint/lib/rules/noReferenceRule.js
@@ -30,7 +30,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-reference",
description: "Disallows `/// <reference path=>` imports (use ES6-style imports instead).",
- rationale: (_a = ["\n Using `/// <reference path=>` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], _a.raw = ["\n Using \\`/// <reference path=>\\` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `/// <reference path=>` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], ["\n Using \\`/// <reference path=>\\` comments to load other files is outdated.\n Use ES6-style imports to reference other files."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -48,4 +48,4 @@ function walk(ctx) {
ctx.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING);
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts b/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
+++ b/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReturnAwaitRule.js b/node_modules/tslint/lib/rules/noReturnAwaitRule.js
index 67cc188ad..4e354dca6 100644
--- a/node_modules/tslint/lib/rules/noReturnAwaitRule.js
+++ b/node_modules/tslint/lib/rules/noReturnAwaitRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-return-await",
description: "Disallows unnecessary `return await`.",
- rationale: (_a = ["\n An async function always wraps the return value in a Promise.\n Using `return await` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], _a.raw = ["\n An async function always wraps the return value in a Promise.\n Using \\`return await\\` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n An async function always wraps the return value in a Promise.\n Using `return await` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], ["\n An async function always wraps the return value in a Promise.\n Using \\`return await\\` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -107,4 +107,4 @@ function isInsideTryBlock(node) {
}
return false;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
index 1cd1b8c5c..759d5fafb 100644
--- a/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.js b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
index c2db583c6..7ada497cc 100644
--- a/node_modules/tslint/lib/rules/noShadowedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
@@ -36,8 +36,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-shadowed-variable",
description: "Disallows shadowing variable declarations.",
- rationale: "Shadowing a variable masks access to it and obscures to what value an identifier actually refers.",
- optionsDescription: (_a = ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are `\"class\"`, `\"enum\"`, `\"function\"`, `\"import\"`, `\"interface\"`, `\"namespace\"`, `\"typeAlias\"`\n and `\"typeParameter\"`. Just set the value to `false` for the check you want to disable.\n All checks default to `true`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n "], _a.raw = ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are \\`\"class\"\\`, \\`\"enum\"\\`, \\`\"function\"\\`, \\`\"import\"\\`, \\`\"interface\"\\`, \\`\"namespace\"\\`, \\`\"typeAlias\"\\`\n and \\`\"typeParameter\"\\`. Just set the value to \\`false\\` for the check you want to disable.\n All checks default to \\`true\\`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Shadowing a variable masks access to it and obscures to what value an identifier actually refers.\n For example, in the following code, it can be confusing why the filter is likely never true:\n\n ```\n const findNeighborsWithin = (instance: MyClass, instances: MyClass[]): MyClass[] => {\n return instances.filter((instance) => instance.neighbors.includes(instance));\n };\n ```\n "], ["\n Shadowing a variable masks access to it and obscures to what value an identifier actually refers.\n For example, in the following code, it can be confusing why the filter is likely never true:\n\n \\`\\`\\`\n const findNeighborsWithin = (instance: MyClass, instances: MyClass[]): MyClass[] => {\n return instances.filter((instance) => instance.neighbors.includes(instance));\n };\n \\`\\`\\`\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are `\"class\"`, `\"enum\"`, `\"function\"`, `\"import\"`, `\"interface\"`, `\"namespace\"`, `\"typeAlias\"`\n and `\"typeParameter\"`. Just set the value to `false` for the check you want to disable.\n All checks default to `true`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n\n The option `\"temporalDeadZone\"` defaults to `true` which shows errors when shadowing block scoped declarations in their\n temporal dead zone. When set to `false` parameters, classes, enums and variables declared\n with `let` or `const` are not considered shadowed if the shadowing occurs within their\n [temporal dead zone](http://jsrocks.org/2015/01/temporal-dead-zone-tdz-demystified).\n\n The following example shows how the `\"temporalDeadZone\"` option changes the linting result:\n\n ```ts\n function fn(value) {\n if (value) {\n const tmp = value; // no error on this line if \"temporalDeadZone\" is false\n return tmp;\n }\n let tmp = undefined;\n if (!value) {\n const tmp = value; // this line always contains an error\n return tmp;\n }\n }\n ```\n "], ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are \\`\"class\"\\`, \\`\"enum\"\\`, \\`\"function\"\\`, \\`\"import\"\\`, \\`\"interface\"\\`, \\`\"namespace\"\\`, \\`\"typeAlias\"\\`\n and \\`\"typeParameter\"\\`. Just set the value to \\`false\\` for the check you want to disable.\n All checks default to \\`true\\`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n\n The option \\`\"temporalDeadZone\"\\` defaults to \\`true\\` which shows errors when shadowing block scoped declarations in their\n temporal dead zone. When set to \\`false\\` parameters, classes, enums and variables declared\n with \\`let\\` or \\`const\\` are not considered shadowed if the shadowing occurs within their\n [temporal dead zone](http://jsrocks.org/2015/01/temporal-dead-zone-tdz-demystified).\n\n The following example shows how the \\`\"temporalDeadZone\"\\` option changes the linting result:\n\n \\`\\`\\`ts\n function fn(value) {\n if (value) {\n const tmp = value; // no error on this line if \"temporalDeadZone\" is false\n return tmp;\n }\n let tmp = undefined;\n if (!value) {\n const tmp = value; // this line always contains an error\n return tmp;\n }\n }\n \\`\\`\\`\n "]))),
options: {
type: "object",
properties: {
@@ -49,6 +49,7 @@ var Rule = /** @class */ (function (_super) {
namespace: { type: "boolean" },
typeAlias: { type: "boolean" },
typeParameter: { type: "boolean" },
+ temporalDeadZone: { type: "boolean" },
},
},
optionExamples: [
@@ -62,7 +63,7 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function parseOptions(option) {
- return tslib_1.__assign({ class: true, enum: true, function: true, import: true, interface: true, namespace: true, typeAlias: true, typeParameter: true }, option);
+ return tslib_1.__assign({ class: true, enum: true, function: true, import: true, interface: true, namespace: true, temporalDeadZone: true, typeAlias: true, typeParameter: true }, option);
}
var Scope = /** @class */ (function () {
function Scope(functionScope) {
@@ -72,16 +73,21 @@ var Scope = /** @class */ (function () {
// if no functionScope is provided we are in the process of creating a new function scope, which for consistency links to itself
this.functionScope = functionScope !== undefined ? functionScope : this;
}
- Scope.prototype.addVariable = function (identifier, blockScoped) {
+ Scope.prototype.addVariable = function (identifier, blockScoped, tdz) {
if (blockScoped === void 0) { blockScoped = true; }
+ if (tdz === void 0) { tdz = false; }
// block scoped variables go to the block scope, function scoped variables to the containing function scope
var scope = blockScoped ? this : this.functionScope;
var list = scope.variables.get(identifier.text);
+ var variableInfo = {
+ identifier: identifier,
+ tdz: tdz,
+ };
if (list === undefined) {
- scope.variables.set(identifier.text, [identifier]);
+ scope.variables.set(identifier.text, [variableInfo]);
}
else {
- list.push(identifier);
+ list.push(variableInfo);
}
};
return Scope;
@@ -89,10 +95,15 @@ var Scope = /** @class */ (function () {
var NoShadowedVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoShadowedVariableWalker, _super);
function NoShadowedVariableWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Scope();
+ return _this;
}
NoShadowedVariableWalker.prototype.walk = function (sourceFile) {
var _this = this;
+ if (sourceFile.isDeclarationFile) {
+ return;
+ }
this.scope = new Scope();
var cb = function (node) {
var parentScope = _this.scope;
@@ -153,7 +164,7 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
break;
case ts.SyntaxKind.ClassDeclaration:
if (_this.options.class && node.name !== undefined) {
- parentScope.addVariable(node.name);
+ parentScope.addVariable(node.name, true, true);
}
// falls through
case ts.SyntaxKind.ClassExpression:
@@ -168,7 +179,7 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
break;
case ts.SyntaxKind.EnumDeclaration:
if (_this.options.enum) {
- parentScope.addVariable(node.name);
+ parentScope.addVariable(node.name, true, true);
}
break;
case ts.SyntaxKind.InterfaceDeclaration:
@@ -180,15 +191,21 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
if (node.parent.kind !== ts.SyntaxKind.IndexSignature &&
!tsutils_1.isThisParameter(node) &&
tsutils_1.isFunctionWithBody(node.parent)) {
- _this.handleBindingName(node.name, false);
+ _this.handleBindingName(node.name, false, true);
}
break;
case ts.SyntaxKind.ModuleDeclaration:
if (_this.options.namespace &&
node.parent.kind !== ts.SyntaxKind.ModuleDeclaration &&
- node.name.kind === ts.SyntaxKind.Identifier) {
+ node.name.kind === ts.SyntaxKind.Identifier &&
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
parentScope.addVariable(node.name, false);
}
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ _this.onScopeEnd(parentScope);
+ _this.scope = parentScope;
+ return; // don't check any ambient declaration blocks
+ }
break;
case ts.SyntaxKind.ImportClause:
if (_this.options.import && node.name !== undefined) {
@@ -238,15 +255,16 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
this.handleBindingName(variable.name, blockScoped);
}
};
- NoShadowedVariableWalker.prototype.handleBindingName = function (node, blockScoped) {
+ NoShadowedVariableWalker.prototype.handleBindingName = function (node, blockScoped, tdz) {
+ if (tdz === void 0) { tdz = blockScoped; }
if (node.kind === ts.SyntaxKind.Identifier) {
- this.scope.addVariable(node, blockScoped);
+ this.scope.addVariable(node, blockScoped, tdz);
}
else {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (element.kind !== ts.SyntaxKind.OmittedExpression) {
- this.handleBindingName(element.name, blockScoped);
+ this.handleBindingName(element.name, blockScoped, tdz);
}
}
}
@@ -255,14 +273,21 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
var _this = this;
var _a = this.scope, variables = _a.variables, variablesSeen = _a.variablesSeen;
variablesSeen.forEach(function (identifiers, name) {
- if (variables.has(name)) {
- for (var _i = 0, identifiers_1 = identifiers; _i < identifiers_1.length; _i++) {
- var identifier = identifiers_1[_i];
+ var declarationsInScope = variables.get(name);
+ var _loop_1 = function (identifier) {
+ if (declarationsInScope !== undefined &&
+ (_this.options.temporalDeadZone ||
+ // check if any of the declaration either has no temporal dead zone or is declared before the identifier
+ declarationsInScope.some(function (declaration) { return !declaration.tdz || declaration.identifier.pos < identifier.pos; }))) {
_this.addFailureAtNode(identifier, Rule.FAILURE_STRING_FACTORY(name));
}
- }
- else if (parent !== undefined) {
- addToList(parent.variablesSeen, name, identifiers);
+ else if (parent !== undefined) {
+ addOneToList(parent.variablesSeen, name, identifier);
+ }
+ };
+ for (var _i = 0, identifiers_1 = identifiers; _i < identifiers_1.length; _i++) {
+ var identifier = identifiers_1[_i];
+ _loop_1(identifier);
}
});
if (parent !== undefined) {
@@ -273,13 +298,24 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
};
return NoShadowedVariableWalker;
}(Lint.AbstractWalker));
-function addToList(map, name, identifiers) {
+function addToList(map, name, variables) {
+ var list = map.get(name);
+ if (list === undefined) {
+ list = [];
+ map.set(name, list);
+ }
+ for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) {
+ var variable = variables_1[_i];
+ list.push(variable.identifier);
+ }
+}
+function addOneToList(map, name, identifier) {
var list = map.get(name);
if (list === undefined) {
- map.set(name, identifiers);
+ map.set(name, [identifier]);
}
else {
- list.push.apply(list, identifiers);
+ list.push(identifier);
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
index cce59d100..06cb02d5e 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
@@ -1,7 +1,24 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING: string;
+ static id(input: string): string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.js b/node_modules/tslint/lib/rules/noStringLiteralRule.js
index c543aa4d8..c0669cf83 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.js
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.js
@@ -25,14 +25,17 @@ var Rule = /** @class */ (function (_super) {
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
+ Rule.id = function (input) {
+ return input;
+ };
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk);
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-string-literal",
- description: (_a = ["\n Forbids unnecessary string literal property access.\n Allows `obj[\"prop-erty\"]` (can't be a regular property access).\n Disallows `obj[\"property\"]` (should be `obj.property`)."], _a.raw = ["\n Forbids unnecessary string literal property access.\n Allows \\`obj[\"prop-erty\"]\\` (can't be a regular property access).\n Disallows \\`obj[\"property\"]\\` (should be \\`obj.property\\`)."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n If `--noImplicitAny` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], _b.raw = ["\n If \\`--noImplicitAny\\` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Forbids unnecessary string literal property access.\n Allows `obj[\"prop-erty\"]` (can't be a regular property access).\n Disallows `obj[\"property\"]` (should be `obj.property`)."], ["\n Forbids unnecessary string literal property access.\n Allows \\`obj[\"prop-erty\"]\\` (can't be a regular property access).\n Disallows \\`obj[\"property\"]\\` (should be \\`obj.property\\`)."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n If `--noImplicitAny` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], ["\n If \\`--noImplicitAny\\` is turned off,\n property access via a string literal will be 'any' if the property does not exist."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -50,8 +53,12 @@ function walk(ctx) {
if (tsutils_1.isElementAccessExpression(node)) {
var argument = node.argumentExpression;
if (argument !== undefined && tsutils_1.isStringLiteral(argument) && tsutils_1.isValidPropertyAccess(argument.text)) {
- // for compatibility with typescript@<2.5.0 to avoid fixing expr['__foo'] to expr.___foo
- var propertyName = ts.unescapeIdentifier(argument.text); // tslint:disable-line:deprecation
+ // typescript@<2.5.0 has an extra underscore in escaped identifier text content,
+ // to avoid fixing issue `expr['__foo'] → expr.___foo`, unescapeIdentifier() is to be used
+ // As of typescript@3, unescapeIdentifier() removed, thus check in runtime, if the method exists
+ // tslint:disable-next-line no-unsafe-any strict-boolean-expressions
+ var unescapeIdentifier = ts.unescapeIdentifier || Rule.id;
+ var propertyName = unescapeIdentifier(argument.text);
ctx.addFailureAtNode(argument, Rule.FAILURE_STRING,
// expr['foo'] -> expr.foo
Lint.Replacement.replaceFromTo(node.expression.end, node.end, "." + propertyName));
@@ -60,4 +67,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.d.ts b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.js b/node_modules/tslint/lib/rules/noStringThrowRule.js
index 1640b91cf..84c314db1 100644
--- a/node_modules/tslint/lib/rules/noStringThrowRule.js
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var noStringThrowRule_examples_1 = require("./code-examples/noStringThrowRule.examples");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -31,11 +32,13 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-string-throw",
- description: "Flags throwing plain strings or concatenations of strings " +
- "because only Errors produce proper stack traces.",
+ description: "Flags throwing plain strings or concatenations of strings.",
hasFix: true,
options: null,
+ optionExamples: [true],
optionsDescription: "Not configurable.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Example \u2013 Doing it right\n\n ```ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n ```\n\n Example \u2013 Anti Pattern\n\n ```ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n ```\n\n Only Error objects contain a `.stack` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "], ["\n Example \u2013 Doing it right\n\n \\`\\`\\`ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Example \u2013 Anti Pattern\n\n \\`\\`\\`ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Only Error objects contain a \\`.stack\\` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "]))),
+ codeExamples: noStringThrowRule_examples_1.codeExamples,
type: "functionality",
typescriptOnly: false,
};
@@ -75,3 +78,4 @@ function isString(node) {
return false;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
index d0ae3c619..1e053483a 100644
--- a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
+++ b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-submodule-imports",
- description: (_a = ["\n Disallows importing any submodule."], _a.raw = ["\n Disallows importing any submodule."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], _b.raw = ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing any submodule."], ["\n Disallows importing any submodule."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."]))),
optionsDescription: "A list of whitelisted package or submodule names.",
options: {
type: "array",
@@ -49,9 +49,8 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
- // TODO remove assertion on upgrade to typescript@2.5.2
if (!ts.isExternalModuleNameRelative(name.text) &&
isSubmodulePath(name.text) &&
!isWhitelisted(name.text, ctx.options)) {
@@ -71,4 +70,4 @@ function isWhitelisted(path, whitelist) {
function isSubmodulePath(path) {
return path.split("/").length > (path[0] === "@" ? 2 : 1);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
index ff699286d..46b8a7ad1 100644
--- a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -7,6 +23,6 @@ export declare class Rule extends Lint.Rules.AbstractRule {
}
export declare class NoSwitchCaseFallThroughWalker extends Lint.AbstractWalker<void> {
walk(sourceFile: ts.SourceFile): void | undefined;
- private visitSwitchStatement({caseBlock: {clauses}});
- private isFallThroughAllowed(clause);
+ private visitSwitchStatement;
+ private isFallThroughAllowed;
}
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
index 713e91fae..428da3e3f 100644
--- a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-switch-case-fall-through",
description: "Disallows falling through case statements.",
- descriptionDetails: (_a = ["\n For example, the following is not allowed:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n ```\n\n However, fall through is allowed when case statements are consecutive or\n a magic `/* falls through */` comment is present. The following is valid:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n ```"], _a.raw = ["\n For example, the following is not allowed:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n \\`\\`\\`\n\n However, fall through is allowed when case statements are consecutive or\n a magic \\`/* falls through */\\` comment is present. The following is valid:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n \\`\\`\\`"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n For example, the following is not allowed:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n ```\n\n However, fall through is allowed when case statements are consecutive or\n a magic `/* falls through */` comment is present. The following is valid:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n ```"], ["\n For example, the following is not allowed:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n \\`\\`\\`\n\n However, fall through is allowed when case statements are consecutive or\n a magic \\`/* falls through */\\` comment is present. The following is valid:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n \\`\\`\\`"]))),
rationale: "Fall though in switch statements is often unintentional and a bug.",
optionsDescription: "Not configurable.",
options: null,
@@ -84,4 +84,4 @@ var NoSwitchCaseFallThroughWalker = /** @class */ (function (_super) {
return NoSwitchCaseFallThroughWalker;
}(Lint.AbstractWalker));
exports.NoSwitchCaseFallThroughWalker = NoSwitchCaseFallThroughWalker;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts b/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
index 2eaf0e03c..da606e4b6 100644
--- a/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noThisAssignmentRule.js b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
index 5d509faa8..df581bdb8 100644
--- a/node_modules/tslint/lib/rules/noThisAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a, _b;
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -71,9 +72,8 @@ var Rule = /** @class */ (function (_super) {
_b),
type: "object",
},
- optionsDescription: (_c = ["\n Two options may be provided on an object:\n\n * `", "` allows using destructuring to access members of `this` (e.g. `{ foo, bar } = this;`).\n * `", "` may be specified as a list of regular expressions to match allowed variable names."], _c.raw = ["\n Two options may be provided on an object:\n\n * \\`", "\\` allows using destructuring to access members of \\`this\\` (e.g. \\`{ foo, bar } = this;\\`).\n * \\`", "\\` may be specified as a list of regular expressions to match allowed variable names."], Lint.Utils.dedent(_c, ALLOW_THIS_DESTRUCTURING, ALLOWED_THIS_NAMES)),
- rationale: "Assigning a variable to `this` instead of properly using arrow lambdas "
- + "may be a symptom of pre-ES6 practices or not manging scope well.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two options may be provided on an object:\n\n * `", "` allows using destructuring to access members of `this` (e.g. `{ foo, bar } = this;`).\n * `", "` may be specified as a list of regular expressions to match allowed variable names."], ["\n Two options may be provided on an object:\n\n * \\`", "\\` allows using destructuring to access members of \\`this\\` (e.g. \\`{ foo, bar } = this;\\`).\n * \\`", "\\` may be specified as a list of regular expressions to match allowed variable names."])), ALLOW_THIS_DESTRUCTURING, ALLOWED_THIS_NAMES),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Assigning a variable to `this` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices\n or not managing scope well.\n\n Instead of storing a reference to `this` and using it inside a `function () {`:\n\n ```\n const self = this;\n\n setTimeout(function () {\n self.doWork();\n });\n ```\n\n Use `() =>` arrow lambdas, as they preserve `this` scope for you:\n\n ```\n setTimeout(() => {\n this.doWork();\n });\n ```\n "], ["\n Assigning a variable to \\`this\\` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices\n or not managing scope well.\n\n Instead of storing a reference to \\`this\\` and using it inside a \\`function () {\\`:\n\n \\`\\`\\`\n const self = this;\n\n setTimeout(function () {\n self.doWork();\n });\n \\`\\`\\`\n\n Use \\`() =>\\` arrow lambdas, as they preserve \\`this\\` scope for you:\n\n \\`\\`\\`\n setTimeout(() => {\n this.doWork();\n });\n \\`\\`\\`\n "]))),
ruleName: "no-this-assignment",
type: "functionality",
typescriptOnly: false,
@@ -125,4 +125,4 @@ var NoThisAssignmentWalker = /** @class */ (function (_super) {
};
return NoThisAssignmentWalker;
}(Lint.AbstractWalker));
-var _a, _b, _c;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
index 5ad6cbe8a..44041143b 100644
--- a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
@@ -44,7 +44,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-trailing-whitespace",
description: "Disallows trailing whitespace at the end of a line.",
rationale: "Keeps version control diffs clean as it prevents accidental whitespace from being committed.",
- optionsDescription: (_a = ["\n Possible settings are:\n\n * `\"", "\"`: Allows trailing whitespace in template strings.\n * `\"", "\"`: Allows trailing whitespace in comments.\n * `\"", "\"`: Allows trailing whitespace only in JSDoc comments.\n * `\"", "\"`: Allows trailing whitespace on empty lines."], _a.raw = ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Allows trailing whitespace in template strings.\n * \\`\"", "\"\\`: Allows trailing whitespace in comments.\n * \\`\"", "\"\\`: Allows trailing whitespace only in JSDoc comments.\n * \\`\"", "\"\\`: Allows trailing whitespace on empty lines."], Lint.Utils.dedent(_a, OPTION_IGNORE_TEMPLATE_STRINGS, OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC, OPTION_IGNORE_BLANK_LINES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Possible settings are:\n\n * `\"", "\"`: Allows trailing whitespace in template strings.\n * `\"", "\"`: Allows trailing whitespace in comments.\n * `\"", "\"`: Allows trailing whitespace only in JSDoc comments.\n * `\"", "\"`: Allows trailing whitespace on empty lines."], ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Allows trailing whitespace in template strings.\n * \\`\"", "\"\\`: Allows trailing whitespace in comments.\n * \\`\"", "\"\\`: Allows trailing whitespace only in JSDoc comments.\n * \\`\"", "\"\\`: Allows trailing whitespace on empty lines."])), OPTION_IGNORE_TEMPLATE_STRINGS, OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC, OPTION_IGNORE_BLANK_LINES),
hasFix: true,
options: {
type: "array",
@@ -129,4 +129,4 @@ function getExcludedComments(sourceFile, options) {
function isJsDoc(sourceText, kind, range) {
return kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceText[range.pos + 2] === "*" && sourceText[range.pos + 3] !== "*";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.js b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
index 153550c57..d8085193a 100644
--- a/node_modules/tslint/lib/rules/noUnboundMethodRule.js
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
@@ -34,13 +34,14 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unbound-method",
- description: "Warns when a method is used as outside of a method call.",
+ description: "Warns when a method is used outside of a method call.",
optionsDescription: "You may optionally pass \"" + OPTION_IGNORE_STATIC + "\" to ignore static methods.",
options: {
type: "string",
enum: [OPTION_IGNORE_STATIC],
},
optionExamples: [true, [true, OPTION_IGNORE_STATIC]],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Class functions don't preserve the class scope when passed as standalone variables.\n For example, this code will log the global scope (`window`/`global`), not the class instance:\n\n ```\n class MyClass {\n public log(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const log = instance.log;\n\n log();\n ```\n\n You need to either use an arrow lambda (`() => {...}`) or call the function with the correct scope.\n\n ```\n class MyClass {\n public logArrowBound = (): void => {\n console.log(bound);\n };\n\n public logManualBind(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const logArrowBound = instance.logArrowBound;\n const logManualBind = instance.logManualBind.bind(instance);\n\n logArrowBound();\n logManualBind();\n ```\n "], ["\n Class functions don't preserve the class scope when passed as standalone variables.\n For example, this code will log the global scope (\\`window\\`/\\`global\\`), not the class instance:\n\n \\`\\`\\`\n class MyClass {\n public log(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const log = instance.log;\n\n log();\n \\`\\`\\`\n\n You need to either use an arrow lambda (\\`() => {...}\\`) or call the function with the correct scope.\n\n \\`\\`\\`\n class MyClass {\n public logArrowBound = (): void => {\n console.log(bound);\n };\n\n public logManualBind(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const logArrowBound = instance.logArrowBound;\n const logManualBind = instance.logManualBind.bind(instance);\n\n logArrowBound();\n logManualBind();\n \\`\\`\\`\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -78,8 +79,9 @@ function isSafeUse(node) {
return parent.expression === node;
case ts.SyntaxKind.TaggedTemplateExpression:
return parent.tag === node;
- // E.g. `obj.method.bind(obj)`.
+ // E.g. `obj.method.bind(obj) or obj.method["prop"]`.
case ts.SyntaxKind.PropertyAccessExpression:
+ case ts.SyntaxKind.ElementAccessExpression:
return true;
// Allow most binary operators, but don't allow e.g. `myArray.forEach(obj.method || otherObj.otherMethod)`.
case ts.SyntaxKind.BinaryExpression:
@@ -102,3 +104,4 @@ function isSafeUse(node) {
return false;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
index 218e9218e..00469f0ca 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
index 25c7f9173..ecc2337ed 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
@@ -35,10 +35,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unnecessary-callback-wrapper",
- description: (_a = ["\n Replaces `x => f(x)` with just `f`.\n To catch more cases, enable `only-arrow-functions` and `arrow-return-shorthand` too."], _a.raw = ["\n Replaces \\`x => f(x)\\` with just \\`f\\`.\n To catch more cases, enable \\`only-arrow-functions\\` and \\`arrow-return-shorthand\\` too."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Replaces `x => f(x)` with just `f`.\n To catch more cases, enable `only-arrow-functions` and `arrow-return-shorthand` too."], ["\n Replaces \\`x => f(x)\\` with just \\`f\\`.\n To catch more cases, enable \\`only-arrow-functions\\` and \\`arrow-return-shorthand\\` too."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n There's generally no reason to wrap a function with a callback wrapper if it's directly called anyway.\n Doing so creates extra inline lambdas that slow the runtime down.\n "], ["\n There's generally no reason to wrap a function with a callback wrapper if it's directly called anyway.\n Doing so creates extra inline lambdas that slow the runtime down.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -83,4 +84,4 @@ function isRedundantCallback(parameters, args, expression) {
}
return true;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js b/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
index fff8b5ed1..950dbda43 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
@@ -41,9 +41,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unnecessary-class",
- description: (_a = ["\n Disallows classes that are not strictly necessary."], _a.raw = ["\n Disallows classes that are not strictly necessary."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], _b.raw = ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n Three arguments may be optionally provided:\n\n * `\"allow-constructor-only\"` ignores classes whose members are constructors.\n * `\"allow-empty-class\"` ignores `class DemoClass {}`.\n * `\"allow-static-only\"` ignores classes whose members are static."], _c.raw = ["\n Three arguments may be optionally provided:\n\n * \\`\"allow-constructor-only\"\\` ignores classes whose members are constructors.\n * \\`\"allow-empty-class\"\\` ignores \\`class DemoClass {}\\`.\n * \\`\"allow-static-only\"\\` ignores classes whose members are static."], Lint.Utils.dedent(_c)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows classes that are not strictly necessary."], ["\n Disallows classes that are not strictly necessary."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Three arguments may be optionally provided:\n\n * `\"allow-constructor-only\"` ignores classes whose members are constructors.\n * `\"allow-empty-class\"` ignores `class DemoClass {}`.\n * `\"allow-static-only\"` ignores classes whose members are static."], ["\n Three arguments may be optionally provided:\n\n * \\`\"allow-constructor-only\"\\` ignores classes whose members are constructors.\n * \\`\"allow-empty-class\"\\` ignores \\`class DemoClass {}\\`.\n * \\`\"allow-static-only\"\\` ignores classes whose members are static."]))),
options: {
type: "array",
items: {
@@ -110,4 +110,4 @@ function hasExtendsClause(declaration) {
function isConstructorWithShorthandProps(member) {
return tsutils_1.isConstructorDeclaration(member) && member.parameters.some(tsutils_1.isParameterProperty);
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
index 37c1931a4..05f0e2842 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
index 794c668fb..110938857 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
@@ -36,6 +36,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Values in JavaScript default to `undefined`.\n There's no need to do so manually.\n "], ["\n Values in JavaScript default to \\`undefined\\`.\n There's no need to do so manually.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -53,7 +54,7 @@ function walk(ctx) {
checkInitializer(node);
break;
case ts.SyntaxKind.VariableDeclaration:
- if (!tsutils_1.isBindingPattern(node.name) && !Lint.isNodeFlagSet(node.parent, ts.NodeFlags.Const)) {
+ if (!tsutils_1.isBindingPattern(node.name) && !tsutils_1.isNodeFlagSet(node.parent, ts.NodeFlags.Const)) {
checkInitializer(node);
}
break;
@@ -82,7 +83,7 @@ function walk(ctx) {
}
}
function failWithFix(node) {
- var fix = Lint.Replacement.deleteFromTo(Lint.childOfKind(node, ts.SyntaxKind.EqualsToken).pos, node.end);
+ var fix = Lint.Replacement.deleteFromTo(tsutils_1.getChildOfKind(node, ts.SyntaxKind.EqualsToken).pos, node.end);
ctx.addFailureAtNode(node, Rule.FAILURE_STRING, fix);
}
}
@@ -102,3 +103,4 @@ function isUndefined(node) {
node.kind === ts.SyntaxKind.Identifier &&
node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
index af476a3f9..a6143341f 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
index a9a32b362..2c89620b7 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
@@ -113,7 +113,6 @@ function walk(ctx, checker) {
return alias !== undefined && symbolIsNamespaceInScope(alias);
}
function symbolsAreEqual(accessed, inScope) {
- // TODO remove type assertion on update to typescript@2.6.0
if (checker.getExportSymbolOfSymbol !== undefined) {
inScope = checker.getExportSymbolOfSymbol(inScope);
return accessed === inScope;
@@ -124,5 +123,5 @@ function walk(ctx, checker) {
}
}
function tryGetAliasedSymbol(symbol, checker) {
- return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
+ return utils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
index 6af6a0d60..ca3a278e0 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
@@ -61,8 +61,10 @@ var Walker = /** @class */ (function (_super) {
var _this = this;
var cb = function (node) {
switch (node.kind) {
- case ts.SyntaxKind.TypeAssertionExpression:
case ts.SyntaxKind.NonNullExpression:
+ _this.checkNonNullAssertion(node);
+ break;
+ case ts.SyntaxKind.TypeAssertionExpression:
case ts.SyntaxKind.AsExpression:
_this.verifyCast(node);
}
@@ -70,23 +72,19 @@ var Walker = /** @class */ (function (_super) {
};
return ts.forEachChild(sourceFile, cb);
};
+ Walker.prototype.checkNonNullAssertion = function (node) {
+ var type = this.checker.getTypeAtLocation(node.expression);
+ if (type === this.checker.getNonNullableType(type)) {
+ this.addFailureAtNode(node, Rule.FAILURE_STRING, Lint.Replacement.deleteFromTo(node.expression.end, node.end));
+ }
+ };
Walker.prototype.verifyCast = function (node) {
- if (tsutils_1.isAssertionExpression(node) && this.options.indexOf(node.type.getText(this.sourceFile)) !== -1) {
+ if (this.options.indexOf(node.type.getText(this.sourceFile)) !== -1) {
return;
}
var castType = this.checker.getTypeAtLocation(node);
- if (castType === undefined) {
- return;
- }
- if (node.kind !== ts.SyntaxKind.NonNullExpression &&
- (tsutils_1.isTypeFlagSet(castType, ts.TypeFlags.Literal) ||
- tsutils_1.isObjectType(castType) &&
- tsutils_1.isObjectFlagSet(castType, ts.ObjectFlags.Tuple)) ||
- // Sometimes tuple types don't have ObjectFlags.Tuple set, like when
- // they're being matched against an inferred type. So, in addition,
- // check if any properties are numbers, which implies that this is
- // likely a tuple type.
- (castType.getProperties().some(function (symbol) { return !isNaN(Number(symbol.name)); }))) {
+ if (tsutils_1.isTypeFlagSet(castType, ts.TypeFlags.Literal) ||
+ tsutils_1.isObjectType(castType) && (tsutils_1.isObjectFlagSet(castType, ts.ObjectFlags.Tuple) || couldBeTupleType(castType))) {
// It's not always safe to remove a cast to a literal type or tuple
// type, as those types are sometimes widened without the cast.
return;
@@ -95,8 +93,35 @@ var Walker = /** @class */ (function (_super) {
if (uncastType === castType) {
this.addFailureAtNode(node, Rule.FAILURE_STRING, node.kind === ts.SyntaxKind.TypeAssertionExpression
? Lint.Replacement.deleteFromTo(node.getStart(), node.expression.getStart())
- : Lint.Replacement.deleteFromTo(node.expression.getEnd(), node.getEnd()));
+ : Lint.Replacement.deleteFromTo(node.expression.end, node.end));
}
};
return Walker;
}(Lint.AbstractWalker));
+/**
+ * Sometimes tuple types don't have ObjectFlags.Tuple set, like when they're being matched against an inferred type.
+ * So, in addition, check if there are integer properties 0..n and no other numeric keys
+ */
+function couldBeTupleType(type) {
+ var properties = type.getProperties();
+ if (properties.length === 0) {
+ return false;
+ }
+ var i = 0;
+ for (; i < properties.length; ++i) {
+ var name = properties[i].name;
+ if (String(i) !== name) {
+ if (i === 0) {
+ // if there are no integer properties, this is not a tuple
+ return false;
+ }
+ break;
+ }
+ }
+ for (; i < properties.length; ++i) {
+ if (String(+properties[i].name) === properties[i].name) {
+ return false; // if there are any other numeric properties, this is not a tuple
+ }
+ }
+ return true;
+}
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
index c0a36360a..301b55b48 100644
--- a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var utils_1 = require("../utils");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -31,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unsafe-any",
- description: (_a = ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for `{} | null | undefined`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as `\"\" + x`) are allowed."], _a.raw = ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for \\`{} | null | undefined\\`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as \\`\"\" + x\\`) are allowed."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for `{} | null | undefined`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as `\"\" + x`) are allowed."], ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for \\`{} | null | undefined\\`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as \\`\"\" + x\\`) are allowed."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use `<T>` template types for generic type handling.\n\n Also see the `no-any` rule.\n "], ["\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use \\`<T>\\` template types for generic type handling.\n\n Also see the \\`no-any\\` rule.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -115,6 +117,10 @@ var NoUnsafeAnyWalker = /** @class */ (function (_super) {
return initializer !== undefined &&
this.visitNode(initializer, isPropertyAny(node, this.checker));
}
+ case ts.SyntaxKind.SpreadAssignment:
+ return this.visitNode(node.expression,
+ // allow any in object spread, but not in object rest
+ !tsutils_1.isReassignmentTarget(node.parent));
case ts.SyntaxKind.ComputedPropertyName:
return this.visitNode(node.expression, true);
case ts.SyntaxKind.TaggedTemplateExpression: {
@@ -284,10 +290,10 @@ var NoUnsafeAnyWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.EqualsEqualsToken:
case ts.SyntaxKind.CommaToken: // Allow `any, any`
case ts.SyntaxKind.BarBarToken: // Allow `any || any`
- case ts.SyntaxKind.AmpersandAmpersandToken:// Allow `any && any`
+ case ts.SyntaxKind.AmpersandAmpersandToken: // Allow `any && any`
allowAnyLeft = allowAnyRight = true;
break;
- case ts.SyntaxKind.InstanceOfKeyword:// Allow test
+ case ts.SyntaxKind.InstanceOfKeyword: // Allow test
allowAnyLeft = true;
break;
case ts.SyntaxKind.EqualsToken:
@@ -359,12 +365,44 @@ function isPropertyAny(node, checker) {
return true;
}
function isNodeAny(node, checker) {
+ var symbol = checker.getSymbolAtLocation(node);
+ if (symbol !== undefined && tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ symbol = checker.getAliasedSymbol(symbol);
+ }
+ if (symbol !== undefined) {
+ // NamespaceModule is a type-only namespace without runtime value, its type is 'any' when used as 'ns.Type' -> avoid error
+ if (tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.NamespaceModule)) {
+ return false;
+ }
+ if (tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
+ return isAny(checker.getDeclaredTypeOfSymbol(symbol));
+ }
+ }
+ // Lowercase JSX elements are assumed to be allowed by design
+ if (isJsxNativeElement(node)) {
+ return false;
+ }
return isAny(checker.getTypeAtLocation(node));
}
+var jsxElementTypes = new Set([
+ ts.SyntaxKind.JsxClosingElement,
+ ts.SyntaxKind.JsxOpeningElement,
+ ts.SyntaxKind.JsxSelfClosingElement,
+]);
+function isJsxNativeElement(node) {
+ if (!tsutils_1.isIdentifier(node) || node.parent === undefined) {
+ return false;
+ }
+ // TypeScript <=2.1 incorrectly parses JSX fragments
+ if (node.text === "") {
+ return true;
+ }
+ return jsxElementTypes.has(node.parent.kind) && utils_1.isLowerCase(node.text[0]);
+}
function isStringLike(expr, checker) {
- return Lint.isTypeFlagSet(checker.getTypeAtLocation(expr), ts.TypeFlags.StringLike);
+ return tsutils_1.isTypeFlagSet(checker.getTypeAtLocation(expr), ts.TypeFlags.StringLike);
}
function isAny(type) {
- return type !== undefined && Lint.isTypeFlagSet(type, ts.TypeFlags.Any);
+ return type !== undefined && tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any);
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
index 117f46536..760aa26c0 100644
--- a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
index ea28c23f4..7fae6d742 100644
--- a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
@@ -35,9 +35,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unsafe-finally",
- description: (_a = ["\n Disallows control flow statements, such as `return`, `continue`,\n `break` and `throws` in finally blocks."], _a.raw = ["\n Disallows control flow statements, such as \\`return\\`, \\`continue\\`,\n \\`break\\` and \\`throws\\` in finally blocks."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows control flow statements, such as `return`, `continue`,\n `break` and `throws` in finally blocks."], ["\n Disallows control flow statements, such as \\`return\\`, \\`continue\\`,\n \\`break\\` and \\`throws\\` in finally blocks."]))),
descriptionDetails: "",
- rationale: (_b = ["\n When used inside `finally` blocks, control flow statements,\n such as `return`, `continue`, `break` and `throws`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], _b.raw = ["\n When used inside \\`finally\\` blocks, control flow statements,\n such as \\`return\\`, \\`continue\\`, \\`break\\` and \\`throws\\`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], Lint.Utils.dedent(_b)),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n When used inside `finally` blocks, control flow statements,\n such as `return`, `continue`, `break` and `throws`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], ["\n When used inside \\`finally\\` blocks, control flow statements,\n such as \\`return\\`, \\`continue\\`, \\`break\\` and \\`throws\\`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -133,4 +133,4 @@ function printJumpKind(node) {
return "return";
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
index cce59d100..cb4dfbb50 100644
--- a/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2014 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
index 7390a6984..6e3794a53 100644
--- a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
@@ -39,9 +39,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-unused-expression",
description: "Disallows unused expression statements.",
- descriptionDetails: (_a = ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], _a.raw = ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Detects potential errors where an assignment or function call was intended."], _b.raw = ["\n Detects potential errors where an assignment or function call was intended."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n Two arguments may be optionally provided:\n\n * `", "` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. `e && e.preventDefault()`).\n * `", "` allows 'new' expressions for side effects (e.g. `new ModifyGlobalState();`.\n * `", "` allows tagged templates for side effects (e.g. `this.add\\`foo\\`;`."], _c.raw = ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. \\`e && e.preventDefault()\\`).\n * \\`", "\\` allows 'new' expressions for side effects (e.g. \\`new ModifyGlobalState();\\`.\n * \\`", "\\` allows tagged templates for side effects (e.g. \\`this.add\\\\\\`foo\\\\\\`;\\`."], Lint.Utils.dedent(_c, ALLOW_FAST_NULL_CHECKS, ALLOW_NEW, ALLOW_TAGGED_TEMPLATE)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Detects potential errors where an assignment or function call was intended."], ["\n Detects potential errors where an assignment or function call was intended."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `", "` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. `e && e.preventDefault()`).\n * `", "` allows 'new' expressions for side effects (e.g. `new ModifyGlobalState();`.\n * `", "` allows tagged templates for side effects (e.g. `this.add\\`foo\\`;`."], ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. \\`e && e.preventDefault()\\`).\n * \\`", "\\` allows 'new' expressions for side effects (e.g. \\`new ModifyGlobalState();\\`.\n * \\`", "\\` allows tagged templates for side effects (e.g. \\`this.add\\\\\\`foo\\\\\\`;\\`."])), ALLOW_FAST_NULL_CHECKS, ALLOW_NEW, ALLOW_TAGGED_TEMPLATE),
options: {
type: "array",
items: {
@@ -211,4 +211,4 @@ function canContainDirective(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
index 60ae7f538..566348792 100644
--- a/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2014 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.js b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
index b7b9f6fe4..8a7d7b5af 100644
--- a/node_modules/tslint/lib/rules/noUnusedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var semver = require("semver");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -34,10 +35,10 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unused-variable",
- description: (_a = ["Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], _a.raw = ["Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], Lint.Utils.dedent(_a)),
- descriptionDetails: (_b = ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have `tslint` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's `--fix` option."], _b.raw = ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have \\`tslint\\` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's \\`--fix\\` option."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], ["\n Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."]))),
+ descriptionDetails: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have `tslint` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's `--fix` option."], ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have \\`tslint\\` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's \\`--fix\\` option."]))),
hasFix: true,
- optionsDescription: (_c = ["\n Three optional arguments may be optionally provided:\n\n * `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], _c.raw = ["\n Three optional arguments may be optionally provided:\n\n * \\`\"check-parameters\"\\` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * \\`{\"ignore-pattern\": \"pattern\"}\\` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], Lint.Utils.dedent(_c)),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Three optional arguments may be optionally provided:\n\n * `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], ["\n Three optional arguments may be optionally provided:\n\n * \\`\"check-parameters\"\\` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * \\`{\"ignore-pattern\": \"pattern\"}\\` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."]))),
options: {
type: "array",
items: {
@@ -59,9 +60,13 @@ var Rule = /** @class */ (function (_super) {
maxLength: 3,
},
optionExamples: [true, [true, { "ignore-pattern": "^_" }]],
+ rationale: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n Variables that are declared and not used anywhere in code are likely an error due to incomplete refactoring.\n Such variables take up space in the code, are mild performance pains, and can lead to confusion by readers.\n "], ["\n Variables that are declared and not used anywhere in code are likely an error due to incomplete refactoring.\n Such variables take up space in the code, are mild performance pains, and can lead to confusion by readers.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
+ deprecationMessage: semver.gte(ts.version, "2.9.0-dev.0")
+ ? "Since TypeScript 2.9. Please use the built-in compiler checks instead."
+ : undefined,
};
return Rule;
}(Lint.Rules.TypedRule));
@@ -100,22 +105,26 @@ function walk(ctx, program) {
continue;
}
var failure = ts.flattenDiagnosticMessageText(diag.messageText, "\n");
- if (ignorePattern !== undefined) {
+ // BUG: this means imports / destructures with all (2+) unused variables don't respect ignore pattern
+ if (ignorePattern !== undefined && kind !== 2 /* DECLARATION */ && kind !== 3 /* ALL_DESTRUCTURES */) {
var varName = /'(.*)'/.exec(failure)[1];
if (ignorePattern.test(varName)) {
continue;
}
}
- if (kind === 0 /* VARIABLE_OR_PARAMETER */) {
- var importName = findImport(diag.start, sourceFile);
- if (importName !== undefined) {
- if (declaration && isImportUsed(importName, sourceFile, checker)) {
- continue;
- }
- if (importSpecifierFailures.has(importName)) {
- throw new Error("Should not get 2 errors for the same import.");
+ if (kind === 0 /* VARIABLE_OR_PARAMETER */ || kind === 2 /* DECLARATION */) {
+ var importNames = findImports(diag.start, sourceFile, kind);
+ if (importNames.length > 0) {
+ for (var _b = 0, importNames_1 = importNames; _b < importNames_1.length; _b++) {
+ var importName = importNames_1[_b];
+ if (declaration && isImportUsed(importName, sourceFile, checker)) {
+ continue;
+ }
+ if (importSpecifierFailures.has(importName)) {
+ throw new Error("Should not get 2 errors for the same import.");
+ }
+ importSpecifierFailures.set(importName, failure);
}
- importSpecifierFailures.set(importName, failure);
continue;
}
}
@@ -156,7 +165,7 @@ function addImportSpecifierFailures(ctx, failures, sourceFile) {
if (defaultName !== undefined) {
failures.delete(defaultName);
}
- removeAll(importNode, "All imports are unused.");
+ removeAll(importNode, "All imports on this line are unused.");
return;
}
if (defaultName !== undefined) {
@@ -249,7 +258,7 @@ function isImportUsed(importSpecifier, sourceFile, checker) {
return false;
}
var symbol = checker.getAliasedSymbol(importedSymbol);
- if (!Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
+ if (!utils.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
return false;
}
return ts.forEachChild(sourceFile, function cb(child) {
@@ -292,12 +301,13 @@ function forEachImport(sourceFile, f) {
return undefined;
});
}
-function findImport(pos, sourceFile) {
- return forEachImport(sourceFile, function (i) {
+function findImports(pos, sourceFile, kind) {
+ var imports = forEachImport(sourceFile, function (i) {
+ if (!isInRange(i, pos)) {
+ return undefined;
+ }
if (i.kind === ts.SyntaxKind.ImportEqualsDeclaration) {
- if (i.name.getStart() === pos) {
- return i.name;
- }
+ return [i.name];
}
else {
if (i.importClause === undefined) {
@@ -306,33 +316,69 @@ function findImport(pos, sourceFile) {
}
var _a = i.importClause, defaultName = _a.name, namedBindings = _a.namedBindings;
if (namedBindings !== undefined && namedBindings.kind === ts.SyntaxKind.NamespaceImport) {
- var name = namedBindings.name;
- if (name.getStart() === pos) {
- return name;
+ return [namedBindings.name];
+ }
+ // Starting from TS2.8, when all imports in an import node are not used,
+ // TS emits only 1 diagnostic object for the whole line as opposed
+ // to the previous behavior of outputting a diagnostic with kind == 6192
+ // (UnusedKind.VARIABLE_OR_PARAMETER) for every unused import.
+ // From TS2.8, in the case of none of the imports in a line being used,
+ // the single diagnostic TS outputs are different between the 1 import
+ // and 2+ imports cases:
+ // - 1 import in node:
+ // - diagnostic has kind == 6133 (UnusedKind.VARIABLE_OR_PARAMETER)
+ // - the text range is the whole node (`import { ... } from "..."`)
+ // whereas pre-TS2.8, the text range was for the import node. so
+ // `name.getStart()` won't equal `pos` like in pre-TS2.8
+ // - 2+ imports in node:
+ // - diagnostic has kind == 6192 (UnusedKind.DECLARATION)
+ // - we know that all of these are unused
+ if (kind === 2 /* DECLARATION */) {
+ var imp = [];
+ if (defaultName !== undefined) {
+ imp.push(defaultName);
}
- return undefined;
+ if (namedBindings !== undefined) {
+ imp.push.apply(imp, namedBindings.elements.map(function (el) { return el.name; }));
+ }
+ return imp.length > 0 ? imp : undefined;
}
- if (defaultName !== undefined && defaultName.getStart() === pos) {
- return defaultName;
+ else if (defaultName !== undefined && (isInRange(defaultName, pos) || namedBindings === undefined // defaultName is the only option
+ )) {
+ return [defaultName];
}
else if (namedBindings !== undefined) {
+ if (namedBindings.elements.length === 1) {
+ return [namedBindings.elements[0].name];
+ }
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
- var name = _b[_i].name;
- if (name.getStart() === pos) {
- return name;
+ var element = _b[_i];
+ if (isInRange(element, pos)) {
+ return [element.name];
}
}
}
}
return undefined;
});
+ return imports !== undefined ? imports : [];
+}
+function isInRange(range, pos) {
+ return range.pos <= pos && range.end >= pos;
}
function getUnusedDiagnostic(diag) {
+ // https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
switch (diag.code) {
- case 6133:
- return 0 /* VARIABLE_OR_PARAMETER */; // "'{0}' is declared but never used.
+ case 6133: // Pre TS 2.9 "'{0}' is declared but never used.
+ // TS 2.9+ "'{0}' is declared but its value is never read."
+ case 6196: // TS 2.9+ "'{0}' is declared but never used."
+ return 0 /* VARIABLE_OR_PARAMETER */;
case 6138:
return 1 /* PROPERTY */; // "Property '{0}' is declared but never used."
+ case 6192:
+ return 2 /* DECLARATION */; // "All imports in import declaration are unused."
+ case 6198:
+ return 3 /* ALL_DESTRUCTURES */; // "All destructured elements are unused."
default:
return undefined;
}
@@ -358,7 +404,7 @@ function makeUnusedCheckedProgram(program, checkParameters) {
readFile: function (f) { return sourceFilesByName.get(getCanonicalFileName(f)).text; },
getSourceFile: function (f) { return sourceFilesByName.get(getCanonicalFileName(f)); },
getDefaultLibFileName: function () { return ts.getDefaultLibFileName(options); },
- writeFile: function () { },
+ writeFile: function () { return undefined; },
getCurrentDirectory: function () { return ""; },
getDirectories: function () { return []; },
getCanonicalFileName: getCanonicalFileName,
@@ -371,4 +417,4 @@ function makeUnusedCheckedProgram(program, checkParameters) {
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
diff --git a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
index 5c742bfbd..a9a849483 100644
--- a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
+++ b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
@@ -18,7 +18,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
+var tsutils_1 = require("tsutils");
var Lint = require("../index");
+var noUseBeforeDeclare_examples_1 = require("./code-examples/noUseBeforeDeclare.examples");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -35,13 +37,14 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-use-before-declare",
description: "Disallows usage of variables before their declaration.",
- descriptionDetails: (_a = ["\n This rule is primarily useful when using the `var` keyword -\n the compiler will detect if a `let` and `const` variable is used before it is declared."], _a.raw = ["\n This rule is primarily useful when using the \\`var\\` keyword -\n the compiler will detect if a \\`let\\` and \\`const\\` variable is used before it is declared."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule is primarily useful when using the `var` keyword since the compiler will\n automatically detect if a block-scoped `let` and `const` variable is used before\n declaration. Since most modern TypeScript doesn't use `var`, this rule is generally\n discouraged and is kept around for legacy purposes. It is slow to compute, is not\n enabled in the built-in configuration presets, and should not be used to inform TSLint\n design decisions.\n "], ["\n This rule is primarily useful when using the \\`var\\` keyword since the compiler will\n automatically detect if a block-scoped \\`let\\` and \\`const\\` variable is used before\n declaration. Since most modern TypeScript doesn't use \\`var\\`, this rule is generally\n discouraged and is kept around for legacy purposes. It is slow to compute, is not\n enabled in the built-in configuration presets, and should not be used to inform TSLint\n design decisions.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
type: "functionality",
typescriptOnly: false,
requiresTypeInfo: true,
+ codeExamples: noUseBeforeDeclare_examples_1.codeExamples,
};
return Rule;
}(Lint.Rules.TypedRule));
@@ -56,6 +59,9 @@ function walk(ctx, checker) {
// Ignore `y` in `x.y`, but recurse to `x`.
return recur(node.expression);
case ts.SyntaxKind.Identifier:
+ if (isPropNameInBinding(node)) {
+ return;
+ }
return checkIdentifier(node, checker.getSymbolAtLocation(node));
case ts.SyntaxKind.ExportSpecifier:
return checkIdentifier(node.name, checker.getExportSpecifierLocalTargetSymbol(node));
@@ -83,5 +89,12 @@ function walk(ctx, checker) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING(node.text));
}
}
+ /**
+ * Destructured vars/args w/ rename are declared later in the source.
+ * var { x: y } = { x: 43 };
+ */
+ function isPropNameInBinding(node) {
+ return node.parent !== undefined && tsutils_1.isBindingElement(node.parent) && node.parent.propertyName === node;
+ }
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.js b/node_modules/tslint/lib/rules/noVarKeywordRule.js
index e79d9c65f..73a2964a5 100644
--- a/node_modules/tslint/lib/rules/noVarKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.js
@@ -37,6 +37,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Declaring variables using `var` has several edge case behaviors that make `var` unsuitable for modern code.\n Variables declared by `var` have their parent function block as their scope, ignoring other control flow statements.\n `var`s have declaration \"hoisting\" (similar to `function`s) and can appear to be used before declaration.\n\n Variables declared by `const` and `let` instead have as their scope the block in which they are defined,\n and are not allowed to used before declaration or be re-declared with another `const` or `let`.\n "], ["\n Declaring variables using \\`var\\` has several edge case behaviors that make \\`var\\` unsuitable for modern code.\n Variables declared by \\`var\\` have their parent function block as their scope, ignoring other control flow statements.\n \\`var\\`s have declaration \"hoisting\" (similar to \\`function\\`s) and can appear to be used before declaration.\n\n Variables declared by \\`const\\` and \\`let\\` instead have as their scope the block in which they are defined,\n and are not allowed to used before declaration or be re-declared with another \\`const\\` or \\`let\\`.\n "]))),
type: "functionality",
typescriptOnly: false,
};
@@ -65,6 +66,7 @@ function walk(ctx) {
// Allow `declare var x: number;` or `declare global { var x: number; }`
function isGlobalVarDeclaration(node) {
var parent = node.parent;
- return Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)
- || parent.kind === ts.SyntaxKind.ModuleBlock && Lint.isNodeFlagSet(parent.parent, ts.NodeFlags.GlobalAugmentation);
+ return tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)
+ || parent.kind === ts.SyntaxKind.ModuleBlock && tsutils_1.isNodeFlagSet(parent.parent, ts.NodeFlags.GlobalAugmentation);
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noVarRequiresRule.js b/node_modules/tslint/lib/rules/noVarRequiresRule.js
index 9a8dfb694..567235b1c 100644
--- a/node_modules/tslint/lib/rules/noVarRequiresRule.js
+++ b/node_modules/tslint/lib/rules/noVarRequiresRule.js
@@ -32,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-var-requires",
description: "Disallows the use of require statements except in import statements.",
- descriptionDetails: (_a = ["\n In other words, the use of forms such as `var module = require(\"module\")` are banned.\n Instead use ES6 style imports or `import foo = require('foo')` imports."], _a.raw = ["\n In other words, the use of forms such as \\`var module = require(\"module\")\\` are banned.\n Instead use ES6 style imports or \\`import foo = require('foo')\\` imports."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n In other words, the use of forms such as `var module = require(\"module\")` are banned.\n Instead use ES2015-style imports or `import foo = require('foo')` imports."], ["\n In other words, the use of forms such as \\`var module = require(\"module\")\\` are banned.\n Instead use ES2015-style imports or \\`import foo = require('foo')\\` imports."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n AMD-style `require([])` and CommonJS-style `require(\"\")` statements are environment-specific\n and more difficult to statically analyze.\n\n ES2015-style `import`s are part of the JavaScript language specfication and recommended as the path going forward.\n TypeScript will compile them to environment-specific forms as needed.\n "], ["\n AMD-style \\`require([])\\` and CommonJS-style \\`require(\"\")\\` statements are environment-specific\n and more difficult to statically analyze.\n\n ES2015-style \\`import\\`s are part of the JavaScript language specfication and recommended as the path going forward.\n TypeScript will compile them to environment-specific forms as needed.\n "]))),
type: "typescript",
typescriptOnly: true,
};
@@ -66,4 +67,4 @@ var NoVarRequiresWalker = /** @class */ (function (_super) {
};
return NoVarRequiresWalker;
}(Lint.ScopeAwareRuleWalker));
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noVoidExpressionRule.js b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
index daaded82d..96742a87d 100644
--- a/node_modules/tslint/lib/rules/noVoidExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
@@ -17,9 +17,9 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var utils_1 = require("../language/utils");
var OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND = "ignore-arrow-function-shorthand";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
@@ -34,7 +34,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-void-expression",
description: "Requires expressions of type `void` to appear in statement position.",
- optionsDescription: (_a = ["\n If `", "` is provided, `() => returnsVoid()` will be allowed.\n Otherwise, it must be written as `() => { returnsVoid(); }`."], _a.raw = ["\n If \\`", "\\` is provided, \\`() => returnsVoid()\\` will be allowed.\n Otherwise, it must be written as \\`() => { returnsVoid(); }\\`."], Lint.Utils.dedent(_a, OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is provided, `() => returnsVoid()` will be allowed.\n Otherwise, it must be written as `() => { returnsVoid(); }`."], ["\n If \\`", "\\` is provided, \\`() => returnsVoid()\\` will be allowed.\n Otherwise, it must be written as \\`() => { returnsVoid(); }\\`."])), OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND),
options: {
type: "array",
items: {
@@ -44,6 +44,7 @@ var Rule = /** @class */ (function (_super) {
minLength: 0,
maxLength: 1,
},
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It's misleading returning the results of an expression whose type is `void`.\n Attempting to do so is likely a symptom of expecting a different return type from a function.\n For example, the following code will log `undefined` but looks like it logs a value:\n\n ```\n const performWork = (): void => {\n workFirst();\n workSecond();\n };\n\n console.log(performWork());\n ```\n "], ["\n It's misleading returning the results of an expression whose type is \\`void\\`.\n Attempting to do so is likely a symptom of expecting a different return type from a function.\n For example, the following code will log \\`undefined\\` but looks like it logs a value:\n\n \\`\\`\\`\n const performWork = (): void => {\n workFirst();\n workSecond();\n };\n\n console.log(performWork());\n \\`\\`\\`\n "]))),
requiresTypeInfo: true,
type: "functionality",
typescriptOnly: false,
@@ -58,7 +59,7 @@ function walk(ctx, checker) {
return ts.forEachChild(sourceFile, function cb(node) {
if (isPossiblyVoidExpression(node)
&& !isParentAllowedVoid(node)
- && utils_1.isTypeFlagSet(checker.getTypeAtLocation(node), ts.TypeFlags.Void)) {
+ && tsutils_1.isTypeFlagSet(checker.getTypeAtLocation(node), ts.TypeFlags.Void)) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
@@ -84,4 +85,4 @@ function isPossiblyVoidExpression(node) {
return false;
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
index 352592b23..a83b51361 100644
--- a/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
index bdcb5c699..3b313b693 100644
--- a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
@@ -36,6 +36,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps keep a consistent style with numeric literals.\n Non-standard literals are more difficult to scan through and can be a symptom of typos.\n "], ["\n Helps keep a consistent style with numeric literals.\n Non-standard literals are more difficult to scan through and can be a symptom of typos.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -102,3 +103,4 @@ function walk(ctx) {
}
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
index 41a6e7c56..c6c00d0d7 100644
--- a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
index d216bdfc6..2462c06d0 100644
--- a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
@@ -44,9 +44,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "object-literal-key-quotes",
description: "Enforces consistent object literal property quote style.",
- descriptionDetails: (_a = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], _a.raw = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."]))),
hasFix: true,
- optionsDescription: (_b = ["\n Possible settings are:\n\n * `\"", "\"`: Property names should always be quoted. (This is the default.)\n * `\"", "\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * `\"", "\"`: Property names should either all be quoted or unquoted.\n * `\"", "\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], _b.raw = ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"", "\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * \\`\"", "\"\\`: Property names should either all be quoted or unquoted.\n * \\`\"", "\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."], Lint.Utils.dedent(_b, OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Possible settings are:\n\n * `\"", "\"`: Property names should always be quoted. (This is the default.)\n * `\"", "\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * `\"", "\"`: Property names should either all be quoted or unquoted.\n * `\"", "\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"", "\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * \\`\"", "\"\\`: Property names should either all be quoted or unquoted.\n * \\`\"", "\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."])), OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED),
options: {
type: "string",
enum: [OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED],
@@ -147,4 +147,4 @@ function hasInconsistentQuotes(properties) {
}
return false;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
index 94e0c80a5..368e5eb99 100644
--- a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "..";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
index 59ac30d76..e770d72e6 100644
--- a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "object-literal-shorthand",
description: "Enforces/disallows use of ES6 object literal shorthand.",
hasFix: true,
- optionsDescription: (_a = ["\n If the 'never' option is provided, any shorthand object literal syntax will cause a failure."], _a.raw = ["\n If the \\'never\\' option is provided, any shorthand object literal syntax will cause a failure."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If the 'never' option is provided, any shorthand object literal syntax will cause a failure."], ["\n If the \\'never\\' option is provided, any shorthand object literal syntax will cause a failure."]))),
options: {
type: "string",
enum: [OPTION_NEVER],
@@ -101,4 +101,4 @@ function handleLonghandMethod(name, initializer, sourceFile) {
}
return [prefix + sourceFile.text.substring(nameStart, name.end), fix];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
index 7ea64b163..9d03fd582 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
@@ -1,9 +1,26 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.OptionallyTypedRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING_ALPHABETICAL(name: string): string;
static FAILURE_STRING_USE_DECLARATION_ORDER(propName: string, typeName: string | undefined): string;
+ static FAILURE_STRING_SHORTHAND_FIRST(name: string): string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
index 70d7c5e49..88bdd7cc9 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
@@ -22,6 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_CASE = "ignore-case";
var OPTION_MATCH_DECLARATION_ORDER = "match-declaration-order";
+var OPTION_SHORTHAND_FIRST = "shorthand-first";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -35,6 +36,9 @@ var Rule = /** @class */ (function (_super) {
var type = typeName === undefined ? "its type declaration" : "'" + typeName + "'";
return "The key '" + propName + "' is not in the same order as it is in " + type + ".";
};
+ Rule.FAILURE_STRING_SHORTHAND_FIRST = function (name) {
+ return "The shorthand property '" + name + "' should appear before normal properties";
+ };
Rule.prototype.apply = function (sourceFile) {
var options = parseOptions(this.ruleArguments);
if (options.matchDeclarationOrder) {
@@ -48,16 +52,16 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "object-literal-sort-keys",
- description: (_a = ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], _a.raw = ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "]))),
rationale: "Useful in preventing merge conflicts",
- optionsDescription: (_b = ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will to compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n "], _b.raw = ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will to compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n "], Lint.Utils.dedent(_b, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n * \"", "\" will enforce shorthand properties to appear first, as in:\n\n const obj = { a, c, b: true };\n "], ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n * \"", "\" will enforce shorthand properties to appear first, as in:\n\n const obj = { a, c, b: true };\n "])), OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST),
options: {
type: "string",
- enum: [OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
+ enum: [OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST],
},
optionExamples: [
true,
- [true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
+ [true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST],
],
type: "maintainability",
typescriptOnly: false,
@@ -69,13 +73,14 @@ function parseOptions(ruleArguments) {
return {
ignoreCase: has(OPTION_IGNORE_CASE),
matchDeclarationOrder: has(OPTION_MATCH_DECLARATION_ORDER),
+ shorthandFirst: has(OPTION_SHORTHAND_FIRST),
};
function has(name) {
return ruleArguments.indexOf(name) !== -1;
}
}
function walk(ctx, checker) {
- var sourceFile = ctx.sourceFile, _a = ctx.options, ignoreCase = _a.ignoreCase, matchDeclarationOrder = _a.matchDeclarationOrder;
+ var sourceFile = ctx.sourceFile, _a = ctx.options, ignoreCase = _a.ignoreCase, matchDeclarationOrder = _a.matchDeclarationOrder, shorthandFirst = _a.shorthandFirst;
ts.forEachChild(sourceFile, function cb(node) {
if (tsutils_1.isObjectLiteralExpression(node) && node.properties.length > 1) {
check(node);
@@ -100,14 +105,31 @@ function walk(ctx, checker) {
return;
}
var lastKey;
+ var lastPropertyWasShorthand;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var property = _a[_i];
switch (property.kind) {
case ts.SyntaxKind.SpreadAssignment:
lastKey = undefined; // reset at spread
+ lastPropertyWasShorthand = undefined; // reset at spread
break;
case ts.SyntaxKind.ShorthandPropertyAssignment:
case ts.SyntaxKind.PropertyAssignment:
+ if (shorthandFirst) {
+ if (property.kind === ts.SyntaxKind.ShorthandPropertyAssignment) {
+ if (lastPropertyWasShorthand === false) {
+ ctx.addFailureAtNode(property.name, Rule.FAILURE_STRING_SHORTHAND_FIRST(property.name.text));
+ return; // only show warning on first out-of-order property
+ }
+ lastPropertyWasShorthand = true;
+ }
+ else {
+ if (lastPropertyWasShorthand === true) {
+ lastKey = undefined; // reset on change from shorthand to normal
+ }
+ lastPropertyWasShorthand = false;
+ }
+ }
if (property.name.kind === ts.SyntaxKind.Identifier ||
property.name.kind === ts.SyntaxKind.StringLiteral) {
var key = ignoreCase ? property.name.text.toLowerCase() : property.name.text;
@@ -162,7 +184,7 @@ function hasBlankLineBefore(sourceFile, element) {
});
}
function hasDoubleNewLine(sourceFile, position) {
- return /(\r\n|\r|\n){2}/.test(sourceFile.text.slice(position, position + 4));
+ return /(\r?\n){2}/.test(sourceFile.text.slice(position, position + 4));
}
function getTypeName(t) {
var parent = t.parent;
@@ -184,4 +206,4 @@ function getContextualType(node, checker) {
var decl = declarations[0];
return tsutils_1.isInterfaceDeclaration(decl) || tsutils_1.isTypeLiteralNode(decl) ? decl : undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/oneLineRule.d.ts b/node_modules/tslint/lib/rules/oneLineRule.d.ts
index 73a63c253..cb45e35bb 100644
--- a/node_modules/tslint/lib/rules/oneLineRule.d.ts
+++ b/node_modules/tslint/lib/rules/oneLineRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/oneLineRule.js b/node_modules/tslint/lib/rules/oneLineRule.js
index 5d271ae91..1d0dccf92 100644
--- a/node_modules/tslint/lib/rules/oneLineRule.js
+++ b/node_modules/tslint/lib/rules/oneLineRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "one-line",
description: "Requires the specified tokens to be on the same line as the expression preceding them.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks that `catch` is on the same line as the closing brace for `try`.\n * `\"", "\"` checks that `finally` is on the same line as the closing brace for `catch`.\n * `\"", "\"` checks that `else` is on the same line as the closing brace for `if`.\n * `\"", "\"` checks that an open brace falls on the same line as its preceding expression.\n * `\"", "\"` checks preceding whitespace for the specified tokens."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks that \\`catch\\` is on the same line as the closing brace for \\`try\\`.\n * \\`\"", "\"\\` checks that \\`finally\\` is on the same line as the closing brace for \\`catch\\`.\n * \\`\"", "\"\\` checks that \\`else\\` is on the same line as the closing brace for \\`if\\`.\n * \\`\"", "\"\\` checks that an open brace falls on the same line as its preceding expression.\n * \\`\"", "\"\\` checks preceding whitespace for the specified tokens."], Lint.Utils.dedent(_a, OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE, OPTION_BRACE, OPTION_WHITESPACE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks that `catch` is on the same line as the closing brace for `try`.\n * `\"", "\"` checks that `finally` is on the same line as the closing brace for `catch`.\n * `\"", "\"` checks that `else` is on the same line as the closing brace for `if`.\n * `\"", "\"` checks that an open brace falls on the same line as its preceding expression.\n * `\"", "\"` checks preceding whitespace for the specified tokens."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks that \\`catch\\` is on the same line as the closing brace for \\`try\\`.\n * \\`\"", "\"\\` checks that \\`finally\\` is on the same line as the closing brace for \\`catch\\`.\n * \\`\"", "\"\\` checks that \\`else\\` is on the same line as the closing brace for \\`if\\`.\n * \\`\"", "\"\\` checks that an open brace falls on the same line as its preceding expression.\n * \\`\"", "\"\\` checks preceding whitespace for the specified tokens."])), OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE, OPTION_BRACE, OPTION_WHITESPACE),
options: {
type: "array",
items: {
@@ -89,7 +89,10 @@ var OneLineWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.InterfaceDeclaration:
case ts.SyntaxKind.ClassDeclaration:
case ts.SyntaxKind.ClassExpression: {
- _this.check(tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenBraceToken, sourceFile));
+ var openBrace = tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenBraceToken, sourceFile);
+ if (openBrace !== undefined) {
+ _this.check(openBrace);
+ }
break;
}
case ts.SyntaxKind.IfStatement: {
@@ -148,4 +151,4 @@ var OneLineWalker = /** @class */ (function (_super) {
};
return OneLineWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
index 42ee49cac..502f282e0 100644
--- a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "one-variable-per-declaration",
description: "Disallows multiple variable definitions in the same declaration statement.",
- optionsDescription: (_a = ["\n One argument may be optionally provided:\n\n * `", "` allows multiple variable definitions in a for loop declaration."], _a.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows multiple variable definitions in a for loop declaration."], Lint.Utils.dedent(_a, OPTION_IGNORE_FOR_LOOP)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows multiple variable definitions in a for loop declaration."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows multiple variable definitions in a for loop declaration."])), OPTION_IGNORE_FOR_LOOP),
options: {
type: "array",
items: {
@@ -68,4 +68,4 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
index 7af04a45b..672c59bb8 100644
--- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "only-arrow-functions",
description: "Disallows traditional (non-arrow) function expressions.",
rationale: "Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "])), OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS),
options: {
type: "array",
items: {
@@ -75,7 +75,7 @@ function walk(ctx) {
case ts.SyntaxKind.FunctionExpression: {
var f = node;
if (!(allowNamedFunctions && f.name !== undefined) && !functionIsExempt(f)) {
- ctx.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.FunctionKeyword), Rule.FAILURE_STRING);
+ ctx.addFailureAtNode(utils.getChildOfKind(node, ts.SyntaxKind.FunctionKeyword, ctx.sourceFile), Rule.FAILURE_STRING);
}
}
}
@@ -91,4 +91,4 @@ function functionIsExempt(node) {
function usesThis(node) {
return node.kind === ts.SyntaxKind.ThisKeyword || !utils.hasOwnThisReference(node) && ts.forEachChild(node, usesThis);
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.d.ts b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
index ab1329ea4..5b624b3e0 100644
--- a/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.js b/node_modules/tslint/lib/rules/orderedImportsRule.js
index 4f7c5f0da..51a5ea82d 100644
--- a/node_modules/tslint/lib/rules/orderedImportsRule.js
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.js
@@ -32,9 +32,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "ordered-imports",
description: "Requires that import statements be alphabetized and grouped.",
- descriptionDetails: (_a = ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], _a.raw = ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."]))),
hasFix: true,
- optionsDescription: (_b = ["\n You may set the `\"import-sources-order\"` option to control the ordering of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"import-sources-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `\"Bar\"`, `\"baz\"`, `\"Foo\"`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `\"baz\"`, `\"Bar\"`, `\"Foo\"`.\n * `\"lowercase-last\"`: Correct order is `\"Bar\"`, `\"Foo\"`, `\"baz\"`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"grouped-imports\"` option to control the grouping of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"grouped-imports\"` are:\n\n * `false`: Do not enforce grouping. (This is the default.)\n * `true`: Group source imports by `\"bar\"`, `\"../baz\"`, `\"./foo\"`.\n\n You may set the `\"named-imports-order\"` option to control the ordering of named\n imports (the `{A, B, C}` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"named-imports-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `{A, b, C}`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `{b, A, C}`.\n * `\"lowercase-last\"`: Correct order is `{A, C, b}`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"module-source-path\"` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for `\"module-source-path\"` are:\n\n * `\"full'`: Correct order is `\"./a/Foo\"`, `\"./b/baz\"`, `\"./c/Bar\"`. (This is the default.)\n * `\"basename\"`: Correct order is `\"./c/Bar\"`, `\"./b/baz\"`, `\"./a/Foo\"`.\n\n "], _b.raw = ["\n You may set the \\`\"import-sources-order\"\\` option to control the ordering of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"import-sources-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`\"Bar\"\\`, \\`\"baz\"\\`, \\`\"Foo\"\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`\"baz\"\\`, \\`\"Bar\"\\`, \\`\"Foo\"\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`\"Bar\"\\`, \\`\"Foo\"\\`, \\`\"baz\"\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"grouped-imports\"\\` option to control the grouping of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"grouped-imports\"\\` are:\n\n * \\`false\\`: Do not enforce grouping. (This is the default.)\n * \\`true\\`: Group source imports by \\`\"bar\"\\`, \\`\"../baz\"\\`, \\`\"./foo\"\\`.\n\n You may set the \\`\"named-imports-order\"\\` option to control the ordering of named\n imports (the \\`{A, B, C}\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"named-imports-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`{A, b, C}\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`{b, A, C}\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`{A, C, b}\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"module-source-path\"\\` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for \\`\"module-source-path\"\\` are:\n\n * \\`\"full'\\`: Correct order is \\`\"./a/Foo\"\\`, \\`\"./b/baz\"\\`, \\`\"./c/Bar\"\\`. (This is the default.)\n * \\`\"basename\"\\`: Correct order is \\`\"./c/Bar\"\\`, \\`\"./b/baz\"\\`, \\`\"./a/Foo\"\\`.\n\n "], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You may set the `\"import-sources-order\"` option to control the ordering of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"import-sources-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `\"Bar\"`, `\"baz\"`, `\"Foo\"`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `\"baz\"`, `\"Bar\"`, `\"Foo\"`.\n * `\"lowercase-last\"`: Correct order is `\"Bar\"`, `\"Foo\"`, `\"baz\"`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"grouped-imports\"` option to control the grouping of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"grouped-imports\"` are:\n\n * `false`: Do not enforce grouping. (This is the default.)\n * `true`: Group source imports by `\"bar\"`, `\"../baz\"`, `\"./foo\"`.\n\n You may set the `\"named-imports-order\"` option to control the ordering of named\n imports (the `{A, B, C}` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"named-imports-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `{A, b, C}`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `{b, A, C}`.\n * `\"lowercase-last\"`: Correct order is `{A, C, b}`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"module-source-path\"` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for `\"module-source-path\"` are:\n\n * `\"full'`: Correct order is `\"./a/Foo\"`, `\"./b/baz\"`, `\"./c/Bar\"`. (This is the default.)\n * `\"basename\"`: Correct order is `\"./c/Bar\"`, `\"./b/baz\"`, `\"./a/Foo\"`.\n\n "], ["\n You may set the \\`\"import-sources-order\"\\` option to control the ordering of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"import-sources-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`\"Bar\"\\`, \\`\"baz\"\\`, \\`\"Foo\"\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`\"baz\"\\`, \\`\"Bar\"\\`, \\`\"Foo\"\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`\"Bar\"\\`, \\`\"Foo\"\\`, \\`\"baz\"\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"grouped-imports\"\\` option to control the grouping of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"grouped-imports\"\\` are:\n\n * \\`false\\`: Do not enforce grouping. (This is the default.)\n * \\`true\\`: Group source imports by \\`\"bar\"\\`, \\`\"../baz\"\\`, \\`\"./foo\"\\`.\n\n You may set the \\`\"named-imports-order\"\\` option to control the ordering of named\n imports (the \\`{A, B, C}\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"named-imports-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`{A, b, C}\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`{b, A, C}\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`{A, C, b}\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"module-source-path\"\\` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for \\`\"module-source-path\"\\` are:\n\n * \\`\"full'\\`: Correct order is \\`\"./a/Foo\"\\`, \\`\"./b/baz\"\\`, \\`\"./c/Bar\"\\`. (This is the default.)\n * \\`\"basename\"\\`: Correct order is \\`\"./c/Bar\"\\`, \\`\"./b/baz\"\\`, \\`\"./a/Foo\"\\`.\n\n "]))),
options: {
type: "object",
properties: {
@@ -240,6 +240,7 @@ var Walker = /** @class */ (function (_super) {
}
};
Walker.prototype.getReplacements = function () {
+ var _a;
var importDeclarationsList = this.importsBlocks
.map(function (block) { return block.getImportDeclarations(); })
.filter(function (imports) { return imports.length > 0; });
@@ -248,7 +249,6 @@ var Walker = /** @class */ (function (_super) {
var startOffset = allImportDeclarations.length === 0 ? 0 : allImportDeclarations[0].nodeStartOffset;
replacements.push(Lint.Replacement.appendText(startOffset, this.getGroupedImports(allImportDeclarations)));
return replacements;
- var _a;
};
Walker.prototype.getReplacementsForExistingImports = function (importDeclarationsList) {
var _this = this;
@@ -435,4 +435,4 @@ function moduleDeclarationBody(node) {
}
return body !== undefined && body.kind === ts.SyntaxKind.ModuleBlock ? body : undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
index 6054ed924..bf0307d56 100644
--- a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
index a6f7f173c..cd7a5ea33 100644
--- a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
@@ -38,8 +38,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "prefer-conditional-expression",
- description: (_a = ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], _a.raw = ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n This reduces duplication and can eliminate an unnecessary variable declaration."], _b.raw = ["\n This reduces duplication and can eliminate an unnecessary variable declaration."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This reduces duplication and can eliminate an unnecessary variable declaration."], ["\n This reduces duplication and can eliminate an unnecessary variable declaration."]))),
optionsDescription: "If `" + OPTION_CHECK_ELSE_IF + "` is specified, the rule also checks nested if-else-if statements.",
options: {
type: "string",
@@ -56,42 +56,50 @@ function walk(ctx) {
var sourceFile = ctx.sourceFile, checkElseIf = ctx.options.checkElseIf;
return ts.forEachChild(sourceFile, function cb(node) {
if (tsutils_1.isIfStatement(node)) {
- var assigned = detect(node, sourceFile, checkElseIf);
+ var assigned = detectAssignment(node, sourceFile, checkElseIf);
if (assigned !== undefined) {
ctx.addFailureAtNode(node.getChildAt(0, sourceFile), Rule.FAILURE_STRING(assigned.getText(sourceFile)));
}
if (assigned !== undefined || !checkElseIf) {
// Be careful not to fail again for the "else if"
- ts.forEachChild(node.expression, cb);
- ts.forEachChild(node.thenStatement, cb);
- if (node.elseStatement !== undefined) {
- ts.forEachChild(node.elseStatement, cb);
- }
- return;
+ do {
+ ts.forEachChild(node.expression, cb);
+ ts.forEachChild(node.thenStatement, cb);
+ if (node.elseStatement === undefined) {
+ return;
+ }
+ node = node.elseStatement;
+ while (tsutils_1.isBlock(node) && node.statements.length === 1) {
+ node = node.statements[0];
+ }
+ } while (tsutils_1.isIfStatement(node));
}
}
return ts.forEachChild(node, cb);
});
}
-function detect(_a, sourceFile, elseIf) {
- var thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
- if (elseStatement === undefined || !elseIf && elseStatement.kind === ts.SyntaxKind.IfStatement) {
- return undefined;
- }
- var elze = tsutils_1.isIfStatement(elseStatement) ? detect(elseStatement, sourceFile, elseIf) : getAssigned(elseStatement, sourceFile);
- if (elze === undefined) {
- return undefined;
+/**
+ * @param inElse `undefined` when this is the top level if statement, `false` when inside the then branch, `true` when inside else
+ */
+function detectAssignment(statement, sourceFile, checkElseIf, inElse) {
+ if (tsutils_1.isIfStatement(statement)) {
+ if (inElse === false || !checkElseIf && inElse || statement.elseStatement === undefined) {
+ return undefined;
+ }
+ var then = detectAssignment(statement.thenStatement, sourceFile, checkElseIf, false);
+ if (then === undefined) {
+ return undefined;
+ }
+ var elze = detectAssignment(statement.elseStatement, sourceFile, checkElseIf, true);
+ return elze !== undefined && nodeEquals(then, elze, sourceFile) ? then : undefined;
}
- var then = getAssigned(thenStatement, sourceFile);
- return then !== undefined && nodeEquals(elze, then, sourceFile) ? then : undefined;
-}
-/** Returns the left side of an assignment. */
-function getAssigned(node, sourceFile) {
- if (tsutils_1.isBlock(node)) {
- return node.statements.length === 1 ? getAssigned(node.statements[0], sourceFile) : undefined;
+ else if (tsutils_1.isBlock(statement)) {
+ return statement.statements.length === 1
+ ? detectAssignment(statement.statements[0], sourceFile, checkElseIf, inElse)
+ : undefined;
}
- else if (tsutils_1.isExpressionStatement(node) && tsutils_1.isBinaryExpression(node.expression)) {
- var _a = node.expression, kind = _a.operatorToken.kind, left = _a.left, right = _a.right;
+ else if (tsutils_1.isExpressionStatement(statement) && tsutils_1.isBinaryExpression(statement.expression)) {
+ var _a = statement.expression, kind = _a.operatorToken.kind, left = _a.left, right = _a.right;
return kind === ts.SyntaxKind.EqualsToken && tsutils_1.isSameLine(sourceFile, right.getStart(sourceFile), right.end) ? left : undefined;
}
else {
@@ -101,4 +109,4 @@ function getAssigned(node, sourceFile) {
function nodeEquals(a, b, sourceFile) {
return a.getText(sourceFile) === b.getText(sourceFile);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferConstRule.js b/node_modules/tslint/lib/rules/preferConstRule.js
index 42f1e6ce4..5d88718de 100644
--- a/node_modules/tslint/lib/rules/preferConstRule.js
+++ b/node_modules/tslint/lib/rules/preferConstRule.js
@@ -43,9 +43,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-const",
description: "Requires that variable declarations use `const` instead of `let` and `var` if possible.",
- descriptionDetails: (_a = ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], _a.raw = ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"]))),
hasFix: true,
- optionsDescription: (_b = ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], _b.raw = ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], Lint.Utils.dedent(_b, OPTION_DESTRUCTURING_ANY, OPTION_DESTRUCTURING_ALL)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."])), OPTION_DESTRUCTURING_ANY, OPTION_DESTRUCTURING_ALL),
options: {
type: "object",
properties: {
@@ -87,7 +87,9 @@ var Scope = /** @class */ (function () {
var PreferConstWalker = /** @class */ (function (_super) {
tslib_1.__extends(PreferConstWalker, _super);
function PreferConstWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Scope();
+ return _this;
}
PreferConstWalker.prototype.walk = function (sourceFile) {
var _this = this;
@@ -146,10 +148,12 @@ var PreferConstWalker = /** @class */ (function (_super) {
}
}
else if (node.kind === ts.SyntaxKind.Parameter) {
- _this.handleBindingName(node.name, {
- canBeConst: false,
- isBlockScoped: true,
- });
+ if (node.parent.kind !== ts.SyntaxKind.IndexSignature) {
+ _this.handleBindingName(node.name, {
+ canBeConst: false,
+ isBlockScoped: true,
+ });
+ }
}
else if (utils.isPostfixUnaryExpression(node) ||
utils.isPrefixUnaryExpression(node) &&
@@ -309,4 +313,4 @@ var PreferConstWalker = /** @class */ (function (_super) {
};
return PreferConstWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferForOfRule.d.ts b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/preferForOfRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
index 9f145cef6..c18d09317 100644
--- a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-function-over-method",
description: "Warns for class methods that do not use 'this'.",
- optionsDescription: (_a = ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], _a.raw = ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], Lint.Utils.dedent(_a, OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."])), OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED),
options: {
type: "string",
enum: [OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED],
@@ -108,4 +108,4 @@ function isRecursiveCall(node, name) {
node.parent.kind === ts.SyntaxKind.PropertyAccessExpression &&
node.parent.name.text === name;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
index a3fe1e9be..4a22ff3ed 100644
--- a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
@@ -50,8 +50,8 @@ function walk(ctx) {
var type = node.type;
if (type !== undefined && tsutils_1.isFunctionTypeNode(type)) {
ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING, type.type === undefined ? undefined : [
- Lint.Replacement.deleteFromTo(Lint.childOfKind(node, ts.SyntaxKind.ColonToken).getStart(), type.getStart()),
- Lint.Replacement.replaceFromTo(Lint.childOfKind(type, ts.SyntaxKind.EqualsGreaterThanToken).pos, type.type.pos, ":"),
+ Lint.Replacement.deleteFromTo(type.pos - 1, type.getStart()),
+ Lint.Replacement.replaceFromTo(type.parameters.end + 1, type.type.pos, ":"),
]);
}
}
diff --git a/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
index 34aff8cc4..7b6f9ea32 100644
--- a/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.d.ts b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.js b/node_modules/tslint/lib/rules/preferSwitchRule.js
index f9afd3650..6291ac4cc 100644
--- a/node_modules/tslint/lib/rules/preferSwitchRule.js
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a, _b;
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -38,14 +39,14 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-switch",
description: "Prefer a `switch` statement to an `if` statement with simple `===` comparisons.",
- optionsDescription: (_a = ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], _a.raw = ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], Lint.Utils.dedent(_a, OPTION_MIN_CASES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."])), OPTION_MIN_CASES),
options: {
type: "object",
- properties: (_b = {},
- _b[OPTION_MIN_CASES] = { type: "number" },
- _b),
+ properties: (_a = {},
+ _a[OPTION_MIN_CASES] = { type: "number" },
+ _a),
},
- optionExamples: [true, [true, (_c = {}, _c[OPTION_MIN_CASES] = 2, _c)]],
+ optionExamples: [true, [true, (_b = {}, _b[OPTION_MIN_CASES] = 2, _b)]],
type: "style",
typescriptOnly: false,
};
@@ -136,4 +137,4 @@ function isSimple(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.d.ts b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
index 0b4ebc00c..e6719dbf7 100644
--- a/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.js b/node_modules/tslint/lib/rules/preferTemplateRule.js
index 5255a5f37..6b065d719 100644
--- a/node_modules/tslint/lib/rules/preferTemplateRule.js
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-template",
description: "Prefer a template expression over string literal concatenation.",
- optionsDescription: (_a = ["\n If `", "` is specified, then a single concatenation (`x + y`) is allowed, but not more (`x + y + z`)."], _a.raw = ["\n If \\`", "\\` is specified, then a single concatenation (\\`x + y\\`) is allowed, but not more (\\`x + y + z\\`)."], Lint.Utils.dedent(_a, OPTION_SINGLE_CONCAT)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then a single concatenation (`x + y`) is allowed, but not more (`x + y + z`)."], ["\n If \\`", "\\` is specified, then a single concatenation (\\`x + y\\`) is allowed, but not more (\\`x + y + z\\`)."])), OPTION_SINGLE_CONCAT),
options: {
type: "string",
enum: [OPTION_SINGLE_CONCAT],
@@ -121,4 +121,4 @@ function isStringLike(node) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
index aa6f8163e..61a97fde0 100644
--- a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
@@ -17,25 +17,61 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a;
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var OPTION_FUNCTION_DECLARATION = "check-function-declaration";
+var OPTION_FUNCTION_EXPRESSION = "check-function-expression";
+var OPTION_ARROW_FUNCTION = "check-arrow-function";
+var OPTION_METHOD_DECLARATION = "check-method-declaration";
+var KIND_FOR_OPTION = (_a = {},
+ _a[OPTION_FUNCTION_DECLARATION] = ts.SyntaxKind.FunctionDeclaration,
+ _a[OPTION_FUNCTION_EXPRESSION] = ts.SyntaxKind.FunctionExpression,
+ _a[OPTION_ARROW_FUNCTION] = ts.SyntaxKind.ArrowFunction,
+ _a[OPTION_METHOD_DECLARATION] = ts.SyntaxKind.MethodDeclaration,
+ _a);
+function parseOptions(ruleArguments) {
+ if (ruleArguments.length === 0) {
+ ruleArguments = Object.keys(KIND_FOR_OPTION);
+ }
+ var enabledKinds = new Set();
+ for (var _i = 0, ruleArguments_1 = ruleArguments; _i < ruleArguments_1.length; _i++) {
+ var arg = ruleArguments_1[_i];
+ enabledKinds.add(KIND_FOR_OPTION[arg]);
+ }
+ return enabledKinds;
+}
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments), program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "promise-function-async",
description: "Requires any function or method that returns a promise to be marked async.",
- rationale: (_a = ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-`async` `Promise`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n "], _a.raw = ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-\\`async\\` \\`Promise\\`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-`async` `Promise`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n\n If no optional arguments are provided then all function types are checked,\n otherwise the specific function types are checked:\n\n * `\"", "\"` check function declarations.\n * `\"", "\"` check function expressions.\n * `\"", "\"` check arrow functions.\n * `\"", "\"` check method declarations.\n "], ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-\\`async\\` \\`Promise\\`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n\n If no optional arguments are provided then all function types are checked,\n otherwise the specific function types are checked:\n\n * \\`\"", "\"\\` check function declarations.\n * \\`\"", "\"\\` check function expressions.\n * \\`\"", "\"\\` check arrow functions.\n * \\`\"", "\"\\` check method declarations.\n "])), OPTION_FUNCTION_DECLARATION, OPTION_FUNCTION_EXPRESSION, OPTION_ARROW_FUNCTION, OPTION_METHOD_DECLARATION),
optionsDescription: "Not configurable.",
- options: null,
- optionExamples: [true],
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [
+ OPTION_FUNCTION_DECLARATION,
+ OPTION_FUNCTION_EXPRESSION,
+ OPTION_ARROW_FUNCTION,
+ OPTION_METHOD_DECLARATION,
+ ],
+ },
+ minLength: 0,
+ maxLength: 4,
+ },
+ optionExamples: [true,
+ [true, OPTION_FUNCTION_DECLARATION, OPTION_METHOD_DECLARATION]],
type: "typescript",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -46,19 +82,23 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
function walk(ctx, tc) {
- return ts.forEachChild(ctx.sourceFile, function cb(node) {
- switch (node.kind) {
- case ts.SyntaxKind.MethodDeclaration:
- case ts.SyntaxKind.FunctionDeclaration:
- if (node.body === undefined) {
- break;
- }
- // falls through
- case ts.SyntaxKind.FunctionExpression:
- case ts.SyntaxKind.ArrowFunction:
- if (!tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) && returnsPromise(node, tc)) {
- ctx.addFailure(node.getStart(ctx.sourceFile), node.body.pos, Rule.FAILURE_STRING);
- }
+ var sourceFile = ctx.sourceFile, options = ctx.options;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (options.has(node.kind)) {
+ switch (node.kind) {
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.FunctionDeclaration:
+ if (node.body === undefined) {
+ break;
+ }
+ // falls through
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.ArrowFunction:
+ if (!tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
+ && returnsPromise(node, tc)) {
+ ctx.addFailure(node.getStart(sourceFile), node.body.pos, Rule.FAILURE_STRING);
+ }
+ }
}
return ts.forEachChild(node, cb);
});
@@ -67,4 +107,4 @@ function returnsPromise(node, tc) {
var type = tc.getReturnTypeOfSignature(tc.getTypeAtLocation(node).getCallSignatures()[0]);
return type.symbol !== undefined && type.symbol.name === "Promise";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.d.ts b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
index a79a13730..c4f5cdecb 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.d.ts
+++ b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.js b/node_modules/tslint/lib/rules/quotemarkRule.js
index 19586069a..e4ab69552 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.js
+++ b/node_modules/tslint/lib/rules/quotemarkRule.js
@@ -53,7 +53,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "quotemark",
description: "Requires single or double quotes for string literals.",
hasFix: true,
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` enforces single quotes.\n * `\"", "\"` enforces double quotes.\n * `\"", "\"` enforces single quotes for JSX attributes.\n * `\"", "\"` enforces double quotes for JSX attributes.\n * `\"", "\"` forbids single-line untagged template strings that do not contain string interpolations.\n * `\"", "\"` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, `[true, \"", "\", \"", "\"]` would not report a failure on the string literal\n `'Hello \"World\"'`."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` enforces single quotes.\n * \\`\"", "\"\\` enforces double quotes.\n * \\`\"", "\"\\` enforces single quotes for JSX attributes.\n * \\`\"", "\"\\` enforces double quotes for JSX attributes.\n * \\`\"", "\"\\` forbids single-line untagged template strings that do not contain string interpolations.\n * \\`\"", "\"\\` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, \\`[true, \"", "\", \"", "\"]\\` would not report a failure on the string literal\n \\`'Hello \"World\"'\\`."], Lint.Utils.dedent(_a, OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_TEMPLATE, OPTION_AVOID_ESCAPE, OPTION_DOUBLE, OPTION_AVOID_ESCAPE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` enforces single quotes.\n * `\"", "\"` enforces double quotes.\n * `\"", "\"` enforces single quotes for JSX attributes.\n * `\"", "\"` enforces double quotes for JSX attributes.\n * `\"", "\"` forbids single-line untagged template strings that do not contain string interpolations.\n * `\"", "\"` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, `[true, \"", "\", \"", "\"]` would not report a failure on the string literal\n `'Hello \"World\"'`."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` enforces single quotes.\n * \\`\"", "\"\\` enforces double quotes.\n * \\`\"", "\"\\` enforces single quotes for JSX attributes.\n * \\`\"", "\"\\` enforces double quotes for JSX attributes.\n * \\`\"", "\"\\` forbids single-line untagged template strings that do not contain string interpolations.\n * \\`\"", "\"\\` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, \\`[true, \"", "\", \"", "\"]\\` would not report a failure on the string literal\n \\`'Hello \"World\"'\\`."])), OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_TEMPLATE, OPTION_AVOID_ESCAPE, OPTION_DOUBLE, OPTION_AVOID_ESCAPE),
options: {
type: "array",
items: {
@@ -118,4 +118,4 @@ function getQuotemarkPreference(args) {
}
return undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/radixRule.d.ts b/node_modules/tslint/lib/rules/radixRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/radixRule.d.ts
+++ b/node_modules/tslint/lib/rules/radixRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/radixRule.js b/node_modules/tslint/lib/rules/radixRule.js
index 3d1f695de..e5548c558 100644
--- a/node_modules/tslint/lib/rules/radixRule.js
+++ b/node_modules/tslint/lib/rules/radixRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "radix",
description: "Requires the radix parameter to be specified when calling `parseInt`.",
- rationale: (_a = ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], _a.raw = ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -44,21 +44,36 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
+function isParseInt(expression) {
+ return tsutils_1.isIdentifier(expression) && expression.text === "parseInt";
+}
+function isPropertyAccessParseInt(expression) {
+ return tsutils_1.isPropertyAccessExpression(expression) && expression.name.text === "parseInt";
+}
+function isPropertyAccessOfIdentifier(expression, identifers) {
+ return tsutils_1.isPropertyAccessExpression(expression) && tsutils_1.isIdentifier(expression.expression) &&
+ identifers.some(function (identifer) { return expression.expression.text === identifer; });
+}
+function isPropertyAccessOfProperty(expression, identifers) {
+ return tsutils_1.isPropertyAccessExpression(expression) && tsutils_1.isPropertyAccessExpression(expression.expression) &&
+ identifers.some(function (identifer) { return expression.expression.name.text === identifer; });
+}
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isCallExpression(node) && node.arguments.length === 1 &&
(
// parseInt("123")
- tsutils_1.isIdentifier(node.expression) && node.expression.text === "parseInt" ||
- // window.parseInt("123") || global.parseInt("123")
- tsutils_1.isPropertyAccessExpression(node.expression) &&
- node.expression.name.text === "parseInt" &&
- tsutils_1.isIdentifier(node.expression.expression) &&
- (node.expression.expression.text === "global" ||
- node.expression.expression.text === "window"))) {
+ isParseInt(node.expression) ||
+ // window.parseInt("123") || global.parseInt("123") || Number.parseInt("123")
+ isPropertyAccessParseInt(node.expression) &&
+ isPropertyAccessOfIdentifier(node.expression, ["global", "window", "Number"]) ||
+ // window.Number.parseInt("123") || global.Number.parseInt("123")
+ isPropertyAccessParseInt(node.expression) &&
+ isPropertyAccessOfProperty(node.expression, ["Number"]) &&
+ isPropertyAccessOfIdentifier(node.expression.expression, ["global", "window"]))) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
index 222faaa7f..5867be53a 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
index c2b8bdb96..e05bd3fff 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
@@ -63,17 +63,17 @@ function walk(ctx, tc) {
});
}
function getBaseTypeOfLiteralType(type) {
- if (Lint.isTypeFlagSet(type, ts.TypeFlags.StringLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.String)) {
+ if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.StringLiteral) || tsutils_1.isTypeFlagSet(type, ts.TypeFlags.String)) {
return "string";
}
- else if (Lint.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.Number)) {
+ else if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) || tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Number)) {
return "number";
}
- else if (tsutils_1.isUnionType(type) && !Lint.isTypeFlagSet(type, ts.TypeFlags.Enum)) {
+ else if (tsutils_1.isUnionType(type) && !tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Enum)) {
var types = type.types.map(getBaseTypeOfLiteralType);
return allSame(types) ? types[0] : "invalid";
}
- else if (Lint.isTypeFlagSet(type, ts.TypeFlags.EnumLiteral)) {
+ else if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.EnumLiteral)) {
// Compatibility for TypeScript pre-2.4, which used EnumLiteralType instead of LiteralType
getBaseTypeOfLiteralType(type.baseType);
}
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
index e2bae0d7c..4d6862114 100644
--- a/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.js b/node_modules/tslint/lib/rules/returnUndefinedRule.js
index e117a1b3d..ab3da43ce 100644
--- a/node_modules/tslint/lib/rules/returnUndefinedRule.js
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.js
@@ -98,10 +98,10 @@ function getReturnKind(node, checker) {
? tryGetReturnType(checker.getContextualType(node), checker)
: undefined;
var returnType = contextual !== undefined ? contextual : tryGetReturnType(checker.getTypeAtLocation(node), checker);
- if (returnType === undefined || Lint.isTypeFlagSet(returnType, ts.TypeFlags.Any)) {
+ if (returnType === undefined || tsutils_1.isTypeFlagSet(returnType, ts.TypeFlags.Any)) {
return undefined;
}
- if ((Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? isEffectivelyVoidPromise : isEffectivelyVoid)(returnType)) {
+ if ((tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? isEffectivelyVoidPromise : isEffectivelyVoid)(returnType)) {
return ReturnKind.Void;
}
return ReturnKind.Value;
@@ -111,7 +111,7 @@ function isEffectivelyVoidPromise(type) {
// Would need access to `checker.getPromisedTypeOfPromise` to do this properly.
// Assume that the return type is the global Promise (since this is an async function) and get its type argument.
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
tsutils_1.isUnionType(type) && type.types.every(isEffectivelyVoidPromise) ||
tsutils_1.isTypeReference(type) && type.typeArguments !== undefined && type.typeArguments.length === 1 &&
isEffectivelyVoidPromise(type.typeArguments[0]);
@@ -119,7 +119,7 @@ function isEffectivelyVoidPromise(type) {
/** True for `void`, `undefined`, or `void | undefined`. */
function isEffectivelyVoid(type) {
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
tsutils_1.isUnionType(type) && type.types.every(isEffectivelyVoid);
}
function tryGetReturnType(fnType, checker) {
diff --git a/node_modules/tslint/lib/rules/semicolonRule.d.ts b/node_modules/tslint/lib/rules/semicolonRule.d.ts
index 1e32e4a09..2f56b6ba7 100644
--- a/node_modules/tslint/lib/rules/semicolonRule.d.ts
+++ b/node_modules/tslint/lib/rules/semicolonRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/semicolonRule.js b/node_modules/tslint/lib/rules/semicolonRule.js
index 6901842f4..9e20e960a 100644
--- a/node_modules/tslint/lib/rules/semicolonRule.js
+++ b/node_modules/tslint/lib/rules/semicolonRule.js
@@ -47,7 +47,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "semicolon",
description: "Enforces consistent semicolon usage at the end of every statement.",
hasFix: true,
- optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods.\n * `\"", "\"` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides `\"", "\"`.\n "], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods.\n * \\`\"", "\"\\` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides \\`\"", "\"\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS, OPTION_STRICT_BOUND_CLASS_METHODS, OPTION_IGNORE_BOUND_CLASS_METHODS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods.\n * `\"", "\"` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides `\"", "\"`.\n "], ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods.\n * \\`\"", "\"\\` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides \\`\"", "\"\\`.\n "])), OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS, OPTION_STRICT_BOUND_CLASS_METHODS, OPTION_IGNORE_BOUND_CLASS_METHODS),
options: {
type: "array",
items: [
@@ -326,4 +326,4 @@ var SemicolonNeverWalker = /** @class */ (function (_super) {
};
return SemicolonNeverWalker;
}(SemicolonWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
index 7e3282b8c..2d7e934fa 100644
--- a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
+++ b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var ALWAYS_OR_NEVER = {
@@ -50,7 +51,7 @@ var Rule = /** @class */ (function (_super) {
},
type: "object",
},
- optionsDescription: (_a = ["\n One argument which is an object which may contain the keys `anonymous`, `named`, and `asyncArrow`\n These should be set to either `\"always\"` or `\"never\"`.\n\n * `\"anonymous\"` checks before the opening paren in anonymous functions\n * `\"named\"` checks before the opening paren in named functions\n * `\"asyncArrow\"` checks before the opening paren in async arrow functions\n * `\"method\"` checks before the opening paren in class methods\n * `\"constructor\"` checks before the opening paren in class constructors\n "], _a.raw = ["\n One argument which is an object which may contain the keys \\`anonymous\\`, \\`named\\`, and \\`asyncArrow\\`\n These should be set to either \\`\"always\"\\` or \\`\"never\"\\`.\n\n * \\`\"anonymous\"\\` checks before the opening paren in anonymous functions\n * \\`\"named\"\\` checks before the opening paren in named functions\n * \\`\"asyncArrow\"\\` checks before the opening paren in async arrow functions\n * \\`\"method\"\\` checks before the opening paren in class methods\n * \\`\"constructor\"\\` checks before the opening paren in class constructors\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument which is an object which may contain the keys `anonymous`, `named`, and `asyncArrow`\n These should be set to either `\"always\"` or `\"never\"`.\n\n * `\"anonymous\"` checks before the opening paren in anonymous functions\n * `\"named\"` checks before the opening paren in named functions\n * `\"asyncArrow\"` checks before the opening paren in async arrow functions\n * `\"method\"` checks before the opening paren in class methods\n * `\"constructor\"` checks before the opening paren in class constructors\n "], ["\n One argument which is an object which may contain the keys \\`anonymous\\`, \\`named\\`, and \\`asyncArrow\\`\n These should be set to either \\`\"always\"\\` or \\`\"never\"\\`.\n\n * \\`\"anonymous\"\\` checks before the opening paren in anonymous functions\n * \\`\"named\"\\` checks before the opening paren in named functions\n * \\`\"asyncArrow\"\\` checks before the opening paren in async arrow functions\n * \\`\"method\"\\` checks before the opening paren in class methods\n * \\`\"constructor\"\\` checks before the opening paren in class constructors\n "]))),
ruleName: "space-before-function-paren",
type: "style",
typescriptOnly: false,
@@ -80,7 +81,7 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
function check(node, option) {
- var openParen = Lint.childOfKind(node, ts.SyntaxKind.OpenParenToken);
+ var openParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenParenToken, sourceFile);
// openParen may be missing for an async arrow function `async x => ...`.
if (openParen === undefined) {
return;
@@ -99,7 +100,7 @@ function walk(ctx) {
function getOption(node, options) {
switch (node.kind) {
case ts.SyntaxKind.ArrowFunction:
- return !hasTypeParameters(node) && Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
+ return !hasTypeParameters(node) && tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
? options.asyncArrow : undefined;
case ts.SyntaxKind.Constructor:
return options.constructor;
@@ -123,4 +124,4 @@ function getOption(node, options) {
function hasTypeParameters(node) {
return node.typeParameters !== undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts b/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
index 4ed2047ee..37eb73ffd 100644
--- a/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
+++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.js b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
index 55e7de0a9..c53cc75ce 100644
--- a/node_modules/tslint/lib/rules/spaceWithinParensRule.js
+++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
@@ -37,9 +37,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "space-within-parens",
- description: "Enforces spaces within parentheses or disallow them.",
+ description: "Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.",
hasFix: true,
- optionsDescription: (_a = ["\n You may enforce the amount of whitespace within parentheses.\n "], _a.raw = ["\n You may enforce the amount of whitespace within parentheses.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n You may enforce the amount of whitespace within parentheses.\n "], ["\n You may enforce the amount of whitespace within parentheses.\n "]))),
options: { type: "number", min: 0 },
type: "style",
typescriptOnly: false,
@@ -75,10 +75,14 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) {
var _this = this;
tsutils_1.forEachToken(sourceFile, function (token) {
if (token.kind === ts.SyntaxKind.OpenParenToken) {
- _this.checkOpenParenToken(token);
+ if (sourceFile.text.charAt(token.end) !== ")") {
+ _this.checkOpenParenToken(token);
+ }
}
else if (token.kind === ts.SyntaxKind.CloseParenToken) {
- _this.checkCloseParenToken(token);
+ if (sourceFile.text.charAt(token.end - 2) !== "(") {
+ _this.checkCloseParenToken(token);
+ }
}
});
};
@@ -151,4 +155,4 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) {
};
return SpaceWithinParensWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
index 8a360c959..10d7c24dc 100644
--- a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
@@ -29,7 +29,7 @@ export declare const enum TypeFailure {
Null = 4,
Undefined = 5,
Enum = 6,
- Mixes = 7,
+ Mixes = 7
}
declare module "typescript" {
interface IntrinsicType extends ts.Type {
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
index 605d85929..dc3dd9227 100644
--- a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_NULL_UNION = "allow-null-union";
@@ -37,8 +38,8 @@ var Rule = /** @class */ (function (_super) {
};
Rule.metadata = {
ruleName: "strict-boolean-expressions",
- description: (_a = ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the `!`, `&&`, and `||` operators\n * The condition in a conditional expression (`cond ? x : y`)\n * Conditions for `if`, `for`, `while`, and `do-while` statements."], _a.raw = ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the \\`!\\`, \\`&&\\`, and \\`||\\` operators\n * The condition in a conditional expression (\\`cond ? x : y\\`)\n * Conditions for \\`if\\`, \\`for\\`, \\`while\\`, and \\`do-while\\` statements."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n These options may be provided:\n\n * `", "` allows union types containing `null`.\n - It does *not* allow `null` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows union types containing `undefined`.\n - It does *not* allow `undefined` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows strings.\n - It does *not* allow unions containing `string`.\n - It does *not* allow string literal types.\n * `", "` allows numbers.\n - It does *not* allow unions containing `number`.\n - It does *not* allow enums or number literal types.\n * `", "` allows multiple of the above to appear together.\n - For example, `string | number` or `RegExp | null | undefined` would normally not be allowed.\n - A type like `\"foo\" | \"bar\" | undefined` is always allowed, because it has only one way to be false.\n * `", "` allows `boolean | undefined`.\n - Also allows `true | false | undefined`.\n - Does not allow `false | undefined`.\n - This option is a subset of `", "`, so you don't need to enable both options at the same time.\n "], _b.raw = ["\n These options may be provided:\n\n * \\`", "\\` allows union types containing \\`null\\`.\n - It does *not* allow \\`null\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows union types containing \\`undefined\\`.\n - It does *not* allow \\`undefined\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows strings.\n - It does *not* allow unions containing \\`string\\`.\n - It does *not* allow string literal types.\n * \\`", "\\` allows numbers.\n - It does *not* allow unions containing \\`number\\`.\n - It does *not* allow enums or number literal types.\n * \\`", "\\` allows multiple of the above to appear together.\n - For example, \\`string | number\\` or \\`RegExp | null | undefined\\` would normally not be allowed.\n - A type like \\`\"foo\" | \"bar\" | undefined\\` is always allowed, because it has only one way to be false.\n * \\`", "\\` allows \\`boolean | undefined\\`.\n - Also allows \\`true | false | undefined\\`.\n - Does not allow \\`false | undefined\\`.\n - This option is a subset of \\`", "\\`, so you don't need to enable both options at the same time.\n "], Lint.Utils.dedent(_b, OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER, OPTION_ALLOW_MIX, OPTION_ALLOW_BOOLEAN_OR_UNDEFINED, OPTION_ALLOW_UNDEFINED_UNION)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the `!`, `&&`, and `||` operators\n * The condition in a conditional expression (`cond ? x : y`)\n * Conditions for `if`, `for`, `while`, and `do-while` statements."], ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the \\`!\\`, \\`&&\\`, and \\`||\\` operators\n * The condition in a conditional expression (\\`cond ? x : y\\`)\n * Conditions for \\`if\\`, \\`for\\`, \\`while\\`, and \\`do-while\\` statements."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n These options may be provided:\n\n * `", "` allows union types containing `null`.\n - It does *not* allow `null` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows union types containing `undefined`.\n - It does *not* allow `undefined` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows strings.\n - It does *not* allow unions containing `string`.\n - It does *not* allow string literal types.\n * `", "` allows numbers.\n - It does *not* allow unions containing `number`.\n - It does *not* allow enums or number literal types.\n * `", "` allows multiple of the above to appear together.\n - For example, `string | number` or `RegExp | null | undefined` would normally not be allowed.\n - A type like `\"foo\" | \"bar\" | undefined` is always allowed, because it has only one way to be false.\n * `", "` allows `boolean | undefined`.\n - Also allows `true | false | undefined`.\n - Does not allow `false | undefined`.\n - This option is a subset of `", "`, so you don't need to enable both options at the same time.\n "], ["\n These options may be provided:\n\n * \\`", "\\` allows union types containing \\`null\\`.\n - It does *not* allow \\`null\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows union types containing \\`undefined\\`.\n - It does *not* allow \\`undefined\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows strings.\n - It does *not* allow unions containing \\`string\\`.\n - It does *not* allow string literal types.\n * \\`", "\\` allows numbers.\n - It does *not* allow unions containing \\`number\\`.\n - It does *not* allow enums or number literal types.\n * \\`", "\\` allows multiple of the above to appear together.\n - For example, \\`string | number\\` or \\`RegExp | null | undefined\\` would normally not be allowed.\n - A type like \\`\"foo\" | \"bar\" | undefined\\` is always allowed, because it has only one way to be false.\n * \\`", "\\` allows \\`boolean | undefined\\`.\n - Also allows \\`true | false | undefined\\`.\n - Does not allow \\`false | undefined\\`.\n - This option is a subset of \\`", "\\`, so you don't need to enable both options at the same time.\n "])), OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER, OPTION_ALLOW_MIX, OPTION_ALLOW_BOOLEAN_OR_UNDEFINED, OPTION_ALLOW_UNDEFINED_UNION),
options: {
type: "array",
items: {
@@ -155,10 +156,10 @@ function getTypeFailure(type, options) {
case true:
// Allow 'any'. Allow 'true' itself, but not any other always-truthy type.
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.BooleanLiteral) ? undefined : 0 /* AlwaysTruthy */;
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.BooleanLiteral) ? undefined : 0 /* AlwaysTruthy */;
case false:
// Allow 'false' itself, but not any other always-falsy type
- return Lint.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) ? undefined : 1 /* AlwaysFalsy */;
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) ? undefined : 1 /* AlwaysFalsy */;
case undefined:
return undefined;
}
@@ -167,13 +168,13 @@ function isBooleanUndefined(type) {
var isTruthy = false;
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var ty = _a[_i];
- if (Lint.isTypeFlagSet(ty, ts.TypeFlags.Boolean)) {
+ if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Boolean)) {
isTruthy = true;
}
- else if (Lint.isTypeFlagSet(ty, ts.TypeFlags.BooleanLiteral)) {
+ else if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.BooleanLiteral)) {
isTruthy = isTruthy || ty.intrinsicName === "true";
}
- else if (!Lint.isTypeFlagSet(ty, ts.TypeFlags.Void | ts.TypeFlags.Undefined)) {
+ else if (!tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Void | ts.TypeFlags.Undefined)) { // tslint:disable-line:no-bitwise
return undefined;
}
}
@@ -267,7 +268,7 @@ function getKind(type) {
(type.intrinsicName === "true" ? 9 /* AlwaysTruthy */ : 5 /* FalseBooleanLiteral */)
: 9 /* AlwaysTruthy */;
function is(flags) {
- return Lint.isTypeFlagSet(type, flags);
+ return tsutils_1.isTypeFlagSet(type, flags);
}
}
function numberLiteralIsZero(type) {
@@ -307,7 +308,7 @@ function stringOr(parts) {
}
}
function isUnionType(type) {
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Union) && !Lint.isTypeFlagSet(type, ts.TypeFlags.Enum);
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Union) && !tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Enum);
}
function showLocation(n) {
switch (n.kind) {
@@ -371,4 +372,4 @@ function showTypeFailure(ty, unionType, strictNullChecks) {
case 7 /* Mixes */: return "unions more than one truthy/falsy type";
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
index 85b7194c3..1ad0fb902 100644
--- a/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
index 526116dd3..0a4c1a41e 100644
--- a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "strict-type-predicates",
- description: (_a = ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires `strictNullChecks` to work properly."], _a.raw = ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires \\`strictNullChecks\\` to work properly."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires `strictNullChecks` to work properly."], ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires \\`strictNullChecks\\` to work properly."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -78,7 +78,7 @@ function walk(ctx, checker) {
}
var exprType = checker.getTypeAtLocation(exprPred.expression);
// TODO: could use checker.getBaseConstraintOfType to help with type parameters, but it's not publicly exposed.
- if (Lint.isTypeFlagSet(exprType, ts.TypeFlags.Any | ts.TypeFlags.TypeParameter)) {
+ if (tsutils_1.isTypeFlagSet(exprType, ts.TypeFlags.Any | ts.TypeFlags.TypeParameter)) {
return;
}
switch (exprPred.kind) {
@@ -116,11 +116,19 @@ function getTypePredicateOneWay(left, right, isStrictEquals) {
switch (right.kind) {
case ts.SyntaxKind.TypeOfExpression:
var expression = right.expression;
- var kind = left.kind === ts.SyntaxKind.StringLiteral ? left.text : "";
- var predicate = getTypePredicateForKind(kind);
+ if (!tsutils_1.isLiteralExpression(left)) {
+ if (tsutils_1.isIdentifier(left) && left.text === "undefined" ||
+ left.kind === ts.SyntaxKind.NullKeyword ||
+ left.kind === ts.SyntaxKind.TrueKeyword ||
+ left.kind === ts.SyntaxKind.FalseKeyword) {
+ return { kind: 2 /* TypeofTypo */ };
+ }
+ return undefined;
+ }
+ var predicate = getTypePredicateForKind(left.text);
return predicate === undefined
? { kind: 2 /* TypeofTypo */ }
- : { kind: 0 /* Plain */, expression: expression, predicate: predicate, isNullOrUndefined: kind === "undefined" };
+ : { kind: 0 /* Plain */, expression: expression, predicate: predicate, isNullOrUndefined: left.text === "undefined" };
case ts.SyntaxKind.NullKeyword:
return nullOrUndefined(ts.TypeFlags.Null);
case ts.SyntaxKind.Identifier:
@@ -159,13 +167,13 @@ function getTypePredicateForKind(kind) {
// It's an object if it's not any of the above.
var allFlags_1 = ts.TypeFlags.Undefined | ts.TypeFlags.Void | ts.TypeFlags.BooleanLike |
ts.TypeFlags.NumberLike | ts.TypeFlags.StringLike | ts.TypeFlags.ESSymbol;
- return function (type) { return !Lint.isTypeFlagSet(type, allFlags_1) && !isFunction(type); };
+ return function (type) { return !tsutils_1.isTypeFlagSet(type, allFlags_1) && !isFunction(type); };
default:
return undefined;
}
}
function flagPredicate(testedFlag) {
- return function (type) { return Lint.isTypeFlagSet(type, testedFlag); };
+ return function (type) { return tsutils_1.isTypeFlagSet(type, testedFlag); };
}
function isFunction(t) {
if (t.getConstructSignatures().length !== 0 || t.getCallSignatures().length !== 0) {
@@ -199,10 +207,10 @@ function testNonStrictNullUndefined(type) {
var anyOther = false;
for (var _i = 0, _a = unionParts(type); _i < _a.length; _i++) {
var ty = _a[_i];
- if (Lint.isTypeFlagSet(ty, ts.TypeFlags.Null)) {
+ if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Null)) {
anyNull = true;
}
- else if (Lint.isTypeFlagSet(ty, undefinedFlags)) {
+ else if (tsutils_1.isTypeFlagSet(ty, undefinedFlags)) {
anyUndefined = true;
}
else {
@@ -218,4 +226,4 @@ function testNonStrictNullUndefined(type) {
function unionParts(type) {
return tsutils_1.isUnionType(type) ? type.types : [type];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/switchDefaultRule.d.ts b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
+++ b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts b/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
index 927ecfb9d..7c36ce7a5 100644
--- a/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
+++ b/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/switchFinalBreakRule.js b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
index d2477edab..bc6417eab 100644
--- a/node_modules/tslint/lib/rules/switchFinalBreakRule.js
+++ b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
@@ -33,7 +33,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "switch-final-break",
description: "Checks whether the final clause of a switch statement ends in \`break;\`.",
- optionsDescription: (_a = ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], _a.raw = ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], Lint.Utils.dedent(_a)),
+ hasFix: true,
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."]))),
options: {
type: "string",
enum: [
@@ -65,29 +66,45 @@ function walk(ctx) {
}
if (always) {
if (!tsutils_1.endsControlFlow(clause)) {
- ctx.addFailureAtNode(clause.getChildAt(0), Rule.FAILURE_STRING_ALWAYS);
+ ctx.addFailureAtNode(clause.getChildAt(0), Rule.FAILURE_STRING_ALWAYS, createAddFix(clause));
}
return;
}
- if (clause.statements.length === 0) {
+ var lastStatement = getLastStatement(clause);
+ if (lastStatement === undefined || !tsutils_1.isBreakStatement(lastStatement)) {
return;
}
- var block = clause.statements[0];
- var statements = clause.statements.length === 1 && tsutils_1.isBlock(block) ? block.statements : clause.statements;
- var lastStatement = last(statements);
- if (lastStatement !== undefined && tsutils_1.isBreakStatement(lastStatement)) {
- if (lastStatement.label !== undefined) {
- var parent = node.parent;
- if (!tsutils_1.isLabeledStatement(parent) || parent.label === lastStatement.label) {
- // break jumps somewhere else, don't complain
- return;
- }
+ if (lastStatement.label !== undefined) {
+ var parent = node.parent;
+ if (!tsutils_1.isLabeledStatement(parent) || parent.label === lastStatement.label) {
+ // break jumps somewhere else, don't complain
+ return;
}
- ctx.addFailureAtNode(lastStatement, Rule.FAILURE_STRING_NEVER);
}
+ ctx.addFailureAtNode(lastStatement, Rule.FAILURE_STRING_NEVER, createRemoveFix(lastStatement));
}
+ function createAddFix(clause) {
+ var lastStatement = getLastStatement(clause);
+ if (lastStatement === undefined) {
+ return Lint.Replacement.appendText(clause.end, " break;");
+ }
+ var fullText = lastStatement.getFullText(ctx.sourceFile);
+ var indentation = fullText.slice(0, fullText.search(/\S+/));
+ return Lint.Replacement.appendText(lastStatement.end, indentation + "break;");
+ }
+ function createRemoveFix(lastStatement) {
+ return Lint.Replacement.replaceFromTo(lastStatement.getFullStart(), lastStatement.end, "");
+ }
+}
+function getLastStatement(clause) {
+ if (clause.statements.length === 0) {
+ return undefined;
+ }
+ var block = clause.statements[0];
+ var statements = clause.statements.length === 1 && tsutils_1.isBlock(block) ? block.statements : clause.statements;
+ return last(statements);
}
function last(arr) {
return arr[arr.length - 1];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.d.ts b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
index ac23c5939..8b60fb6f7 100644
--- a/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.js b/node_modules/tslint/lib/rules/trailingCommaRule.js
index 784bc9a58..f6270e27c 100644
--- a/node_modules/tslint/lib/rules/trailingCommaRule.js
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.js
@@ -69,9 +69,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "trailing-comma",
- description: (_a = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], _a.raw = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."]))),
hasFix: true,
- optionsDescription: (_b = ["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option `esSpecCompliant`. Set this option to `true` to disallow trailing comma on\n object and array rest and rest parameters.\n "], _b.raw = ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option \\`esSpecCompliant\\`. Set this option to \\`true\\` to disallow trailing comma on\n object and array rest and rest parameters.\n "], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option `esSpecCompliant`. Set this option to `true` to disallow trailing comma on\n object and array rest and rest parameters.\n "], ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option \\`esSpecCompliant\\`. Set this option to \\`true\\` to disallow trailing comma on\n object and array rest and rest parameters.\n "]))),
options: {
type: "object",
properties: {
@@ -231,4 +231,4 @@ function isArrayRest(node) {
function noRest() {
return false;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
index 7a87690b6..1d2d9cb96 100644
--- a/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.js b/node_modules/tslint/lib/rules/tripleEqualsRule.js
index 7b4490807..a5b1fbbf7 100644
--- a/node_modules/tslint/lib/rules/tripleEqualsRule.js
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "triple-equals",
description: "Requires `===` and `!==` in place of `==` and `!=`.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"allow-null-check\"` allows `==` and `!=` when comparing to `null`.\n * `\"allow-undefined-check\"` allows `==` and `!=` when comparing to `undefined`."], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"allow-null-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`null\\`.\n * \\`\"allow-undefined-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`undefined\\`."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `\"allow-null-check\"` allows `==` and `!=` when comparing to `null`.\n * `\"allow-undefined-check\"` allows `==` and `!=` when comparing to `undefined`."], ["\n Two arguments may be optionally provided:\n\n * \\`\"allow-null-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`null\\`.\n * \\`\"allow-undefined-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`undefined\\`."]))),
options: {
type: "array",
items: {
@@ -83,4 +83,4 @@ function isExpressionAllowed(node, options) {
node.kind === ts.SyntaxKind.Identifier &&
node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
index b8b6debd3..38389b0de 100644
--- a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
+++ b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
index 691ecffc5..cfbe088d9 100644
--- a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
+++ b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "type-literal-delimiter",
- description: (_a = ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], _a.raw = ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -79,4 +79,4 @@ function walk(ctx) {
});
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typedefRule.d.ts b/node_modules/tslint/lib/rules/typedefRule.d.ts
index 6c60fe1ce..fc68d04af 100644
--- a/node_modules/tslint/lib/rules/typedefRule.d.ts
+++ b/node_modules/tslint/lib/rules/typedefRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typedefRule.js b/node_modules/tslint/lib/rules/typedefRule.js
index 76022abd9..1f1bfb51e 100644
--- a/node_modules/tslint/lib/rules/typedefRule.js
+++ b/node_modules/tslint/lib/rules/typedefRule.js
@@ -50,7 +50,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "typedef",
description: "Requires type definitions to exist.",
- optionsDescription: (_a = ["\n Several arguments may be optionally provided:\n\n * `\"", "\"` checks return type of functions.\n * `\"", "\"` checks return type of arrow functions.\n * `\"", "\"` checks type specifier of function parameters for non-arrow functions.\n * `\"", "\"` checks type specifier of function parameters for arrow functions.\n * `\"", "\"` checks return types of interface properties.\n * `\"", "\"` checks non-binding variable declarations.\n * `\"", "\"` checks member variable declarations.\n * `\"", "\"` checks object destructuring declarations.\n * `\"", "\"` checks array destructuring declarations."], _a.raw = ["\n Several arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks return type of functions.\n * \\`\"", "\"\\` checks return type of arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for non-arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for arrow functions.\n * \\`\"", "\"\\` checks return types of interface properties.\n * \\`\"", "\"\\` checks non-binding variable declarations.\n * \\`\"", "\"\\` checks member variable declarations.\n * \\`\"", "\"\\` checks object destructuring declarations.\n * \\`\"", "\"\\` checks array destructuring declarations."], Lint.Utils.dedent(_a, OPTION_CALL_SIGNATURE, OPTION_ARROW_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_ARROW_PARAMETER, OPTION_PROPERTY_DECLARATION, OPTION_VARIABLE_DECLARATION, OPTION_MEMBER_VARIABLE_DECLARATION, OPTION_OBJECT_DESTRUCTURING, OPTION_ARRAY_DESTRUCTURING)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Several arguments may be optionally provided:\n\n * `\"", "\"` checks return type of functions.\n * `\"", "\"` checks return type of arrow functions.\n * `\"", "\"` checks type specifier of function parameters for non-arrow functions.\n * `\"", "\"` checks type specifier of function parameters for arrow functions.\n * `\"", "\"` checks return types of interface properties.\n * `\"", "\"` checks non-binding variable declarations.\n * `\"", "\"` checks member variable declarations.\n * `\"", "\"` checks object destructuring declarations.\n * `\"", "\"` checks array destructuring declarations."], ["\n Several arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks return type of functions.\n * \\`\"", "\"\\` checks return type of arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for non-arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for arrow functions.\n * \\`\"", "\"\\` checks return types of interface properties.\n * \\`\"", "\"\\` checks non-binding variable declarations.\n * \\`\"", "\"\\` checks member variable declarations.\n * \\`\"", "\"\\` checks object destructuring declarations.\n * \\`\"", "\"\\` checks array destructuring declarations."])), OPTION_CALL_SIGNATURE, OPTION_ARROW_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_ARROW_PARAMETER, OPTION_PROPERTY_DECLARATION, OPTION_VARIABLE_DECLARATION, OPTION_MEMBER_VARIABLE_DECLARATION, OPTION_OBJECT_DESTRUCTURING, OPTION_ARRAY_DESTRUCTURING),
options: {
type: "array",
items: {
@@ -193,4 +193,4 @@ function isNodeArray(nodeOrArray) {
return Array.isArray(nodeOrArray);
}
exports.isNodeArray = isNodeArray;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
index 1f72293ed..a62a0ba69 100644
--- a/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
index 04d58629e..be87083de 100644
--- a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
@@ -57,7 +57,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "typedef-whitespace",
description: "Requires or disallows whitespace for type definitions.",
descriptionDetails: "Determines if a space is required or not before the colon in a type specifier.",
- optionsDescription: (_a = ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of `\"onespace\"`, `\"space\"` or `\"nospace\"`.\n Possible keys are:\n\n * `\"call-signature\"` checks return type of functions.\n * `\"index-signature\"` checks index type specifier of indexers.\n * `\"parameter\"` checks function parameters.\n * `\"property-declaration\"` checks object property declarations.\n * `\"variable-declaration\"` checks variable declaration."], _a.raw = ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of \\`\"onespace\"\\`, \\`\"space\"\\` or \\`\"nospace\"\\`.\n Possible keys are:\n\n * \\`\"call-signature\"\\` checks return type of functions.\n * \\`\"index-signature\"\\` checks index type specifier of indexers.\n * \\`\"parameter\"\\` checks function parameters.\n * \\`\"property-declaration\"\\` checks object property declarations.\n * \\`\"variable-declaration\"\\` checks variable declaration."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of `\"onespace\"`, `\"space\"` or `\"nospace\"`.\n Possible keys are:\n\n * `\"call-signature\"` checks return type of functions.\n * `\"index-signature\"` checks index type specifier of indexers.\n * `\"parameter\"` checks function parameters.\n * `\"property-declaration\"` checks object property declarations.\n * `\"variable-declaration\"` checks variable declaration."], ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of \\`\"onespace\"\\`, \\`\"space\"\\` or \\`\"nospace\"\\`.\n Possible keys are:\n\n * \\`\"call-signature\"\\` checks return type of functions.\n * \\`\"index-signature\"\\` checks index type specifier of indexers.\n * \\`\"parameter\"\\` checks function parameters.\n * \\`\"property-declaration\"\\` checks object property declarations.\n * \\`\"variable-declaration\"\\` checks variable declaration."]))),
options: {
type: "array",
items: [SPACE_OBJECT, SPACE_OBJECT],
@@ -106,7 +106,7 @@ var TypedefWhitespaceWalker = /** @class */ (function (_super) {
return ts.forEachChild(sourceFile, cb);
};
TypedefWhitespaceWalker.prototype.checkSpace = function (node, key) {
- if (node.type === undefined) {
+ if (!("type" in node) || node.type === undefined) {
return;
}
var _a = this.options, left = _a.left, right = _a.right;
@@ -195,4 +195,4 @@ function getOptionType(node) {
return undefined;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.d.ts b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.js b/node_modules/tslint/lib/rules/typeofCompareRule.js
index 7668784df..9a6b5f2d9 100644
--- a/node_modules/tslint/lib/rules/typeofCompareRule.js
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
optionExamples: [true],
type: "functionality",
typescriptOnly: false,
- deprecationMessage: ts.versionMajorMinor === "2.1"
+ deprecationMessage: !/^2\.1\./.test(ts.version)
? "Starting from TypeScript 2.2 the compiler includes this check which makes this rule redundant."
: "",
};
diff --git a/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
index 0a461d4d2..08c051e01 100644
--- a/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
+++ b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -5,6 +21,6 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING_OMITTING_SINGLE_PARAMETER(otherLine?: number): string;
static FAILURE_STRING_OMITTING_REST_PARAMETER(otherLine?: number): string;
static FAILURE_STRING_SINGLE_PARAMETER_DIFFERENCE(otherLine: number | undefined, type1: string, type2: string): string;
- private static FAILURE_STRING_START(otherLine?);
+ private static FAILURE_STRING_START;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
+++ b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
index 5036e75e2..d07faac42 100644
--- a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
+++ b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
@@ -49,11 +49,11 @@ function walk(ctx, checker) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
var argsAndParams = getArgsAndParameters(node, checker);
if (argsAndParams !== undefined) {
- checkArgsAndParameters(node, argsAndParams);
+ checkArgsAndParameters(argsAndParams);
}
return ts.forEachChild(node, cb);
});
- function checkArgsAndParameters(node, _a) {
+ function checkArgsAndParameters(_a) {
var typeArguments = _a.typeArguments, typeParameters = _a.typeParameters;
// Just check the last one. Must specify previous type parameters if the last one is specified.
var i = typeArguments.length - 1;
@@ -65,12 +65,10 @@ function walk(ctx, checker) {
}
function createFix() {
if (i === 0) {
- var lt = Lint.childOfKind(node, ts.SyntaxKind.LessThanToken);
- var gt = Lint.childOfKind(node, ts.SyntaxKind.GreaterThanToken);
- return Lint.Replacement.deleteFromTo(lt.getStart(), gt.getEnd());
+ return Lint.Replacement.deleteFromTo(typeArguments.pos - 1, typeArguments.end + 1);
}
else {
- return Lint.Replacement.deleteFromTo(typeArguments[i - 1].getEnd(), arg.getEnd());
+ return Lint.Replacement.deleteFromTo(typeArguments[i - 1].end, arg.end);
}
}
}
@@ -117,5 +115,5 @@ function getAliasedSymbol(symbol, checker) {
if (symbol === undefined) {
return undefined;
}
- return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : symbol;
+ return tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : symbol;
}
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.d.ts b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/useIsnanRule.d.ts
+++ b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.js b/node_modules/tslint/lib/rules/useIsnanRule.js
index bbb845580..cd5de673a 100644
--- a/node_modules/tslint/lib/rules/useIsnanRule.js
+++ b/node_modules/tslint/lib/rules/useIsnanRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "use-isnan",
description: "Enforces use of the `isNaN()` function to check for NaN references instead of a comparison to the `NaN` constant.",
- rationale: (_a = ["\n Since `NaN !== NaN`, comparisons with regular operators will produce unexpected results.\n So, instead of `if (myVar === NaN)`, do `if (isNaN(myVar))`."], _a.raw = ["\n Since \\`NaN !== NaN\\`, comparisons with regular operators will produce unexpected results.\n So, instead of \\`if (myVar === NaN)\\`, do \\`if (isNaN(myVar))\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Since `NaN !== NaN`, comparisons with regular operators will produce unexpected results.\n So, instead of `if (myVar === NaN)`, do `if (isNaN(myVar))`."], ["\n Since \\`NaN !== NaN\\`, comparisons with regular operators will produce unexpected results.\n So, instead of \\`if (myVar === NaN)\\`, do \\`if (isNaN(myVar))\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -67,4 +67,4 @@ function walk(ctx) {
function isExpressionNaN(node) {
return node.kind === ts.SyntaxKind.Identifier && node.text === "NaN";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/variableNameRule.js b/node_modules/tslint/lib/rules/variableNameRule.js
index ce17c71ea..d33afc53b 100644
--- a/node_modules/tslint/lib/rules/variableNameRule.js
+++ b/node_modules/tslint/lib/rules/variableNameRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// tslint:disable object-literal-sort-keys
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
@@ -41,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "variable-name",
description: "Checks variable names for various errors.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"`: allows only lowerCamelCased or UPPER_CASED variable names\n * `\"", "\"` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows PascalCase in addition to lowerCamelCase.\n * `\"", "\"` allows snake_case in addition to lowerCamelCase.\n * `\"", "\"`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\`: allows only lowerCamelCased or UPPER_CASED variable names\n * \\`\"", "\"\\` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows PascalCase in addition to lowerCamelCase.\n * \\`\"", "\"\\` allows snake_case in addition to lowerCamelCase.\n * \\`\"", "\"\\`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], Lint.Utils.dedent(_a, OPTION_CHECK_FORMAT, OPTION_LEADING_UNDERSCORE, OPTION_TRAILING_UNDERSCORE, OPTION_ALLOW_PASCAL_CASE, OPTION_ALLOW_SNAKE_CASE, OPTION_BAN_KEYWORDS, bannedKeywordsStr)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"`: allows only lowerCamelCased or UPPER_CASED variable names\n * `\"", "\"` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows PascalCase in addition to lowerCamelCase.\n * `\"", "\"` allows snake_case in addition to lowerCamelCase.\n * `\"", "\"`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\`: allows only lowerCamelCased or UPPER_CASED variable names\n * \\`\"", "\"\\` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows PascalCase in addition to lowerCamelCase.\n * \\`\"", "\"\\` allows snake_case in addition to lowerCamelCase.\n * \\`\"", "\"\\`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""])), OPTION_CHECK_FORMAT, OPTION_LEADING_UNDERSCORE, OPTION_TRAILING_UNDERSCORE, OPTION_ALLOW_PASCAL_CASE, OPTION_ALLOW_SNAKE_CASE, OPTION_BAN_KEYWORDS, bannedKeywordsStr),
options: {
type: "array",
items: {
@@ -99,7 +100,7 @@ function walk(ctx) {
}
case ts.SyntaxKind.VariableStatement:
// skip 'declare' keywords
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
return;
}
break;
@@ -174,4 +175,4 @@ function isCamelCase(name, options) {
}
return true;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.d.ts b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
index d35e1e5ad..6a6280637 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.js b/node_modules/tslint/lib/rules/whitespaceRule.js
index baae7ec33..b39159eb3 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.js
+++ b/node_modules/tslint/lib/rules/whitespaceRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "whitespace",
description: "Enforces whitespace style conventions.",
rationale: "Helps maintain a readable, consistent style in your codebase.",
- optionsDescription: (_a = ["\n Ten arguments may be optionally provided:\n\n * `\"check-branch\"` checks branching statements (`if`/`else`/`for`/`while`) are followed by whitespace.\n * `\"check-decl\"`checks that variable declarations have whitespace around the equals token.\n * `\"check-operator\"` checks for whitespace around operator tokens.\n * `\"check-module\"` checks for whitespace in import & export statements.\n * `\"check-separator\"` checks for whitespace after separator tokens (`,`/`;`).\n * `\"check-rest-spread\"` checks that there is no whitespace after rest/spread operator (`...`).\n * `\"check-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-type-operator\"` checks for whitespace between type operators `|` and `&`.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], _a.raw = ["\n Ten arguments may be optionally provided:\n\n * \\`\"check-branch\"\\` checks branching statements (\\`if\\`/\\`else\\`/\\`for\\`/\\`while\\`) are followed by whitespace.\n * \\`\"check-decl\"\\`checks that variable declarations have whitespace around the equals token.\n * \\`\"check-operator\"\\` checks for whitespace around operator tokens.\n * \\`\"check-module\"\\` checks for whitespace in import & export statements.\n * \\`\"check-separator\"\\` checks for whitespace after separator tokens (\\`,\\`/\\`;\\`).\n * \\`\"check-rest-spread\"\\` checks that there is no whitespace after rest/spread operator (\\`...\\`).\n * \\`\"check-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-type-operator\"\\` checks for whitespace between type operators \\`|\\` and \\`&\\`.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Ten arguments may be optionally provided:\n\n * `\"check-branch\"` checks branching statements (`if`/`else`/`for`/`while`) are followed by whitespace.\n * `\"check-decl\"`checks that variable declarations have whitespace around the equals token.\n * `\"check-operator\"` checks for whitespace around operator tokens.\n * `\"check-module\"` checks for whitespace in import & export statements.\n * `\"check-separator\"` checks for whitespace after separator tokens (`,`/`;`).\n * `\"check-rest-spread\"` checks that there is no whitespace after rest/spread operator (`...`).\n * `\"check-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-type-operator\"` checks for whitespace between type operators `|` and `&`.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], ["\n Ten arguments may be optionally provided:\n\n * \\`\"check-branch\"\\` checks branching statements (\\`if\\`/\\`else\\`/\\`for\\`/\\`while\\`) are followed by whitespace.\n * \\`\"check-decl\"\\`checks that variable declarations have whitespace around the equals token.\n * \\`\"check-operator\"\\` checks for whitespace around operator tokens.\n * \\`\"check-module\"\\` checks for whitespace in import & export statements.\n * \\`\"check-separator\"\\` checks for whitespace after separator tokens (\\`,\\`/\\`;\\`).\n * \\`\"check-rest-spread\"\\` checks that there is no whitespace after rest/spread operator (\\`...\\`).\n * \\`\"check-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-type-operator\"\\` checks for whitespace between type operators \\`|\\` and \\`&\\`.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"]))),
options: {
type: "array",
items: {
@@ -173,6 +173,7 @@ function walk(ctx) {
}
break;
case ts.SyntaxKind.VariableDeclaration:
+ case ts.SyntaxKind.PropertyDeclaration:
var _c = node, name = _c.name, type = _c.type, initializer = _c.initializer;
if (options.decl && initializer !== undefined) {
checkForTrailingWhitespace((type !== undefined ? type : name).getEnd());
@@ -276,7 +277,7 @@ function walk(ctx) {
if (!options.operator) {
return;
}
- var equalsGreaterThanToken = Lint.childOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken);
+ var equalsGreaterThanToken = utils.getChildOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken, sourceFile);
// condition so we don't crash if the arrow is somehow missing
if (equalsGreaterThanToken === undefined) {
return;
@@ -308,4 +309,4 @@ function walk(ctx) {
ctx.addFailureAt(position, 1, Rule.FAILURE_STRING_INVALID, fix);
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/runner.d.ts b/node_modules/tslint/lib/runner.d.ts
index 80b0430de..0d19ecd75 100644
--- a/node_modules/tslint/lib/runner.d.ts
+++ b/node_modules/tslint/lib/runner.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
export interface Options {
/**
* Path to a configuration file.
@@ -10,7 +26,7 @@ export interface Options {
/**
* File paths to lint.
*/
- files?: string[];
+ files: string[];
/**
* Whether to return status code 0 even if there are lint errors.
*/
@@ -48,9 +64,10 @@ export interface Options {
*/
rulesDirectory?: string | string[];
/**
- * That TSLint produces the correct output for the specified directory.
+ * Run the tests in the given directories to ensure a (custom) TSLint rule's output matches the expected output.
+ * When this property is `true` the `files` property is used to specify the directories from which the tests should be executed.
*/
- test?: string;
+ test?: boolean;
/**
* Whether to enable type checking when linting a project.
*/
@@ -59,7 +76,7 @@ export interface Options {
export declare const enum Status {
Ok = 0,
FatalError = 1,
- LintError = 2,
+ LintError = 2
}
export interface Logger {
log(message: string): void;
diff --git a/node_modules/tslint/lib/runner.js b/node_modules/tslint/lib/runner.js
index b21019592..3ce085cb8 100644
--- a/node_modules/tslint/lib/runner.js
+++ b/node_modules/tslint/lib/runner.js
@@ -25,7 +25,7 @@ var path = require("path");
var ts = require("typescript");
var configuration_1 = require("./configuration");
var error_1 = require("./error");
-var Linter = require("./linter");
+var linter_1 = require("./linter");
var utils_1 = require("./utils");
function run(options, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -39,7 +39,7 @@ function run(options, logger) {
case 2:
error_2 = _a.sent();
if (error_2 instanceof error_1.FatalError) {
- logger.error(error_2.message);
+ logger.error(error_2.message + "\n");
return [2 /*return*/, 1 /* FatalError */];
}
throw error_2;
@@ -56,10 +56,10 @@ function runWorker(options, logger) {
switch (_b.label) {
case 0:
if (options.init) {
- if (fs.existsSync(configuration_1.CONFIG_FILENAME)) {
- throw new error_1.FatalError("Cannot generate " + configuration_1.CONFIG_FILENAME + ": file already exists");
+ if (fs.existsSync(configuration_1.JSON_CONFIG_FILENAME)) {
+ throw new error_1.FatalError("Cannot generate " + configuration_1.JSON_CONFIG_FILENAME + ": file already exists");
}
- fs.writeFileSync(configuration_1.CONFIG_FILENAME, JSON.stringify(configuration_1.DEFAULT_CONFIG, undefined, " "));
+ fs.writeFileSync(configuration_1.JSON_CONFIG_FILENAME, JSON.stringify(configuration_1.DEFAULT_CONFIG, undefined, " "));
return [2 /*return*/, 0 /* Ok */];
}
if (!options.test) return [3 /*break*/, 2];
@@ -67,7 +67,7 @@ function runWorker(options, logger) {
case 1:
test_1 = _b.sent();
results = test_1.runTests((options.files || []).map(trimSingleQuotes), options.rulesDirectory);
- return [2 /*return*/, test_1.consoleTestResultsHandler(results) ? 0 /* Ok */ : 1 /* FatalError */];
+ return [2 /*return*/, test_1.consoleTestResultsHandler(results, logger) ? 0 /* Ok */ : 1 /* FatalError */];
case 2:
if (options.config && !fs.existsSync(options.config)) {
throw new error_1.FatalError("Invalid option for configuration: " + options.config);
@@ -76,7 +76,7 @@ function runWorker(options, logger) {
case 3:
_a = _b.sent(), output = _a.output, errorCount = _a.errorCount;
if (output && output.trim()) {
- logger.log(output);
+ logger.log(output + "\n");
}
return [2 /*return*/, options.force || errorCount === 0 ? 0 /* Ok */ : 2 /* LintError */];
}
@@ -87,14 +87,14 @@ function runLinter(options, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, files, program, diagnostics, message;
return tslib_1.__generator(this, function (_b) {
- _a = resolveFilesAndProgram(options), files = _a.files, program = _a.program;
+ _a = resolveFilesAndProgram(options, logger), files = _a.files, program = _a.program;
// if type checking, run the type checker
if (program && options.typeCheck) {
diagnostics = ts.getPreEmitDiagnostics(program);
if (diagnostics.length !== 0) {
message = diagnostics.map(function (d) { return showDiagnostic(d, program, options.outputAbsolutePaths); }).join("\n");
if (options.force) {
- logger.error(message);
+ logger.error(message + "\n");
}
else {
throw new error_1.FatalError(message);
@@ -105,83 +105,114 @@ function runLinter(options, logger) {
});
});
}
-function resolveFilesAndProgram(_a) {
+function resolveFilesAndProgram(_a, logger) {
var files = _a.files, project = _a.project, exclude = _a.exclude, outputAbsolutePaths = _a.outputAbsolutePaths;
// remove single quotes which break matching on Windows when glob is passed in single quotes
- var ignore = utils_1.arrayify(exclude).map(trimSingleQuotes);
+ exclude = exclude.map(trimSingleQuotes);
if (project === undefined) {
- return { files: resolveGlobs(files, ignore, outputAbsolutePaths) };
+ return { files: resolveGlobs(files, exclude, outputAbsolutePaths, logger) };
}
var projectPath = findTsconfig(project);
if (projectPath === undefined) {
throw new error_1.FatalError("Invalid option for project: " + project);
}
- var program = Linter.createProgram(projectPath);
+ exclude = exclude.map(function (pattern) { return path.resolve(pattern); });
+ var program = linter_1.Linter.createProgram(projectPath);
var filesFound;
- if (files === undefined || files.length === 0) {
- filesFound = Linter.getFileNames(program);
- if (ignore.length !== 0) {
- var mm_1 = ignore.map(function (pattern) { return new minimatch_1.Minimatch(path.resolve(pattern)); });
- filesFound = filesFound.filter(function (file) { return !mm_1.some(function (matcher) { return matcher.match(file); }); });
- }
+ if (files.length === 0) {
+ filesFound = filterFiles(linter_1.Linter.getFileNames(program), exclude, false);
}
else {
- filesFound = resolveGlobs(files, ignore, outputAbsolutePaths);
+ files = files.map(function (f) { return path.resolve(f); });
+ filesFound = filterFiles(program.getSourceFiles().map(function (f) { return f.fileName; }), files, true);
+ filesFound = filterFiles(filesFound, exclude, false);
+ // find non-glob files that have no matching file in the project and are not excluded by any exclude pattern
+ for (var _i = 0, _b = filterFiles(files, exclude, false); _i < _b.length; _i++) {
+ var file = _b[_i];
+ if (!glob.hasMagic(file) && !filesFound.some(minimatch_1.filter(file))) {
+ if (fs.existsSync(file)) {
+ throw new error_1.FatalError("'" + file + "' is not included in project.");
+ }
+ logger.error("'" + file + "' does not exist. This will be an error in TSLint 6.\n"); // TODO make this an error in v6.0.0
+ }
+ }
}
return { files: filesFound, program: program };
}
-function resolveGlobs(files, ignore, outputAbsolutePaths) {
- return utils_1.flatMap(utils_1.arrayify(files), function (file) {
- return glob.sync(trimSingleQuotes(file), { ignore: ignore, nodir: true });
- })
- .map(function (file) { return outputAbsolutePaths ? path.resolve(file) : path.relative(process.cwd(), file); });
+function filterFiles(files, patterns, include) {
+ if (patterns.length === 0) {
+ return include ? [] : files;
+ }
+ var matcher = patterns.map(function (pattern) { return new minimatch_1.Minimatch(pattern, { dot: !include }); }); // `glob` always enables `dot` for ignore patterns
+ return files.filter(function (file) { return include === matcher.some(function (pattern) { return pattern.match(file); }); });
+}
+function resolveGlobs(files, ignore, outputAbsolutePaths, logger) {
+ var results = utils_1.flatMap(files, function (file) { return glob.sync(trimSingleQuotes(file), { ignore: ignore, nodir: true }); });
+ // warn if `files` contains non-existent files, that are not patters and not excluded by any of the exclude patterns
+ for (var _i = 0, _a = filterFiles(files, ignore, false); _i < _a.length; _i++) {
+ var file = _a[_i];
+ if (!glob.hasMagic(file) && !results.some(minimatch_1.filter(file))) {
+ logger.error("'" + file + "' does not exist. This will be an error in TSLint 6.\n"); // TODO make this an error in v6.0.0
+ }
+ }
+ var cwd = process.cwd();
+ return results.map(function (file) { return outputAbsolutePaths ? path.resolve(cwd, file) : path.relative(cwd, file); });
}
function doLinting(options, files, program, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
- var possibleConfigAbsolutePath, linter, lastFolder, configFile, isFileExcluded, _i, files_1, file, contents, folder;
+ function isFileExcluded(filepath) {
+ if (configFile === undefined || configFile.linterOptions == undefined || configFile.linterOptions.exclude == undefined) {
+ return false;
+ }
+ var fullPath = path.resolve(filepath);
+ return configFile.linterOptions.exclude.some(function (pattern) { return new minimatch_1.Minimatch(pattern).match(fullPath); });
+ }
+ var linter, lastFolder, configFile, _i, files_1, file, folder, contents, sourceFile;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
- possibleConfigAbsolutePath = options.config !== undefined ? path.resolve(options.config) : null;
- linter = new Linter({
+ linter = new linter_1.Linter({
fix: !!options.fix,
formatter: options.format,
formattersDirectory: options.formattersDirectory,
rulesDirectory: options.rulesDirectory,
}, program);
- isFileExcluded = function (filepath) {
- if (configFile === undefined || configFile.linterOptions == undefined || configFile.linterOptions.exclude == undefined) {
- return false;
- }
- var fullPath = path.resolve(filepath);
- return configFile.linterOptions.exclude.some(function (pattern) { return new minimatch_1.Minimatch(pattern).match(fullPath); });
- };
+ configFile = options.config !== undefined ? configuration_1.findConfiguration(options.config).results : undefined;
_i = 0, files_1 = files;
_a.label = 1;
case 1:
- if (!(_i < files_1.length)) return [3 /*break*/, 4];
+ if (!(_i < files_1.length)) return [3 /*break*/, 6];
file = files_1[_i];
- if (!fs.existsSync(file)) {
- throw new error_1.FatalError("Unable to open file: " + file);
- }
- return [4 /*yield*/, tryReadFile(file, logger)];
- case 2:
- contents = _a.sent();
- if (contents !== undefined) {
+ if (options.config === undefined) {
folder = path.dirname(file);
if (lastFolder !== folder) {
- configFile = configuration_1.findConfiguration(possibleConfigAbsolutePath, folder).results;
+ configFile = configuration_1.findConfiguration(null, folder).results;
lastFolder = folder;
}
- if (!isFileExcluded(file)) {
- linter.lint(file, contents, configFile);
- }
}
- _a.label = 3;
+ if (isFileExcluded(file)) {
+ return [3 /*break*/, 5];
+ }
+ contents = void 0;
+ if (!(program !== undefined)) return [3 /*break*/, 2];
+ sourceFile = program.getSourceFile(file);
+ if (sourceFile !== undefined) {
+ contents = sourceFile.text;
+ }
+ return [3 /*break*/, 4];
+ case 2: return [4 /*yield*/, tryReadFile(file, logger)];
case 3:
+ contents = _a.sent();
+ _a.label = 4;
+ case 4:
+ if (contents !== undefined) {
+ linter.lint(file, contents, configFile);
+ }
+ _a.label = 5;
+ case 5:
_i++;
return [3 /*break*/, 1];
- case 4: return [2 /*return*/, linter.getResult()];
+ case 6: return [2 /*return*/, linter.getResult()];
}
});
});
@@ -191,15 +222,18 @@ function tryReadFile(filename, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var buffer, fd;
return tslib_1.__generator(this, function (_a) {
- buffer = new Buffer(256);
+ if (!fs.existsSync(filename)) {
+ throw new error_1.FatalError("Unable to open file: " + filename);
+ }
+ buffer = Buffer.allocUnsafe(256);
fd = fs.openSync(filename, "r");
try {
fs.readSync(fd, buffer, 0, 256, 0);
- if (buffer.readInt8(0, true) === 0x47 && buffer.readInt8(188, true) === 0x47) {
+ if (buffer.readInt8(0) === 0x47 && buffer.readInt8(188) === 0x47) {
// MPEG transport streams use the '.ts' file extension. They use 0x47 as the frame
// separator, repeating every 188 bytes. It is unlikely to find that pattern in
// TypeScript source, so tslint ignores files with the specific pattern.
- logger.error(filename + ": ignoring MPEG transport stream");
+ logger.error(filename + ": ignoring MPEG transport stream\n");
return [2 /*return*/, undefined];
}
}
diff --git a/node_modules/tslint/lib/test.d.ts b/node_modules/tslint/lib/test.d.ts
index cefedf6a7..6230670ec 100644
--- a/node_modules/tslint/lib/test.d.ts
+++ b/node_modules/tslint/lib/test.d.ts
@@ -1,3 +1,20 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { Logger } from "./runner";
import { LintError } from "./verify/lintError";
export interface TestOutput {
skipped: false;
@@ -20,5 +37,5 @@ export interface TestResult {
}
export declare function runTests(patterns: string[], rulesDirectory?: string | string[]): TestResult[];
export declare function runTest(testDirectory: string, rulesDirectory?: string | string[]): TestResult;
-export declare function consoleTestResultsHandler(testResults: TestResult[]): boolean;
-export declare function consoleTestResultHandler(testResult: TestResult): boolean;
+export declare function consoleTestResultsHandler(testResults: TestResult[], logger: Logger): boolean;
+export declare function consoleTestResultHandler(testResult: TestResult, logger: Logger): boolean;
diff --git a/node_modules/tslint/lib/test.js b/node_modules/tslint/lib/test.js
index 10cb4eba0..dfb828e55 100644
--- a/node_modules/tslint/lib/test.js
+++ b/node_modules/tslint/lib/test.js
@@ -16,7 +16,7 @@
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var chalk = require("chalk");
+var chalk_1 = require("chalk");
var diff = require("diff");
var fs = require("fs");
var glob = require("glob");
@@ -24,7 +24,7 @@ var path = require("path");
var semver = require("semver");
var ts = require("typescript");
var rule_1 = require("./language/rule/rule");
-var Linter = require("./linter");
+var linter_1 = require("./linter");
var utils_1 = require("./utils");
var parse = require("./verify/parse");
var MARKUP_FILE_EXTENSION = ".lint";
@@ -43,14 +43,14 @@ function runTests(patterns, rulesDirectory) {
exports.runTests = runTests;
function runTest(testDirectory, rulesDirectory) {
var filesToLint = glob.sync(path.join(testDirectory, "**/*" + MARKUP_FILE_EXTENSION));
- var tslintConfig = Linter.findConfiguration(path.join(testDirectory, "tslint.json"), "").results;
+ var tslintConfig = linter_1.Linter.findConfiguration(path.join(testDirectory, "tslint.json"), "").results;
var tsConfig = path.join(testDirectory, "tsconfig.json");
var compilerOptions = { allowJs: true };
var hasConfig = fs.existsSync(tsConfig);
if (hasConfig) {
var _a = ts.readConfigFile(tsConfig, ts.sys.readFile), config = _a.config, error = _a.error;
if (error !== undefined) {
- throw new Error(JSON.stringify(error));
+ throw new Error(ts.formatDiagnostics([error], ts.createCompilerHost({})));
}
var parseConfigHost = {
fileExists: fs.existsSync,
@@ -114,7 +114,7 @@ function runTest(testDirectory, rulesDirectory) {
formattersDirectory: "",
rulesDirectory: rulesDirectory,
};
- var linter = new Linter(lintOptions, program);
+ var linter = new linter_1.Linter(lintOptions, program);
// Need to use the true path (ending in '.lint') for "encoding" rule so that it can read the file.
linter.lint(isEncodingRule ? fileToLint : fileCompileName, fileTextWithoutMarkup, tslintConfig);
var failures = linter.getResult().failures;
@@ -166,28 +166,27 @@ function runTest(testDirectory, rulesDirectory) {
return results;
}
exports.runTest = runTest;
-function consoleTestResultsHandler(testResults) {
+function consoleTestResultsHandler(testResults, logger) {
var didAllTestsPass = true;
for (var _i = 0, testResults_1 = testResults; _i < testResults_1.length; _i++) {
var testResult = testResults_1[_i];
- if (!consoleTestResultHandler(testResult)) {
+ if (!consoleTestResultHandler(testResult, logger)) {
didAllTestsPass = false;
}
}
return didAllTestsPass;
}
exports.consoleTestResultsHandler = consoleTestResultsHandler;
-function consoleTestResultHandler(testResult) {
+function consoleTestResultHandler(testResult, logger) {
// needed to get colors to show up when passing through Grunt
- chalk.enabled = true;
+ chalk_1.default.enabled = true;
var didAllTestsPass = true;
for (var _i = 0, _a = Object.keys(testResult.results); _i < _a.length; _i++) {
var fileName = _a[_i];
var results = testResult.results[fileName];
- process.stdout.write(fileName + ":");
- /* tslint:disable:no-console */
+ logger.log(fileName + ":");
if (results.skipped) {
- console.log(chalk.yellow(" Skipped, requires typescript " + results.requirement));
+ logger.log(chalk_1.default.yellow(" Skipped, requires typescript " + results.requirement + "\n"));
}
else {
var markupDiffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
@@ -195,38 +194,44 @@ function consoleTestResultHandler(testResult) {
var didMarkupTestPass = !markupDiffResults.some(function (hunk) { return hunk.added === true || hunk.removed === true; });
var didFixesTestPass = !fixesDiffResults.some(function (hunk) { return hunk.added === true || hunk.removed === true; });
if (didMarkupTestPass && didFixesTestPass) {
- console.log(chalk.green(" Passed"));
+ logger.log(chalk_1.default.green(" Passed\n"));
}
else {
- console.log(chalk.red(" Failed!"));
+ logger.log(chalk_1.default.red(" Failed!\n"));
didAllTestsPass = false;
if (!didMarkupTestPass) {
- displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION);
+ displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION, logger);
}
if (!didFixesTestPass) {
- displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION);
+ displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION, logger);
}
}
}
- /* tslint:enable:no-console */
}
return didAllTestsPass;
}
exports.consoleTestResultHandler = consoleTestResultHandler;
-function displayDiffResults(diffResults, extension) {
- /* tslint:disable:no-console */
- console.log(chalk.green("Expected (from " + extension + " file)"));
- console.log(chalk.red("Actual (from TSLint)"));
- for (var _i = 0, diffResults_1 = diffResults; _i < diffResults_1.length; _i++) {
- var diffResult = diffResults_1[_i];
- var color = chalk.grey;
+function displayDiffResults(diffResults, extension, logger) {
+ logger.log(chalk_1.default.green("Expected (from " + extension + " file)\n"));
+ logger.log(chalk_1.default.red("Actual (from TSLint)\n"));
+ var _loop_2 = function (diffResult) {
+ var color = chalk_1.default.grey;
+ var prefix = " ";
if (diffResult.added) {
- color = chalk.green.underline;
+ color = chalk_1.default.green.underline;
+ prefix = "+ ";
}
else if (diffResult.removed) {
- color = chalk.red.underline;
+ color = chalk_1.default.red.underline;
+ prefix = "- ";
}
- process.stdout.write(color(diffResult.value));
+ logger.log(color(diffResult.value.split(/\r\n|\r|\n/)
+ // strings end on a newline which we do not want to include the prefix.
+ // tslint:disable-next-line:prefer-template
+ .map(function (line, index, array) { return index === array.length - 1 ? line : prefix + line + "\n"; }).join("")));
+ };
+ for (var _i = 0, diffResults_1 = diffResults; _i < diffResults_1.length; _i++) {
+ var diffResult = diffResults_1[_i];
+ _loop_2(diffResult);
}
- /* tslint:enable:no-console */
}
diff --git a/node_modules/tslint/lib/tslint-cli.d.ts b/node_modules/tslint/lib/tslint-cli.d.ts
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/lib/tslint-cli.d.ts
+++ /dev/null
diff --git a/node_modules/tslint/lib/tslint-cli.js b/node_modules/tslint/lib/tslint-cli.js
deleted file mode 100644
index d2b38d7d9..000000000
--- a/node_modules/tslint/lib/tslint-cli.js
+++ /dev/null
@@ -1,219 +0,0 @@
-"use strict";
-/**
- * @license
- * Copyright 2013 Palantir Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-// tslint:disable no-console object-literal-sort-keys
-var commander = require("commander");
-var fs = require("fs");
-var linter_1 = require("./linter");
-var runner_1 = require("./runner");
-var utils_1 = require("./utils");
-var options = [
- {
- short: "c",
- name: "config",
- type: "string",
- describe: "configuration file",
- description: (_a = ["\n The location of the configuration file that tslint will use to\n determine which rules are activated and what options to provide\n to the rules. If no option is specified, the config file named\n tslint.json is used, so long as it exists in the path.\n The format of the file is { rules: { /* rules list */ } },\n where /* rules list */ is a key: value comma-seperated list of\n rulename: rule-options pairs. Rule-options can be either a\n boolean true/false value denoting whether the rule is used or not,\n or a list [boolean, ...] where the boolean provides the same role\n as in the non-list case, and the rest of the list are options passed\n to the rule that will determine what it checks for (such as number\n of characters for the max-line-length rule, or what functions to ban\n for the ban rule)."], _a.raw = ["\n The location of the configuration file that tslint will use to\n determine which rules are activated and what options to provide\n to the rules. If no option is specified, the config file named\n tslint.json is used, so long as it exists in the path.\n The format of the file is { rules: { /* rules list */ } },\n where /* rules list */ is a key: value comma-seperated list of\n rulename: rule-options pairs. Rule-options can be either a\n boolean true/false value denoting whether the rule is used or not,\n or a list [boolean, ...] where the boolean provides the same role\n as in the non-list case, and the rest of the list are options passed\n to the rule that will determine what it checks for (such as number\n of characters for the max-line-length rule, or what functions to ban\n for the ban rule)."], utils_1.dedent(_a)),
- },
- {
- short: "e",
- name: "exclude",
- type: "array",
- describe: "exclude globs from path expansion",
- description: (_b = ["\n A filename or glob which indicates files to exclude from linting.\n This option can be supplied multiple times if you need multiple\n globs to indicate which files to exclude."], _b.raw = ["\n A filename or glob which indicates files to exclude from linting.\n This option can be supplied multiple times if you need multiple\n globs to indicate which files to exclude."], utils_1.dedent(_b)),
- },
- {
- name: "fix",
- type: "boolean",
- describe: "fixes linting errors for select rules (this may overwrite linted files)",
- description: "Fixes linting errors for select rules. This may overwrite linted files.",
- },
- {
- name: "force",
- type: "boolean",
- describe: "return status code 0 even if there are lint errors",
- description: (_c = ["\n Return status code 0 even if there are any lint errors.\n Useful while running as npm script."], _c.raw = ["\n Return status code 0 even if there are any lint errors.\n Useful while running as npm script."], utils_1.dedent(_c)),
- },
- {
- short: "i",
- name: "init",
- type: "boolean",
- describe: "generate a tslint.json config file in the current working directory",
- description: "Generates a tslint.json config file in the current working directory.",
- },
- {
- short: "o",
- name: "out",
- type: "string",
- describe: "output file",
- description: (_d = ["\n A filename to output the results to. By default, tslint outputs to\n stdout, which is usually the console where you're running it from."], _d.raw = ["\n A filename to output the results to. By default, tslint outputs to\n stdout, which is usually the console where you're running it from."], utils_1.dedent(_d)),
- },
- {
- name: "outputAbsolutePaths",
- type: "boolean",
- describe: "whether or not outputted file paths are absolute",
- description: "If true, all paths in the output will be absolute.",
- },
- {
- short: "r",
- name: "rules-dir",
- type: "string",
- describe: "rules directory",
- description: (_e = ["\n An additional rules directory, for user-created rules.\n tslint will always check its default rules directory, in\n node_modules/tslint/lib/rules, before checking the user-provided\n rules directory, so rules in the user-provided rules directory\n with the same name as the base rules will not be loaded."], _e.raw = ["\n An additional rules directory, for user-created rules.\n tslint will always check its default rules directory, in\n node_modules/tslint/lib/rules, before checking the user-provided\n rules directory, so rules in the user-provided rules directory\n with the same name as the base rules will not be loaded."], utils_1.dedent(_e)),
- },
- {
- short: "s",
- name: "formatters-dir",
- type: "string",
- describe: "formatters directory",
- description: (_f = ["\n An additional formatters directory, for user-created formatters.\n Formatters are files that will format the tslint output, before\n writing it to stdout or the file passed in --out. The default\n directory, node_modules/tslint/build/formatters, will always be\n checked first, so user-created formatters with the same names\n as the base formatters will not be loaded."], _f.raw = ["\n An additional formatters directory, for user-created formatters.\n Formatters are files that will format the tslint output, before\n writing it to stdout or the file passed in --out. The default\n directory, node_modules/tslint/build/formatters, will always be\n checked first, so user-created formatters with the same names\n as the base formatters will not be loaded."], utils_1.dedent(_f)),
- },
- {
- short: "t",
- name: "format",
- type: "string",
- describe: "output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)",
- description: (_g = ["\n The formatter to use to format the results of the linter before\n outputting it to stdout or the file passed in --out. The core\n formatters are prose (human readable), json (machine readable)\n and verbose. prose is the default if this option is not used.\n Other built-in options include pmd, msbuild, checkstyle, and vso.\n Additional formatters can be added and used if the --formatters-dir\n option is set."], _g.raw = ["\n The formatter to use to format the results of the linter before\n outputting it to stdout or the file passed in --out. The core\n formatters are prose (human readable), json (machine readable)\n and verbose. prose is the default if this option is not used.\n Other built-in options include pmd, msbuild, checkstyle, and vso.\n Additional formatters can be added and used if the --formatters-dir\n option is set."], utils_1.dedent(_g)),
- },
- {
- name: "test",
- type: "boolean",
- describe: "test that tslint produces the correct output for the specified directory",
- description: (_h = ["\n Runs tslint on matched directories and checks if tslint outputs\n match the expected output in .lint files. Automatically loads the\n tslint.json files in the directories as the configuration file for\n the tests. See the full tslint documentation for more details on how\n this can be used to test custom rules."], _h.raw = ["\n Runs tslint on matched directories and checks if tslint outputs\n match the expected output in .lint files. Automatically loads the\n tslint.json files in the directories as the configuration file for\n the tests. See the full tslint documentation for more details on how\n this can be used to test custom rules."], utils_1.dedent(_h)),
- },
- {
- short: "p",
- name: "project",
- type: "string",
- describe: "tsconfig.json file",
- description: (_j = ["\n The path or directory containing a tsconfig.json file that will be\n used to determine which files will be linted. This flag also enables\n rules that require the type checker."], _j.raw = ["\n The path or directory containing a tsconfig.json file that will be\n used to determine which files will be linted. This flag also enables\n rules that require the type checker."], utils_1.dedent(_j)),
- },
- {
- name: "type-check",
- type: "boolean",
- describe: "(deprecated) check for type errors before linting the project",
- description: (_k = ["\n (deprecated) Checks for type errors before linting a project.\n --project must be specified in order to enable type checking."], _k.raw = ["\n (deprecated) Checks for type errors before linting a project.\n --project must be specified in order to enable type checking."], utils_1.dedent(_k)),
- },
-];
-var builtinOptions = [
- {
- short: "v",
- name: "version",
- type: "boolean",
- describe: "current version",
- description: "The current version of tslint.",
- },
- {
- short: "h",
- name: "help",
- type: "boolean",
- describe: "display detailed help",
- description: "Prints this help message.",
- },
-];
-commander.version(linter_1.VERSION, "-v, --version");
-for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
- var option = options_1[_i];
- var commanderStr = optionUsageTag(option) + optionParam(option);
- if (option.type === "array") {
- commander.option(commanderStr, option.describe, collect, []);
- }
- else {
- commander.option(commanderStr, option.describe);
- }
-}
-commander.on("--help", function () {
- var indent = "\n ";
- var optionDetails = options.concat(builtinOptions).map(function (o) {
- return optionUsageTag(o) + ":" + (o.description.startsWith("\n") ? o.description.replace(/\n/g, indent) : indent + o.description);
- });
- console.log("tslint accepts the following commandline options:\n\n " + optionDetails.join("\n\n ") + "\n\n");
-});
-// Hack to get unknown option errors to work. https://github.com/visionmedia/commander.js/pull/121
-var parsed = commander.parseOptions(process.argv.slice(2));
-commander.args = parsed.args;
-if (parsed.unknown.length !== 0) {
- commander.parseArgs([], parsed.unknown);
-}
-var argv = commander.opts();
-if (!(argv.init || argv.test !== undefined || argv.project !== undefined || commander.args.length > 0)) {
- console.error("No files specified. Use --project to lint a project folder.");
- process.exit(1);
-}
-if (argv.typeCheck) {
- console.warn("--type-check is deprecated. You only need --project to enable rule which need type information.");
- if (argv.project === undefined) {
- console.error("--project must be specified in order to enable type checking.");
- process.exit(1);
- }
-}
-var log;
-if (argv.out != undefined) {
- var outputStream_1 = fs.createWriteStream(argv.out, {
- flags: "w+",
- mode: 420,
- });
- log = function (message) { return outputStream_1.write(message + "\n"); };
-}
-else {
- log = console.log;
-}
-runner_1.run({
- config: argv.config,
- exclude: argv.exclude,
- files: commander.args,
- fix: argv.fix,
- force: argv.force,
- format: argv.format === undefined ? "prose" : argv.format,
- formattersDirectory: argv.formattersDir,
- init: argv.init,
- out: argv.out,
- outputAbsolutePaths: argv.outputAbsolutePaths,
- project: argv.project,
- rulesDirectory: argv.rulesDir,
- test: argv.test,
- typeCheck: argv.typeCheck,
-}, {
- log: log,
- error: function (m) { return console.error(m); },
-})
- .then(function (rc) {
- process.exitCode = rc;
-}).catch(function (e) {
- console.error(e);
- process.exitCode = 1;
-});
-function optionUsageTag(_a) {
- var short = _a.short, name = _a.name;
- return short !== undefined ? "-" + short + ", --" + name : "--" + name;
-}
-function optionParam(option) {
- switch (option.type) {
- case "string":
- return " [" + option.name + "]";
- case "array":
- return " <" + option.name + ">";
- case "boolean":
- return "";
- }
-}
-function collect(val, memo) {
- memo.push(val);
- return memo;
-}
-var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
diff --git a/node_modules/tslint/lib/utils.d.ts b/node_modules/tslint/lib/utils.d.ts
index 07f3bf5e5..9d7aa545e 100644
--- a/node_modules/tslint/lib/utils.d.ts
+++ b/node_modules/tslint/lib/utils.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
/**
* @license
* Copyright 2016 Palantir Technologies, Inc.
@@ -15,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/// <reference types="node" />
/**
* Enforces the invariant that the input is an array.
*/
@@ -57,3 +57,6 @@ export declare function readBufferWithDetectedEncoding(buffer: Buffer): string;
export declare type Encoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
export declare function detectBufferEncoding(buffer: Buffer, length?: number): Encoding;
export declare function denormalizeWinPath(path: string): string;
+export declare function isPascalCased(name: string): boolean;
+export declare function isCamelCased(name: string): boolean;
+export declare function isKebabCased(name: string): boolean;
diff --git a/node_modules/tslint/lib/utils.js b/node_modules/tslint/lib/utils.js
index df04f51fd..26889aa0b 100644
--- a/node_modules/tslint/lib/utils.js
+++ b/node_modules/tslint/lib/utils.js
@@ -216,3 +216,21 @@ function denormalizeWinPath(path) {
return path.replace(/\\/g, "/");
}
exports.denormalizeWinPath = denormalizeWinPath;
+function isPascalCased(name) {
+ return isUpperCase(name[0]) && !name.includes("_") && !name.includes("-");
+}
+exports.isPascalCased = isPascalCased;
+function isCamelCased(name) {
+ return isLowerCase(name[0]) && !name.includes("_") && !name.includes("-");
+}
+exports.isCamelCased = isCamelCased;
+function isKebabCased(name) {
+ for (var i = 0; i < name.length; i++) {
+ var c = name.charAt(i);
+ if (c === "_" || !isLowerCase(c)) {
+ return false;
+ }
+ }
+ return true;
+}
+exports.isKebabCased = isKebabCased;
diff --git a/node_modules/tslint/lib/verify/lines.js b/node_modules/tslint/lib/verify/lines.js
index 9fb0f5ef2..80c80ba57 100644
--- a/node_modules/tslint/lib/verify/lines.js
+++ b/node_modules/tslint/lib/verify/lines.js
@@ -1,5 +1,6 @@
"use strict";
/*
+ * @license
* Copyright 2016 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/node_modules/tslint/lib/verify/lintError.js b/node_modules/tslint/lib/verify/lintError.js
index b57661299..58082053a 100644
--- a/node_modules/tslint/lib/verify/lintError.js
+++ b/node_modules/tslint/lib/verify/lintError.js
@@ -1,5 +1,6 @@
"use strict";
/*
+ * @license
* Copyright 2016 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/node_modules/tslint/lib/verify/parse.js b/node_modules/tslint/lib/verify/parse.js
index 528f68cc8..32743a5c9 100644
--- a/node_modules/tslint/lib/verify/parse.js
+++ b/node_modules/tslint/lib/verify/parse.js
@@ -1,5 +1,6 @@
"use strict";
/*
+ * @license
* Copyright 2016 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/node_modules/tslint/node_modules/chalk/index.js b/node_modules/tslint/node_modules/chalk/index.js
deleted file mode 100644
index 05e62b346..000000000
--- a/node_modules/tslint/node_modules/chalk/index.js
+++ /dev/null
@@ -1,228 +0,0 @@
-'use strict';
-const escapeStringRegexp = require('escape-string-regexp');
-const ansiStyles = require('ansi-styles');
-const supportsColor = require('supports-color');
-
-const template = require('./templates.js');
-
-const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
-
-// `supportsColor.level` → `ansiStyles.color[name]` mapping
-const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
-
-// `color-convert` models to exclude from the Chalk API due to conflicts and such
-const skipModels = new Set(['gray']);
-
-const styles = Object.create(null);
-
-function applyOptions(obj, options) {
- options = options || {};
-
- // Detect level if not set manually
- const scLevel = supportsColor ? supportsColor.level : 0;
- obj.level = options.level === undefined ? scLevel : options.level;
- obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
-}
-
-function Chalk(options) {
- // We check for this.template here since calling `chalk.constructor()`
- // by itself will have a `this` of a previously constructed chalk object
- if (!this || !(this instanceof Chalk) || this.template) {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = function () {
- const args = [].slice.call(arguments);
- return chalkTag.apply(null, [chalk.template].concat(args));
- };
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
-
- chalk.template.constructor = Chalk;
-
- return chalk.template;
- }
-
- applyOptions(this, options);
-}
-
-// Use bright blue on Windows as the normal blue color is illegible
-if (isSimpleWindowsTerm) {
- ansiStyles.blue.open = '\u001B[94m';
-}
-
-for (const key of Object.keys(ansiStyles)) {
- ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
-
- styles[key] = {
- get() {
- const codes = ansiStyles[key];
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
- }
- };
-}
-
-styles.visible = {
- get() {
- return build.call(this, this._styles || [], true, 'visible');
- }
-};
-
-ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
-for (const model of Object.keys(ansiStyles.color.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- styles[model] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.color.close,
- closeRe: ansiStyles.color.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
- };
-}
-
-ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
-for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.bgColor.close,
- closeRe: ansiStyles.bgColor.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
- };
-}
-
-const proto = Object.defineProperties(() => {}, styles);
-
-function build(_styles, _empty, key) {
- const builder = function () {
- return applyStyle.apply(builder, arguments);
- };
-
- builder._styles = _styles;
- builder._empty = _empty;
-
- const self = this;
-
- Object.defineProperty(builder, 'level', {
- enumerable: true,
- get() {
- return self.level;
- },
- set(level) {
- self.level = level;
- }
- });
-
- Object.defineProperty(builder, 'enabled', {
- enumerable: true,
- get() {
- return self.enabled;
- },
- set(enabled) {
- self.enabled = enabled;
- }
- });
-
- // See below for fix regarding invisible grey/dim combination on Windows
- builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
-
- // `__proto__` is used because we must return a function, but there is
- // no way to create a function with a different prototype
- builder.__proto__ = proto; // eslint-disable-line no-proto
-
- return builder;
-}
-
-function applyStyle() {
- // Support varags, but simply cast to string in case there's only one arg
- const args = arguments;
- const argsLen = args.length;
- let str = String(arguments[0]);
-
- if (argsLen === 0) {
- return '';
- }
-
- if (argsLen > 1) {
- // Don't slice `arguments`, it prevents V8 optimizations
- for (let a = 1; a < argsLen; a++) {
- str += ' ' + args[a];
- }
- }
-
- if (!this.enabled || this.level <= 0 || !str) {
- return this._empty ? '' : str;
- }
-
- // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
- // see https://github.com/chalk/chalk/issues/58
- // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
- const originalDim = ansiStyles.dim.open;
- if (isSimpleWindowsTerm && this.hasGrey) {
- ansiStyles.dim.open = '';
- }
-
- for (const code of this._styles.slice().reverse()) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
-
- // Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS
- // https://github.com/chalk/chalk/pull/92
- str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
- }
-
- // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
- ansiStyles.dim.open = originalDim;
-
- return str;
-}
-
-function chalkTag(chalk, strings) {
- if (!Array.isArray(strings)) {
- // If chalk() was called by itself or with a string,
- // return the string itself as a string.
- return [].slice.call(arguments, 1).join(' ');
- }
-
- const args = [].slice.call(arguments, 2);
- const parts = [strings.raw[0]];
-
- for (let i = 1; i < strings.length; i++) {
- parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
- parts.push(String(strings.raw[i]));
- }
-
- return template(chalk, parts.join(''));
-}
-
-Object.defineProperties(Chalk.prototype, styles);
-
-module.exports = Chalk(); // eslint-disable-line new-cap
-module.exports.supportsColor = supportsColor;
-module.exports.default = module.exports; // For TypeScript
diff --git a/node_modules/tslint/node_modules/chalk/license b/node_modules/tslint/node_modules/chalk/license
deleted file mode 100644
index e7af2f771..000000000
--- a/node_modules/tslint/node_modules/chalk/license
+++ /dev/null
@@ -1,9 +0,0 @@
-MIT License
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/tslint/node_modules/chalk/package.json b/node_modules/tslint/node_modules/chalk/package.json
deleted file mode 100644
index 69889f0cd..000000000
--- a/node_modules/tslint/node_modules/chalk/package.json
+++ /dev/null
@@ -1,66 +0,0 @@
-{
- "name": "chalk",
- "version": "2.3.0",
- "description": "Terminal string styling done right",
- "license": "MIT",
- "repository": "chalk/chalk",
- "engines": {
- "node": ">=4"
- },
- "scripts": {
- "test": "xo && tsc --project types && nyc ava",
- "bench": "matcha benchmark.js",
- "coveralls": "nyc report --reporter=text-lcov | coveralls"
- },
- "files": [
- "index.js",
- "templates.js",
- "types/index.d.ts"
- ],
- "keywords": [
- "color",
- "colour",
- "colors",
- "terminal",
- "console",
- "cli",
- "string",
- "str",
- "ansi",
- "style",
- "styles",
- "tty",
- "formatting",
- "rgb",
- "256",
- "shell",
- "xterm",
- "log",
- "logging",
- "command-line",
- "text"
- ],
- "dependencies": {
- "ansi-styles": "^3.1.0",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^4.0.0"
- },
- "devDependencies": {
- "ava": "*",
- "coveralls": "^3.0.0",
- "execa": "^0.8.0",
- "import-fresh": "^2.0.0",
- "matcha": "^0.7.0",
- "nyc": "^11.0.2",
- "resolve-from": "^4.0.0",
- "typescript": "^2.5.3",
- "xo": "*"
- },
- "types": "types/index.d.ts",
- "xo": {
- "envs": [
- "node",
- "mocha"
- ]
- }
-}
diff --git a/node_modules/tslint/node_modules/chalk/readme.md b/node_modules/tslint/node_modules/chalk/readme.md
deleted file mode 100644
index 9bb2e65e8..000000000
--- a/node_modules/tslint/node_modules/chalk/readme.md
+++ /dev/null
@@ -1,309 +0,0 @@
-<h1 align="center">
- <br>
- <br>
- <img width="320" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk">
- <br>
- <br>
- <br>
-</h1>
-
-> Terminal string styling done right
-
-[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
-
-### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
-
-![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png)
-
-
-## Highlights
-
-- Expressive API
-- Highly performant
-- Ability to nest styles
-- [256/Truecolor color support](#256-and-truecolor-color-support)
-- Auto-detects color support
-- Doesn't extend `String.prototype`
-- Clean and focused
-- Actively maintained
-- [Used by ~17,000 packages](https://www.npmjs.com/browse/depended/chalk) as of June 20th, 2017
-
-
-## Install
-
-```console
-$ npm install chalk
-```
-
-
-## Usage
-
-```js
-const chalk = require('chalk');
-
-console.log(chalk.blue('Hello world!'));
-```
-
-Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
-
-```js
-const chalk = require('chalk');
-const log = console.log;
-
-// Combine styled and normal strings
-log(chalk.blue('Hello') + 'World' + chalk.red('!'));
-
-// Compose multiple styles using the chainable API
-log(chalk.blue.bgRed.bold('Hello world!'));
-
-// Pass in multiple arguments
-log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
-
-// Nest styles
-log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
-
-// Nest styles of the same type even (color, underline, background)
-log(chalk.green(
- 'I am a green line ' +
- chalk.blue.underline.bold('with a blue substring') +
- ' that becomes green again!'
-));
-
-// ES2015 template literal
-log(`
-CPU: ${chalk.red('90%')}
-RAM: ${chalk.green('40%')}
-DISK: ${chalk.yellow('70%')}
-`);
-
-// ES2015 tagged template literal
-log(chalk`
-CPU: {red ${cpu.totalPercent}%}
-RAM: {green ${ram.used / ram.total * 100}%}
-DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
-`);
-
-// Use RGB colors in terminal emulators that support it.
-log(chalk.keyword('orange')('Yay for orange colored text!'));
-log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
-log(chalk.hex('#DEADED').bold('Bold gray!'));
-```
-
-Easily define your own themes:
-
-```js
-const chalk = require('chalk');
-
-const error = chalk.bold.red;
-const warning = chalk.keyword('orange');
-
-console.log(error('Error!'));
-console.log(warning('Warning!'));
-```
-
-Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
-
-```js
-const name = 'Sindre';
-console.log(chalk.green('Hello %s'), name);
-//=> 'Hello Sindre'
-```
-
-
-## API
-
-### chalk.`<style>[.<style>...](string, [string...])`
-
-Example: `chalk.red.bold.underline('Hello', 'world');`
-
-Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
-
-Multiple arguments will be separated by space.
-
-### chalk.enabled
-
-Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
-
-Chalk is enabled by default unless expicitly disabled via the constructor or `chalk.level` is `0`.
-
-If you need to change this in a reusable module, create a new instance:
-
-```js
-const ctx = new chalk.constructor({enabled: false});
-```
-
-### chalk.level
-
-Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
-
-If you need to change this in a reusable module, create a new instance:
-
-```js
-const ctx = new chalk.constructor({level: 0});
-```
-
-Levels are as follows:
-
-0. All colors disabled
-1. Basic color support (16 colors)
-2. 256 color support
-3. Truecolor support (16 million colors)
-
-### chalk.supportsColor
-
-Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
-
-Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
-
-Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
-
-
-## Styles
-
-### Modifiers
-
-- `reset`
-- `bold`
-- `dim`
-- `italic` *(Not widely supported)*
-- `underline`
-- `inverse`
-- `hidden`
-- `strikethrough` *(Not widely supported)*
-- `visible` (Text is emitted only if enabled)
-
-### Colors
-
-- `black`
-- `red`
-- `green`
-- `yellow`
-- `blue` *(On Windows the bright version is used since normal blue is illegible)*
-- `magenta`
-- `cyan`
-- `white`
-- `gray` ("bright black")
-- `redBright`
-- `greenBright`
-- `yellowBright`
-- `blueBright`
-- `magentaBright`
-- `cyanBright`
-- `whiteBright`
-
-### Background colors
-
-- `bgBlack`
-- `bgRed`
-- `bgGreen`
-- `bgYellow`
-- `bgBlue`
-- `bgMagenta`
-- `bgCyan`
-- `bgWhite`
-- `bgBlackBright`
-- `bgRedBright`
-- `bgGreenBright`
-- `bgYellowBright`
-- `bgBlueBright`
-- `bgMagentaBright`
-- `bgCyanBright`
-- `bgWhiteBright`
-
-
-## Tagged template literal
-
-Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
-
-```js
-const chalk = require('chalk');
-
-const miles = 18;
-const calculateFeet = miles => miles * 5280;
-
-console.log(chalk`
- There are {bold 5280 feet} in a mile.
- In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
-`);
-```
-
-Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
-
-Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
-
-```js
-console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
-console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
-```
-
-Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
-
-All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
-
-
-## 256 and Truecolor color support
-
-Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
-
-Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
-
-Examples:
-
-- `chalk.hex('#DEADED').underline('Hello, world!')`
-- `chalk.keyword('orange')('Some orange text')`
-- `chalk.rgb(15, 100, 204).inverse('Hello!')`
-
-Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
-
-- `chalk.bgHex('#DEADED').underline('Hello, world!')`
-- `chalk.bgKeyword('orange')('Some orange text')`
-- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
-
-The following color models can be used:
-
-- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
-- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
-- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
-- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
-- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 1, 1).bold('Orange!')`
-- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hsl(32, 0, 50).bold('Orange!')`
-- `ansi16`
-- `ansi256`
-
-
-## Windows
-
-If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
-
-
-## Origin story
-
-[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
-
-
-## Related
-
-- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
-- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
-- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
-- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
-- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
-- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
-- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
-- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
-- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
-- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
-- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
-- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
-- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
-
-
-## Maintainers
-
-- [Sindre Sorhus](https://github.com/sindresorhus)
-- [Josh Junon](https://github.com/qix-)
-
-
-## License
-
-MIT
diff --git a/node_modules/tslint/node_modules/chalk/templates.js b/node_modules/tslint/node_modules/chalk/templates.js
deleted file mode 100644
index dbdf9b221..000000000
--- a/node_modules/tslint/node_modules/chalk/templates.js
+++ /dev/null
@@ -1,128 +0,0 @@
-'use strict';
-const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
-const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
-const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
-const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
-
-const ESCAPES = new Map([
- ['n', '\n'],
- ['r', '\r'],
- ['t', '\t'],
- ['b', '\b'],
- ['f', '\f'],
- ['v', '\v'],
- ['0', '\0'],
- ['\\', '\\'],
- ['e', '\u001B'],
- ['a', '\u0007']
-]);
-
-function unescape(c) {
- if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- return ESCAPES.get(c) || c;
-}
-
-function parseArguments(name, args) {
- const results = [];
- const chunks = args.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- if (!isNaN(chunk)) {
- results.push(Number(chunk));
- } else if ((matches = chunk.match(STRING_REGEX))) {
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
- } else {
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
- }
- }
-
- return results;
-}
-
-function parseStyle(style) {
- STYLE_REGEX.lastIndex = 0;
-
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
-}
-
-function buildStyle(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
- for (const styleName of Object.keys(enabled)) {
- if (Array.isArray(enabled[styleName])) {
- if (!(styleName in current)) {
- throw new Error(`Unknown Chalk style: ${styleName}`);
- }
-
- if (enabled[styleName].length > 0) {
- current = current[styleName].apply(current, enabled[styleName]);
- } else {
- current = current[styleName];
- }
- }
- }
-
- return current;
-}
-
-module.exports = (chalk, tmp) => {
- const styles = [];
- const chunks = [];
- let chunk = [];
-
- // eslint-disable-next-line max-params
- tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
- if (escapeChar) {
- chunk.push(unescape(escapeChar));
- } else if (style) {
- const str = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
- styles.push({inverse, styles: parseStyle(style)});
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(chr);
- }
- });
-
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
- throw new Error(errMsg);
- }
-
- return chunks.join('');
-};
diff --git a/node_modules/tslint/node_modules/chalk/types/index.d.ts b/node_modules/tslint/node_modules/chalk/types/index.d.ts
deleted file mode 100644
index b4e4dc57e..000000000
--- a/node_modules/tslint/node_modules/chalk/types/index.d.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-// Type definitions for Chalk
-// Definitions by: Thomas Sauer <https://github.com/t-sauer>
-
-export const enum Level {
- None = 0,
- Basic = 1,
- Ansi256 = 2,
- TrueColor = 3
-}
-
-export interface ChalkOptions {
- enabled?: boolean;
- level?: Level;
-}
-
-export interface ChalkConstructor {
- new (options?: ChalkOptions): Chalk;
- (options?: ChalkOptions): Chalk;
-}
-
-export interface ColorSupport {
- level: Level;
- hasBasic: boolean;
- has256: boolean;
- has16m: boolean;
-}
-
-export interface Chalk {
- (...text: string[]): string;
- (text: TemplateStringsArray, ...placeholders: string[]): string;
- constructor: ChalkConstructor;
- enabled: boolean;
- level: Level;
- rgb(r: number, g: number, b: number): this;
- hsl(h: number, s: number, l: number): this;
- hsv(h: number, s: number, v: number): this;
- hwb(h: number, w: number, b: number): this;
- bgHex(color: string): this;
- bgKeyword(color: string): this;
- bgRgb(r: number, g: number, b: number): this;
- bgHsl(h: number, s: number, l: number): this;
- bgHsv(h: number, s: number, v: number): this;
- bgHwb(h: number, w: number, b: number): this;
- hex(color: string): this;
- keyword(color: string): this;
-
- readonly reset: this;
- readonly bold: this;
- readonly dim: this;
- readonly italic: this;
- readonly underline: this;
- readonly inverse: this;
- readonly hidden: this;
- readonly strikethrough: this;
-
- readonly visible: this;
-
- readonly black: this;
- readonly red: this;
- readonly green: this;
- readonly yellow: this;
- readonly blue: this;
- readonly magenta: this;
- readonly cyan: this;
- readonly white: this;
- readonly gray: this;
- readonly grey: this;
- readonly blackBright: this;
- readonly redBright: this;
- readonly greenBright: this;
- readonly yellowBright: this;
- readonly blueBright: this;
- readonly magentaBright: this;
- readonly cyanBright: this;
- readonly whiteBright: this;
-
- readonly bgBlack: this;
- readonly bgRed: this;
- readonly bgGreen: this;
- readonly bgYellow: this;
- readonly bgBlue: this;
- readonly bgMagenta: this;
- readonly bgCyan: this;
- readonly bgWhite: this;
- readonly bgBlackBright: this;
- readonly bgRedBright: this;
- readonly bgGreenBright: this;
- readonly bgYellowBright: this;
- readonly bgBlueBright: this;
- readonly bgMagentaBright: this;
- readonly bgCyanBright: this;
- readonly bgWhiteBright: this;
-}
-
-declare const chalk: Chalk & { supportsColor: ColorSupport };
-
-export default chalk
diff --git a/node_modules/tslint/node_modules/commander/CHANGELOG.md b/node_modules/tslint/node_modules/commander/CHANGELOG.md
index e55813269..d61aa451c 100644
--- a/node_modules/tslint/node_modules/commander/CHANGELOG.md
+++ b/node_modules/tslint/node_modules/commander/CHANGELOG.md
@@ -1,4 +1,67 @@
+2.18.0 / 2018-09-07
+==================
+
+ * Standardize help output (#853)
+ * chmod 644 travis.yml (#851)
+ * add support for execute typescript subcommand via ts-node (#849)
+
+2.17.1 / 2018-08-07
+==================
+
+ * Fix bug in command emit (#844)
+
+2.17.0 / 2018-08-03
+==================
+
+ * fixed newline output after help information (#833)
+ * Fix to emit the action even without command (#778)
+ * npm update (#823)
+
+2.16.0 / 2018-06-29
+==================
+
+ * Remove Makefile and `test/run` (#821)
+ * Make 'npm test' run on Windows (#820)
+ * Add badge to display install size (#807)
+ * chore: cache node_modules (#814)
+ * chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
+ * fixed typo in readme (#812)
+ * Fix types (#804)
+ * Update eslint to resolve vulnerabilities in lodash (#799)
+ * updated readme with custom event listeners. (#791)
+ * fix tests (#794)
+
+2.15.0 / 2018-03-07
+==================
+
+ * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
+ * Arguments description
+
+2.14.1 / 2018-02-07
+==================
+
+ * Fix typing of help function
+
+2.14.0 / 2018-02-05
+==================
+
+ * only register the option:version event once
+ * Fixes issue #727: Passing empty string for option on command is set to undefined
+ * enable eqeqeq rule
+ * resolves #754 add linter configuration to project
+ * resolves #560 respect custom name for version option
+ * document how to override the version flag
+ * document using options per command
+
+2.13.0 / 2018-01-09
+==================
+
+ * Do not print default for --no-
+ * remove trailing spaces in command help
+ * Update CI's Node.js to LTS and latest version
+ * typedefs: Command and Option types added to commander namespace
+
2.12.2 / 2017-11-28
==================
diff --git a/node_modules/tslint/node_modules/commander/Readme.md b/node_modules/tslint/node_modules/commander/Readme.md
index acd31c616..8484c47a8 100644
--- a/node_modules/tslint/node_modules/commander/Readme.md
+++ b/node_modules/tslint/node_modules/commander/Readme.md
@@ -3,7 +3,8 @@
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
-[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
+[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
+[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
@@ -16,7 +17,7 @@
## Option parsing
- Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
```js
#!/usr/bin/env node
@@ -42,9 +43,9 @@ if (program.bbqSauce) console.log(' - bbq');
console.log(' - %s cheese', program.cheese);
```
- Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
-Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
+Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
```js
#!/usr/bin/env node
@@ -64,6 +65,44 @@ if (program.sauce) console.log(' with sauce');
else console.log(' without sauce');
```
+## Version option
+
+Calling the `version` implicitly adds the `-V` and `--version` options to the command.
+When either of these options is present, the command prints the version number and exits.
+
+ $ ./examples/pizza -V
+ 0.0.1
+
+If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
+
+```js
+program
+ .version('0.0.1', '-v, --version')
+```
+
+The version flags can be named anything, but the long option is required.
+
+## Command-specific options
+
+You can attach options to a command.
+
+```js
+#!/usr/bin/env node
+
+var program = require('commander');
+
+program
+ .command('rm <dir>')
+ .option('-r, --recursive', 'Remove recursively')
+ .action(function (dir, cmd) {
+ console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
+ })
+
+program.parse(process.argv)
+```
+
+A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
+
## Coercion
```js
@@ -114,7 +153,7 @@ program
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
.parse(process.argv);
-
+
console.log(' size: %j', program.size);
console.log(' drink: %j', program.drink);
```
@@ -194,7 +233,7 @@ program
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
-Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the option from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
+Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
@@ -209,22 +248,20 @@ You can enable `--harmony` option in two ways:
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
```
- $ ./examples/pizza --help
-
- Usage: pizza [options]
+$ ./examples/pizza --help
+Usage: pizza [options]
- An application for pizzas ordering
+An application for pizzas ordering
- Options:
-
- -h, --help output usage information
- -V, --version output the version number
- -p, --peppers Add peppers
- -P, --pineapple Add pineapple
- -b, --bbq Add bbq sauce
- -c, --cheese <type> Add the specified type of cheese [marble]
- -C, --no-cheese You do not want any cheese
+Options:
+ -h, --help output usage information
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineapple
+ -b, --bbq Add bbq sauce
+ -c, --cheese <type> Add the specified type of cheese [marble]
+ -C, --no-cheese You do not want any cheese
```
## Custom help
@@ -232,7 +269,7 @@ You can enable `--harmony` option in two ways:
You can display arbitrary `-h, --help` information
by listening for "--help". Commander will automatically
exit once you are done so that the remainder of your program
- does not execute causing undesired behaviours, for example
+ does not execute causing undesired behaviors, for example
in the following executable "stuff" will not output when
`--help` is used.
@@ -255,11 +292,11 @@ program
// node's emit() is immediate
program.on('--help', function(){
- console.log(' Examples:');
- console.log('');
- console.log(' $ custom-help --help');
- console.log(' $ custom-help -h');
+ console.log('')
+ console.log('Examples:');
console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
});
program.parse(process.argv);
@@ -270,7 +307,6 @@ console.log('stuff');
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
```
-
Usage: custom-help [options]
Options:
@@ -285,7 +321,6 @@ Examples:
$ custom-help --help
$ custom-help -h
-
```
## .outputHelp(cb)
@@ -318,6 +353,22 @@ function make_red(txt) {
Output help information and exit immediately.
Optional callback cb allows post-processing of help text before it is displayed.
+
+## Custom event listeners
+ You can execute custom actions by listening to command and option events.
+
+```js
+program.on('option:verbose', function () {
+ process.env.VERBOSE = this.verbose;
+});
+
+// error on unknown commands
+program.on('command:*', function () {
+ console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
+ process.exit(1);
+});
+```
+
## Examples
```js
@@ -347,11 +398,11 @@ program
.action(function(cmd, options){
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
}).on('--help', function() {
- console.log(' Examples:');
- console.log();
- console.log(' $ deploy exec sequential');
- console.log(' $ deploy exec async');
- console.log();
+ console.log('');
+ console.log('Examples:');
+ console.log('');
+ console.log(' $ deploy exec sequential');
+ console.log(' $ deploy exec async');
});
program
diff --git a/node_modules/tslint/node_modules/commander/index.js b/node_modules/tslint/node_modules/commander/index.js
index cb82f55b9..8e296691c 100644
--- a/node_modules/tslint/node_modules/commander/index.js
+++ b/node_modules/tslint/node_modules/commander/index.js
@@ -10,6 +10,12 @@ var basename = path.basename;
var fs = require('fs');
/**
+ * Inherit `Command` from `EventEmitter.prototype`.
+ */
+
+require('util').inherits(Command, EventEmitter);
+
+/**
* Expose the root command.
*/
@@ -37,9 +43,9 @@ exports.Option = Option;
function Option(flags, description) {
this.flags = flags;
- this.required = ~flags.indexOf('<');
- this.optional = ~flags.indexOf('[');
- this.bool = !~flags.indexOf('-no-');
+ this.required = flags.indexOf('<') >= 0;
+ this.optional = flags.indexOf('[') >= 0;
+ this.bool = flags.indexOf('-no-') === -1;
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
@@ -68,7 +74,7 @@ Option.prototype.name = function() {
*/
Option.prototype.attributeName = function() {
- return camelcase( this.name() );
+ return camelcase(this.name());
};
/**
@@ -80,7 +86,7 @@ Option.prototype.attributeName = function() {
*/
Option.prototype.is = function(arg) {
- return arg == this.short || arg == this.long;
+ return this.short === arg || this.long === arg;
};
/**
@@ -100,12 +106,6 @@ function Command(name) {
}
/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Command.prototype.__proto__ = EventEmitter.prototype;
-
-/**
* Add command `name`.
*
* The `.action()` callback is invoked when the
@@ -167,7 +167,7 @@ Command.prototype.__proto__ = EventEmitter.prototype;
*/
Command.prototype.command = function(name, desc, opts) {
- if(typeof desc === 'object' && desc !== null){
+ if (typeof desc === 'object' && desc !== null) {
opts = desc;
desc = null;
}
@@ -196,7 +196,7 @@ Command.prototype.command = function(name, desc, opts) {
* @api public
*/
-Command.prototype.arguments = function (desc) {
+Command.prototype.arguments = function(desc) {
return this.parseExpectedArgs(desc.split(/ +/));
};
@@ -292,7 +292,7 @@ Command.prototype.action = function(fn) {
if (parsed.args.length) args = parsed.args.concat(args);
self._args.forEach(function(arg, i) {
- if (arg.required && null == args[i]) {
+ if (arg.required && args[i] == null) {
self.missingArgument(arg.name);
} else if (arg.variadic) {
if (i !== self._args.length - 1) {
@@ -371,32 +371,31 @@ Command.prototype.action = function(fn) {
*/
Command.prototype.option = function(flags, description, fn, defaultValue) {
- var self = this
- , option = new Option(flags, description)
- , oname = option.name()
- , name = option.attributeName();
+ var self = this,
+ option = new Option(flags, description),
+ oname = option.name(),
+ name = option.attributeName();
// default as 3rd arg
- if (typeof fn != 'function') {
+ if (typeof fn !== 'function') {
if (fn instanceof RegExp) {
var regex = fn;
fn = function(val, def) {
var m = regex.exec(val);
return m ? m[0] : def;
- }
- }
- else {
+ };
+ } else {
defaultValue = fn;
fn = null;
}
}
// preassign default value only for --no-*, [optional], or <required>
- if (false == option.bool || option.optional || option.required) {
+ if (!option.bool || option.optional || option.required) {
// when --no-* we make sure default is true
- if (false == option.bool) defaultValue = true;
+ if (!option.bool) defaultValue = true;
// preassign only if we have a default
- if (undefined !== defaultValue) {
+ if (defaultValue !== undefined) {
self[name] = defaultValue;
option.defaultValue = defaultValue;
}
@@ -409,21 +408,21 @@ Command.prototype.option = function(flags, description, fn, defaultValue) {
// and conditionally invoke the callback
this.on('option:' + oname, function(val) {
// coercion
- if (null !== val && fn) val = fn(val, undefined === self[name]
- ? defaultValue
- : self[name]);
+ if (val !== null && fn) {
+ val = fn(val, self[name] === undefined ? defaultValue : self[name]);
+ }
// unassigned or bool
- if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {
// if no value, bool true, and we have a default, then use it!
- if (null == val) {
+ if (val == null) {
self[name] = option.bool
? defaultValue || true
: false;
} else {
self[name] = val;
}
- } else if (null !== val) {
+ } else if (val !== null) {
// reassign
self[name] = val;
}
@@ -440,8 +439,8 @@ Command.prototype.option = function(flags, description, fn, defaultValue) {
* @api public
*/
Command.prototype.allowUnknownOption = function(arg) {
- this._allowUnknownOption = arguments.length === 0 || arg;
- return this;
+ this._allowUnknownOption = arguments.length === 0 || arg;
+ return this;
};
/**
@@ -485,7 +484,7 @@ Command.prototype.parse = function(argv) {
})[0];
}
- if (this._execs[name] && typeof this._execs[name] != "function") {
+ if (this._execs[name] && typeof this._execs[name] !== 'function') {
return this.executeSubCommand(argv, args, parsed.unknown);
} else if (aliasCommand) {
// is alias of a subCommand
@@ -513,10 +512,10 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
args = args.concat(unknown);
if (!args.length) this.help();
- if ('help' == args[0] && 1 == args.length) this.help();
+ if (args[0] === 'help' && args.length === 1) this.help();
// <cmd> --help
- if ('help' == args[0]) {
+ if (args[0] === 'help') {
args[0] = args[1];
args[1] = '--help';
}
@@ -524,28 +523,30 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
// executable
var f = argv[1];
// name of the subcommand, link `pm-install`
- var bin = basename(f, '.js') + '-' + args[0];
-
+ var bin = basename(f, path.extname(f)) + '-' + args[0];
// In case of globally installed, get the base dir where executable
// subcommand file should be located at
- var baseDir
- , link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f;
+ var baseDir,
+ link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f;
// when symbolink is relative path
if (link !== f && link.charAt(0) !== '/') {
- link = path.join(dirname(f), link)
+ link = path.join(dirname(f), link);
}
baseDir = dirname(link);
// prefer local `./<bin>` to bin in the $PATH
var localBin = path.join(baseDir, bin);
- // whether bin file is a js script with explicit `.js` extension
+ // whether bin file is a js script with explicit `.js` or `.ts` extension
var isExplicitJS = false;
if (exists(localBin + '.js')) {
bin = localBin + '.js';
isExplicitJS = true;
+ } else if (exists(localBin + '.ts')) {
+ bin = localBin + '.ts';
+ isExplicitJS = true;
} else if (exists(localBin)) {
bin = localBin;
}
@@ -565,23 +566,23 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
}
} else {
args.unshift(bin);
- proc = spawn(process.execPath, args, { stdio: 'inherit'});
+ proc = spawn(process.execPath, args, { stdio: 'inherit' });
}
var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];
signals.forEach(function(signal) {
- process.on(signal, function(){
- if ((proc.killed === false) && (proc.exitCode === null)){
+ process.on(signal, function() {
+ if (proc.killed === false && proc.exitCode === null) {
proc.kill(signal);
}
});
});
proc.on('close', process.exit.bind(process));
proc.on('error', function(err) {
- if (err.code == "ENOENT") {
- console.error('\n %s(1) does not exist, try --help\n', bin);
- } else if (err.code == "EACCES") {
- console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
+ if (err.code === 'ENOENT') {
+ console.error('%s(1) does not exist, try --help', bin);
+ } else if (err.code === 'EACCES') {
+ console.error('%s(1) not executable. try chmod or run with root', bin);
}
process.exit(1);
});
@@ -601,15 +602,15 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
*/
Command.prototype.normalize = function(args) {
- var ret = []
- , arg
- , lastOpt
- , index;
+ var ret = [],
+ arg,
+ lastOpt,
+ index;
for (var i = 0, len = args.length; i < len; ++i) {
arg = args[i];
if (i > 0) {
- lastOpt = this.optionFor(args[i-1]);
+ lastOpt = this.optionFor(args[i - 1]);
}
if (arg === '--') {
@@ -618,7 +619,7 @@ Command.prototype.normalize = function(args) {
break;
} else if (lastOpt && lastOpt.required) {
ret.push(arg);
- } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {
arg.slice(1).split('').forEach(function(c) {
ret.push('-' + c);
});
@@ -662,6 +663,10 @@ Command.prototype.parseArgs = function(args, unknown) {
if (unknown.length > 0) {
this.unknownOption(unknown[0]);
}
+ if (this.commands.length === 0 &&
+ this._args.filter(function(a) { return a.required }).length === 0) {
+ this.emit('command:*');
+ }
}
return this;
@@ -693,11 +698,11 @@ Command.prototype.optionFor = function(arg) {
*/
Command.prototype.parseOptions = function(argv) {
- var args = []
- , len = argv.length
- , literal
- , option
- , arg;
+ var args = [],
+ len = argv.length,
+ literal,
+ option,
+ arg;
var unknownOptions = [];
@@ -711,7 +716,7 @@ Command.prototype.parseOptions = function(argv) {
continue;
}
- if ('--' == arg) {
+ if (arg === '--') {
literal = true;
continue;
}
@@ -724,12 +729,12 @@ Command.prototype.parseOptions = function(argv) {
// requires arg
if (option.required) {
arg = argv[++i];
- if (null == arg) return this.optionMissingArgument(option);
+ if (arg == null) return this.optionMissingArgument(option);
this.emit('option:' + option.name(), arg);
// optional arg
} else if (option.optional) {
- arg = argv[i+1];
- if (null == arg || ('-' == arg[0] && '-' != arg)) {
+ arg = argv[i + 1];
+ if (arg == null || (arg[0] === '-' && arg !== '-')) {
arg = null;
} else {
++i;
@@ -743,13 +748,13 @@ Command.prototype.parseOptions = function(argv) {
}
// looks like an option
- if (arg.length > 1 && '-' == arg[0]) {
+ if (arg.length > 1 && arg[0] === '-') {
unknownOptions.push(arg);
// If the next argument looks like it might be
// an argument for this option, we pass it on.
// If it isn't, then it'll simply be ignored
- if (argv[i+1] && '-' != argv[i+1][0]) {
+ if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {
unknownOptions.push(argv[++i]);
}
continue;
@@ -769,12 +774,12 @@ Command.prototype.parseOptions = function(argv) {
* @api public
*/
Command.prototype.opts = function() {
- var result = {}
- , len = this.options.length;
+ var result = {},
+ len = this.options.length;
- for (var i = 0 ; i < len; i++) {
+ for (var i = 0; i < len; i++) {
var key = this.options[i].attributeName();
- result[key] = key === 'version' ? this._version : this[key];
+ result[key] = key === this._versionOptionName ? this._version : this[key];
}
return result;
};
@@ -854,11 +859,13 @@ Command.prototype.variadicArgNotLast = function(name) {
*/
Command.prototype.version = function(str, flags) {
- if (0 == arguments.length) return this._version;
+ if (arguments.length === 0) return this._version;
this._version = str;
flags = flags || '-V, --version';
- this.option(flags, 'output the version number');
- this.on('option:version', function() {
+ var versionOption = new Option(flags, 'output the version number');
+ this._versionOptionName = versionOption.long.substr(2) || 'version';
+ this.options.push(versionOption);
+ this.on('option:' + this._versionOptionName, function() {
process.stdout.write(str + '\n');
process.exit(0);
});
@@ -869,13 +876,15 @@ Command.prototype.version = function(str, flags) {
* Set the description to `str`.
*
* @param {String} str
+ * @param {Object} argsDescription
* @return {String|Command}
* @api public
*/
-Command.prototype.description = function(str) {
- if (0 === arguments.length) return this._description;
+Command.prototype.description = function(str, argsDescription) {
+ if (arguments.length === 0) return this._description;
this._description = str;
+ this._argsDescription = argsDescription;
return this;
};
@@ -889,8 +898,8 @@ Command.prototype.description = function(str) {
Command.prototype.alias = function(alias) {
var command = this;
- if(this.commands.length !== 0) {
- command = this.commands[this.commands.length - 1]
+ if (this.commands.length !== 0) {
+ command = this.commands[this.commands.length - 1];
}
if (arguments.length === 0) return command._alias;
@@ -914,11 +923,11 @@ Command.prototype.usage = function(str) {
return humanReadableArgName(arg);
});
- var usage = '[options]'
- + (this.commands.length ? ' [command]' : '')
- + (this._args.length ? ' ' + args.join(' ') : '');
+ var usage = '[options]' +
+ (this.commands.length ? ' [command]' : '') +
+ (this._args.length ? ' ' + args.join(' ') : '');
- if (0 == arguments.length) return this._usage || usage;
+ if (arguments.length === 0) return this._usage || usage;
this._usage = str;
return this;
@@ -933,12 +942,51 @@ Command.prototype.usage = function(str) {
*/
Command.prototype.name = function(str) {
- if (0 === arguments.length) return this._name;
+ if (arguments.length === 0) return this._name;
this._name = str;
return this;
};
/**
+ * Return prepared commands.
+ *
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.prepareCommands = function() {
+ return this.commands.filter(function(cmd) {
+ return !cmd._noHelp;
+ }).map(function(cmd) {
+ var args = cmd._args.map(function(arg) {
+ return humanReadableArgName(arg);
+ }).join(' ');
+
+ return [
+ cmd._name +
+ (cmd._alias ? '|' + cmd._alias : '') +
+ (cmd.options.length ? ' [options]' : '') +
+ (args ? ' ' + args : ''),
+ cmd._description
+ ];
+ });
+};
+
+/**
+ * Return the largest command length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestCommandLength = function() {
+ var commands = this.prepareCommands();
+ return commands.reduce(function(max, command) {
+ return Math.max(max, command[0].length);
+ }, 0);
+};
+
+/**
* Return the largest option length.
*
* @return {Number}
@@ -946,12 +994,53 @@ Command.prototype.name = function(str) {
*/
Command.prototype.largestOptionLength = function() {
- return this.options.reduce(function(max, option) {
+ var options = [].slice.call(this.options);
+ options.push({
+ flags: '-h, --help'
+ });
+ return options.reduce(function(max, option) {
return Math.max(max, option.flags.length);
}, 0);
};
/**
+ * Return the largest arg length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestArgLength = function() {
+ return this._args.reduce(function(max, arg) {
+ return Math.max(max, arg.name.length);
+ }, 0);
+};
+
+/**
+ * Return the pad width.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.padWidth = function() {
+ var width = this.largestOptionLength();
+ if (this._argsDescription && this._args.length) {
+ if (this.largestArgLength() > width) {
+ width = this.largestArgLength();
+ }
+ }
+
+ if (this.commands && this.commands.length) {
+ if (this.largestCommandLength() > width) {
+ width = this.largestCommandLength();
+ }
+ }
+
+ return width;
+};
+
+/**
* Return help for options.
*
* @return {String}
@@ -959,12 +1048,12 @@ Command.prototype.largestOptionLength = function() {
*/
Command.prototype.optionHelp = function() {
- var width = this.largestOptionLength();
+ var width = this.padWidth();
// Append the help information
return this.options.map(function(option) {
- return pad(option.flags, width) + ' ' + option.description
- + (option.defaultValue !== undefined ? ' (default: ' + option.defaultValue + ')' : '');
+ return pad(option.flags, width) + ' ' + option.description +
+ ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');
}).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
.join('\n');
};
@@ -979,35 +1068,17 @@ Command.prototype.optionHelp = function() {
Command.prototype.commandHelp = function() {
if (!this.commands.length) return '';
- var commands = this.commands.filter(function(cmd) {
- return !cmd._noHelp;
- }).map(function(cmd) {
- var args = cmd._args.map(function(arg) {
- return humanReadableArgName(arg);
- }).join(' ');
-
- return [
- cmd._name
- + (cmd._alias ? '|' + cmd._alias : '')
- + (cmd.options.length ? ' [options]' : '')
- + ' ' + args
- , cmd._description
- ];
- });
-
- var width = commands.reduce(function(max, command) {
- return Math.max(max, command[0].length);
- }, 0);
+ var commands = this.prepareCommands();
+ var width = this.padWidth();
return [
- ''
- , ' Commands:'
- , ''
- , commands.map(function(cmd) {
+ 'Commands:',
+ '',
+ commands.map(function(cmd) {
var desc = cmd[1] ? ' ' + cmd[1] : '';
- return pad(cmd[0], width) + desc;
- }).join('\n').replace(/^/gm, ' ')
- , ''
+ return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
+ }).join('\n').replace(/^/gm, ' '),
+ ''
].join('\n');
};
@@ -1022,9 +1093,20 @@ Command.prototype.helpInformation = function() {
var desc = [];
if (this._description) {
desc = [
- ' ' + this._description
- , ''
+ this._description,
+ ''
];
+
+ var argsDescription = this._argsDescription;
+ if (argsDescription && this._args.length) {
+ var width = this.padWidth();
+ desc.push('Arguments:');
+ desc.push('');
+ this._args.forEach(function(arg) {
+ desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
+ });
+ desc.push('');
+ }
}
var cmdName = this._name;
@@ -1032,9 +1114,8 @@ Command.prototype.helpInformation = function() {
cmdName = cmdName + '|' + this._alias;
}
var usage = [
+ 'Usage: ' + cmdName + ' ' + this.usage(),
''
- ,' Usage: ' + cmdName + ' ' + this.usage()
- , ''
];
var cmds = [];
@@ -1042,11 +1123,10 @@ Command.prototype.helpInformation = function() {
if (commandHelp) cmds = [commandHelp];
var options = [
+ 'Options:',
+ '',
+ '' + this.optionHelp().replace(/^/gm, ' '),
''
- , ' Options:'
- , ''
- , '' + this.optionHelp().replace(/^/gm, ' ')
- , ''
];
return usage
@@ -1066,7 +1146,7 @@ Command.prototype.outputHelp = function(cb) {
if (!cb) {
cb = function(passthru) {
return passthru;
- }
+ };
}
process.stdout.write(cb(this.helpInformation()));
this.emit('--help');
@@ -1122,7 +1202,7 @@ function pad(str, width) {
function outputHelpIfNecessary(cmd, options) {
options = options || [];
for (var i = 0; i < options.length; i++) {
- if (options[i] == '--help' || options[i] == '-h') {
+ if (options[i] === '--help' || options[i] === '-h') {
cmd.outputHelp();
process.exit(0);
}
@@ -1142,7 +1222,7 @@ function humanReadableArgName(arg) {
return arg.required
? '<' + nameOutput + '>'
- : '[' + nameOutput + ']'
+ : '[' + nameOutput + ']';
}
// for versions before node v0.8 when there weren't `fs.existsSync`
@@ -1155,4 +1235,3 @@ function exists(file) {
return false;
}
}
-
diff --git a/node_modules/tslint/node_modules/commander/package.json b/node_modules/tslint/node_modules/commander/package.json
index 04b3c69b5..5ce7058a9 100644
--- a/node_modules/tslint/node_modules/commander/package.json
+++ b/node_modules/tslint/node_modules/commander/package.json
@@ -1,6 +1,6 @@
{
"name": "commander",
- "version": "2.12.2",
+ "version": "2.18.0",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
@@ -15,8 +15,9 @@
"url": "https://github.com/tj/commander.js.git"
},
"scripts": {
- "test": "make test && npm run test-typings",
- "test-typings": "node_modules/typescript/bin/tsc -p tsconfig.json"
+ "lint": "eslint index.js",
+ "test": "node test/run.js && npm run test-typings",
+ "test-typings": "tsc -p tsconfig.json"
},
"main": "index",
"files": [
@@ -25,10 +26,13 @@
],
"dependencies": {},
"devDependencies": {
- "@types/node": "^7.0.48",
- "should": "^11.2.1",
- "sinon": "^2.4.1",
- "typescript": "^2.6.2"
+ "@types/node": "^10.9.4",
+ "eslint": "^5.5.0",
+ "should": "^13.2.3",
+ "sinon": "^6.2.0",
+ "standard": "^12.0.1",
+ "ts-node": "^7.0.1",
+ "typescript": "^2.9.2"
},
"typings": "typings/index.d.ts"
}
diff --git a/node_modules/tslint/node_modules/commander/typings/index.d.ts b/node_modules/tslint/node_modules/commander/typings/index.d.ts
index f36f5a7c4..312b056de 100644
--- a/node_modules/tslint/node_modules/commander/typings/index.d.ts
+++ b/node_modules/tslint/node_modules/commander/typings/index.d.ts
@@ -1,7 +1,11 @@
+// Type definitions for commander 2.11
// Project: https://github.com/visionmedia/commander.js
-// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
+// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare class Option {
+declare namespace local {
+
+ class Option {
flags: string;
required: boolean;
optional: boolean;
@@ -17,9 +21,9 @@ declare class Option {
* @param {string} [description]
*/
constructor(flags: string, description?: string);
-}
+ }
-declare class Command extends NodeJS.EventEmitter {
+ class Command extends NodeJS.EventEmitter {
[key: string]: any;
args: string[];
@@ -121,6 +125,7 @@ declare class Command extends NodeJS.EventEmitter {
* @returns {Command} for chaining
*/
parseExpectedArgs(args: string[]): Command;
+
/**
* Register callback `fn` for the command.
*
@@ -213,9 +218,9 @@ declare class Command extends NodeJS.EventEmitter {
/**
* Return an object containing options as key-value pairs
*
- * @returns {{[key: string]: string}}
+ * @returns {{[key: string]: any}}
*/
- opts(): { [key: string]: string };
+ opts(): { [key: string]: any };
/**
* Set the description to `str`.
@@ -262,16 +267,25 @@ declare class Command extends NodeJS.EventEmitter {
/**
* Output help information for this command.
*
- * @param {(str: string) => string} [cb]
+ * @param {(str: string) => string} [cb]
*/
outputHelp(cb?: (str: string) => string): void;
- /** Output help information and exit. */
- help(): void;
+ /** Output help information and exit.
+ *
+ * @param {(str: string) => string} [cb]
+ */
+ help(cb?: (str: string) => string): never;
+ }
+
}
declare namespace commander {
+ type Command = local.Command
+
+ type Option = local.Option
+
interface CommandOptions {
noHelp?: boolean;
isDefault?: boolean;
@@ -283,8 +297,8 @@ declare namespace commander {
}
interface CommanderStatic extends Command {
- Command: typeof Command;
- Option: typeof Option;
+ Command: typeof local.Command;
+ Option: typeof local.Option;
CommandOptions: CommandOptions;
ParseOptionsResult: ParseOptionsResult;
}
@@ -292,4 +306,4 @@ declare namespace commander {
}
declare const commander: commander.CommanderStatic;
-export = commander; \ No newline at end of file
+export = commander;
diff --git a/node_modules/tslint/node_modules/resolve/.editorconfig b/node_modules/tslint/node_modules/resolve/.editorconfig
deleted file mode 100644
index ac29adef0..000000000
--- a/node_modules/tslint/node_modules/resolve/.editorconfig
+++ /dev/null
@@ -1,20 +0,0 @@
-root = true
-
-[*]
-indent_style = tab
-indent_size = 4
-end_of_line = lf
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-max_line_length = 120
-
-[CHANGELOG.md]
-indent_style = space
-indent_size = 2
-
-[*.json]
-max_line_length = off
-
-[Makefile]
-max_line_length = off
diff --git a/node_modules/tslint/node_modules/resolve/.eslintignore b/node_modules/tslint/node_modules/resolve/.eslintignore
deleted file mode 100644
index 3c3629e64..000000000
--- a/node_modules/tslint/node_modules/resolve/.eslintignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/tslint/node_modules/resolve/.eslintrc b/node_modules/tslint/node_modules/resolve/.eslintrc
deleted file mode 100644
index 9db19a4f8..000000000
--- a/node_modules/tslint/node_modules/resolve/.eslintrc
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "extends": "@ljharb",
- "root": true,
- "rules": {
- "array-bracket-newline": 0,
- "array-element-newline": 0,
- "indent": [2, 4],
- "strict": 0,
- "complexity": 0,
- "consistent-return": 0,
- "curly": 0,
- "dot-notation": [2, { "allowKeywords": true }],
- "func-name-matching": 0,
- "func-style": 0,
- "global-require": 0,
- "id-length": [2, { "min": 1, "max": 30 }],
- "max-nested-callbacks": 0,
- "max-params": 0,
- "max-statements-per-line": [2, { "max": 2 }],
- "max-statements": 0,
- "no-magic-numbers": 0,
- "no-console": 0,
- "no-shadow": 0,
- "no-unused-vars": [2, { "vars": "all", "args": "none" }],
- "no-use-before-define": 0,
- "object-curly-newline": 0,
- "operator-linebreak": [2, "before"],
- "sort-keys": 0,
- }
-}
diff --git a/node_modules/tslint/node_modules/resolve/.travis.yml b/node_modules/tslint/node_modules/resolve/.travis.yml
deleted file mode 100644
index 099f694ee..000000000
--- a/node_modules/tslint/node_modules/resolve/.travis.yml
+++ /dev/null
@@ -1,173 +0,0 @@
-language: node_js
-os:
- - linux
-node_js:
- - "8.8"
- - "7.10"
- - "6.11"
- - "5.12"
- - "4.8"
- - "iojs-v3.3"
- - "iojs-v2.5"
- - "iojs-v1.8"
- - "0.12"
- - "0.10"
- - "0.8"
-before_install:
- - 'nvm install-latest-npm'
-install:
- - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
-script:
- - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
- - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
- - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
- - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
-sudo: false
-env:
- - TEST=true
-matrix:
- fast_finish: true
- include:
- - node_js: "node"
- env: PRETEST=true
- - node_js: "8.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "8.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.9"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.8"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "7.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.10"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.9"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.8"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "6.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.11"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.10"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.9"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.8"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "5.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "4.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v3.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v3.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v3.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v2.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v2.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v2.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v2.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v2.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.7"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.5"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.4"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.3"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.2"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.1"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "iojs-v1.0"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "0.11"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "0.9"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "0.6"
- env: TEST=true ALLOW_FAILURE=true
- - node_js: "0.4"
- env: TEST=true ALLOW_FAILURE=true
- allow_failures:
- - os: osx
- - env: TEST=true ALLOW_FAILURE=true
diff --git a/node_modules/tslint/node_modules/resolve/LICENSE b/node_modules/tslint/node_modules/resolve/LICENSE
deleted file mode 100644
index ee27ba4b4..000000000
--- a/node_modules/tslint/node_modules/resolve/LICENSE
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/tslint/node_modules/resolve/appveyor.yml b/node_modules/tslint/node_modules/resolve/appveyor.yml
deleted file mode 100644
index f54a1b609..000000000
--- a/node_modules/tslint/node_modules/resolve/appveyor.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-version: 1.0.{build}
-skip_branch_with_pr: true
-build: off
-
-environment:
- matrix:
- - nodejs_version: "7"
- - nodejs_version: "6"
- - nodejs_version: "5"
- - nodejs_version: "4"
- - nodejs_version: "3"
- - nodejs_version: "2"
- - nodejs_version: "1"
- - nodejs_version: "0.12"
- - nodejs_version: "0.10"
- - nodejs_version: "0.8"
- - nodejs_version: "0.6"
-matrix:
- # fast_finish: true
- allow_failures:
- - nodejs_version: "0.6"
-
-platform:
- - x86
- - x64
-
-# Install scripts. (runs after repo cloning)
-install:
- # Get the latest stable version of Node.js or io.js
- - ps: Install-Product node $env:nodejs_version $env:platform
- - IF %nodejs_version% EQU 0.6 npm -g install npm@1.3
- - IF %nodejs_version% EQU 0.8 npm -g install npm@2
- - set PATH=%APPDATA%\npm;%PATH%
- #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm
- # install modules
- - npm install
-
-# Post-install test scripts.
-test_script:
- # Output useful info for debugging.
- - node --version
- - npm --version
- # run tests
- - npm run tests-only
diff --git a/node_modules/tslint/node_modules/resolve/example/async.js b/node_modules/tslint/node_modules/resolve/example/async.js
deleted file mode 100644
index 20e65dc28..000000000
--- a/node_modules/tslint/node_modules/resolve/example/async.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var resolve = require('../');
-resolve('tap', { basedir: __dirname }, function (err, res) {
- if (err) console.error(err);
- else console.log(res);
-});
diff --git a/node_modules/tslint/node_modules/resolve/example/sync.js b/node_modules/tslint/node_modules/resolve/example/sync.js
deleted file mode 100644
index 54b2cc100..000000000
--- a/node_modules/tslint/node_modules/resolve/example/sync.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var resolve = require('../');
-var res = resolve.sync('tap', { basedir: __dirname });
-console.log(res);
diff --git a/node_modules/tslint/node_modules/resolve/index.js b/node_modules/tslint/node_modules/resolve/index.js
deleted file mode 100644
index eb6ba89e6..000000000
--- a/node_modules/tslint/node_modules/resolve/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var core = require('./lib/core');
-var async = require('./lib/async');
-async.core = core;
-async.isCore = function isCore(x) { return core[x]; };
-async.sync = require('./lib/sync');
-
-exports = async;
-module.exports = async;
diff --git a/node_modules/tslint/node_modules/resolve/lib/async.js b/node_modules/tslint/node_modules/resolve/lib/async.js
deleted file mode 100644
index ef1bde782..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/async.js
+++ /dev/null
@@ -1,203 +0,0 @@
-var core = require('./core');
-var fs = require('fs');
-var path = require('path');
-var caller = require('./caller.js');
-var nodeModulesPaths = require('./node-modules-paths.js');
-
-module.exports = function resolve(x, options, callback) {
- var cb = callback;
- var opts = options || {};
- if (typeof opts === 'function') {
- cb = opts;
- opts = {};
- }
- if (typeof x !== 'string') {
- var err = new TypeError('Path must be a string.');
- return process.nextTick(function () {
- cb(err);
- });
- }
-
- var isFile = opts.isFile || function (file, cb) {
- fs.stat(file, function (err, stat) {
- if (!err) {
- return cb(null, stat.isFile() || stat.isFIFO());
- }
- if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
- return cb(err);
- });
- };
- var readFile = opts.readFile || fs.readFile;
-
- var extensions = opts.extensions || ['.js'];
- var y = opts.basedir || path.dirname(caller());
-
- opts.paths = opts.paths || [];
-
- if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
- var res = path.resolve(y, x);
- if (x === '..' || x.slice(-1) === '/') res += '/';
- if (/\/$/.test(x) && res === y) {
- loadAsDirectory(res, opts.package, onfile);
- } else loadAsFile(res, opts.package, onfile);
- } else loadNodeModules(x, y, function (err, n, pkg) {
- if (err) cb(err);
- else if (n) cb(null, n, pkg);
- else if (core[x]) return cb(null, x);
- else {
- var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'");
- moduleError.code = 'MODULE_NOT_FOUND';
- cb(moduleError);
- }
- });
-
- function onfile(err, m, pkg) {
- if (err) cb(err);
- else if (m) cb(null, m, pkg);
- else loadAsDirectory(res, function (err, d, pkg) {
- if (err) cb(err);
- else if (d) cb(null, d, pkg);
- else {
- var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'");
- moduleError.code = 'MODULE_NOT_FOUND';
- cb(moduleError);
- }
- });
- }
-
- function loadAsFile(x, thePackage, callback) {
- var loadAsFilePackage = thePackage;
- var cb = callback;
- if (typeof loadAsFilePackage === 'function') {
- cb = loadAsFilePackage;
- loadAsFilePackage = undefined;
- }
-
- var exts = [''].concat(extensions);
- load(exts, x, loadAsFilePackage);
-
- function load(exts, x, loadPackage) {
- if (exts.length === 0) return cb(null, undefined, loadPackage);
- var file = x + exts[0];
-
- var pkg = loadPackage;
- if (pkg) onpkg(null, pkg);
- else loadpkg(path.dirname(file), onpkg);
-
- function onpkg(err, pkg_, dir) {
- pkg = pkg_;
- if (err) return cb(err);
- if (dir && pkg && opts.pathFilter) {
- var rfile = path.relative(dir, file);
- var rel = rfile.slice(0, rfile.length - exts[0].length);
- var r = opts.pathFilter(pkg, x, rel);
- if (r) return load(
- [''].concat(extensions.slice()),
- path.resolve(dir, r),
- pkg
- );
- }
- isFile(file, onex);
- }
- function onex(err, ex) {
- if (err) return cb(err);
- if (ex) return cb(null, file, pkg);
- load(exts.slice(1), x, pkg);
- }
- }
- }
-
- function loadpkg(dir, cb) {
- if (dir === '' || dir === '/') return cb(null);
- if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
- return cb(null);
- }
- if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb(null);
-
- var pkgfile = path.join(dir, 'package.json');
- isFile(pkgfile, function (err, ex) {
- // on err, ex is false
- if (!ex) return loadpkg(path.dirname(dir), cb);
-
- readFile(pkgfile, function (err, body) {
- if (err) cb(err);
- try { var pkg = JSON.parse(body); } catch (jsonErr) {}
-
- if (pkg && opts.packageFilter) {
- pkg = opts.packageFilter(pkg, pkgfile);
- }
- cb(null, pkg, dir);
- });
- });
- }
-
- function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
- var cb = callback;
- var fpkg = loadAsDirectoryPackage;
- if (typeof fpkg === 'function') {
- cb = fpkg;
- fpkg = opts.package;
- }
-
- var pkgfile = path.join(x, 'package.json');
- isFile(pkgfile, function (err, ex) {
- if (err) return cb(err);
- if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb);
-
- readFile(pkgfile, function (err, body) {
- if (err) return cb(err);
- try {
- var pkg = JSON.parse(body);
- } catch (jsonErr) {}
-
- if (opts.packageFilter) {
- pkg = opts.packageFilter(pkg, pkgfile);
- }
-
- if (pkg.main) {
- if (pkg.main === '.' || pkg.main === './') {
- pkg.main = 'index';
- }
- loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
- if (err) return cb(err);
- if (m) return cb(null, m, pkg);
- if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb);
-
- var dir = path.resolve(x, pkg.main);
- loadAsDirectory(dir, pkg, function (err, n, pkg) {
- if (err) return cb(err);
- if (n) return cb(null, n, pkg);
- loadAsFile(path.join(x, 'index'), pkg, cb);
- });
- });
- return;
- }
-
- loadAsFile(path.join(x, '/index'), pkg, cb);
- });
- });
- }
-
- function processDirs(cb, dirs) {
- if (dirs.length === 0) return cb(null, undefined);
- var dir = dirs[0];
-
- var file = path.join(dir, x);
- loadAsFile(file, undefined, onfile);
-
- function onfile(err, m, pkg) {
- if (err) return cb(err);
- if (m) return cb(null, m, pkg);
- loadAsDirectory(path.join(dir, x), undefined, ondir);
- }
-
- function ondir(err, n, pkg) {
- if (err) return cb(err);
- if (n) return cb(null, n, pkg);
- processDirs(cb, dirs.slice(1));
- }
- }
- function loadNodeModules(x, start, cb) {
- processDirs(cb, nodeModulesPaths(start, opts));
- }
-};
diff --git a/node_modules/tslint/node_modules/resolve/lib/caller.js b/node_modules/tslint/node_modules/resolve/lib/caller.js
deleted file mode 100644
index b14a2804a..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/caller.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = function () {
- // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
- var origPrepareStackTrace = Error.prepareStackTrace;
- Error.prepareStackTrace = function (_, stack) { return stack; };
- var stack = (new Error()).stack;
- Error.prepareStackTrace = origPrepareStackTrace;
- return stack[2].getFileName();
-};
diff --git a/node_modules/tslint/node_modules/resolve/lib/core.js b/node_modules/tslint/node_modules/resolve/lib/core.js
deleted file mode 100644
index 5386d4d8d..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/core.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];
-
-function versionIncluded(specifier) {
- if (specifier === true) { return true; }
- var parts = specifier.split(' ');
- var op = parts[0];
- var versionParts = parts[1].split('.');
-
- for (var i = 0; i < 3; ++i) {
- var cur = Number(current[i] || 0);
- var ver = Number(versionParts[i] || 0);
- if (cur === ver) {
- continue; // eslint-disable-line no-restricted-syntax, no-continue
- }
- if (op === '<') {
- return cur < ver;
- } else if (op === '>=') {
- return cur >= ver;
- } else {
- return false;
- }
- }
- return false;
-}
-
-var data = require('./core.json');
-
-var core = {};
-for (var mod in data) { // eslint-disable-line no-restricted-syntax
- if (Object.prototype.hasOwnProperty.call(data, mod)) {
- core[mod] = versionIncluded(data[mod]);
- }
-}
-module.exports = core;
diff --git a/node_modules/tslint/node_modules/resolve/lib/core.json b/node_modules/tslint/node_modules/resolve/lib/core.json
deleted file mode 100644
index 668301f7c..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/core.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "assert": true,
- "buffer_ieee754": "< 0.9.7",
- "buffer": true,
- "child_process": true,
- "cluster": true,
- "console": true,
- "constants": true,
- "crypto": true,
- "_debugger": "< 8",
- "dgram": true,
- "dns": true,
- "domain": true,
- "events": true,
- "freelist": "< 6",
- "fs": true,
- "http": true,
- "http2": ">= 8.8",
- "https": true,
- "_http_server": ">= 0.11",
- "_linklist": "< 8",
- "module": true,
- "net": true,
- "os": true,
- "path": true,
- "perf_hooks": ">= 8.5",
- "process": ">= 1",
- "punycode": true,
- "querystring": true,
- "readline": true,
- "repl": true,
- "stream": true,
- "string_decoder": true,
- "sys": true,
- "timers": true,
- "tls": true,
- "tty": true,
- "url": true,
- "util": true,
- "v8": ">= 1",
- "vm": true,
- "zlib": true
-}
diff --git a/node_modules/tslint/node_modules/resolve/lib/node-modules-paths.js b/node_modules/tslint/node_modules/resolve/lib/node-modules-paths.js
deleted file mode 100644
index a4bde6a96..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/node-modules-paths.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var path = require('path');
-var fs = require('fs');
-var parse = path.parse || require('path-parse');
-
-module.exports = function nodeModulesPaths(start, opts) {
- var modules = opts && opts.moduleDirectory
- ? [].concat(opts.moduleDirectory)
- : ['node_modules'];
-
- // ensure that `start` is an absolute path at this point,
- // resolving against the process' current working directory
- var absoluteStart = path.resolve(start);
-
- if (opts && opts.preserveSymlinks === false) {
- try {
- absoluteStart = fs.realpathSync(absoluteStart);
- } catch (err) {
- if (err.code !== 'ENOENT') {
- throw err;
- }
- }
- }
-
- var prefix = '/';
- if (/^([A-Za-z]:)/.test(absoluteStart)) {
- prefix = '';
- } else if (/^\\\\/.test(absoluteStart)) {
- prefix = '\\\\';
- }
-
- var paths = [absoluteStart];
- var parsed = parse(absoluteStart);
- while (parsed.dir !== paths[paths.length - 1]) {
- paths.push(parsed.dir);
- parsed = parse(parsed.dir);
- }
-
- var dirs = paths.reduce(function (dirs, aPath) {
- return dirs.concat(modules.map(function (moduleDir) {
- return path.join(prefix, aPath, moduleDir);
- }));
- }, []);
-
- return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
-};
diff --git a/node_modules/tslint/node_modules/resolve/lib/sync.js b/node_modules/tslint/node_modules/resolve/lib/sync.js
deleted file mode 100644
index bc9e287a1..000000000
--- a/node_modules/tslint/node_modules/resolve/lib/sync.js
+++ /dev/null
@@ -1,93 +0,0 @@
-var core = require('./core');
-var fs = require('fs');
-var path = require('path');
-var caller = require('./caller.js');
-var nodeModulesPaths = require('./node-modules-paths.js');
-
-module.exports = function (x, options) {
- if (typeof x !== 'string') {
- throw new TypeError('Path must be a string.');
- }
- var opts = options || {};
- var isFile = opts.isFile || function (file) {
- try {
- var stat = fs.statSync(file);
- } catch (e) {
- if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
- throw e;
- }
- return stat.isFile() || stat.isFIFO();
- };
- var readFileSync = opts.readFileSync || fs.readFileSync;
-
- var extensions = opts.extensions || ['.js'];
- var y = opts.basedir || path.dirname(caller());
-
- opts.paths = opts.paths || [];
-
- if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
- var res = path.resolve(y, x);
- if (x === '..' || x.slice(-1) === '/') res += '/';
- var m = loadAsFileSync(res) || loadAsDirectorySync(res);
- if (m) return m;
- } else {
- var n = loadNodeModulesSync(x, y);
- if (n) return n;
- }
-
- if (core[x]) return x;
-
- var err = new Error("Cannot find module '" + x + "' from '" + y + "'");
- err.code = 'MODULE_NOT_FOUND';
- throw err;
-
- function loadAsFileSync(x) {
- if (isFile(x)) {
- return x;
- }
-
- for (var i = 0; i < extensions.length; i++) {
- var file = x + extensions[i];
- if (isFile(file)) {
- return file;
- }
- }
- }
-
- function loadAsDirectorySync(x) {
- var pkgfile = path.join(x, '/package.json');
- if (isFile(pkgfile)) {
- try {
- var body = readFileSync(pkgfile, 'UTF8');
- var pkg = JSON.parse(body);
-
- if (opts.packageFilter) {
- pkg = opts.packageFilter(pkg, x);
- }
-
- if (pkg.main) {
- if (pkg.main === '.' || pkg.main === './') {
- pkg.main = 'index';
- }
- var m = loadAsFileSync(path.resolve(x, pkg.main));
- if (m) return m;
- var n = loadAsDirectorySync(path.resolve(x, pkg.main));
- if (n) return n;
- }
- } catch (e) {}
- }
-
- return loadAsFileSync(path.join(x, '/index'));
- }
-
- function loadNodeModulesSync(x, start) {
- var dirs = nodeModulesPaths(start, opts);
- for (var i = 0; i < dirs.length; i++) {
- var dir = dirs[i];
- var m = loadAsFileSync(path.join(dir, '/', x));
- if (m) return m;
- var n = loadAsDirectorySync(path.join(dir, '/', x));
- if (n) return n;
- }
- }
-};
diff --git a/node_modules/tslint/node_modules/resolve/package.json b/node_modules/tslint/node_modules/resolve/package.json
deleted file mode 100644
index add5b137e..000000000
--- a/node_modules/tslint/node_modules/resolve/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "resolve",
- "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
- "version": "1.5.0",
- "repository": {
- "type": "git",
- "url": "git://github.com/browserify/node-resolve.git"
- },
- "main": "index.js",
- "keywords": [
- "resolve",
- "require",
- "node",
- "module"
- ],
- "scripts": {
- "prepublish": "safe-publish-latest",
- "lint": "eslint .",
- "tests-only": "tape test/*.js",
- "pretest": "npm run lint",
- "test": "npm run --silent tests-only"
- },
- "devDependencies": {
- "@ljharb/eslint-config": "^12.2.1",
- "eslint": "^4.9.0",
- "object-keys": "^1.0.11",
- "safe-publish-latest": "^1.1.1",
- "tap": "0.4.13",
- "tape": "^4.8.0"
- },
- "license": "MIT",
- "author": {
- "name": "James Halliday",
- "email": "mail@substack.net",
- "url": "http://substack.net"
- },
- "dependencies": {
- "path-parse": "^1.0.5"
- }
-}
diff --git a/node_modules/tslint/node_modules/resolve/readme.markdown b/node_modules/tslint/node_modules/resolve/readme.markdown
deleted file mode 100644
index 6000624a4..000000000
--- a/node_modules/tslint/node_modules/resolve/readme.markdown
+++ /dev/null
@@ -1,160 +0,0 @@
-# resolve
-
-implements the [node `require.resolve()`
-algorithm](https://nodejs.org/api/modules.html#modules_all_together)
-such that you can `require.resolve()` on behalf of a file asynchronously and
-synchronously
-
-[![build status](https://secure.travis-ci.org/browserify/node-resolve.png)](http://travis-ci.org/browserify/node-resolve)
-
-# example
-
-asynchronously resolve:
-
-``` js
-var resolve = require('resolve');
-resolve('tap', { basedir: __dirname }, function (err, res) {
- if (err) console.error(err)
- else console.log(res)
-});
-```
-
-```
-$ node example/async.js
-/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
-```
-
-synchronously resolve:
-
-``` js
-var resolve = require('resolve');
-var res = resolve.sync('tap', { basedir: __dirname });
-console.log(res);
-```
-
-```
-$ node example/sync.js
-/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
-```
-
-# methods
-
-``` js
-var resolve = require('resolve')
-```
-
-## resolve(id, opts={}, cb)
-
-Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`.
-
-options are:
-
-* opts.basedir - directory to begin resolving from
-
-* opts.package - `package.json` data applicable to the module being loaded
-
-* opts.extensions - array of file extensions to search in order
-
-* opts.readFile - how to read files asynchronously
-
-* opts.isFile - function to asynchronously test whether a file exists
-
-* opts.packageFilter - transform the parsed package.json contents before looking
-at the "main" field
-
-* opts.pathFilter(pkg, path, relativePath) - transform a path within a package
- * pkg - package data
- * path - the path being resolved
- * relativePath - the path relative from the package.json location
- * returns - a relative path that will be joined from the package.json location
-
-* opts.paths - require.paths array to use if nothing is found on the normal
-node_modules recursive walk (probably don't use this)
-
-* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
-
-* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
-This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
-**Note:** this property is currently `true` by default but it will be changed to
-`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*.
-
-default `opts` values:
-
-``` javascript
-{
- paths: [],
- basedir: __dirname,
- extensions: [ '.js' ],
- readFile: fs.readFile,
- isFile: function (file, cb) {
- fs.stat(file, function (err, stat) {
- if (err && err.code === 'ENOENT') cb(null, false)
- else if (err) cb(err)
- else cb(null, stat.isFile())
- });
- },
- moduleDirectory: 'node_modules',
- preserveSymlinks: true
-}
-```
-
-## resolve.sync(id, opts)
-
-Synchronously resolve the module path string `id`, returning the result and
-throwing an error when `id` can't be resolved.
-
-options are:
-
-* opts.basedir - directory to begin resolving from
-
-* opts.extensions - array of file extensions to search in order
-
-* opts.readFile - how to read files synchronously
-
-* opts.isFile - function to synchronously test whether a file exists
-
-* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json
-* contents before looking at the "main" field
-
-* opts.paths - require.paths array to use if nothing is found on the normal
-node_modules recursive walk (probably don't use this)
-
-* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
-
-* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
-This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
-**Note:** this property is currently `true` by default but it will be changed to
-`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*.
-
-default `opts` values:
-
-``` javascript
-{
- paths: [],
- basedir: __dirname,
- extensions: [ '.js' ],
- readFileSync: fs.readFileSync,
- isFile: function (file) {
- try { return fs.statSync(file).isFile() }
- catch (e) { return false }
- },
- moduleDirectory: 'node_modules',
- preserveSymlinks: true
-}
-````
-
-## resolve.isCore(pkg)
-
-Return whether a package is in core.
-
-# install
-
-With [npm](https://npmjs.org) do:
-
-```
-npm install resolve
-```
-
-# license
-
-MIT
diff --git a/node_modules/tslint/node_modules/resolve/test/core.js b/node_modules/tslint/node_modules/resolve/test/core.js
deleted file mode 100644
index 978c867cb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/core.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var test = require('tape');
-var keys = require('object-keys');
-var resolve = require('../');
-
-test('core modules', function (t) {
- t.test('isCore()', function (st) {
- st.ok(resolve.isCore('fs'));
- st.ok(resolve.isCore('net'));
- st.ok(resolve.isCore('http'));
-
- st.ok(!resolve.isCore('seq'));
- st.ok(!resolve.isCore('../'));
- st.end();
- });
-
- t.test('core list', function (st) {
- var cores = keys(resolve.core);
- st.plan(cores.length);
-
- for (var i = 0; i < cores.length; ++i) {
- var mod = cores[i];
- if (resolve.core[mod]) {
- st.doesNotThrow(
- function () { require(mod); }, // eslint-disable-line no-loop-func
- 'requiring ' + mod + ' does not throw'
- );
- } else {
- st.skip(mod + ' not supported');
- }
- }
-
- st.end();
- });
-
- t.end();
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/dotdot.js b/node_modules/tslint/node_modules/resolve/test/dotdot.js
deleted file mode 100644
index 30806659b..000000000
--- a/node_modules/tslint/node_modules/resolve/test/dotdot.js
+++ /dev/null
@@ -1,29 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('dotdot', function (t) {
- t.plan(4);
- var dir = path.join(__dirname, '/dotdot/abc');
-
- resolve('..', { basedir: dir }, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(__dirname, 'dotdot/index.js'));
- });
-
- resolve('.', { basedir: dir }, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, 'index.js'));
- });
-});
-
-test('dotdot sync', function (t) {
- t.plan(2);
- var dir = path.join(__dirname, '/dotdot/abc');
-
- var a = resolve.sync('..', { basedir: dir });
- t.equal(a, path.join(__dirname, 'dotdot/index.js'));
-
- var b = resolve.sync('.', { basedir: dir });
- t.equal(b, path.join(dir, 'index.js'));
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/tslint/node_modules/resolve/test/dotdot/abc/index.js
deleted file mode 100644
index 67f2534eb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/dotdot/abc/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var x = require('..');
-console.log(x);
diff --git a/node_modules/tslint/node_modules/resolve/test/dotdot/index.js b/node_modules/tslint/node_modules/resolve/test/dotdot/index.js
deleted file mode 100644
index 643f9fcc6..000000000
--- a/node_modules/tslint/node_modules/resolve/test/dotdot/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'whatever';
diff --git a/node_modules/tslint/node_modules/resolve/test/faulty_basedir.js b/node_modules/tslint/node_modules/resolve/test/faulty_basedir.js
deleted file mode 100644
index e20d937ca..000000000
--- a/node_modules/tslint/node_modules/resolve/test/faulty_basedir.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var test = require('tape');
-var resolve = require('../');
-
-test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
- t.plan(1);
-
- var resolverDir = 'C:\\a\\b\\c\\d';
-
- resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
- t.equal(true, !!err);
- });
-
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/filter.js b/node_modules/tslint/node_modules/resolve/test/filter.js
deleted file mode 100644
index 51a753f16..000000000
--- a/node_modules/tslint/node_modules/resolve/test/filter.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('filter', function (t) {
- t.plan(2);
- var dir = path.join(__dirname, 'resolver');
- resolve('./baz', {
- basedir: dir,
- packageFilter: function (pkg) {
- pkg.main = 'doom';
- return pkg;
- }
- }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'baz/doom.js'));
- t.equal(pkg.main, 'doom');
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/filter_sync.js b/node_modules/tslint/node_modules/resolve/test/filter_sync.js
deleted file mode 100644
index fd4e97c28..000000000
--- a/node_modules/tslint/node_modules/resolve/test/filter_sync.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('filter', function (t) {
- var dir = path.join(__dirname, 'resolver');
- var res = resolve.sync('./baz', {
- basedir: dir,
- packageFilter: function (pkg) {
- pkg.main = 'doom';
- return pkg;
- }
- });
- t.equal(res, path.join(dir, 'baz/doom.js'));
- t.end();
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/mock.js b/node_modules/tslint/node_modules/resolve/test/mock.js
deleted file mode 100644
index a88059d45..000000000
--- a/node_modules/tslint/node_modules/resolve/test/mock.js
+++ /dev/null
@@ -1,143 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('mock', function (t) {
- t.plan(8);
-
- var files = {};
- files[path.resolve('/foo/bar/baz.js')] = 'beep';
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file, cb) {
- cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
- },
- readFile: function (file, cb) {
- cb(null, files[path.resolve(file)]);
- }
- };
- }
-
- resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/bar/baz.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/bar/baz.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('baz', opts('/foo/bar'), function (err, res) {
- t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-
- resolve('../baz', opts('/foo/bar'), function (err, res) {
- t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-});
-
-test('mock from package', function (t) {
- t.plan(8);
-
- var files = {};
- files[path.resolve('/foo/bar/baz.js')] = 'beep';
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file, cb) {
- cb(null, Object.prototype.hasOwnProperty.call(files, file));
- },
- 'package': { main: 'bar' },
- readFile: function (file, cb) {
- cb(null, files[file]);
- }
- };
- }
-
- resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/bar/baz.js'));
- t.equal(pkg && pkg.main, 'bar');
- });
-
- resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/bar/baz.js'));
- t.equal(pkg && pkg.main, 'bar');
- });
-
- resolve('baz', opts('/foo/bar'), function (err, res) {
- t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-
- resolve('../baz', opts('/foo/bar'), function (err, res) {
- t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-});
-
-test('mock package', function (t) {
- t.plan(2);
-
- var files = {};
- files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
- files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
- main: './baz.js'
- });
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file, cb) {
- cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
- },
- readFile: function (file, cb) {
- cb(null, files[path.resolve(file)]);
- }
- };
- }
-
- resolve('bar', opts('/foo'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
- t.equal(pkg && pkg.main, './baz.js');
- });
-});
-
-test('mock package from package', function (t) {
- t.plan(2);
-
- var files = {};
- files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
- files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
- main: './baz.js'
- });
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file, cb) {
- cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
- },
- 'package': { main: 'bar' },
- readFile: function (file, cb) {
- cb(null, files[path.resolve(file)]);
- }
- };
- }
-
- resolve('bar', opts('/foo'), function (err, res, pkg) {
- if (err) return t.fail(err);
- t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
- t.equal(pkg && pkg.main, './baz.js');
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/mock_sync.js b/node_modules/tslint/node_modules/resolve/test/mock_sync.js
deleted file mode 100644
index 43af10289..000000000
--- a/node_modules/tslint/node_modules/resolve/test/mock_sync.js
+++ /dev/null
@@ -1,67 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('mock', function (t) {
- t.plan(4);
-
- var files = {};
- files[path.resolve('/foo/bar/baz.js')] = 'beep';
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file) {
- return Object.prototype.hasOwnProperty.call(files, file);
- },
- readFileSync: function (file) {
- return files[file];
- }
- };
- }
-
- t.equal(
- resolve.sync('./baz', opts('/foo/bar')),
- path.resolve('/foo/bar/baz.js')
- );
-
- t.equal(
- resolve.sync('./baz.js', opts('/foo/bar')),
- path.resolve('/foo/bar/baz.js')
- );
-
- t.throws(function () {
- resolve.sync('baz', opts('/foo/bar'));
- });
-
- t.throws(function () {
- resolve.sync('../baz', opts('/foo/bar'));
- });
-});
-
-test('mock package', function (t) {
- t.plan(1);
-
- var files = {};
- files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
- files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
- main: './baz.js'
- });
-
- function opts(basedir) {
- return {
- basedir: path.resolve(basedir),
- isFile: function (file) {
- return Object.prototype.hasOwnProperty.call(files, file);
- },
- readFileSync: function (file) {
- return files[file];
- }
- };
- }
-
- t.equal(
- resolve.sync('bar', opts('/foo')),
- path.resolve('/foo/node_modules/bar/baz.js')
- );
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/module_dir.js b/node_modules/tslint/node_modules/resolve/test/module_dir.js
deleted file mode 100644
index b50e5bb17..000000000
--- a/node_modules/tslint/node_modules/resolve/test/module_dir.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('moduleDirectory strings', function (t) {
- t.plan(4);
- var dir = path.join(__dirname, 'module_dir');
- var xopts = {
- basedir: dir,
- moduleDirectory: 'xmodules'
- };
- resolve('aaa', xopts, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
- });
-
- var yopts = {
- basedir: dir,
- moduleDirectory: 'ymodules'
- };
- resolve('aaa', yopts, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
- });
-});
-
-test('moduleDirectory array', function (t) {
- t.plan(6);
- var dir = path.join(__dirname, 'module_dir');
- var aopts = {
- basedir: dir,
- moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
- };
- resolve('aaa', aopts, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
- });
-
- var bopts = {
- basedir: dir,
- moduleDirectory: ['zmodules', 'ymodules', 'xmodules']
- };
- resolve('aaa', bopts, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
- });
-
- var copts = {
- basedir: dir,
- moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
- };
- resolve('bbb', copts, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, '/zmodules/bbb/main.js'));
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/tslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
deleted file mode 100644
index dd7cf7b2d..000000000
--- a/node_modules/tslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = function (x) { return x * 100; };
diff --git a/node_modules/tslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/tslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
deleted file mode 100644
index ef2d4d4bf..000000000
--- a/node_modules/tslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = function (x) { return x + 100; };
diff --git a/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
deleted file mode 100644
index e8ba62993..000000000
--- a/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = function (n) { return n * 111; };
diff --git a/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
deleted file mode 100644
index c13b8cf6a..000000000
--- a/node_modules/tslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "main": "main.js"
-}
diff --git a/node_modules/tslint/node_modules/resolve/test/node-modules-paths.js b/node_modules/tslint/node_modules/resolve/test/node-modules-paths.js
deleted file mode 100644
index a917f063a..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node-modules-paths.js
+++ /dev/null
@@ -1,93 +0,0 @@
-var test = require('tape');
-var path = require('path');
-var parse = path.parse || require('path-parse');
-var keys = require('object-keys');
-
-var nodeModulesPaths = require('../lib/node-modules-paths');
-
-var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) {
- var moduleDirs = [].concat(moduleDirectories || 'node_modules');
-
- var foundModuleDirs = {};
- var uniqueDirs = {};
- var parsedDirs = {};
- for (var i = 0; i < dirs.length; ++i) {
- var parsed = parse(dirs[i]);
- if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; }
- foundModuleDirs[parsed.base] += 1;
- parsedDirs[parsed.dir] = true;
- uniqueDirs[dirs[i]] = true;
- }
- t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has');
- var foundModuleDirNames = keys(foundModuleDirs);
- t.deepEqual(foundModuleDirNames, moduleDirs.concat(paths || []), 'all desired module dirs were found');
- t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique');
-
- var counts = {};
- for (var j = 0; j < foundModuleDirNames.length; ++j) {
- counts[foundModuleDirs[j]] = true;
- }
- t.equal(keys(counts).length, 1, 'all found module directories had the same count');
-};
-
-test('node-modules-paths', function (t) {
- t.test('no options', function (t) {
- var start = path.join(__dirname, 'resolver');
- var dirs = nodeModulesPaths(start);
-
- verifyDirs(t, start, dirs);
-
- t.end();
- });
-
- t.test('empty options', function (t) {
- var start = path.join(__dirname, 'resolver');
- var dirs = nodeModulesPaths(start, {});
-
- verifyDirs(t, start, dirs);
-
- t.end();
- });
-
- t.test('with paths option', function (t) {
- var start = path.join(__dirname, 'resolver');
- var paths = ['a', 'b'];
- var dirs = nodeModulesPaths(start, { paths: paths });
-
- verifyDirs(t, start, dirs, null, paths);
-
- t.end();
- });
-
- t.test('with moduleDirectory option', function (t) {
- var start = path.join(__dirname, 'resolver');
- var moduleDirectory = 'not node modules';
- var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory });
-
- verifyDirs(t, start, dirs, moduleDirectory);
-
- t.end();
- });
-
- t.test('with 1 moduleDirectory and paths options', function (t) {
- var start = path.join(__dirname, 'resolver');
- var paths = ['a', 'b'];
- var moduleDirectory = 'not node modules';
- var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory });
-
- verifyDirs(t, start, dirs, moduleDirectory, paths);
-
- t.end();
- });
-
- t.test('with 1+ moduleDirectory and paths options', function (t) {
- var start = path.join(__dirname, 'resolver');
- var paths = ['a', 'b'];
- var moduleDirectories = ['not node modules', 'other modules'];
- var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
-
- verifyDirs(t, start, dirs, moduleDirectories, paths);
-
- t.end();
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/node_path.js b/node_modules/tslint/node_modules/resolve/test/node_path.js
deleted file mode 100644
index 38a7d7e7d..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node_path.js
+++ /dev/null
@@ -1,49 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('$NODE_PATH', function (t) {
- t.plan(4);
-
- resolve('aaa', {
- paths: [
- path.join(__dirname, '/node_path/x'),
- path.join(__dirname, '/node_path/y')
- ],
- basedir: __dirname
- }, function (err, res) {
- t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'));
- });
-
- resolve('bbb', {
- paths: [
- path.join(__dirname, '/node_path/x'),
- path.join(__dirname, '/node_path/y')
- ],
- basedir: __dirname
- }, function (err, res) {
- t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'));
- });
-
- resolve('ccc', {
- paths: [
- path.join(__dirname, '/node_path/x'),
- path.join(__dirname, '/node_path/y')
- ],
- basedir: __dirname
- }, function (err, res) {
- t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'));
- });
-
- // ensure that relative paths still resolve against the
- // regular `node_modules` correctly
- resolve('tap', {
- paths: [
- 'node_path'
- ],
- basedir: 'node_path/x'
- }, function (err, res) {
- var root = require('tap/package.json').main;
- t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root));
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/tslint/node_modules/resolve/test/node_path/x/aaa/index.js
deleted file mode 100644
index ad70d0bb0..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node_path/x/aaa/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'A';
diff --git a/node_modules/tslint/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/tslint/node_modules/resolve/test/node_path/x/ccc/index.js
deleted file mode 100644
index a64132e4c..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node_path/x/ccc/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'C';
diff --git a/node_modules/tslint/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/tslint/node_modules/resolve/test/node_path/y/bbb/index.js
deleted file mode 100644
index 4d0f32e24..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node_path/y/bbb/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'B';
diff --git a/node_modules/tslint/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/tslint/node_modules/resolve/test/node_path/y/ccc/index.js
deleted file mode 100644
index 793315e84..000000000
--- a/node_modules/tslint/node_modules/resolve/test/node_path/y/ccc/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'CY';
diff --git a/node_modules/tslint/node_modules/resolve/test/nonstring.js b/node_modules/tslint/node_modules/resolve/test/nonstring.js
deleted file mode 100644
index ef63c40f9..000000000
--- a/node_modules/tslint/node_modules/resolve/test/nonstring.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var test = require('tape');
-var resolve = require('../');
-
-test('nonstring', function (t) {
- t.plan(1);
- resolve(555, function (err, res, pkg) {
- t.ok(err);
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/pathfilter.js b/node_modules/tslint/node_modules/resolve/test/pathfilter.js
deleted file mode 100644
index 733045a06..000000000
--- a/node_modules/tslint/node_modules/resolve/test/pathfilter.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('#62: deep module references and the pathFilter', function (t) {
- t.plan(9);
-
- var resolverDir = path.join(__dirname, '/pathfilter/deep_ref');
- var pathFilter = function (pkg, x, remainder) {
- t.equal(pkg.version, '1.2.3');
- t.equal(x, path.join(resolverDir, 'node_modules/deep/ref'));
- t.equal(remainder, 'ref');
- return 'alt';
- };
-
- resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) {
- if (err) t.fail(err);
-
- t.equal(pkg.version, '1.2.3');
- t.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
- });
-
- resolve(
- 'deep/deeper/ref',
- { basedir: resolverDir },
- function (err, res, pkg) {
- if (err) t.fail(err);
- t.notEqual(pkg, undefined);
- t.equal(pkg.version, '1.2.3');
- t.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
- }
- );
-
- resolve(
- 'deep/ref',
- { basedir: resolverDir, pathFilter: pathFilter },
- function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
- }
- );
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/tslint/node_modules/resolve/test/pathfilter/deep_ref/main.js
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/pathfilter/deep_ref/main.js
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence.js b/node_modules/tslint/node_modules/resolve/test/precedence.js
deleted file mode 100644
index 2febb598f..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('precedence', function (t) {
- t.plan(3);
- var dir = path.join(__dirname, 'precedence/aaa');
-
- resolve('./', { basedir: dir }, function (err, res, pkg) {
- t.ifError(err);
- t.equal(res, path.join(dir, 'index.js'));
- t.equal(pkg.name, 'resolve');
- });
-});
-
-test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string
- t.plan(1);
- var dir = path.join(__dirname, 'precedence/bbb');
-
- resolve('./', { basedir: dir }, function (err, res, pkg) {
- t.ok(err);
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence/aaa.js b/node_modules/tslint/node_modules/resolve/test/precedence/aaa.js
deleted file mode 100644
index b83a3e7ad..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence/aaa.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'wtf';
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/tslint/node_modules/resolve/test/precedence/aaa/index.js
deleted file mode 100644
index e0f8f6abf..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence/aaa/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 'okok';
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/tslint/node_modules/resolve/test/precedence/aaa/main.js
deleted file mode 100644
index 93542a965..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence/aaa/main.js
+++ /dev/null
@@ -1 +0,0 @@
-console.log(require('./'));
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence/bbb.js b/node_modules/tslint/node_modules/resolve/test/precedence/bbb.js
deleted file mode 100644
index 2298f47fd..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence/bbb.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = '>_<';
diff --git a/node_modules/tslint/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/tslint/node_modules/resolve/test/precedence/bbb/main.js
deleted file mode 100644
index 716b81d4b..000000000
--- a/node_modules/tslint/node_modules/resolve/test/precedence/bbb/main.js
+++ /dev/null
@@ -1 +0,0 @@
-console.log(require('./')); // should throw
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver.js b/node_modules/tslint/node_modules/resolve/test/resolver.js
deleted file mode 100644
index 56641dfde..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver.js
+++ /dev/null
@@ -1,349 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('async foo', function (t) {
- t.plan(10);
- var dir = path.join(__dirname, 'resolver');
-
- resolve('./foo', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'foo.js'));
- t.equal(pkg && pkg.name, 'resolve');
- });
-
- resolve('./foo.js', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'foo.js'));
- t.equal(pkg && pkg.name, 'resolve');
- });
-
- resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'foo.js'));
- t.equal(pkg && pkg.main, 'resolver');
- });
-
- resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'foo.js'));
- t.equal(pkg.main, 'resolver');
- });
-
- resolve('foo', { basedir: dir }, function (err) {
- t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-});
-
-test('bar', function (t) {
- t.plan(6);
- var dir = path.join(__dirname, 'resolver');
-
- resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
- t.equal(pkg, undefined);
- });
-});
-
-test('baz', function (t) {
- t.plan(4);
- var dir = path.join(__dirname, 'resolver');
-
- resolve('./baz', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'baz/quux.js'));
- t.equal(pkg.main, 'quux.js');
- });
-
- resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'baz/quux.js'));
- t.equal(pkg.main, 'quux.js');
- });
-});
-
-test('biz', function (t) {
- t.plan(24);
- var dir = path.join(__dirname, 'resolver/biz/node_modules');
-
- resolve('./grux', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'grux/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'grux/index.js'));
- t.equal(pkg.main, 'biz');
- });
-
- resolve('./garply', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'garply/lib/index.js'));
- t.equal(pkg.main, './lib');
- });
-
- resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'garply/lib/index.js'));
- t.equal(pkg.main, './lib');
- });
-
- resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'tiv/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'tiv/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'tiv/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'tiv/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'grux/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'grux/index.js'));
- t.equal(pkg, undefined);
- });
-
- resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'garply/lib/index.js'));
- t.equal(pkg.main, './lib');
- });
-
- resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'garply/lib/index.js'));
- t.equal(pkg.main, './lib');
- });
-});
-
-test('quux', function (t) {
- t.plan(2);
- var dir = path.join(__dirname, 'resolver/quux');
-
- resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'foo/index.js'));
- t.equal(pkg.main, 'quux');
- });
-});
-
-test('normalize', function (t) {
- t.plan(2);
- var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');
-
- resolve('../grux', { basedir: dir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'index.js'));
- t.equal(pkg, undefined);
- });
-});
-
-test('cup', function (t) {
- t.plan(4);
- var dir = path.join(__dirname, 'resolver');
-
- resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'cup.coffee'));
- });
-
- resolve('./cup.coffee', { basedir: dir }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'cup.coffee'));
- });
-
- resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) {
- t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-});
-
-test('mug', function (t) {
- t.plan(3);
- var dir = path.join(__dirname, 'resolver');
-
- resolve('./mug', { basedir: dir }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'mug.js'));
- });
-
- resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, '/mug.coffee'));
- });
-
- resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
- t.equal(res, path.join(dir, '/mug.js'));
- });
-});
-
-test('other path', function (t) {
- t.plan(6);
- var resolverDir = path.join(__dirname, 'resolver');
- var dir = path.join(resolverDir, 'bar');
- var otherDir = path.join(resolverDir, 'other_path');
-
- resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(resolverDir, 'other_path/root.js'));
- });
-
- resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) {
- if (err) t.fail(err);
- t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js'));
- });
-
- resolve('root', { basedir: dir }, function (err, res) {
- t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-
- resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) {
- t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'");
- t.equal(err.code, 'MODULE_NOT_FOUND');
- });
-});
-
-test('incorrect main', function (t) {
- t.plan(1);
-
- var resolverDir = path.join(__dirname, 'resolver');
- var dir = path.join(resolverDir, 'incorrect_main');
-
- resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'index.js'));
- });
-});
-
-test('without basedir', function (t) {
- t.plan(1);
-
- var dir = path.join(__dirname, 'resolver/without_basedir');
- var tester = require(path.join(dir, 'main.js'));
-
- tester(t, function (err, res, pkg) {
- if (err) {
- t.fail(err);
- } else {
- t.equal(res, path.join(dir, 'node_modules/mymodule.js'));
- }
- });
-});
-
-test('#25: node modules with the same name as node stdlib modules', function (t) {
- t.plan(1);
-
- var resolverDir = path.join(__dirname, 'resolver/punycode');
-
- resolve('punycode', { basedir: resolverDir }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(resolverDir, 'node_modules/punycode/index.js'));
- });
-});
-
-test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {
- t.plan(2);
-
- var dir = path.join(__dirname, 'resolver');
-
- resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'same_names/foo.js'));
- });
-
- resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(dir, 'same_names/foo/index.js'));
- });
-});
-
-test('async: #121 - treating an existing file as a dir when no basedir', function (t) {
- var testFile = path.basename(__filename);
-
- t.test('sanity check', function (st) {
- st.plan(1);
- resolve('./' + testFile, function (err, res, pkg) {
- if (err) t.fail(err);
- st.equal(res, __filename, 'sanity check');
- });
- });
-
- t.test('with a fake directory', function (st) {
- st.plan(4);
-
- resolve('./' + testFile + '/blah', function (err, res, pkg) {
- st.ok(err, 'there is an error');
- st.notOk(res, 'no result');
-
- st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
- st.equal(
- err && err.message,
- 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
- 'can not find nonexistent module'
- );
- st.end();
- });
- });
-
- t.end();
-});
-
-test('async dot main', function (t) {
- var start = new Date();
- t.plan(3);
- resolve('./resolver/dot_main', function (err, ret) {
- t.notOk(err);
- t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js'));
- t.ok(new Date() - start < 50, 'resolve.sync timedout');
- t.end();
- });
-});
-
-test('async dot slash main', function (t) {
- var start = new Date();
- t.plan(3);
- resolve('./resolver/dot_slash_main', function (err, ret) {
- t.notOk(err);
- t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js'));
- t.ok(new Date() - start < 50, 'resolve.sync timedout');
- t.end();
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/tslint/node_modules/resolve/test/resolver/baz/doom.js
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/baz/doom.js
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/baz/package.json b/node_modules/tslint/node_modules/resolve/test/resolver/baz/package.json
deleted file mode 100644
index c41e4dbf7..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/baz/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "main": "quux.js"
-}
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/tslint/node_modules/resolve/test/resolver/baz/quux.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/baz/quux.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/cup.coffee b/node_modules/tslint/node_modules/resolve/test/resolver/cup.coffee
deleted file mode 100644
index 8b1378917..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/cup.coffee
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/index.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/package.json
deleted file mode 100644
index d7f4fc807..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/dot_main/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "main": "."
-}
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/index.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/package.json
deleted file mode 100644
index f51287b9d..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/dot_slash_main/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "main": "./"
-}
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/foo.js b/node_modules/tslint/node_modules/resolve/test/resolver/foo.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/foo.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/index.js
deleted file mode 100644
index bc1fb0a6f..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/package.json
deleted file mode 100644
index b71880417..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/incorrect_main/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "main": "wrong.js"
-}
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/mug.coffee b/node_modules/tslint/node_modules/resolve/test/resolver/mug.coffee
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/mug.coffee
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/mug.js b/node_modules/tslint/node_modules/resolve/test/resolver/mug.js
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/mug.js
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/tslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/tslint/node_modules/resolve/test/resolver/other_path/root.js
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/other_path/root.js
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/tslint/node_modules/resolve/test/resolver/quux/foo/index.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/quux/foo/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo.js
deleted file mode 100644
index 888cae37a..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 42;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo/index.js
deleted file mode 100644
index bd816eaba..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/same_names/foo/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/tslint/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep
+++ /dev/null
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/tslint/node_modules/resolve/test/resolver/without_basedir/main.js
deleted file mode 100644
index 5b31975be..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver/without_basedir/main.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var resolve = require('../../../');
-
-module.exports = function (t, cb) {
- resolve('mymodule', null, cb);
-};
diff --git a/node_modules/tslint/node_modules/resolve/test/resolver_sync.js b/node_modules/tslint/node_modules/resolve/test/resolver_sync.js
deleted file mode 100644
index 8e33dca69..000000000
--- a/node_modules/tslint/node_modules/resolve/test/resolver_sync.js
+++ /dev/null
@@ -1,267 +0,0 @@
-var path = require('path');
-var test = require('tape');
-var resolve = require('../');
-
-test('foo', function (t) {
- var dir = path.join(__dirname, 'resolver');
-
- t.equal(
- resolve.sync('./foo', { basedir: dir }),
- path.join(dir, 'foo.js')
- );
-
- t.equal(
- resolve.sync('./foo.js', { basedir: dir }),
- path.join(dir, 'foo.js')
- );
-
- t.throws(function () {
- resolve.sync('foo', { basedir: dir });
- });
-
- t.end();
-});
-
-test('bar', function (t) {
- var dir = path.join(__dirname, 'resolver');
-
- t.equal(
- resolve.sync('foo', { basedir: path.join(dir, 'bar') }),
- path.join(dir, 'bar/node_modules/foo/index.js')
- );
- t.end();
-});
-
-test('baz', function (t) {
- var dir = path.join(__dirname, 'resolver');
-
- t.equal(
- resolve.sync('./baz', { basedir: dir }),
- path.join(dir, 'baz/quux.js')
- );
- t.end();
-});
-
-test('biz', function (t) {
- var dir = path.join(__dirname, 'resolver/biz/node_modules');
- t.equal(
- resolve.sync('./grux', { basedir: dir }),
- path.join(dir, 'grux/index.js')
- );
-
- t.equal(
- resolve.sync('tiv', { basedir: path.join(dir, 'grux') }),
- path.join(dir, 'tiv/index.js')
- );
-
- t.equal(
- resolve.sync('grux', { basedir: path.join(dir, 'tiv') }),
- path.join(dir, 'grux/index.js')
- );
- t.end();
-});
-
-test('normalize', function (t) {
- var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');
- t.equal(
- resolve.sync('../grux', { basedir: dir }),
- path.join(dir, 'index.js')
- );
- t.end();
-});
-
-test('cup', function (t) {
- var dir = path.join(__dirname, 'resolver');
- t.equal(
- resolve.sync('./cup', {
- basedir: dir,
- extensions: ['.js', '.coffee']
- }),
- path.join(dir, 'cup.coffee')
- );
-
- t.equal(
- resolve.sync('./cup.coffee', { basedir: dir }),
- path.join(dir, 'cup.coffee')
- );
-
- t.throws(function () {
- resolve.sync('./cup', {
- basedir: dir,
- extensions: ['.js']
- });
- });
-
- t.end();
-});
-
-test('mug', function (t) {
- var dir = path.join(__dirname, 'resolver');
- t.equal(
- resolve.sync('./mug', { basedir: dir }),
- path.join(dir, 'mug.js')
- );
-
- t.equal(
- resolve.sync('./mug', {
- basedir: dir,
- extensions: ['.coffee', '.js']
- }),
- path.join(dir, 'mug.coffee')
- );
-
- t.equal(
- resolve.sync('./mug', {
- basedir: dir,
- extensions: ['.js', '.coffee']
- }),
- path.join(dir, 'mug.js')
- );
-
- t.end();
-});
-
-test('other path', function (t) {
- var resolverDir = path.join(__dirname, 'resolver');
- var dir = path.join(resolverDir, 'bar');
- var otherDir = path.join(resolverDir, 'other_path');
-
- t.equal(
- resolve.sync('root', {
- basedir: dir,
- paths: [otherDir]
- }),
- path.join(resolverDir, 'other_path/root.js')
- );
-
- t.equal(
- resolve.sync('lib/other-lib', {
- basedir: dir,
- paths: [otherDir]
- }),
- path.join(resolverDir, 'other_path/lib/other-lib.js')
- );
-
- t.throws(function () {
- resolve.sync('root', { basedir: dir });
- });
-
- t.throws(function () {
- resolve.sync('zzz', {
- basedir: dir,
- paths: [otherDir]
- });
- });
-
- t.end();
-});
-
-test('incorrect main', function (t) {
- var resolverDir = path.join(__dirname, 'resolver');
- var dir = path.join(resolverDir, 'incorrect_main');
-
- t.equal(
- resolve.sync('./incorrect_main', { basedir: resolverDir }),
- path.join(dir, 'index.js')
- );
-
- t.end();
-});
-
-test('#25: node modules with the same name as node stdlib modules', function (t) {
- var resolverDir = path.join(__dirname, 'resolver/punycode');
-
- t.equal(
- resolve.sync('punycode', { basedir: resolverDir }),
- path.join(resolverDir, 'node_modules/punycode/index.js')
- );
-
- t.end();
-});
-
-var stubStatSync = function stubStatSync(fn) {
- var fs = require('fs');
- var statSync = fs.statSync;
- try {
- fs.statSync = function () {
- throw new EvalError('Unknown Error');
- };
- return fn();
- } finally {
- fs.statSync = statSync;
- }
-};
-
-test('#79 - re-throw non ENOENT errors from stat', function (t) {
- var dir = path.join(__dirname, 'resolver');
-
- stubStatSync(function () {
- t.throws(function () {
- resolve.sync('foo', { basedir: dir });
- }, /Unknown Error/);
- });
-
- t.end();
-});
-
-test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {
- var dir = path.join(__dirname, 'resolver');
-
- t.equal(
- resolve.sync('./foo', { basedir: path.join(dir, 'same_names') }),
- path.join(dir, 'same_names/foo.js')
- );
- t.equal(
- resolve.sync('./foo/', { basedir: path.join(dir, 'same_names') }),
- path.join(dir, 'same_names/foo/index.js')
- );
- t.end();
-});
-
-test('sync: #121 - treating an existing file as a dir when no basedir', function (t) {
- var testFile = path.basename(__filename);
-
- t.test('sanity check', function (st) {
- st.equal(
- resolve.sync('./' + testFile),
- __filename,
- 'sanity check'
- );
- st.end();
- });
-
- t.test('with a fake directory', function (st) {
- function run() { return resolve.sync('./' + testFile + '/blah'); }
-
- st.throws(run, 'throws an error');
-
- try {
- run();
- } catch (e) {
- st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
- st.equal(
- e.message,
- 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
- 'can not find nonexistent module'
- );
- }
-
- st.end();
- });
-
- t.end();
-});
-
-test('sync dot main', function (t) {
- var start = new Date();
- t.equal(resolve.sync('./resolver/dot_main'), path.join(__dirname, 'resolver/dot_main/index.js'));
- t.ok(new Date() - start < 50, 'resolve.sync timedout');
- t.end();
-});
-
-test('sync dot slash main', function (t) {
- var start = new Date();
- t.equal(resolve.sync('./resolver/dot_slash_main'), path.join(__dirname, 'resolver/dot_slash_main/index.js'));
- t.ok(new Date() - start < 50, 'resolve.sync timedout');
- t.end();
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/subdirs.js b/node_modules/tslint/node_modules/resolve/test/subdirs.js
deleted file mode 100644
index b7b8450a9..000000000
--- a/node_modules/tslint/node_modules/resolve/test/subdirs.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var test = require('tape');
-var resolve = require('../');
-var path = require('path');
-
-test('subdirs', function (t) {
- t.plan(2);
-
- var dir = path.join(__dirname, '/subdirs');
- resolve('a/b/c/x.json', { basedir: dir }, function (err, res) {
- t.ifError(err);
- t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json'));
- });
-});
diff --git a/node_modules/tslint/node_modules/resolve/test/symlinks.js b/node_modules/tslint/node_modules/resolve/test/symlinks.js
deleted file mode 100644
index 544a02371..000000000
--- a/node_modules/tslint/node_modules/resolve/test/symlinks.js
+++ /dev/null
@@ -1,54 +0,0 @@
-var path = require('path');
-var fs = require('fs');
-var test = require('tape');
-var resolve = require('../');
-
-var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink');
-try {
- fs.unlinkSync(symlinkDir);
-} catch (err) {}
-try {
- fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir');
-} catch (err) {
- // if fails then it is probably on Windows and lets try to create a junction
- fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction');
-}
-
-test('symlink', function (t) {
- t.plan(1);
-
- resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) {
- if (err) t.fail(err);
- t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
- });
-});
-
-test('sync symlink when preserveSymlinks = true', function (t) {
- t.plan(4);
-
- resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) {
- t.ok(err, 'there is an error');
- t.notOk(res, 'no result');
-
- t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
- t.equal(
- err && err.message,
- 'Cannot find module \'foo\' from \'' + symlinkDir + '\'',
- 'can not find nonexistent module'
- );
- });
-});
-
-test('sync symlink', function (t) {
- var start = new Date();
- t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
- t.ok(new Date() - start < 50, 'resolve.sync timedout');
- t.end();
-});
-
-test('sync symlink when preserveSymlinks = true', function (t) {
- t.throws(function () {
- resolve.sync('foo', { basedir: symlinkDir });
- }, /Cannot find module 'foo'/);
- t.end();
-});
diff --git a/node_modules/tslint/package.json b/node_modules/tslint/package.json
index 2b32392eb..ebee3682c 100644
--- a/node_modules/tslint/package.json
+++ b/node_modules/tslint/package.json
@@ -1,6 +1,6 @@
{
"name": "tslint",
- "version": "5.8.0",
+ "version": "5.11.0",
"description": "An extensible static analysis linter for the TypeScript language",
"bin": {
"tslint": "./bin/tslint"
@@ -26,7 +26,7 @@
"compile:scripts": "tsc -p scripts",
"compile:test": "tsc -p test",
"lint": "npm-run-all -p lint:global lint:from-bin",
- "lint:global": "tslint --project test/tsconfig.json --format stylish # test includes 'src' too",
+ "lint:global": "tslint --project test/tsconfig.json --format stylish",
"lint:from-bin": "node bin/tslint --project test/tsconfig.json --format stylish",
"publish:local": "./scripts/npmPublish.sh",
"test": "npm-run-all test:pre -p test:mocha test:rules",
@@ -39,24 +39,23 @@
"dependencies": {
"babel-code-frame": "^6.22.0",
"builtin-modules": "^1.1.1",
- "chalk": "^2.1.0",
- "commander": "^2.9.0",
+ "chalk": "^2.3.0",
+ "commander": "^2.12.1",
"diff": "^3.2.0",
"glob": "^7.1.1",
+ "js-yaml": "^3.7.0",
"minimatch": "^3.0.4",
"resolve": "^1.3.2",
"semver": "^5.3.0",
- "tslib": "^1.7.1",
- "tsutils": "^2.12.1"
+ "tslib": "^1.8.0",
+ "tsutils": "^2.27.2"
},
"peerDependencies": {
- "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev"
+ "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev"
},
"devDependencies": {
"@types/babel-code-frame": "^6.20.0",
"@types/chai": "^3.5.0",
- "@types/chalk": "^0.4.31",
- "@types/commander": "^2.9.0",
"@types/diff": "^3.2.0",
"@types/glob": "^5.0.30",
"@types/js-yaml": "^3.5.31",
@@ -68,19 +67,18 @@
"@types/semver": "^5.3.30",
"chai": "^3.5.0",
"github": "^8.2.1",
- "js-yaml": "^3.7.0",
"json-stringify-pretty-compact": "^1.0.3",
"mocha": "^3.2.0",
"npm-run-all": "^4.0.2",
"nyc": "^10.2.0",
"rimraf": "^2.5.4",
"ts-node": "^3.3.0",
- "tslint": "^5.7.0",
+ "tslint": "^5.8.0",
"tslint-test-config-non-relative": "file:test/external/tslint-test-config-non-relative",
- "typescript": "~2.5.1"
+ "typescript": "~2.9.2"
},
"license": "Apache-2.0",
"engines": {
- "node": ">=4.1.2"
+ "node": ">=4.8.0"
}
}