aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-28 00:38:50 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-28 00:40:43 +0200
commit7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch)
tree6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/tslint/lib
parent963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff)
downloadwallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/tslint/lib')
-rw-r--r--node_modules/tslint/lib/configs/all.d.ts148
-rw-r--r--node_modules/tslint/lib/configs/all.js254
-rw-r--r--node_modules/tslint/lib/configs/latest.d.ts28
-rw-r--r--node_modules/tslint/lib/configs/latest.js41
-rw-r--r--node_modules/tslint/lib/configs/recommended.d.ts236
-rw-r--r--node_modules/tslint/lib/configs/recommended.js305
-rw-r--r--node_modules/tslint/lib/configuration.d.ts104
-rw-r--r--node_modules/tslint/lib/configuration.js439
-rw-r--r--node_modules/tslint/lib/enableDisableRules.d.ts3
-rw-r--r--node_modules/tslint/lib/enableDisableRules.js148
-rw-r--r--node_modules/tslint/lib/error.d.ts22
-rw-r--r--node_modules/tslint/lib/error.js48
-rw-r--r--node_modules/tslint/lib/formatterLoader.d.ts2
-rw-r--r--node_modules/tslint/lib/formatterLoader.js74
-rw-r--r--node_modules/tslint/lib/formatters.d.ts18
-rw-r--r--node_modules/tslint/lib/formatters.js23
-rw-r--r--node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts24
-rw-r--r--node_modules/tslint/lib/formatters/checkstyleFormatter.js78
-rw-r--r--node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/codeFrameFormatter.js79
-rw-r--r--node_modules/tslint/lib/formatters/fileslistFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/fileslistFormatter.js52
-rw-r--r--node_modules/tslint/lib/formatters/index.d.ts24
-rw-r--r--node_modules/tslint/lib/formatters/index.js34
-rw-r--r--node_modules/tslint/lib/formatters/jsonFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/jsonFormatter.js42
-rw-r--r--node_modules/tslint/lib/formatters/msbuildFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/msbuildFormatter.js51
-rw-r--r--node_modules/tslint/lib/formatters/pmdFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/pmdFormatter.js60
-rw-r--r--node_modules/tslint/lib/formatters/proseFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/proseFormatter.js62
-rw-r--r--node_modules/tslint/lib/formatters/stylishFormatter.d.ts27
-rw-r--r--node_modules/tslint/lib/formatters/stylishFormatter.js111
-rw-r--r--node_modules/tslint/lib/formatters/tapFormatter.d.ts24
-rw-r--r--node_modules/tslint/lib/formatters/tapFormatter.js64
-rw-r--r--node_modules/tslint/lib/formatters/verboseFormatter.d.ts24
-rw-r--r--node_modules/tslint/lib/formatters/verboseFormatter.js50
-rw-r--r--node_modules/tslint/lib/formatters/vsoFormatter.d.ts23
-rw-r--r--node_modules/tslint/lib/formatters/vsoFormatter.js54
-rw-r--r--node_modules/tslint/lib/index.d.ts46
-rw-r--r--node_modules/tslint/lib/index.js39
-rw-r--r--node_modules/tslint/lib/language/formatter/abstractFormatter.d.ts22
-rw-r--r--node_modules/tslint/lib/language/formatter/abstractFormatter.js24
-rw-r--r--node_modules/tslint/lib/language/formatter/formatter.d.ts51
-rw-r--r--node_modules/tslint/lib/language/formatter/formatter.js18
-rw-r--r--node_modules/tslint/lib/language/rule/abstractRule.d.ts39
-rw-r--r--node_modules/tslint/lib/language/rule/abstractRule.js50
-rw-r--r--node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts22
-rw-r--r--node_modules/tslint/lib/language/rule/optionallyTypedRule.js28
-rw-r--r--node_modules/tslint/lib/language/rule/rule.d.ts178
-rw-r--r--node_modules/tslint/lib/language/rule/rule.js168
-rw-r--r--node_modules/tslint/lib/language/rule/typedRule.d.ts23
-rw-r--r--node_modules/tslint/lib/language/rule/typedRule.js32
-rw-r--r--node_modules/tslint/lib/language/utils.d.ts97
-rw-r--r--node_modules/tslint/lib/language/utils.js402
-rw-r--r--node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts38
-rw-r--r--node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js82
-rw-r--r--node_modules/tslint/lib/language/walker/index.d.ts23
-rw-r--r--node_modules/tslint/lib/language/walker/index.js28
-rw-r--r--node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts26
-rw-r--r--node_modules/tslint/lib/language/walker/programAwareRuleWalker.js37
-rw-r--r--node_modules/tslint/lib/language/walker/ruleWalker.d.ts49
-rw-r--r--node_modules/tslint/lib/language/walker/ruleWalker.js96
-rw-r--r--node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts65
-rw-r--r--node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js100
-rw-r--r--node_modules/tslint/lib/language/walker/syntaxWalker.d.ts104
-rw-r--r--node_modules/tslint/lib/language/walker/syntaxWalker.js534
-rw-r--r--node_modules/tslint/lib/language/walker/walkContext.d.ts30
-rw-r--r--node_modules/tslint/lib/language/walker/walkContext.js41
-rw-r--r--node_modules/tslint/lib/language/walker/walker.d.ts30
-rw-r--r--node_modules/tslint/lib/language/walker/walker.js34
-rw-r--r--node_modules/tslint/lib/linter.d.ts39
-rw-r--r--node_modules/tslint/lib/linter.js234
-rw-r--r--node_modules/tslint/lib/ruleLoader.d.ts3
-rw-r--r--node_modules/tslint/lib/ruleLoader.js122
-rw-r--r--node_modules/tslint/lib/rules.d.ts19
-rw-r--r--node_modules/tslint/lib/rules.js24
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js142
-rw-r--r--node_modules/tslint/lib/rules/alignRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/alignRule.js180
-rw-r--r--node_modules/tslint/lib/rules/arrayTypeRule.d.ts26
-rw-r--r--node_modules/tslint/lib/rules/arrayTypeRule.js156
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.js95
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.js101
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.js81
-rw-r--r--node_modules/tslint/lib/rules/banRule.d.ts31
-rw-r--r--node_modules/tslint/lib/rules/banRule.js123
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.js75
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.js90
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.js61
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.d.ts11
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.js204
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.d.ts79
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.js332
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.js92
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts11
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.js118
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.d.ts22
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.js101
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.js72
-rw-r--r--node_modules/tslint/lib/rules/eoflineRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/eoflineRule.js56
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.js59
-rw-r--r--node_modules/tslint/lib/rules/forinRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/forinRule.js68
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.js91
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.d.ts31
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.js126
-rw-r--r--node_modules/tslint/lib/rules/indentRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/indentRule.js179
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.js75
-rw-r--r--node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js66
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.js96
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.js69
-rw-r--r--node_modules/tslint/lib/rules/linebreakStyleRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/linebreakStyleRule.js67
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.js70
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.js76
-rw-r--r--node_modules/tslint/lib/rules/maxFileLineCountRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/maxFileLineCountRule.js60
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.js63
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.js132
-rw-r--r--node_modules/tslint/lib/rules/memberOrderingRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/memberOrderingRule.js427
-rw-r--r--node_modules/tslint/lib/rules/newParensRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/newParensRule.js53
-rw-r--r--node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/newlineBeforeReturnRule.js90
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js60
-rw-r--r--node_modules/tslint/lib/rules/noAnyRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noAnyRule.js58
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.js57
-rw-r--r--node_modules/tslint/lib/rules/noBitwiseRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noBitwiseRule.js73
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js121
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.js99
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts13
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js128
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.js63
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.js61
-rw-r--r--node_modules/tslint/lib/rules/noDebuggerRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noDebuggerRule.js53
-rw-r--r--node_modules/tslint/lib/rules/noDefaultExportRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noDefaultExportRule.js65
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.js156
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.js87
-rw-r--r--node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/noEmptyInterfaceRule.js59
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.js73
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.js56
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.js66
-rw-r--r--node_modules/tslint/lib/rules/noForInArrayRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noForInArrayRule.js60
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.js75
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.js123
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js113
-rw-r--r--node_modules/tslint/lib/rules/noInternalModuleRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noInternalModuleRule.js84
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js61
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.js97
-rw-r--r--node_modules/tslint/lib/rules/noIrregularWhitespaceRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js59
-rw-r--r--node_modules/tslint/lib/rules/noMagicNumbersRule.d.ts9
-rw-r--r--node_modules/tslint/lib/rules/noMagicNumbersRule.js94
-rw-r--r--node_modules/tslint/lib/rules/noMergeableNamespaceRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noMergeableNamespaceRule.js95
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.js74
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.js75
-rw-r--r--node_modules/tslint/lib/rules/noNonNullAssertionRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noNonNullAssertionRule.js53
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.js59
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js73
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts26
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.js67
-rw-r--r--node_modules/tslint/lib/rules/noReferenceImportRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noReferenceImportRule.js98
-rw-r--r--node_modules/tslint/lib/rules/noReferenceRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noReferenceRule.js51
-rw-r--r--node_modules/tslint/lib/rules/noRequireImportsRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noRequireImportsRule.js61
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.js143
-rw-r--r--node_modules/tslint/lib/rules/noSparseArraysRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noSparseArraysRule.js98
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.js60
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.js77
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts12
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js90
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js129
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.js88
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js85
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js105
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js118
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js79
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts26
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.js218
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.js136
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.js214
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts6
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.js350
-rw-r--r--node_modules/tslint/lib/rules/noUseBeforeDeclareRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js87
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.js69
-rw-r--r--node_modules/tslint/lib/rules/noVarRequiresRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noVarRequiresRule.js70
-rw-r--r--node_modules/tslint/lib/rules/noVoidExpressionRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/noVoidExpressionRule.js87
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts11
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.js104
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts9
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js150
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.js75
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js87
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.d.ts27
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.js275
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js71
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js97
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.js263
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.js96
-rw-r--r--node_modules/tslint/lib/rules/preferConstRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/preferConstRule.js310
-rw-r--r--node_modules/tslint/lib/rules/preferForOfRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/preferForOfRule.js183
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js111
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.js60
-rw-r--r--node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/preferObjectSpreadRule.js116
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.js139
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.js123
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js70
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.js120
-rw-r--r--node_modules/tslint/lib/rules/radixRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/radixRule.js64
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.js79
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.js146
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.d.ts9
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.js232
-rw-r--r--node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.d.ts24
-rw-r--r--node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js111
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts38
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js335
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts9
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.js217
-rw-r--r--node_modules/tslint/lib/rules/switchDefaultRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/switchDefaultRule.js54
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.d.ts9
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.js211
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.d.ts8
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.js86
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.d.ts6
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.js193
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.js194
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.js77
-rw-r--r--node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts10
-rw-r--r--node_modules/tslint/lib/rules/unifiedSignaturesRule.js308
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.js70
-rw-r--r--node_modules/tslint/lib/rules/variableNameRule.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/variableNameRule.js178
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.js238
-rw-r--r--node_modules/tslint/lib/runner.d.ts71
-rw-r--r--node_modules/tslint/lib/runner.js195
-rw-r--r--node_modules/tslint/lib/test.d.ts24
-rw-r--r--node_modules/tslint/lib/test.js234
-rw-r--r--node_modules/tslint/lib/test/lines.d.ts37
-rw-r--r--node_modules/tslint/lib/test/lines.js157
-rw-r--r--node_modules/tslint/lib/test/lintError.d.ts12
-rw-r--r--node_modules/tslint/lib/test/lintError.js40
-rw-r--r--node_modules/tslint/lib/test/parse.d.ts13
-rw-r--r--node_modules/tslint/lib/test/parse.js219
-rw-r--r--node_modules/tslint/lib/tslint-cli.d.ts0
-rw-r--r--node_modules/tslint/lib/tslint-cli.js153
-rw-r--r--node_modules/tslint/lib/utils.d.ts58
-rw-r--r--node_modules/tslint/lib/utils.js216
342 files changed, 23345 insertions, 0 deletions
diff --git a/node_modules/tslint/lib/configs/all.d.ts b/node_modules/tslint/lib/configs/all.d.ts
new file mode 100644
index 000000000..583a2d296
--- /dev/null
+++ b/node_modules/tslint/lib/configs/all.d.ts
@@ -0,0 +1,148 @@
+export declare const rules: {
+ "adjacent-overload-signatures": boolean;
+ "ban-types": {
+ options: string[][];
+ };
+ "member-access": (string | boolean)[];
+ "member-ordering": (boolean | {
+ "order": string;
+ "alphabetize": boolean;
+ })[];
+ "no-any": boolean;
+ "no-empty-interface": boolean;
+ "no-import-side-effect": boolean;
+ "no-inferrable-types": (string | boolean)[];
+ "no-internal-module": boolean;
+ "no-magic-numbers": boolean;
+ "no-namespace": boolean;
+ "no-non-null-assertion": boolean;
+ "no-reference": boolean;
+ "no-var-requires": boolean;
+ "only-arrow-functions": boolean;
+ "prefer-for-of": boolean;
+ "promise-function-async": boolean;
+ "typedef": (string | boolean)[];
+ "typedef-whitespace": (boolean | {
+ "call-signature": string;
+ "index-signature": string;
+ "parameter": string;
+ "property-declaration": string;
+ "variable-declaration": string;
+ })[];
+ "unified-signatures": boolean;
+ "await-promise": boolean;
+ "curly": boolean;
+ "forin": boolean;
+ "label-position": boolean;
+ "no-arg": boolean;
+ "no-bitwise": boolean;
+ "no-conditional-assignment": boolean;
+ "no-console": boolean;
+ "no-construct": boolean;
+ "no-debugger": boolean;
+ "no-duplicate-super": boolean;
+ "no-duplicate-variable": boolean;
+ "no-empty": boolean;
+ "no-eval": boolean;
+ "no-floating-promises": boolean;
+ "no-for-in-array": boolean;
+ "no-inferred-empty-object-type": boolean;
+ "no-invalid-template-strings": boolean;
+ "no-misused-new": boolean;
+ "no-null-keyword": boolean;
+ "no-object-literal-type-assertion": boolean;
+ "no-shadowed-variable": boolean;
+ "no-string-literal": boolean;
+ "no-string-throw": boolean;
+ "no-sparse-arrays": boolean;
+ "no-unbound-method": boolean;
+ "no-unsafe-any": boolean;
+ "no-unsafe-finally": boolean;
+ "no-unused-expression": boolean;
+ "no-unused-variable": boolean;
+ "no-use-before-declare": boolean;
+ "no-var-keyword": boolean;
+ "no-void-expression": boolean;
+ "prefer-conditional-expression": boolean;
+ "radix": boolean;
+ "restrict-plus-operands": boolean;
+ "strict-boolean-expressions": boolean;
+ "strict-type-predicates": boolean;
+ "switch-default": boolean;
+ "triple-equals": boolean;
+ "use-isnan": boolean;
+ "cyclomatic-complexity": boolean;
+ "eofline": boolean;
+ "indent": (string | boolean)[];
+ "linebreak-style": (string | boolean)[];
+ "max-classes-per-file": (number | boolean)[];
+ "max-file-line-count": (number | boolean)[];
+ "max-line-length": (number | boolean)[];
+ "no-default-export": boolean;
+ "no-irregular-whitespace": boolean;
+ "no-mergeable-namespace": boolean;
+ "no-require-imports": boolean;
+ "no-trailing-whitespace": boolean;
+ "object-literal-sort-keys": boolean;
+ "prefer-const": boolean;
+ "trailing-comma": (boolean | {
+ "multiline": string;
+ "singleline": string;
+ })[];
+ "align": (string | boolean)[];
+ "array-type": (string | boolean)[];
+ "arrow-parens": boolean;
+ "arrow-return-shorthand": (string | boolean)[];
+ "callable-types": boolean;
+ "class-name": boolean;
+ "comment-format": (string | boolean)[];
+ "completed-docs": boolean;
+ "deprecation": boolean;
+ "encoding": boolean;
+ "import-spacing": boolean;
+ "interface-name": boolean;
+ "interface-over-type-literal": boolean;
+ "jsdoc-format": boolean;
+ "match-default-export-name": boolean;
+ "new-parens": boolean;
+ "newline-before-return": boolean;
+ "no-angle-bracket-type-assertion": boolean;
+ "no-boolean-literal-compare": boolean;
+ "no-consecutive-blank-lines": boolean;
+ "no-parameter-properties": boolean;
+ "no-reference-import": boolean;
+ "no-unnecessary-callback-wrapper": boolean;
+ "no-unnecessary-initializer": boolean;
+ "no-unnecessary-qualifier": boolean;
+ "no-unnecessary-type-assertion": boolean;
+ "number-literal-format": boolean;
+ "object-literal-key-quotes": (string | boolean)[];
+ "object-literal-shorthand": boolean;
+ "one-line": (string | boolean)[];
+ "one-variable-per-declaration": boolean;
+ "ordered-imports": (boolean | {
+ "import-sources-order": string;
+ "named-imports-order": string;
+ })[];
+ "prefer-function-over-method": boolean;
+ "prefer-method-signature": boolean;
+ "prefer-object-spread": boolean;
+ "prefer-switch": boolean;
+ "prefer-template": boolean;
+ "quotemark": (string | boolean)[];
+ "return-undefined": boolean;
+ "semicolon": (string | boolean)[];
+ "space-before-function-paren": (boolean | {
+ "anonymous": string;
+ "asyncArrow": string;
+ "constructor": string;
+ "method": string;
+ "named": string;
+ })[];
+ "variable-name": (string | boolean)[];
+ "whitespace": (string | boolean)[];
+};
+export declare const RULES_EXCLUDED_FROM_ALL_CONFIG: string[];
+export declare const jsRules: {
+ [key: string]: any;
+};
diff --git a/node_modules/tslint/lib/configs/all.js b/node_modules/tslint/lib/configs/all.js
new file mode 100644
index 000000000..526c3a30f
--- /dev/null
+++ b/node_modules/tslint/lib/configs/all.js
@@ -0,0 +1,254 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var path_1 = require("path");
+var ruleLoader_1 = require("../ruleLoader");
+var utils_1 = require("../utils");
+// tslint:disable object-literal-sort-keys
+// tslint:disable object-literal-key-quotes
+exports.rules = {
+ // TypeScript Specific
+ "adjacent-overload-signatures": true,
+ "ban-types": {
+ options: [
+ ["Object", "Avoid using the `Object` type. Did you mean `object`?"],
+ ["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."],
+ ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
+ ["Number", "Avoid using the `Number` type. Did you mean `number`?"],
+ ["String", "Avoid using the `String` type. Did you mean `string`?"],
+ ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
+ ],
+ },
+ "member-access": [true, "check-accessor", "check-constructor"],
+ "member-ordering": [true, {
+ "order": "statics-first",
+ "alphabetize": true,
+ }],
+ "no-any": true,
+ "no-empty-interface": true,
+ "no-import-side-effect": true,
+ // Technically this is not the strictest setting, but don't want to conflict with "typedef"
+ "no-inferrable-types": [true, "ignore-params"],
+ "no-internal-module": true,
+ "no-magic-numbers": true,
+ "no-namespace": true,
+ "no-non-null-assertion": true,
+ "no-reference": true,
+ "no-var-requires": true,
+ "only-arrow-functions": true,
+ "prefer-for-of": true,
+ "promise-function-async": true,
+ "typedef": [
+ true,
+ "call-signature",
+ "arrow-call-signature",
+ "parameter",
+ "arrow-parameter",
+ "property-declaration",
+ "variable-declaration",
+ "member-variable-declaration",
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace",
+ },
+ {
+ "call-signature": "onespace",
+ "index-signature": "onespace",
+ "parameter": "onespace",
+ "property-declaration": "onespace",
+ "variable-declaration": "onespace",
+ },
+ ],
+ "unified-signatures": true,
+ // Functionality
+ "await-promise": true,
+ // "ban": no sensible default
+ "curly": true,
+ "forin": true,
+ // "import-blacklist": no sensible default
+ "label-position": true,
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-conditional-assignment": true,
+ "no-console": true,
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-super": true,
+ "no-duplicate-variable": true,
+ "no-empty": true,
+ "no-eval": true,
+ "no-floating-promises": true,
+ "no-for-in-array": true,
+ "no-inferred-empty-object-type": true,
+ "no-invalid-template-strings": true,
+ // "no-invalid-this": Won't this be deprecated?
+ "no-misused-new": true,
+ "no-null-keyword": true,
+ "no-object-literal-type-assertion": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": true,
+ "no-string-throw": true,
+ "no-sparse-arrays": true,
+ "no-unbound-method": true,
+ "no-unsafe-any": true,
+ "no-unsafe-finally": true,
+ "no-unused-expression": true,
+ "no-unused-variable": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "no-void-expression": true,
+ "prefer-conditional-expression": true,
+ "radix": true,
+ "restrict-plus-operands": true,
+ "strict-boolean-expressions": true,
+ "strict-type-predicates": true,
+ "switch-default": true,
+ "triple-equals": true,
+ "use-isnan": true,
+ // Maintainability
+ "cyclomatic-complexity": true,
+ "eofline": true,
+ "indent": [true, "spaces"],
+ "linebreak-style": [true, "LF"],
+ "max-classes-per-file": [true, 1],
+ "max-file-line-count": [true, 1000],
+ "max-line-length": [true, 120],
+ "no-default-export": true,
+ "no-irregular-whitespace": true,
+ "no-mergeable-namespace": true,
+ "no-require-imports": true,
+ "no-trailing-whitespace": true,
+ "object-literal-sort-keys": true,
+ "prefer-const": true,
+ "trailing-comma": [true, {
+ "multiline": "always",
+ "singleline": "never",
+ }],
+ // Style
+ "align": [
+ true,
+ "parameters",
+ "arguments",
+ "statements",
+ "elements",
+ "members",
+ ],
+ "array-type": [true, "array-simple"],
+ "arrow-parens": true,
+ "arrow-return-shorthand": [true, "multiline"],
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space",
+ "check-uppercase",
+ ],
+ "completed-docs": true,
+ // "file-header": No sensible default
+ "deprecation": true,
+ "encoding": true,
+ "import-spacing": true,
+ "interface-name": true,
+ "interface-over-type-literal": true,
+ "jsdoc-format": true,
+ "match-default-export-name": true,
+ "new-parens": true,
+ "newline-before-return": true,
+ "no-angle-bracket-type-assertion": true,
+ "no-boolean-literal-compare": true,
+ "no-consecutive-blank-lines": true,
+ "no-parameter-properties": true,
+ "no-reference-import": true,
+ "no-unnecessary-callback-wrapper": true,
+ "no-unnecessary-initializer": true,
+ "no-unnecessary-qualifier": true,
+ "no-unnecessary-type-assertion": true,
+ "number-literal-format": true,
+ "object-literal-key-quotes": [true, "consistent-as-needed"],
+ "object-literal-shorthand": true,
+ "one-line": [
+ true,
+ "check-catch",
+ "check-else",
+ "check-finally",
+ "check-open-brace",
+ "check-whitespace",
+ ],
+ "one-variable-per-declaration": true,
+ "ordered-imports": [true, {
+ "import-sources-order": "case-insensitive",
+ "named-imports-order": "case-insensitive",
+ }],
+ "prefer-function-over-method": true,
+ "prefer-method-signature": true,
+ "prefer-object-spread": true,
+ "prefer-switch": true,
+ "prefer-template": true,
+ "quotemark": [
+ true,
+ "double",
+ "avoid-escape",
+ "avoid-template",
+ ],
+ "return-undefined": true,
+ "semicolon": [true, "always"],
+ "space-before-function-paren": [true, {
+ "anonymous": "never",
+ "asyncArrow": "always",
+ "constructor": "never",
+ "method": "never",
+ "named": "never",
+ }],
+ "variable-name": [
+ true,
+ "ban-keywords",
+ "check-format",
+ ],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-module",
+ "check-separator",
+ "check-type",
+ "check-typecast",
+ "check-preblock",
+ ],
+};
+exports.RULES_EXCLUDED_FROM_ALL_CONFIG = ["ban", "fileHeader", "importBlacklist", "noInvalidThis", "noSwitchCaseFallThrough", "typeofCompare"];
+// Exclude typescript-only rules from jsRules, otherwise it's identical.
+exports.jsRules = {};
+for (var key in exports.rules) {
+ if (!utils_1.hasOwnProperty(exports.rules, key)) {
+ continue;
+ }
+ var Rule = ruleLoader_1.findRule(key, path_1.join(__dirname, "..", "rules"));
+ if (Rule === undefined) {
+ throw new Error("Couldn't find rule '" + key + "'.");
+ }
+ if (!Rule.metadata.typescriptOnly) {
+ exports.jsRules[key] = exports.rules[key];
+ }
+}
diff --git a/node_modules/tslint/lib/configs/latest.d.ts b/node_modules/tslint/lib/configs/latest.d.ts
new file mode 100644
index 000000000..02fc74e53
--- /dev/null
+++ b/node_modules/tslint/lib/configs/latest.d.ts
@@ -0,0 +1,28 @@
+/**
+ * @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.
+ */
+export declare const rules: {
+ "align": {
+ options: string[];
+ };
+ "no-invalid-template-strings": boolean;
+ "no-sparse-arrays": boolean;
+ "no-object-literal-type-assertion": boolean;
+ "prefer-conditional-expression": boolean;
+ "prefer-object-spread": boolean;
+};
+declare const xtends = "tslint:recommended";
+export { xtends as extends };
diff --git a/node_modules/tslint/lib/configs/latest.js b/node_modules/tslint/lib/configs/latest.js
new file mode 100644
index 000000000..19eb18143
--- /dev/null
+++ b/node_modules/tslint/lib/configs/latest.js
@@ -0,0 +1,41 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+// tslint:disable object-literal-sort-keys
+// tslint:disable:object-literal-key-quotes
+exports.rules = {
+ // added in v5.1
+ "align": {
+ options: [
+ "parameters",
+ "statements",
+ "members",
+ ],
+ },
+ "no-invalid-template-strings": true,
+ "no-sparse-arrays": true,
+ // added in v5.2
+ "no-object-literal-type-assertion": true,
+ // added in v5.3
+ "prefer-conditional-expression": true,
+ "prefer-object-spread": true,
+};
+// tslint:enable object-literal-sort-keys
+// work around "extends" being a keyword
+var xtends = "tslint:recommended";
+exports.extends = xtends;
diff --git a/node_modules/tslint/lib/configs/recommended.d.ts b/node_modules/tslint/lib/configs/recommended.d.ts
new file mode 100644
index 000000000..75e3bba56
--- /dev/null
+++ b/node_modules/tslint/lib/configs/recommended.d.ts
@@ -0,0 +1,236 @@
+/**
+ * @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.
+ */
+export declare const rules: {
+ "adjacent-overload-signatures": boolean;
+ "align": {
+ options: string[];
+ };
+ "array-type": {
+ options: string[];
+ };
+ "arrow-parens": boolean;
+ "arrow-return-shorthand": boolean;
+ "ban-types": {
+ options: string[][];
+ };
+ "callable-types": boolean;
+ "class-name": boolean;
+ "comment-format": {
+ options: string[];
+ };
+ "curly": boolean;
+ "cyclomatic-complexity": boolean;
+ "eofline": boolean;
+ "forin": boolean;
+ "import-spacing": boolean;
+ "indent": {
+ options: string[];
+ };
+ "interface-name": {
+ options: string[];
+ };
+ "interface-over-type-literal": boolean;
+ "jsdoc-format": boolean;
+ "label-position": boolean;
+ "max-classes-per-file": {
+ options: number[];
+ };
+ "max-line-length": {
+ options: number[];
+ };
+ "member-access": boolean;
+ "member-ordering": {
+ options: {
+ order: string;
+ };
+ };
+ "new-parens": boolean;
+ "no-angle-bracket-type-assertion": boolean;
+ "no-any": boolean;
+ "no-arg": boolean;
+ "no-bitwise": boolean;
+ "no-conditional-assignment": boolean;
+ "no-consecutive-blank-lines": boolean;
+ "no-console": boolean;
+ "no-construct": boolean;
+ "no-debugger": boolean;
+ "no-duplicate-super": boolean;
+ "no-empty": boolean;
+ "no-empty-interface": boolean;
+ "no-eval": boolean;
+ "no-internal-module": boolean;
+ "no-invalid-this": boolean;
+ "no-misused-new": boolean;
+ "no-namespace": boolean;
+ "no-parameter-properties": boolean;
+ "no-reference": boolean;
+ "no-reference-import": boolean;
+ "no-shadowed-variable": boolean;
+ "no-string-literal": boolean;
+ "no-string-throw": boolean;
+ "no-switch-case-fall-through": boolean;
+ "no-trailing-whitespace": boolean;
+ "no-unnecessary-initializer": boolean;
+ "no-unsafe-finally": boolean;
+ "no-unused-expression": boolean;
+ "no-use-before-declare": boolean;
+ "no-var-keyword": boolean;
+ "no-var-requires": boolean;
+ "object-literal-key-quotes": {
+ options: string[];
+ };
+ "object-literal-shorthand": boolean;
+ "object-literal-sort-keys": boolean;
+ "one-line": {
+ options: string[];
+ };
+ "one-variable-per-declaration": {
+ options: string[];
+ };
+ "only-arrow-functions": {
+ options: string[];
+ };
+ "ordered-imports": {
+ options: {
+ "import-sources-order": string;
+ "named-imports-order": string;
+ };
+ };
+ "prefer-const": boolean;
+ "prefer-for-of": boolean;
+ "quotemark": {
+ options: string[];
+ };
+ "radix": boolean;
+ "semicolon": {
+ options: string[];
+ };
+ "space-before-function-paren": {
+ options: {
+ anonymous: string;
+ asyncArrow: string;
+ constructor: string;
+ method: string;
+ named: string;
+ };
+ };
+ "trailing-comma": {
+ options: {
+ multiline: string;
+ singleline: string;
+ };
+ };
+ "triple-equals": {
+ options: string[];
+ };
+ "typedef": boolean;
+ "typedef-whitespace": {
+ options: {
+ "call-signature": string;
+ "index-signature": string;
+ "parameter": string;
+ "property-declaration": string;
+ "variable-declaration": string;
+ }[];
+ };
+ "typeof-compare": boolean;
+ "unified-signatures": boolean;
+ "use-isnan": boolean;
+ "variable-name": {
+ options: string[];
+ };
+ "whitespace": {
+ options: string[];
+ };
+};
+export declare const jsRules: {
+ "align": {
+ options: string[];
+ };
+ "class-name": boolean;
+ "curly": boolean;
+ "eofline": boolean;
+ "forin": boolean;
+ "import-spacing": boolean;
+ "indent": {
+ options: string[];
+ };
+ "jsdoc-format": boolean;
+ "label-position": boolean;
+ "max-line-length": {
+ options: number[];
+ };
+ "new-parens": boolean;
+ "no-arg": boolean;
+ "no-bitwise": boolean;
+ "no-conditional-assignment": boolean;
+ "no-consecutive-blank-lines": boolean;
+ "no-console": boolean;
+ "no-construct": boolean;
+ "no-debugger": boolean;
+ "no-duplicate-super": boolean;
+ "no-duplicate-variable": boolean;
+ "no-empty": boolean;
+ "no-eval": boolean;
+ "no-reference": boolean;
+ "no-shadowed-variable": boolean;
+ "no-string-literal": boolean;
+ "no-string-throw": boolean;
+ "no-switch-case-fall-through": boolean;
+ "no-trailing-whitespace": boolean;
+ "no-unused-expression": boolean;
+ "no-use-before-declare": boolean;
+ "object-literal-sort-keys": boolean;
+ "one-line": {
+ options: string[];
+ };
+ "one-variable-per-declaration": {
+ options: string[];
+ };
+ "quotemark": {
+ options: string[];
+ };
+ "radix": boolean;
+ "semicolon": {
+ options: string[];
+ };
+ "space-before-function-paren": {
+ options: {
+ anonymous: string;
+ asyncArrow: string;
+ constructor: string;
+ method: string;
+ named: string;
+ };
+ };
+ "trailing-comma": {
+ options: {
+ multiline: string;
+ singleline: string;
+ };
+ };
+ "triple-equals": {
+ options: string[];
+ };
+ "use-isnan": boolean;
+ "variable-name": {
+ options: string[];
+ };
+ "whitespace": {
+ options: string[];
+ };
+};
diff --git a/node_modules/tslint/lib/configs/recommended.js b/node_modules/tslint/lib/configs/recommended.js
new file mode 100644
index 000000000..16f44613e
--- /dev/null
+++ b/node_modules/tslint/lib/configs/recommended.js
@@ -0,0 +1,305 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.rules = {
+ "adjacent-overload-signatures": true,
+ "align": {
+ options: [
+ "parameters",
+ "statements",
+ ],
+ },
+ "array-type": {
+ options: ["array-simple"],
+ },
+ "arrow-parens": true,
+ "arrow-return-shorthand": true,
+ "ban-types": {
+ options: [
+ ["Object", "Avoid using the `Object` type. Did you mean `object`?"],
+ ["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."],
+ ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
+ ["Number", "Avoid using the `Number` type. Did you mean `number`?"],
+ ["String", "Avoid using the `String` type. Did you mean `string`?"],
+ ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
+ ],
+ },
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": {
+ options: ["check-space"],
+ },
+ "curly": true,
+ "cyclomatic-complexity": false,
+ "eofline": true,
+ "forin": true,
+ "import-spacing": true,
+ "indent": {
+ options: ["spaces"],
+ },
+ "interface-name": {
+ options: ["always-prefix"],
+ },
+ "interface-over-type-literal": true,
+ "jsdoc-format": true,
+ "label-position": true,
+ "max-classes-per-file": {
+ options: [1],
+ },
+ "max-line-length": {
+ options: [120],
+ },
+ "member-access": true,
+ "member-ordering": {
+ options: {
+ order: "statics-first",
+ },
+ },
+ "new-parens": true,
+ "no-angle-bracket-type-assertion": true,
+ "no-any": false,
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-conditional-assignment": true,
+ "no-consecutive-blank-lines": true,
+ "no-console": true,
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-super": true,
+ "no-empty": true,
+ "no-empty-interface": true,
+ "no-eval": true,
+ "no-internal-module": true,
+ "no-invalid-this": false,
+ "no-misused-new": true,
+ "no-namespace": true,
+ "no-parameter-properties": false,
+ "no-reference": true,
+ "no-reference-import": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": true,
+ "no-string-throw": true,
+ "no-switch-case-fall-through": false,
+ "no-trailing-whitespace": true,
+ "no-unnecessary-initializer": true,
+ "no-unsafe-finally": true,
+ "no-unused-expression": true,
+ // disable this rule as it is very heavy performance-wise and not that useful
+ "no-use-before-declare": false,
+ "no-var-keyword": true,
+ "no-var-requires": true,
+ "object-literal-key-quotes": {
+ options: ["consistent-as-needed"],
+ },
+ "object-literal-shorthand": true,
+ "object-literal-sort-keys": true,
+ "one-line": {
+ options: [
+ "check-catch",
+ "check-else",
+ "check-finally",
+ "check-open-brace",
+ "check-whitespace",
+ ],
+ },
+ "one-variable-per-declaration": {
+ options: ["ignore-for-loop"],
+ },
+ "only-arrow-functions": {
+ options: [
+ "allow-declarations",
+ "allow-named-functions",
+ ],
+ },
+ "ordered-imports": {
+ options: {
+ "import-sources-order": "case-insensitive",
+ "named-imports-order": "case-insensitive",
+ },
+ },
+ "prefer-const": true,
+ "prefer-for-of": true,
+ "quotemark": {
+ options: [
+ "double",
+ "avoid-escape",
+ ],
+ },
+ "radix": true,
+ "semicolon": {
+ options: ["always"],
+ },
+ "space-before-function-paren": {
+ options: {
+ anonymous: "never",
+ asyncArrow: "always",
+ constructor: "never",
+ method: "never",
+ named: "never",
+ },
+ },
+ "trailing-comma": {
+ options: {
+ multiline: "always",
+ singleline: "never",
+ },
+ },
+ "triple-equals": {
+ options: ["allow-null-check"],
+ },
+ "typedef": false,
+ "typedef-whitespace": {
+ options: [
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace",
+ },
+ {
+ "call-signature": "onespace",
+ "index-signature": "onespace",
+ "parameter": "onespace",
+ "property-declaration": "onespace",
+ "variable-declaration": "onespace",
+ },
+ ],
+ },
+ "typeof-compare": true,
+ "unified-signatures": true,
+ "use-isnan": true,
+ "variable-name": {
+ options: [
+ "ban-keywords",
+ "check-format",
+ "allow-pascal-case",
+ ],
+ },
+ "whitespace": {
+ options: [
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type",
+ "check-typecast",
+ ],
+ },
+};
+exports.jsRules = {
+ "align": {
+ options: [
+ "parameters",
+ "statements",
+ ],
+ },
+ "class-name": true,
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "import-spacing": true,
+ "indent": {
+ options: ["spaces"],
+ },
+ "jsdoc-format": true,
+ "label-position": true,
+ "max-line-length": {
+ options: [120],
+ },
+ "new-parens": true,
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-conditional-assignment": true,
+ "no-consecutive-blank-lines": true,
+ "no-console": true,
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-super": true,
+ "no-duplicate-variable": true,
+ "no-empty": true,
+ "no-eval": true,
+ "no-reference": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": true,
+ "no-string-throw": true,
+ "no-switch-case-fall-through": false,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ // disable this rule as it is very heavy performance-wise and not that useful
+ "no-use-before-declare": false,
+ "object-literal-sort-keys": true,
+ "one-line": {
+ options: [
+ "check-catch",
+ "check-else",
+ "check-finally",
+ "check-open-brace",
+ "check-whitespace",
+ ],
+ },
+ "one-variable-per-declaration": {
+ options: ["ignore-for-loop"],
+ },
+ "quotemark": {
+ options: [
+ "double",
+ "avoid-escape",
+ ],
+ },
+ "radix": true,
+ "semicolon": {
+ options: ["always"],
+ },
+ "space-before-function-paren": {
+ options: {
+ anonymous: "never",
+ asyncArrow: "always",
+ constructor: "never",
+ method: "never",
+ named: "never",
+ },
+ },
+ "trailing-comma": {
+ options: {
+ multiline: "always",
+ singleline: "never",
+ },
+ },
+ "triple-equals": {
+ options: ["allow-null-check"],
+ },
+ "use-isnan": true,
+ "variable-name": {
+ options: [
+ "ban-keywords",
+ "check-format",
+ "allow-pascal-case",
+ ],
+ },
+ "whitespace": {
+ options: [
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type",
+ "check-typecast",
+ ],
+ },
+};
diff --git a/node_modules/tslint/lib/configuration.d.ts b/node_modules/tslint/lib/configuration.d.ts
new file mode 100644
index 000000000..ede434408
--- /dev/null
+++ b/node_modules/tslint/lib/configuration.d.ts
@@ -0,0 +1,104 @@
+import { IOptions, RuleSeverity } from "./language/rule/rule";
+export interface IConfigurationFile {
+ /**
+ * The severity that is applied to rules in _this_ config with `severity === "default"`.
+ * Not inherited.
+ */
+ defaultSeverity?: RuleSeverity;
+ /**
+ * An array of config files whose rules are inherited by this config file.
+ */
+ extends: string[];
+ /**
+ * Rules that are used to lint to JavaScript files.
+ */
+ jsRules: Map<string, Partial<IOptions>>;
+ /**
+ * Other linter options, currently for testing. Not publicly supported.
+ */
+ linterOptions?: {
+ typeCheck?: boolean;
+ };
+ /**
+ * Directories containing custom rules. Resolved using node module semantics.
+ */
+ rulesDirectory: string[];
+ /**
+ * Rules that are used to lint TypeScript files.
+ */
+ rules: Map<string, Partial<IOptions>>;
+}
+export interface IConfigurationLoadResult {
+ path?: string;
+ results?: IConfigurationFile;
+}
+export declare const CONFIG_FILENAME = "tslint.json";
+export declare const DEFAULT_CONFIG: IConfigurationFile;
+export declare const EMPTY_CONFIG: IConfigurationFile;
+/**
+ * Searches for a TSLint configuration and returns the data from the config.
+ * @param configFile A path to a config file, this can be null if the location of a config is not known
+ * @param inputFilePath A path containing the current file being linted. This is the starting location
+ * of the search for a configuration.
+ * @returns Load status for a TSLint configuration object
+ */
+export declare function findConfiguration(configFile: string | null, inputFilePath: string): IConfigurationLoadResult;
+/**
+ * Searches for a TSLint configuration and returns the path to it.
+ * Could return undefined if not configuration is found.
+ * @param suppliedConfigFilePath A path to an known config file supplied by a user. Pass null here if
+ * 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
+ * or undefined if neither can be found.
+ */
+export declare function findConfigurationPath(suppliedConfigFilePath: string | null, inputFilePath: string): string | undefined;
+/**
+ * Used Node semantics to load a configuration file given configFilePath.
+ * For example:
+ * '/path/to/config' will be treated as an absolute path
+ * './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
+ * @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 extendConfigurationFile(targetConfig: IConfigurationFile, nextConfigSource: IConfigurationFile): IConfigurationFile;
+export declare function getRelativePath(directory?: string | null, relativeTo?: string): string | undefined;
+export declare function useAsPath(directory: string): boolean;
+/**
+ * @param directories A path(s) to a directory of custom rules
+ * @param relativeTo A path that directories provided are relative to.
+ * For example, if the directories come from a tslint.json file, this path
+ * should be the path to the tslint.json file.
+ * @return An array of absolute paths to directories potentially containing rules
+ */
+export declare function getRulesDirectories(directories?: string | string[], relativeTo?: string): string[];
+export interface RawConfigFile {
+ extends?: string | string[];
+ linterOptions?: IConfigurationFile["linterOptions"];
+ rulesDirectory?: string | string[];
+ defaultSeverity?: string;
+ rules?: RawRulesConfig;
+ jsRules?: RawRulesConfig;
+}
+export interface RawRulesConfig {
+ [key: string]: RawRuleConfig;
+}
+export declare type RawRuleConfig = null | undefined | boolean | any[] | {
+ severity?: RuleSeverity | "warn" | "none" | "default";
+ options?: any;
+};
+/**
+ * Parses a config file and normalizes legacy config settings
+ *
+ * @param configFile The raw object read from the JSON of a config file
+ * @param configFileDir The directory of the config file
+ */
+export declare function parseConfigFile(configFile: RawConfigFile, configFileDir?: string): IConfigurationFile;
+/**
+ * Fills in default values for `IOption` properties and outputs an array of `IOption`
+ */
+export declare function convertRuleOptions(ruleConfiguration: Map<string, Partial<IOptions>>): IOptions[];
diff --git a/node_modules/tslint/lib/configuration.js b/node_modules/tslint/lib/configuration.js
new file mode 100644
index 000000000..39e6569ab
--- /dev/null
+++ b/node_modules/tslint/lib/configuration.js
@@ -0,0 +1,439 @@
+"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 });
+var fs = require("fs");
+var path = require("path");
+var resolve = require("resolve");
+var error_1 = require("./error");
+var utils_1 = require("./utils");
+exports.CONFIG_FILENAME = "tslint.json";
+exports.DEFAULT_CONFIG = {
+ defaultSeverity: "error",
+ extends: ["tslint:recommended"],
+ jsRules: new Map(),
+ rules: new Map(),
+ rulesDirectory: [],
+};
+exports.EMPTY_CONFIG = {
+ defaultSeverity: "error",
+ extends: [],
+ jsRules: new Map(),
+ rules: new Map(),
+ rulesDirectory: [],
+};
+var BUILT_IN_CONFIG = /^tslint:(.*)$/;
+/**
+ * Searches for a TSLint configuration and returns the data from the config.
+ * @param configFile A path to a config file, this can be null if the location of a config is not known
+ * @param inputFilePath A path containing the current file being linted. This is the starting location
+ * of the search for a configuration.
+ * @returns Load status for a TSLint configuration object
+ */
+function findConfiguration(configFile, inputFilePath) {
+ var configPath = findConfigurationPath(configFile, inputFilePath);
+ var loadResult = { path: configPath };
+ try {
+ loadResult.results = loadConfigurationFromPath(configPath);
+ return loadResult;
+ }
+ catch (error) {
+ throw new error_1.FatalError("Failed to load " + configPath + ": " + error.message, error);
+ }
+}
+exports.findConfiguration = findConfiguration;
+/**
+ * Searches for a TSLint configuration and returns the path to it.
+ * Could return undefined if not configuration is found.
+ * @param suppliedConfigFilePath A path to an known config file supplied by a user. Pass null here if
+ * 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
+ * or undefined if neither can be found.
+ */
+function findConfigurationPath(suppliedConfigFilePath, inputFilePath) {
+ if (suppliedConfigFilePath != null) {
+ if (!fs.existsSync(suppliedConfigFilePath)) {
+ throw new Error("Could not find config file at: " + path.resolve(suppliedConfigFilePath));
+ }
+ else {
+ return path.resolve(suppliedConfigFilePath);
+ }
+ }
+ else {
+ // convert to dir if it's a file or doesn't exist
+ var useDirName = false;
+ try {
+ var stats = fs.statSync(inputFilePath);
+ if (stats.isFile()) {
+ useDirName = true;
+ }
+ }
+ catch (e) {
+ // throws if file doesn't exist
+ useDirName = true;
+ }
+ if (useDirName) {
+ inputFilePath = path.dirname(inputFilePath);
+ }
+ // search for tslint.json from input file location
+ var configFilePath = findup(exports.CONFIG_FILENAME, inputFilePath);
+ if (configFilePath !== undefined) {
+ return path.resolve(configFilePath);
+ }
+ // search for tslint.json in home directory
+ var homeDir = getHomeDir();
+ if (homeDir != null) {
+ configFilePath = path.join(homeDir, exports.CONFIG_FILENAME);
+ if (fs.existsSync(configFilePath)) {
+ return path.resolve(configFilePath);
+ }
+ }
+ // no path could be found
+ return undefined;
+ }
+}
+exports.findConfigurationPath = findConfigurationPath;
+/**
+ * Find a file by name in a directory or any ancestory directory.
+ * This is case-insensitive, so it can find 'TsLiNt.JsOn' when searching for 'tslint.json'.
+ */
+function findup(filename, directory) {
+ while (true) {
+ var res = findFile(directory);
+ if (res !== undefined) {
+ return path.join(directory, res);
+ }
+ var parent = path.dirname(directory);
+ if (parent === directory) {
+ return undefined;
+ }
+ 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));
+ }
+ return result;
+ }
+}
+/**
+ * Used Node semantics to load a configuration file given configFilePath.
+ * For example:
+ * '/path/to/config' will be treated as an absolute path
+ * './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
+ * @returns a configuration object for TSLint loaded from the file at configFilePath
+ */
+function loadConfigurationFromPath(configFilePath, originalFilePath) {
+ if (originalFilePath === void 0) { originalFilePath = configFilePath; }
+ if (configFilePath == null) {
+ 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);
+ }
+ 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 {
+ rawConfigFile = require(resolvedConfigFilePath);
+ delete require.cache[resolvedConfigFilePath];
+ }
+ 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);
+ }
+}
+exports.loadConfigurationFromPath = loadConfigurationFromPath;
+/**
+ * Resolve configuration file path or node_module reference
+ * @param filePath Relative ("./path"), absolute ("/path"), node module ("path"), or built-in ("tslint:path")
+ */
+function resolveConfigurationPath(filePath, relativeTo) {
+ var matches = filePath.match(BUILT_IN_CONFIG);
+ var isBuiltInConfig = matches != null && matches.length > 0;
+ if (isBuiltInConfig) {
+ var configName = matches[1];
+ try {
+ return require.resolve("./configs/" + configName);
+ }
+ catch (err) {
+ throw new Error(filePath + " is not a built-in config, try \"tslint:recommended\" instead.");
+ }
+ }
+ var basedir = relativeTo !== undefined ? relativeTo : process.cwd();
+ try {
+ return resolve.sync(filePath, { basedir: basedir });
+ }
+ catch (err) {
+ try {
+ return require.resolve(filePath);
+ }
+ catch (err) {
+ // tslint:disable-next-line prefer-template (fixed in 5.3)
+ throw new Error("Invalid \"extends\" configuration value - could not require \"" + filePath + "\". " +
+ "Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) " +
+ "for the approximate method TSLint uses to find the referenced configuration file.");
+ }
+ }
+}
+function extendConfigurationFile(targetConfig, nextConfigSource) {
+ function combineProperties(targetProperty, nextProperty) {
+ var combinedProperty = {};
+ add(targetProperty);
+ // next config source overwrites the target config object
+ add(nextProperty);
+ return combinedProperty;
+ function add(property) {
+ if (property !== undefined) {
+ for (var name in property) {
+ if (utils_1.hasOwnProperty(property, name)) {
+ combinedProperty[name] = property[name];
+ }
+ }
+ }
+ }
+ }
+ function combineMaps(target, next) {
+ var combined = new Map();
+ target.forEach(function (options, ruleName) {
+ combined.set(ruleName, options);
+ });
+ next.forEach(function (options, ruleName) {
+ var combinedRule = combined.get(ruleName);
+ if (combinedRule != null) {
+ combined.set(ruleName, combineProperties(combinedRule, options));
+ }
+ else {
+ combined.set(ruleName, options);
+ }
+ });
+ return combined;
+ }
+ var combinedRulesDirs = targetConfig.rulesDirectory.concat(nextConfigSource.rulesDirectory);
+ var dedupedRulesDirs = Array.from(new Set(combinedRulesDirs));
+ return {
+ extends: [],
+ jsRules: combineMaps(targetConfig.jsRules, nextConfigSource.jsRules),
+ linterOptions: combineProperties(targetConfig.linterOptions, nextConfigSource.linterOptions),
+ rules: combineMaps(targetConfig.rules, nextConfigSource.rules),
+ rulesDirectory: dedupedRulesDirs,
+ };
+}
+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 != null && fs.existsSync(homePath)) {
+ return homePath;
+ }
+ }
+ return undefined;
+}
+// returns the absolute path (contrary to what the name implies)
+function getRelativePath(directory, relativeTo) {
+ if (directory != null) {
+ var basePath = relativeTo !== undefined ? relativeTo : process.cwd();
+ return path.resolve(basePath, directory);
+ }
+ return undefined;
+}
+exports.getRelativePath = getRelativePath;
+// check if directory should be used as path or if it should be resolved like a module
+// matches if directory starts with '/', './', '../', 'node_modules/' or equals '.' or '..'
+function useAsPath(directory) {
+ return /^(?:\.?\.?(?:\/|$)|node_modules\/)/.test(directory);
+}
+exports.useAsPath = useAsPath;
+/**
+ * @param directories A path(s) to a directory of custom rules
+ * @param relativeTo A path that directories provided are relative to.
+ * For example, if the directories come from a tslint.json file, this path
+ * should be the path to the tslint.json file.
+ * @return An array of absolute paths to directories potentially containing rules
+ */
+function getRulesDirectories(directories, relativeTo) {
+ return utils_1.arrayify(directories)
+ .map(function (dir) {
+ if (!useAsPath(dir)) {
+ try {
+ return path.dirname(resolve.sync(dir, { basedir: relativeTo }));
+ }
+ catch (err) {
+ // swallow error and fallback to using directory as path
+ }
+ }
+ var absolutePath = getRelativePath(dir, relativeTo);
+ if (absolutePath != null) {
+ if (!fs.existsSync(absolutePath)) {
+ throw new Error("Could not find custom rule directory: " + dir);
+ }
+ }
+ return absolutePath;
+ })
+ .filter(function (dir) { return dir !== undefined; });
+}
+exports.getRulesDirectories = getRulesDirectories;
+/**
+ * Parses the options of a single rule and upgrades legacy settings such as `true`, `[true, "option"]`
+ *
+ * @param ruleConfigValue The raw option setting of a rule
+ */
+function parseRuleOptions(ruleConfigValue, rawDefaultRuleSeverity) {
+ var ruleArguments;
+ var defaultRuleSeverity = "error";
+ if (rawDefaultRuleSeverity !== undefined) {
+ switch (rawDefaultRuleSeverity.toLowerCase()) {
+ case "warn":
+ case "warning":
+ defaultRuleSeverity = "warning";
+ break;
+ case "off":
+ case "none":
+ defaultRuleSeverity = "off";
+ break;
+ default:
+ defaultRuleSeverity = "error";
+ }
+ }
+ var ruleSeverity = defaultRuleSeverity;
+ if (ruleConfigValue == null) {
+ ruleArguments = [];
+ ruleSeverity = "off";
+ }
+ else if (Array.isArray(ruleConfigValue)) {
+ if (ruleConfigValue.length > 0) {
+ // old style: array
+ ruleArguments = ruleConfigValue.slice(1);
+ ruleSeverity = ruleConfigValue[0] === true ? defaultRuleSeverity : "off";
+ }
+ }
+ else if (typeof ruleConfigValue === "boolean") {
+ // old style: boolean
+ ruleArguments = [];
+ ruleSeverity = ruleConfigValue ? defaultRuleSeverity : "off";
+ }
+ else if (typeof ruleConfigValue === "object") {
+ if (ruleConfigValue.severity !== undefined) {
+ switch (ruleConfigValue.severity.toLowerCase()) {
+ case "default":
+ ruleSeverity = defaultRuleSeverity;
+ break;
+ case "error":
+ ruleSeverity = "error";
+ break;
+ case "warn":
+ case "warning":
+ ruleSeverity = "warning";
+ break;
+ case "off":
+ case "none":
+ ruleSeverity = "off";
+ break;
+ default:
+ console.warn("Invalid severity level: " + ruleConfigValue.severity);
+ ruleSeverity = defaultRuleSeverity;
+ }
+ }
+ if (ruleConfigValue.options != null) {
+ ruleArguments = utils_1.arrayify(ruleConfigValue.options);
+ }
+ }
+ return {
+ ruleArguments: ruleArguments,
+ ruleSeverity: ruleSeverity,
+ };
+}
+/**
+ * Parses a config file and normalizes legacy config settings
+ *
+ * @param configFile The raw object read from the JSON of a config file
+ * @param configFileDir The directory of the config file
+ */
+function parseConfigFile(configFile, configFileDir) {
+ return {
+ extends: utils_1.arrayify(configFile.extends),
+ jsRules: parseRules(configFile.jsRules),
+ linterOptions: configFile.linterOptions !== undefined ? configFile.linterOptions : {},
+ rules: parseRules(configFile.rules),
+ rulesDirectory: getRulesDirectories(configFile.rulesDirectory, configFileDir),
+ };
+ 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));
+ }
+ }
+ }
+ return map;
+ }
+}
+exports.parseConfigFile = parseConfigFile;
+/**
+ * Fills in default values for `IOption` properties and outputs an array of `IOption`
+ */
+function convertRuleOptions(ruleConfiguration) {
+ var output = [];
+ ruleConfiguration.forEach(function (_a, ruleName) {
+ var ruleArguments = _a.ruleArguments, ruleSeverity = _a.ruleSeverity;
+ var options = {
+ disabledIntervals: [],
+ ruleArguments: ruleArguments != null ? ruleArguments : [],
+ ruleName: ruleName,
+ ruleSeverity: ruleSeverity != null ? ruleSeverity : "error",
+ };
+ output.push(options);
+ });
+ return output;
+}
+exports.convertRuleOptions = convertRuleOptions;
diff --git a/node_modules/tslint/lib/enableDisableRules.d.ts b/node_modules/tslint/lib/enableDisableRules.d.ts
new file mode 100644
index 000000000..ab8f67c74
--- /dev/null
+++ b/node_modules/tslint/lib/enableDisableRules.d.ts
@@ -0,0 +1,3 @@
+import * as ts from "typescript";
+import { RuleFailure } from "./language/rule/rule";
+export declare function removeDisabledFailures(sourceFile: ts.SourceFile, failures: RuleFailure[]): RuleFailure[];
diff --git a/node_modules/tslint/lib/enableDisableRules.js b/node_modules/tslint/lib/enableDisableRules.js
new file mode 100644
index 000000000..e76cb63bd
--- /dev/null
+++ b/node_modules/tslint/lib/enableDisableRules.js
@@ -0,0 +1,148 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+// tslint:disable object-literal-sort-keys
+var utils = require("tsutils");
+var ts = require("typescript");
+function removeDisabledFailures(sourceFile, failures) {
+ if (failures.length === 0) {
+ // Usually there won't be failures anyway, so no need to look for "tslint:disable".
+ return failures;
+ }
+ var failingRules = new Set(failures.map(function (f) { return f.getRuleName(); }));
+ var map = getDisableMap(sourceFile, failingRules);
+ return failures.filter(function (failure) {
+ var disabledIntervals = map.get(failure.getRuleName());
+ return disabledIntervals === undefined || !disabledIntervals.some(function (_a) {
+ var pos = _a.pos, end = _a.end;
+ var failPos = failure.getStartPosition().getPosition();
+ var failEnd = failure.getEndPosition().getPosition();
+ return failEnd >= pos && (end === -1 || failPos <= end);
+ });
+ });
+}
+exports.removeDisabledFailures = removeDisabledFailures;
+/**
+ * The map will have an array of TextRange for each disable of a rule in a file.
+ * (It will have no entry if the rule is never disabled, meaning all arrays are non-empty.)
+ */
+function getDisableMap(sourceFile, failingRules) {
+ var map = new Map();
+ utils.forEachComment(sourceFile, function (fullText, comment) {
+ var commentText = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia
+ ? fullText.substring(comment.pos + 2, comment.end)
+ : fullText.substring(comment.pos + 2, comment.end - 2);
+ var parsed = parseComment(commentText);
+ if (parsed !== undefined) {
+ var rulesList = parsed.rulesList, isEnabled = parsed.isEnabled, modifier = parsed.modifier;
+ var switchRange = getSwitchRange(modifier, comment, sourceFile);
+ if (switchRange !== undefined) {
+ var rulesToSwitch = rulesList === "all" ? Array.from(failingRules) : rulesList.filter(function (r) { return failingRules.has(r); });
+ for (var _i = 0, rulesToSwitch_1 = rulesToSwitch; _i < rulesToSwitch_1.length; _i++) {
+ var ruleToSwitch = rulesToSwitch_1[_i];
+ switchRuleState(ruleToSwitch, isEnabled, switchRange.pos, switchRange.end);
+ }
+ }
+ }
+ });
+ return map;
+ function switchRuleState(ruleName, isEnable, start, end) {
+ var disableRanges = map.get(ruleName);
+ if (isEnable) {
+ if (disableRanges !== undefined) {
+ var lastDisable = disableRanges[disableRanges.length - 1];
+ if (lastDisable.end === -1) {
+ lastDisable.end = start;
+ if (end !== -1) {
+ // Disable it again after the enable range is over.
+ disableRanges.push({ pos: end, end: -1 });
+ }
+ }
+ }
+ }
+ else {
+ if (disableRanges === undefined) {
+ map.set(ruleName, [{ pos: start, end: end }]);
+ }
+ else if (disableRanges[disableRanges.length - 1].end !== -1) {
+ disableRanges.push({ pos: start, end: end });
+ }
+ }
+ }
+}
+/** End will be -1 to indicate no end. */
+function getSwitchRange(modifier, range, sourceFile) {
+ var lineStarts = sourceFile.getLineStarts();
+ switch (modifier) {
+ case "line":
+ return {
+ // start at the beginning of the line where comment starts
+ pos: getStartOfLinePosition(range.pos),
+ // end at the beginning of the line following the comment
+ end: getStartOfLinePosition(range.end, 1),
+ };
+ case "next-line":
+ // start at the beginning of the line following the comment
+ var pos = getStartOfLinePosition(range.end, 1);
+ if (pos === -1) {
+ // no need to switch anything, there is no next line
+ return undefined;
+ }
+ // end at the beginning of the line following the next line
+ return { pos: pos, end: getStartOfLinePosition(range.end, 2) };
+ default:
+ // switch rule for the rest of the file
+ // start at the current position, but skip end position
+ return { pos: range.pos, end: -1 };
+ }
+ /** Returns -1 for last line. */
+ function getStartOfLinePosition(position, lineOffset) {
+ if (lineOffset === void 0) { lineOffset = 0; }
+ var line = ts.getLineAndCharacterOfPosition(sourceFile, position).line + lineOffset;
+ return line >= lineStarts.length ? -1 : lineStarts[line];
+ }
+}
+function parseComment(commentText) {
+ // regex is: start of string followed by any amount of whitespace
+ // followed by tslint and colon
+ // followed by either "enable" or "disable"
+ // followed optionally by -line or -next-line
+ // followed by either colon, whitespace or end of string
+ var match = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/.exec(commentText);
+ if (match === null) {
+ return undefined;
+ }
+ // remove everything matched by the previous regex to get only the specified rules
+ // split at whitespaces
+ // filter empty items coming from whitespaces at start, at end or empty list
+ var rulesList = splitOnSpaces(commentText.substr(match[0].length));
+ if (rulesList.length === 0 && match[3] === ":") {
+ // nothing to do here: an explicit separator was specified but no rules to switch
+ return undefined;
+ }
+ if (rulesList.length === 0 ||
+ rulesList.indexOf("all") !== -1) {
+ // if list is empty we default to all enabled rules
+ // if `all` is specified we ignore the other rules and take all enabled rules
+ rulesList = "all";
+ }
+ return { rulesList: rulesList, isEnabled: match[1] === "enable", modifier: match[2] };
+}
+function splitOnSpaces(str) {
+ return str.split(/\s+/).filter(function (s) { return s !== ""; });
+}
diff --git a/node_modules/tslint/lib/error.d.ts b/node_modules/tslint/lib/error.d.ts
new file mode 100644
index 000000000..471e1100b
--- /dev/null
+++ b/node_modules/tslint/lib/error.d.ts
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+export declare class Error {
+ name?: string;
+ message: string;
+ stack?: string;
+ constructor(message?: string);
+}
+/**
+ * Used to exit the program and display a friendly message without the callstack.
+ */
+export declare class FatalError extends Error {
+ message: string;
+ innerError: Error;
+ static NAME: string;
+ constructor(message: string, innerError?: Error);
+}
+export declare function isError(possibleError: any): possibleError is Error;
+export declare function showWarningOnce(message: string): void;
diff --git a/node_modules/tslint/lib/error.js b/node_modules/tslint/lib/error.js
new file mode 100644
index 000000000..c21a7f3ec
--- /dev/null
+++ b/node_modules/tslint/lib/error.js
@@ -0,0 +1,48 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var shownWarnings = new Set();
+/**
+ * Used to exit the program and display a friendly message without the callstack.
+ */
+var FatalError = (function (_super) {
+ tslib_1.__extends(FatalError, _super);
+ function FatalError(message, innerError) {
+ var _this = _super.call(this, message) || this;
+ _this.message = message;
+ _this.innerError = innerError;
+ _this.name = FatalError.NAME;
+ _this.stack = new Error().stack;
+ return _this;
+ }
+ return FatalError;
+}(Error));
+FatalError.NAME = "FatalError";
+exports.FatalError = FatalError;
+function isError(possibleError) {
+ return possibleError != null && possibleError.message !== undefined;
+}
+exports.isError = isError;
+function showWarningOnce(message) {
+ if (!shownWarnings.has(message)) {
+ console.warn(message);
+ shownWarnings.add(message);
+ }
+}
+exports.showWarningOnce = showWarningOnce;
diff --git a/node_modules/tslint/lib/formatterLoader.d.ts b/node_modules/tslint/lib/formatterLoader.d.ts
new file mode 100644
index 000000000..b596ed3f8
--- /dev/null
+++ b/node_modules/tslint/lib/formatterLoader.d.ts
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 000000000..cda997016
--- /dev/null
+++ b/node_modules/tslint/lib/formatterLoader.js
@@ -0,0 +1,74 @@
+"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 });
+var fs = require("fs");
+var path = require("path");
+var utils_1 = require("./utils");
+var moduleDirectory = path.dirname(module.filename);
+var CORE_FORMATTERS_DIRECTORY = path.resolve(moduleDirectory, ".", "formatters");
+function findFormatter(name, formattersDirectory) {
+ if (typeof name === "function") {
+ return name;
+ }
+ else if (typeof name === "string") {
+ name = name.trim();
+ var camelizedName = utils_1.camelize(name + "Formatter");
+ // first check for core formatters
+ var Formatter = loadFormatter(CORE_FORMATTERS_DIRECTORY, camelizedName);
+ if (Formatter != null) {
+ return Formatter;
+ }
+ // then check for rules within the first level of rulesDirectory
+ if (formattersDirectory !== undefined) {
+ Formatter = loadFormatter(formattersDirectory, camelizedName);
+ if (Formatter !== undefined) {
+ return Formatter;
+ }
+ }
+ // else try to resolve as module
+ return loadFormatterModule(name);
+ }
+ else {
+ // If an something else is passed as a name (e.g. object)
+ throw new Error("Name of type " + typeof name + " is not supported.");
+ }
+}
+exports.findFormatter = findFormatter;
+function loadFormatter() {
+ var paths = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ paths[_i] = arguments[_i];
+ }
+ 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;
+ }
+ return undefined;
+}
+function loadFormatterModule(name) {
+ var src;
+ try {
+ src = require.resolve(name);
+ }
+ catch (e) {
+ return undefined;
+ }
+ return require(src).Formatter;
+}
diff --git a/node_modules/tslint/lib/formatters.d.ts b/node_modules/tslint/lib/formatters.d.ts
new file mode 100644
index 000000000..869625a5a
--- /dev/null
+++ b/node_modules/tslint/lib/formatters.d.ts
@@ -0,0 +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.
+ */
+export * from "./language/formatter/abstractFormatter";
+export * from "./formatters/index";
diff --git a/node_modules/tslint/lib/formatters.js b/node_modules/tslint/lib/formatters.js
new file mode 100644
index 000000000..2deff81af
--- /dev/null
+++ b/node_modules/tslint/lib/formatters.js
@@ -0,0 +1,23 @@
+"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.
+ */
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+Object.defineProperty(exports, "__esModule", { value: true });
+__export(require("./language/formatter/abstractFormatter"));
+__export(require("./formatters/index"));
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
new file mode 100644
index 000000000..8c6b27056
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+ private escapeXml(str);
+}
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.js b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
new file mode 100644
index 000000000..c3345f774
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
@@ -0,0 +1,78 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var output = '<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3">';
+ if (failures.length !== 0) {
+ var failuresSorted = failures.sort(function (a, b) {
+ return a.getFileName().localeCompare(b.getFileName());
+ });
+ var previousFilename = null;
+ for (var _i = 0, failuresSorted_1 = failuresSorted; _i < failuresSorted_1.length; _i++) {
+ var failure = failuresSorted_1[_i];
+ var severity = failure.getRuleSeverity();
+ if (failure.getFileName() !== previousFilename) {
+ if (previousFilename !== null) {
+ output += "</file>";
+ }
+ previousFilename = failure.getFileName();
+ output += "<file name=\"" + this.escapeXml(failure.getFileName()) + "\">";
+ }
+ output += "<error line=\"" + (failure.getStartPosition().getLineAndCharacter().line + 1) + "\" ";
+ output += "column=\"" + (failure.getStartPosition().getLineAndCharacter().character + 1) + "\" ";
+ output += "severity=\"" + severity + "\" ";
+ output += "message=\"" + this.escapeXml(failure.getFailure()) + "\" ";
+ // checkstyle parser wants "source" to have structure like <anything>dot<category>dot<type>
+ output += "source=\"failure.tslint." + this.escapeXml(failure.getRuleName()) + "\" />";
+ }
+ if (previousFilename !== null) {
+ output += "</file>";
+ }
+ }
+ output += "</checkstyle>";
+ return output;
+ };
+ Formatter.prototype.escapeXml = function (str) {
+ return str
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/'/g, "&#39;")
+ .replace(/"/g, "&quot;");
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a, _b;
diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts b/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts
new file mode 100644
index 000000000..af3160a3f
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.js b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
new file mode 100644
index 000000000..b828bf58e
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
@@ -0,0 +1,79 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var codeFrame = require("babel-code-frame");
+var colors = require("colors");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ if (typeof failures[0] === "undefined") {
+ return "\n";
+ }
+ var outputLines = [];
+ var currentFile;
+ for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
+ var failure = failures_1[_i];
+ var fileName = failure.getFileName();
+ // Output the name of each file once
+ if (currentFile !== fileName) {
+ outputLines.push("");
+ outputLines.push(fileName);
+ currentFile = fileName;
+ }
+ var failureString = failure.getFailure();
+ failureString = colors.red(failureString);
+ // Rule
+ var ruleName = failure.getRuleName();
+ ruleName = colors.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: colors.enabled,
+ highlightCode: true,
+ });
+ // Ouput
+ outputLines.push(failureString + " " + ruleName);
+ outputLines.push(frame);
+ outputLines.push("");
+ }
+ // Removes initial blank line
+ if (outputLines[0] === "") {
+ outputLines.shift();
+ }
+ return outputLines.join("\n") + "\n";
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ consumer: "human",
+};
+exports.Formatter = Formatter;
+var _a, _b;
diff --git a/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts b/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts
new file mode 100644
index 000000000..af3160a3f
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/fileslistFormatter.js b/node_modules/tslint/lib/formatters/fileslistFormatter.js
new file mode 100644
index 000000000..23bda6bcb
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/fileslistFormatter.js
@@ -0,0 +1,52 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ if (failures.length === 0) {
+ return "";
+ }
+ var files = [];
+ var currentFile;
+ for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
+ var failure = failures_1[_i];
+ var fileName = failure.getFileName();
+ if (fileName !== currentFile) {
+ files.push(fileName);
+ currentFile = fileName;
+ }
+ }
+ return files.join("\n") + "\n";
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ formatterName: "filesList",
+ description: "Lists files containing lint errors.",
+ sample: "directory/myFile.ts",
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
diff --git a/node_modules/tslint/lib/formatters/index.d.ts b/node_modules/tslint/lib/formatters/index.d.ts
new file mode 100644
index 000000000..e954e1705
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/index.d.ts
@@ -0,0 +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.
+ */
+export { Formatter as JsonFormatter } from "./jsonFormatter";
+export { Formatter as PmdFormatter } from "./pmdFormatter";
+export { Formatter as ProseFormatter } from "./proseFormatter";
+export { Formatter as VerboseFormatter } from "./verboseFormatter";
+export { Formatter as StylishFormatter } from "./stylishFormatter";
+export { Formatter as FileslistFormatter } from "./fileslistFormatter";
+export { Formatter as CodeFrameFormatter } from "./codeFrameFormatter";
+export { Formatter as TapFormatter } from "./tapFormatter";
diff --git a/node_modules/tslint/lib/formatters/index.js b/node_modules/tslint/lib/formatters/index.js
new file mode 100644
index 000000000..213f23ddb
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/index.js
@@ -0,0 +1,34 @@
+"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 });
+var jsonFormatter_1 = require("./jsonFormatter");
+exports.JsonFormatter = jsonFormatter_1.Formatter;
+var pmdFormatter_1 = require("./pmdFormatter");
+exports.PmdFormatter = pmdFormatter_1.Formatter;
+var proseFormatter_1 = require("./proseFormatter");
+exports.ProseFormatter = proseFormatter_1.Formatter;
+var verboseFormatter_1 = require("./verboseFormatter");
+exports.VerboseFormatter = verboseFormatter_1.Formatter;
+var stylishFormatter_1 = require("./stylishFormatter");
+exports.StylishFormatter = stylishFormatter_1.Formatter;
+var fileslistFormatter_1 = require("./fileslistFormatter");
+exports.FileslistFormatter = fileslistFormatter_1.Formatter;
+var codeFrameFormatter_1 = require("./codeFrameFormatter");
+exports.CodeFrameFormatter = codeFrameFormatter_1.Formatter;
+var tapFormatter_1 = require("./tapFormatter");
+exports.TapFormatter = tapFormatter_1.Formatter;
diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.d.ts b/node_modules/tslint/lib/formatters/jsonFormatter.d.ts
new file mode 100644
index 000000000..af3160a3f
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/jsonFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.js b/node_modules/tslint/lib/formatters/jsonFormatter.js
new file mode 100644
index 000000000..73b8fd9d1
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/jsonFormatter.js
@@ -0,0 +1,42 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var failuresJSON = failures.map(function (failure) { return failure.toJson(); });
+ return JSON.stringify(failuresJSON);
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a;
diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
new file mode 100644
index 000000000..6227c2b8c
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.js b/node_modules/tslint/lib/formatters/msbuildFormatter.js
new file mode 100644
index 000000000..6f3792d14
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/msbuildFormatter.js
@@ -0,0 +1,51 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var utils_1 = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var outputLines = failures.map(function (failure) {
+ var fileName = failure.getFileName();
+ var failureString = failure.getFailure();
+ var camelizedRule = utils_1.camelize(failure.getRuleName());
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var positionTuple = "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character + 1) + ")";
+ var severity = failure.getRuleSeverity();
+ return "" + fileName + positionTuple + ": " + severity + " " + camelizedRule + ": " + failureString;
+ });
+ return outputLines.join("\n") + "\n";
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ formatterName: "msbuild",
+ description: "Formats errors for consumption by msbuild.",
+ descriptionDetails: (_a = ["\n The output is compatible with both msbuild and Visual Studio. All failures have the\n 'warning' severity."], _a.raw = ["\n The output is compatible with both msbuild and Visual Studio. All failures have the\n 'warning' severity."], utils_1.dedent(_a)),
+ sample: "myFile.ts(1,14): warning: Missing semicolon",
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a;
diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.d.ts b/node_modules/tslint/lib/formatters/pmdFormatter.d.ts
new file mode 100644
index 000000000..af3160a3f
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/pmdFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.js b/node_modules/tslint/lib/formatters/pmdFormatter.js
new file mode 100644
index 000000000..927d90428
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/pmdFormatter.js
@@ -0,0 +1,60 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var output = "<pmd version=\"tslint\">";
+ for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
+ var failure = failures_1[_i];
+ var failureString = failure.getFailure()
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/'/g, "&#39;")
+ .replace(/"/g, "&quot;");
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var priority = failure.getRuleSeverity() === "warning" ? 4 : 3;
+ output += "<file name=\"" + failure.getFileName();
+ output += "\"><violation begincolumn=\"" + (lineAndCharacter.character + 1);
+ output += "\" beginline=\"" + (lineAndCharacter.line + 1);
+ output += "\" priority=\"" + priority + "\"";
+ output += " rule=\"" + failureString + "\"></violation></file>";
+ }
+ output += "</pmd>";
+ return output;
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ 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)),
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a;
diff --git a/node_modules/tslint/lib/formatters/proseFormatter.d.ts b/node_modules/tslint/lib/formatters/proseFormatter.d.ts
new file mode 100644
index 000000000..fce71e7e0
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/proseFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[], fixes?: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/proseFormatter.js b/node_modules/tslint/lib/formatters/proseFormatter.js
new file mode 100644
index 000000000..981884a1e
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/proseFormatter.js
@@ -0,0 +1,62 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures, fixes) {
+ if (failures.length === 0 && (fixes === undefined || fixes.length === 0)) {
+ return "\n";
+ }
+ var fixLines = [];
+ if (fixes !== undefined) {
+ var perFileFixes = new Map();
+ for (var _i = 0, fixes_1 = fixes; _i < fixes_1.length; _i++) {
+ var fix = fixes_1[_i];
+ var prevFixes = perFileFixes.get(fix.getFileName());
+ perFileFixes.set(fix.getFileName(), (prevFixes !== undefined ? prevFixes : 0) + 1);
+ }
+ perFileFixes.forEach(function (fixCount, fixedFile) {
+ fixLines.push("Fixed " + fixCount + " error(s) in " + fixedFile);
+ });
+ fixLines.push(""); // add a blank line between fixes and failures
+ }
+ var errorLines = failures.map(function (failure) {
+ var fileName = failure.getFileName();
+ var failureString = failure.getFailure();
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var positionTuple = "[" + (lineAndCharacter.line + 1) + ", " + (lineAndCharacter.character + 1) + "]";
+ return failure.getRuleSeverity().toUpperCase() + ": " + fileName + positionTuple + ": " + failureString;
+ });
+ return fixLines.concat(errorLines).join("\n") + "\n";
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ formatterName: "prose",
+ description: "The default formatter which outputs simple human-readable messages.",
+ sample: "ERROR: myFile.ts[1, 14]: Missing semicolon",
+ consumer: "human",
+};
+exports.Formatter = Formatter;
diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.d.ts b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts
new file mode 100644
index 000000000..f82a678dd
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts
@@ -0,0 +1,27 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+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);
+}
diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.js b/node_modules/tslint/lib/formatters/stylishFormatter.js
new file mode 100644
index 000000000..c358dcaec
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/stylishFormatter.js
@@ -0,0 +1,111 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var colors = require("colors");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var outputLines = this.mapToMessages(failures);
+ // Removes initial blank line
+ if (outputLines[0] === "") {
+ outputLines.shift();
+ }
+ return outputLines.join("\n") + "\n";
+ };
+ Formatter.prototype.mapToMessages = function (failures) {
+ if (failures.length === 0) {
+ return [];
+ }
+ var outputLines = [];
+ var positionMaxSize = this.getPositionMaxSize(failures);
+ var ruleMaxSize = this.getRuleMaxSize(failures);
+ var currentFile;
+ for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
+ var failure = failures_1[_i];
+ var fileName = failure.getFileName();
+ // Output the name of each file once
+ if (currentFile !== fileName) {
+ outputLines.push("");
+ outputLines.push(fileName);
+ currentFile = fileName;
+ }
+ var failureString = failure.getFailure();
+ failureString = colors.yellow(failureString);
+ // Rule
+ var ruleName = failure.getRuleName();
+ ruleName = this.pad(ruleName, ruleMaxSize);
+ ruleName = colors.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"
+ ? colors.blue(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple)
+ : colors.red(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple);
+ // Output
+ var output = positionTuple + " " + ruleName + " " + failureString;
+ outputLines.push(output);
+ }
+ return outputLines;
+ };
+ Formatter.prototype.pad = function (str, len) {
+ var padder = Array(len + 1).join(" ");
+ return (str + padder).substring(0, padder.length);
+ };
+ Formatter.prototype.getPositionMaxSize = function (failures) {
+ var positionMaxSize = 0;
+ for (var _i = 0, failures_2 = failures; _i < failures_2.length; _i++) {
+ var failure = failures_2[_i];
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var positionSize = (lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1)).length;
+ if (positionSize > positionMaxSize) {
+ positionMaxSize = positionSize;
+ }
+ }
+ return positionMaxSize;
+ };
+ Formatter.prototype.getRuleMaxSize = function (failures) {
+ var ruleMaxSize = 0;
+ for (var _i = 0, failures_3 = failures; _i < failures_3.length; _i++) {
+ var failure = failures_3[_i];
+ var ruleSize = failure.getRuleName().length;
+ if (ruleSize > ruleMaxSize) {
+ ruleMaxSize = ruleSize;
+ }
+ }
+ return ruleMaxSize;
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ formatterName: "stylish",
+ description: "Human-readable formatter which creates stylish messages.",
+ descriptionDetails: (_a = ["\n The output matches that produced by eslint's stylish formatter. Its readability\n enhanced through spacing and colouring"], _a.raw = ["\n The output matches that produced by eslint's stylish formatter. Its readability\n 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)),
+ consumer: "human",
+};
+exports.Formatter = Formatter;
+var _a, _b;
diff --git a/node_modules/tslint/lib/formatters/tapFormatter.d.ts b/node_modules/tslint/lib/formatters/tapFormatter.d.ts
new file mode 100644
index 000000000..b44fb7d11
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/tapFormatter.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+ private mapToMessages(failures);
+}
diff --git a/node_modules/tslint/lib/formatters/tapFormatter.js b/node_modules/tslint/lib/formatters/tapFormatter.js
new file mode 100644
index 000000000..1bf56b9fc
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/tapFormatter.js
@@ -0,0 +1,64 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ var output = ["TAP version 13"];
+ if (failures.length === 0) {
+ output = output.concat([
+ "1..0 # SKIP No failures",
+ ]);
+ }
+ else {
+ output = output.concat(["1.." + failures.length]).concat(this.mapToMessages(failures));
+ }
+ return output.join("\n") + "\n";
+ };
+ Formatter.prototype.mapToMessages = function (failures) {
+ return failures.map(function (failure, i) {
+ var fileName = failure.getFileName();
+ var failureString = failure.getFailure();
+ var ruleName = failure.getRuleName();
+ var failureMessage = failure.getFailure();
+ 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 Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ 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)),
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a;
diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.d.ts b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts
new file mode 100644
index 000000000..94ee65563
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts
@@ -0,0 +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 { AbstractFormatter } from "../language/formatter/abstractFormatter";
+import { IFormatterMetadata } from "../language/formatter/formatter";
+import { RuleFailure } from "../language/rule/rule";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[]): string;
+ private mapToMessages(failures);
+}
diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.js b/node_modules/tslint/lib/formatters/verboseFormatter.js
new file mode 100644
index 000000000..dfaf66313
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/verboseFormatter.js
@@ -0,0 +1,50 @@
+"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 });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures) {
+ return this.mapToMessages(failures).join("\n") + "\n";
+ };
+ Formatter.prototype.mapToMessages = function (failures) {
+ return failures.map(function (failure) {
+ var fileName = failure.getFileName();
+ var failureString = failure.getFailure();
+ var ruleName = failure.getRuleName();
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var positionTuple = "[" + (lineAndCharacter.line + 1) + ", " + (lineAndCharacter.character + 1) + "]";
+ return failure.getRuleSeverity().toUpperCase() + ": (" + ruleName + ") " + fileName + positionTuple + ": " + failureString;
+ });
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+Formatter.metadata = {
+ formatterName: "verbose",
+ description: "The human-readable formatter which includes the rule name in messages.",
+ descriptionDetails: "The output is the same as the prose formatter with the rule name included",
+ sample: "ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon",
+ consumer: "human",
+};
+exports.Formatter = Formatter;
diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.d.ts b/node_modules/tslint/lib/formatters/vsoFormatter.d.ts
new file mode 100644
index 000000000..d5ebd9f2b
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/vsoFormatter.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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";
+export declare class Formatter extends AbstractFormatter {
+ static metadata: IFormatterMetadata;
+ format(failures: RuleFailure[], warnings?: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.js b/node_modules/tslint/lib/formatters/vsoFormatter.js
new file mode 100644
index 000000000..b2c4082ed
--- /dev/null
+++ b/node_modules/tslint/lib/formatters/vsoFormatter.js
@@ -0,0 +1,54 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
+var Utils = require("../utils");
+var Formatter = (function (_super) {
+ tslib_1.__extends(Formatter, _super);
+ function Formatter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Formatter.prototype.format = function (failures, warnings) {
+ if (warnings === void 0) { warnings = []; }
+ var all = failures.concat(warnings);
+ var outputLines = all.map(function (failure) {
+ var fileName = failure.getFileName();
+ var failureString = failure.getFailure();
+ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var line = lineAndCharacter.line + 1;
+ var character = lineAndCharacter.character + 1;
+ var code = failure.getRuleName();
+ var properties = "sourcepath=" + fileName + ";linenumber=" + line + ";columnnumber=" + character + ";code=" + code + ";";
+ return "##vso[task.logissue type=warning;" + properties + "]" + failureString;
+ });
+ return outputLines.join("\n") + "\n";
+ };
+ return Formatter;
+}(abstractFormatter_1.AbstractFormatter));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ sample: "##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon",
+ consumer: "machine",
+};
+exports.Formatter = Formatter;
+var _a;
diff --git a/node_modules/tslint/lib/index.d.ts b/node_modules/tslint/lib/index.d.ts
new file mode 100644
index 000000000..4c492c980
--- /dev/null
+++ b/node_modules/tslint/lib/index.d.ts
@@ -0,0 +1,46 @@
+/**
+ * @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 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 * from "./language/rule/rule";
+export * from "./enableDisableRules";
+export * from "./formatterLoader";
+export * from "./ruleLoader";
+export * from "./language/utils";
+export * from "./language/walker";
+export * from "./language/formatter/formatter";
+export interface LintResult {
+ errorCount: number;
+ warningCount: number;
+ failures: RuleFailure[];
+ fixes?: RuleFailure[];
+ format: string | FormatterConstructor;
+ output: string;
+}
+export interface ILinterOptions {
+ fix: boolean;
+ formatter?: string | FormatterConstructor;
+ formattersDirectory?: string;
+ rulesDirectory?: string | string[];
+}
diff --git a/node_modules/tslint/lib/index.js b/node_modules/tslint/lib/index.js
new file mode 100644
index 000000000..fb7cfef26
--- /dev/null
+++ b/node_modules/tslint/lib/index.js
@@ -0,0 +1,39 @@
+"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.
+ */
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+Object.defineProperty(exports, "__esModule", { value: true });
+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;
+__export(require("./language/rule/rule"));
+__export(require("./enableDisableRules"));
+__export(require("./formatterLoader"));
+__export(require("./ruleLoader"));
+__export(require("./language/utils"));
+__export(require("./language/walker"));
diff --git a/node_modules/tslint/lib/language/formatter/abstractFormatter.d.ts b/node_modules/tslint/lib/language/formatter/abstractFormatter.d.ts
new file mode 100644
index 000000000..918f13803
--- /dev/null
+++ b/node_modules/tslint/lib/language/formatter/abstractFormatter.d.ts
@@ -0,0 +1,22 @@
+/**
+ * @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 { RuleFailure } from "../rule/rule";
+import { IFormatter, IFormatterMetadata } from "./formatter";
+export declare abstract class AbstractFormatter implements IFormatter {
+ static metadata: IFormatterMetadata;
+ abstract format(failures: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/language/formatter/abstractFormatter.js b/node_modules/tslint/lib/language/formatter/abstractFormatter.js
new file mode 100644
index 000000000..63e037732
--- /dev/null
+++ b/node_modules/tslint/lib/language/formatter/abstractFormatter.js
@@ -0,0 +1,24 @@
+"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 });
+var AbstractFormatter = (function () {
+ function AbstractFormatter() {
+ }
+ return AbstractFormatter;
+}());
+exports.AbstractFormatter = AbstractFormatter;
diff --git a/node_modules/tslint/lib/language/formatter/formatter.d.ts b/node_modules/tslint/lib/language/formatter/formatter.d.ts
new file mode 100644
index 000000000..201054396
--- /dev/null
+++ b/node_modules/tslint/lib/language/formatter/formatter.d.ts
@@ -0,0 +1,51 @@
+/**
+ * @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 { RuleFailure } from "../rule/rule";
+export interface IFormatterMetadata {
+ /**
+ * The name of the formatter.
+ */
+ formatterName: string;
+ /**
+ * A short, one line description of what the formatter does.
+ */
+ description: string;
+ /**
+ * More elaborate details about the formatter.
+ */
+ descriptionDetails?: string;
+ /**
+ * Sample output from the formatter.
+ */
+ sample: string;
+ /**
+ * Sample output from the formatter.
+ */
+ consumer: ConsumerType;
+}
+export declare type ConsumerType = "human" | "machine";
+export interface FormatterConstructor {
+ new (): IFormatter;
+}
+export interface IFormatter {
+ /**
+ * Formats linter results
+ * @param {RuleFailure[]} failures Linter failures that were not fixed
+ * @param {RuleFailure[]} fixes Fixed linter failures. Available when the `--fix` argument is used on the command line
+ */
+ format(failures: RuleFailure[], fixes?: RuleFailure[]): string;
+}
diff --git a/node_modules/tslint/lib/language/formatter/formatter.js b/node_modules/tslint/lib/language/formatter/formatter.js
new file mode 100644
index 000000000..1c258a5da
--- /dev/null
+++ b/node_modules/tslint/lib/language/formatter/formatter.js
@@ -0,0 +1,18 @@
+"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 });
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.d.ts b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
new file mode 100644
index 000000000..8a2362b5c
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
@@ -0,0 +1,39 @@
+/**
+ * @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 { IWalker, WalkContext } from "../walker";
+import { IOptions, IRule, IRuleMetadata, RuleFailure, RuleSeverity } from "./rule";
+export declare abstract class AbstractRule implements IRule {
+ private options;
+ static metadata: IRuleMetadata;
+ protected readonly ruleArguments: any[];
+ protected readonly ruleSeverity: RuleSeverity;
+ ruleName: string;
+ constructor(options: IOptions);
+ getOptions(): IOptions;
+ abstract apply(sourceFile: ts.SourceFile): RuleFailure[];
+ applyWithWalker(walker: IWalker): RuleFailure[];
+ isEnabled(): boolean;
+ protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<void>) => void): RuleFailure[];
+ protected applyWithFunction<T, U extends T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: U): RuleFailure[];
+ /**
+ * @deprecated
+ * Failures will be filtered based on `tslint:disable` comments by tslint.
+ * This method now does nothing.
+ */
+ protected filterFailures(failures: RuleFailure[]): RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.js b/node_modules/tslint/lib/language/rule/abstractRule.js
new file mode 100644
index 000000000..52f4c8f55
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/abstractRule.js
@@ -0,0 +1,50 @@
+"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 });
+var walker_1 = require("../walker");
+var AbstractRule = (function () {
+ function AbstractRule(options) {
+ this.options = options;
+ this.ruleName = options.ruleName;
+ this.ruleArguments = options.ruleArguments;
+ this.ruleSeverity = options.ruleSeverity;
+ }
+ AbstractRule.prototype.getOptions = function () {
+ return this.options;
+ };
+ AbstractRule.prototype.applyWithWalker = function (walker) {
+ walker.walk(walker.getSourceFile());
+ return walker.getFailures();
+ };
+ AbstractRule.prototype.isEnabled = function () {
+ return this.ruleSeverity !== "off";
+ };
+ AbstractRule.prototype.applyWithFunction = function (sourceFile, walkFn, options) {
+ var ctx = new walker_1.WalkContext(sourceFile, this.ruleName, options);
+ walkFn(ctx);
+ return ctx.failures;
+ };
+ /**
+ * @deprecated
+ * Failures will be filtered based on `tslint:disable` comments by tslint.
+ * This method now does nothing.
+ */
+ AbstractRule.prototype.filterFailures = function (failures) { return failures; };
+ return AbstractRule;
+}());
+exports.AbstractRule = AbstractRule;
diff --git a/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts b/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts
new file mode 100644
index 000000000..f12d74f44
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts
@@ -0,0 +1,22 @@
+/**
+ * @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 { AbstractRule } from "./abstractRule";
+import { ITypedRule, RuleFailure } from "./rule";
+export declare abstract class OptionallyTypedRule extends AbstractRule implements ITypedRule {
+ abstract applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/language/rule/optionallyTypedRule.js b/node_modules/tslint/lib/language/rule/optionallyTypedRule.js
new file mode 100644
index 000000000..1914eda40
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/optionallyTypedRule.js
@@ -0,0 +1,28 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractRule_1 = require("./abstractRule");
+var OptionallyTypedRule = (function (_super) {
+ tslib_1.__extends(OptionallyTypedRule, _super);
+ function OptionallyTypedRule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return OptionallyTypedRule;
+}(abstractRule_1.AbstractRule));
+exports.OptionallyTypedRule = OptionallyTypedRule;
diff --git a/node_modules/tslint/lib/language/rule/rule.d.ts b/node_modules/tslint/lib/language/rule/rule.d.ts
new file mode 100644
index 000000000..e432ce375
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/rule.d.ts
@@ -0,0 +1,178 @@
+/**
+ * @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 { IWalker } from "../walker";
+export interface RuleConstructor {
+ metadata: IRuleMetadata;
+ new (options: IOptions): IRule;
+}
+export interface IRuleMetadata {
+ /**
+ * The kebab-case name of the rule.
+ */
+ ruleName: string;
+ /**
+ * The type of the rule - its overall purpose
+ */
+ type: RuleType;
+ /**
+ * A rule deprecation message, if applicable.
+ */
+ deprecationMessage?: string;
+ /**
+ * A short, one line description of what the rule does.
+ */
+ description: string;
+ /**
+ * More elaborate details about the rule.
+ */
+ descriptionDetails?: string;
+ /**
+ * Whether or not the rule will provide fix suggestions.
+ */
+ hasFix?: boolean;
+ /**
+ * An explanation of the available options for the rule.
+ */
+ optionsDescription: string;
+ /**
+ * Schema of the options the rule accepts.
+ * The first boolean for whether the rule is enabled or not is already implied.
+ * This field describes the options after that boolean.
+ * If null, this rule has no options and is not configurable.
+ */
+ options: any;
+ /**
+ * Examples of what a standard config for the rule might look like.
+ * Using a string[] here is deprecated. Write the options as a JSON object instead.
+ */
+ optionExamples?: Array<true | any[]> | string[];
+ /**
+ * An explanation of why the rule is useful.
+ */
+ rationale?: string;
+ /**
+ * Whether or not the rule requires type info to run.
+ */
+ requiresTypeInfo?: boolean;
+ /**
+ * Whether or not the rule use for TypeScript only. If `false`, this rule may be used with .js files.
+ */
+ typescriptOnly: boolean;
+}
+export declare type RuleType = "functionality" | "maintainability" | "style" | "typescript";
+export declare type RuleSeverity = "warning" | "error" | "off";
+export interface IOptions {
+ ruleArguments: any[];
+ ruleSeverity: RuleSeverity;
+ ruleName: string;
+ /**
+ * @deprecated
+ * Tslint now handles disables itself.
+ * This will be empty.
+ */
+ disabledIntervals: IDisabledInterval[];
+}
+/**
+ * @deprecated
+ * These are now handled internally.
+ */
+export interface IDisabledInterval {
+ startPosition: number;
+ endPosition: number;
+}
+export interface IRule {
+ getOptions(): IOptions;
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): RuleFailure[];
+ applyWithWalker(walker: IWalker): RuleFailure[];
+}
+export interface ITypedRule extends IRule {
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[];
+}
+export interface IRuleFailureJson {
+ endPosition: IRuleFailurePositionJson;
+ failure: string;
+ fix?: FixJson;
+ name: string;
+ ruleSeverity: string;
+ ruleName: string;
+ startPosition: IRuleFailurePositionJson;
+}
+export interface IRuleFailurePositionJson {
+ character: number;
+ line: number;
+ position: number;
+}
+export declare function isTypedRule(rule: IRule): rule is ITypedRule;
+export interface ReplacementJson {
+ innerStart: number;
+ innerLength: number;
+ innerText: string;
+}
+export declare class Replacement {
+ readonly start: number;
+ readonly length: number;
+ readonly text: string;
+ static applyFixes(content: string, fixes: Fix[]): string;
+ static applyAll(content: string, replacements: Replacement[]): string;
+ static replaceNode(node: ts.Node, text: string, sourceFile?: ts.SourceFile): Replacement;
+ static replaceFromTo(start: number, end: number, text: string): Replacement;
+ static deleteText(start: number, length: number): Replacement;
+ static deleteFromTo(start: number, end: number): Replacement;
+ static appendText(start: number, text: string): Replacement;
+ constructor(start: number, length: number, text: string);
+ readonly end: number;
+ apply(content: string): string;
+ toJson(): ReplacementJson;
+}
+export declare class RuleFailurePosition {
+ private position;
+ private lineAndCharacter;
+ constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
+ getPosition(): number;
+ getLineAndCharacter(): ts.LineAndCharacter;
+ toJson(): IRuleFailurePositionJson;
+ equals(ruleFailurePosition: RuleFailurePosition): boolean;
+}
+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 ruleSeverity;
+ constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string, fix?: Fix);
+ getFileName(): string;
+ getRuleName(): string;
+ getStartPosition(): RuleFailurePosition;
+ getEndPosition(): RuleFailurePosition;
+ getFailure(): string;
+ hasFix(): boolean;
+ getFix(): Replacement | Replacement[] | undefined;
+ getRawLines(): string;
+ getRuleSeverity(): RuleSeverity;
+ setRuleSeverity(value: RuleSeverity): void;
+ toJson(): IRuleFailureJson;
+ equals(ruleFailure: RuleFailure): boolean;
+ private createFailurePosition(position);
+}
diff --git a/node_modules/tslint/lib/language/rule/rule.js b/node_modules/tslint/lib/language/rule/rule.js
new file mode 100644
index 000000000..98291f25a
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/rule.js
@@ -0,0 +1,168 @@
+"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 });
+var utils_1 = require("../../utils");
+function isTypedRule(rule) {
+ return "applyWithProgram" in rule;
+}
+exports.isTypedRule = isTypedRule;
+var Replacement = (function () {
+ function Replacement(start, length, text) {
+ this.start = start;
+ this.length = length;
+ this.text = text;
+ }
+ Replacement.applyFixes = function (content, fixes) {
+ return this.applyAll(content, utils_1.flatMap(fixes, utils_1.arrayify));
+ };
+ Replacement.applyAll = function (content, replacements) {
+ // sort in reverse so that diffs are properly applied
+ replacements.sort(function (a, b) { return b.end !== a.end ? b.end - a.end : b.start - a.start; });
+ return replacements.reduce(function (text, r) { return r.apply(text); }, content);
+ };
+ Replacement.replaceNode = function (node, text, sourceFile) {
+ return this.replaceFromTo(node.getStart(sourceFile), node.getEnd(), text);
+ };
+ Replacement.replaceFromTo = function (start, end, text) {
+ return new Replacement(start, end - start, text);
+ };
+ Replacement.deleteText = function (start, length) {
+ return new Replacement(start, length, "");
+ };
+ Replacement.deleteFromTo = function (start, end) {
+ return new Replacement(start, end - start, "");
+ };
+ Replacement.appendText = function (start, text) {
+ return new Replacement(start, 0, text);
+ };
+ Object.defineProperty(Replacement.prototype, "end", {
+ get: function () {
+ return this.start + this.length;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Replacement.prototype.apply = function (content) {
+ return content.substring(0, this.start) + this.text + content.substring(this.start + this.length);
+ };
+ Replacement.prototype.toJson = function () {
+ // tslint:disable object-literal-sort-keys
+ return {
+ innerStart: this.start,
+ innerLength: this.length,
+ innerText: this.text,
+ };
+ // tslint:enable object-literal-sort-keys
+ };
+ return Replacement;
+}());
+exports.Replacement = Replacement;
+var RuleFailurePosition = (function () {
+ function RuleFailurePosition(position, lineAndCharacter) {
+ this.position = position;
+ this.lineAndCharacter = lineAndCharacter;
+ }
+ RuleFailurePosition.prototype.getPosition = function () {
+ return this.position;
+ };
+ RuleFailurePosition.prototype.getLineAndCharacter = function () {
+ return this.lineAndCharacter;
+ };
+ RuleFailurePosition.prototype.toJson = function () {
+ return {
+ character: this.lineAndCharacter.character,
+ line: this.lineAndCharacter.line,
+ position: this.position,
+ };
+ };
+ RuleFailurePosition.prototype.equals = function (ruleFailurePosition) {
+ var ll = this.lineAndCharacter;
+ var rr = ruleFailurePosition.lineAndCharacter;
+ return this.position === ruleFailurePosition.position
+ && ll.line === rr.line
+ && ll.character === rr.character;
+ };
+ return RuleFailurePosition;
+}());
+exports.RuleFailurePosition = RuleFailurePosition;
+var RuleFailure = (function () {
+ function RuleFailure(sourceFile, start, end, failure, ruleName, fix) {
+ this.sourceFile = sourceFile;
+ this.failure = failure;
+ this.ruleName = ruleName;
+ this.fix = fix;
+ this.fileName = sourceFile.fileName;
+ this.startPosition = this.createFailurePosition(start);
+ this.endPosition = this.createFailurePosition(end);
+ this.rawLines = sourceFile.text;
+ this.ruleSeverity = "error";
+ }
+ RuleFailure.prototype.getFileName = function () {
+ return this.fileName;
+ };
+ RuleFailure.prototype.getRuleName = function () {
+ return this.ruleName;
+ };
+ RuleFailure.prototype.getStartPosition = function () {
+ return this.startPosition;
+ };
+ RuleFailure.prototype.getEndPosition = function () {
+ return this.endPosition;
+ };
+ RuleFailure.prototype.getFailure = function () {
+ return this.failure;
+ };
+ RuleFailure.prototype.hasFix = function () {
+ return this.fix !== undefined;
+ };
+ RuleFailure.prototype.getFix = function () {
+ return this.fix;
+ };
+ RuleFailure.prototype.getRawLines = function () {
+ return this.rawLines;
+ };
+ RuleFailure.prototype.getRuleSeverity = function () {
+ return this.ruleSeverity;
+ };
+ RuleFailure.prototype.setRuleSeverity = function (value) {
+ this.ruleSeverity = value;
+ };
+ RuleFailure.prototype.toJson = function () {
+ return {
+ endPosition: this.endPosition.toJson(),
+ failure: this.failure,
+ fix: this.fix === undefined ? undefined : Array.isArray(this.fix) ? this.fix.map(function (r) { return r.toJson(); }) : this.fix.toJson(),
+ name: this.fileName,
+ ruleName: this.ruleName,
+ ruleSeverity: this.ruleSeverity.toUpperCase(),
+ startPosition: this.startPosition.toJson(),
+ };
+ };
+ RuleFailure.prototype.equals = function (ruleFailure) {
+ return this.failure === ruleFailure.getFailure()
+ && this.fileName === ruleFailure.getFileName()
+ && this.startPosition.equals(ruleFailure.getStartPosition())
+ && this.endPosition.equals(ruleFailure.getEndPosition());
+ };
+ RuleFailure.prototype.createFailurePosition = function (position) {
+ var lineAndCharacter = this.sourceFile.getLineAndCharacterOfPosition(position);
+ return new RuleFailurePosition(position, lineAndCharacter);
+ };
+ return RuleFailure;
+}());
+exports.RuleFailure = RuleFailure;
diff --git a/node_modules/tslint/lib/language/rule/typedRule.d.ts b/node_modules/tslint/lib/language/rule/typedRule.d.ts
new file mode 100644
index 000000000..a4d1fcca0
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/typedRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 { AbstractRule } from "./abstractRule";
+import { ITypedRule, RuleFailure } from "./rule";
+export declare abstract class TypedRule extends AbstractRule implements ITypedRule {
+ apply(): RuleFailure[];
+ abstract applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/language/rule/typedRule.js b/node_modules/tslint/lib/language/rule/typedRule.js
new file mode 100644
index 000000000..45a2fb30d
--- /dev/null
+++ b/node_modules/tslint/lib/language/rule/typedRule.js
@@ -0,0 +1,32 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var abstractRule_1 = require("./abstractRule");
+var TypedRule = (function (_super) {
+ tslib_1.__extends(TypedRule, _super);
+ function TypedRule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TypedRule.prototype.apply = function () {
+ // if no program is given to the linter, throw an error
+ throw new Error("The '" + this.ruleName + "' rule requires type checking");
+ };
+ return TypedRule;
+}(abstractRule_1.AbstractRule));
+exports.TypedRule = TypedRule;
diff --git a/node_modules/tslint/lib/language/utils.d.ts b/node_modules/tslint/lib/language/utils.d.ts
new file mode 100644
index 000000000..a8ccc2be1
--- /dev/null
+++ b/node_modules/tslint/lib/language/utils.d.ts
@@ -0,0 +1,97 @@
+import * as ts from "typescript";
+import { IDisabledInterval, RuleFailure } from "./rule/rule";
+export declare function getSourceFile(fileName: string, source: string): ts.SourceFile;
+/** @deprecated See IDisabledInterval. */
+export declare function doesIntersect(failure: RuleFailure, disabledIntervals: IDisabledInterval[]): boolean;
+/**
+ * @returns true if any modifier kinds passed along exist in the given modifiers array
+ */
+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".
+ */
+export declare function isBlockScopedVariable(node: ts.VariableDeclaration | ts.VariableStatement): boolean;
+export declare function isBlockScopedBindingElement(node: ts.BindingElement): boolean;
+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.
+ */
+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.
+ */
+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) => boolean): ts.Node | undefined;
+export declare function isAssignment(node: ts.Node): boolean;
+/**
+ * Bitwise check for node flags.
+ */
+export declare function isNodeFlagSet(node: ts.Node, flagToCheck: ts.NodeFlags): boolean;
+/**
+ * Bitwise check for combined node flags.
+ */
+export declare function isCombinedNodeFlagSet(node: ts.Node, flagToCheck: ts.NodeFlags): boolean;
+/**
+ * Bitwise check for combined modifier flags.
+ */
+export declare function isCombinedModifierFlagSet(node: ts.Node, flagToCheck: ts.ModifierFlags): boolean;
+/**
+ * Bitwise check for type flags.
+ */
+export declare function isTypeFlagSet(type: ts.Type, flagToCheck: ts.TypeFlags): boolean;
+/**
+ * Bitwise check for symbol flags.
+ */
+export declare function isSymbolFlagSet(symbol: ts.Symbol, flagToCheck: ts.SymbolFlags): boolean;
+/**
+ * Bitwise check for object flags.
+ * Does not work with TypeScript 2.0.x
+ */
+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.
+ */
+export declare function isNestedModuleDeclaration(decl: ts.ModuleDeclaration): boolean;
+export declare function unwrapParentheses(node: ts.Expression): ts.Expression;
+export declare function isScopeBoundary(node: ts.Node): boolean;
+export declare function isBlockScopeBoundary(node: ts.Node): boolean;
+export declare function isLoop(node: ts.Node): node is ts.IterationStatement;
+export interface TokenPosition {
+ /** The start of the token including all trivia before it */
+ fullStart: number;
+ /** The start of the token */
+ tokenStart: number;
+ /** The end of the token */
+ end: number;
+}
+export declare type ForEachTokenCallback = (fullText: string, kind: ts.SyntaxKind, pos: TokenPosition, parent: ts.Node) => void;
+export declare type ForEachCommentCallback = (fullText: string, kind: ts.SyntaxKind, pos: TokenPosition) => void;
+export declare type FilterCallback = (node: ts.Node) => boolean;
+/**
+ * Iterate over all tokens of `node`
+ *
+ * @description JsDoc comments are treated like regular comments and only visited if `skipTrivia` === false.
+ *
+ * @param node The node whose tokens should be visited
+ * @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.
+ */
+export declare function forEachToken(node: ts.Node, skipTrivia: boolean, cb: ForEachTokenCallback, filter?: FilterCallback): void;
+/** Iterate over all comments owned by `node` or its children */
+export declare function forEachComment(node: ts.Node, cb: ForEachCommentCallback): void;
+/**
+ * Checks if there are any comments between `position` and the next non-trivia token
+ *
+ * @param text The text to scan
+ * @param position The position inside `text` where to start scanning. Make sure that this is a valid start position.
+ * This value is typically obtained from `node.getFullStart()` or `node.getEnd()`
+ */
+export declare function hasCommentAfterPosition(text: string, position: number): boolean;
+export interface EqualsKind {
+ isPositive: boolean;
+ isStrict: boolean;
+}
+export declare function getEqualsKind(node: ts.BinaryOperatorToken): EqualsKind | undefined;
diff --git a/node_modules/tslint/lib/language/utils.js b/node_modules/tslint/lib/language/utils.js
new file mode 100644
index 000000000..4f1fa52cf
--- /dev/null
+++ b/node_modules/tslint/lib/language/utils.js
@@ -0,0 +1,402 @@
+"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 });
+var path = require("path");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+function getSourceFile(fileName, source) {
+ var normalizedName = path.normalize(fileName).replace(/\\/g, "/");
+ return ts.createSourceFile(normalizedName, source, ts.ScriptTarget.ES5, /*setParentNodes*/ true);
+}
+exports.getSourceFile = getSourceFile;
+/** @deprecated See IDisabledInterval. */
+function doesIntersect(failure, disabledIntervals) {
+ return disabledIntervals.some(function (interval) {
+ var maxStart = Math.max(interval.startPosition, failure.getStartPosition().getPosition());
+ var minEnd = Math.min(interval.endPosition, failure.getEndPosition().getPosition());
+ return maxStart <= minEnd;
+ });
+}
+exports.doesIntersect = doesIntersect;
+/**
+ * @returns true if any modifier kinds passed along exist in the given modifiers array
+ */
+function hasModifier(modifiers) {
+ var modifierKinds = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ modifierKinds[_i - 1] = arguments[_i];
+ }
+ if (modifiers === undefined || modifierKinds.length === 0) {
+ return false;
+ }
+ return modifiers.some(function (m) {
+ return modifierKinds.some(function (k) { return m.kind === k; });
+ });
+}
+exports.hasModifier = hasModifier;
+/**
+ * Determines if the appropriate bit in the parent (VariableDeclarationList) is set,
+ * which indicates this is a "let" or "const".
+ */
+function isBlockScopedVariable(node) {
+ if (node.kind === ts.SyntaxKind.VariableDeclaration) {
+ var parent = node.parent;
+ return parent.kind === ts.SyntaxKind.CatchClause || tsutils_1.isBlockScopedVariableDeclarationList(parent);
+ }
+ else {
+ return tsutils_1.isBlockScopedVariableDeclarationList(node.declarationList);
+ }
+}
+exports.isBlockScopedVariable = isBlockScopedVariable;
+function isBlockScopedBindingElement(node) {
+ var variableDeclaration = getBindingElementVariableDeclaration(node);
+ // if no variable declaration, it must be a function param, which is block scoped
+ return (variableDeclaration == null) || isBlockScopedVariable(variableDeclaration);
+}
+exports.isBlockScopedBindingElement = isBlockScopedBindingElement;
+function getBindingElementVariableDeclaration(node) {
+ var currentParent = node.parent;
+ while (currentParent.kind !== ts.SyntaxKind.VariableDeclaration) {
+ if (currentParent.parent == null) {
+ return null; // function parameter, no variable declaration
+ }
+ else {
+ currentParent = currentParent.parent;
+ }
+ }
+ return currentParent;
+}
+exports.getBindingElementVariableDeclaration = getBindingElementVariableDeclaration;
+/**
+ * Finds a child of a given node with a given kind.
+ * Note: This uses `node.getChildren()`, which does extra parsing work to include tokens.
+ */
+function childOfKind(node, kind) {
+ return node.getChildren().find(function (child) { return child.kind === kind; });
+}
+exports.childOfKind = childOfKind;
+/**
+ * @returns true if some ancestor of `node` satisfies `predicate`, including `node` itself.
+ */
+function someAncestor(node, predicate) {
+ return predicate(node) || (node.parent != null && someAncestor(node.parent, predicate));
+}
+exports.someAncestor = someAncestor;
+function ancestorWhere(node, predicate) {
+ var cur = node;
+ do {
+ if (predicate(cur)) {
+ return cur;
+ }
+ cur = cur.parent;
+ } while (cur !== undefined);
+ return undefined;
+}
+exports.ancestorWhere = ancestorWhere;
+function isAssignment(node) {
+ if (node.kind === ts.SyntaxKind.BinaryExpression) {
+ var binaryExpression = node;
+ return binaryExpression.operatorToken.kind >= ts.SyntaxKind.FirstAssignment
+ && binaryExpression.operatorToken.kind <= ts.SyntaxKind.LastAssignment;
+ }
+ else {
+ return false;
+ }
+}
+exports.isAssignment = isAssignment;
+/**
+ * Bitwise check for node flags.
+ */
+function isNodeFlagSet(node, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (node.flags & flagToCheck) !== 0;
+}
+exports.isNodeFlagSet = isNodeFlagSet;
+/**
+ * Bitwise check for combined node flags.
+ */
+function isCombinedNodeFlagSet(node, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (ts.getCombinedNodeFlags(node) & flagToCheck) !== 0;
+}
+exports.isCombinedNodeFlagSet = isCombinedNodeFlagSet;
+/**
+ * Bitwise check for combined modifier flags.
+ */
+function isCombinedModifierFlagSet(node, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (ts.getCombinedModifierFlags(node) & flagToCheck) !== 0;
+}
+exports.isCombinedModifierFlagSet = isCombinedModifierFlagSet;
+/**
+ * Bitwise check for type flags.
+ */
+function isTypeFlagSet(type, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (type.flags & flagToCheck) !== 0;
+}
+exports.isTypeFlagSet = isTypeFlagSet;
+/**
+ * Bitwise check for symbol flags.
+ */
+function isSymbolFlagSet(symbol, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (symbol.flags & flagToCheck) !== 0;
+}
+exports.isSymbolFlagSet = isSymbolFlagSet;
+/**
+ * Bitwise check for object flags.
+ * Does not work with TypeScript 2.0.x
+ */
+function isObjectFlagSet(objectType, flagToCheck) {
+ // tslint:disable-next-line:no-bitwise
+ return (objectType.objectFlags & flagToCheck) !== 0;
+}
+exports.isObjectFlagSet = isObjectFlagSet;
+/**
+ * @returns true if decl is a nested module declaration, i.e. represents a segment of a dotted module path.
+ */
+function isNestedModuleDeclaration(decl) {
+ // in a declaration expression like 'module a.b.c' - 'a' is the top level module declaration node and 'b' and 'c'
+ // are nested therefore we can depend that a node's position will only match with its name's position for nested
+ // nodes
+ return decl.name.pos === decl.pos;
+}
+exports.isNestedModuleDeclaration = isNestedModuleDeclaration;
+function unwrapParentheses(node) {
+ while (node.kind === ts.SyntaxKind.ParenthesizedExpression) {
+ node = node.expression;
+ }
+ return node;
+}
+exports.unwrapParentheses = unwrapParentheses;
+function isScopeBoundary(node) {
+ return node.kind === ts.SyntaxKind.FunctionDeclaration
+ || node.kind === ts.SyntaxKind.FunctionExpression
+ || node.kind === ts.SyntaxKind.PropertyAssignment
+ || node.kind === ts.SyntaxKind.ShorthandPropertyAssignment
+ || node.kind === ts.SyntaxKind.MethodDeclaration
+ || node.kind === ts.SyntaxKind.Constructor
+ || node.kind === ts.SyntaxKind.ModuleDeclaration
+ || node.kind === ts.SyntaxKind.ArrowFunction
+ || node.kind === ts.SyntaxKind.ParenthesizedExpression
+ || node.kind === ts.SyntaxKind.ClassDeclaration
+ || node.kind === ts.SyntaxKind.ClassExpression
+ || node.kind === ts.SyntaxKind.InterfaceDeclaration
+ || node.kind === ts.SyntaxKind.GetAccessor
+ || node.kind === ts.SyntaxKind.SetAccessor
+ || node.kind === ts.SyntaxKind.SourceFile && ts.isExternalModule(node);
+}
+exports.isScopeBoundary = isScopeBoundary;
+function isBlockScopeBoundary(node) {
+ return isScopeBoundary(node)
+ || node.kind === ts.SyntaxKind.Block
+ || isLoop(node)
+ || node.kind === ts.SyntaxKind.WithStatement
+ || node.kind === ts.SyntaxKind.SwitchStatement
+ || node.parent !== undefined
+ && (node.parent.kind === ts.SyntaxKind.TryStatement
+ || node.parent.kind === ts.SyntaxKind.IfStatement);
+}
+exports.isBlockScopeBoundary = isBlockScopeBoundary;
+function isLoop(node) {
+ return node.kind === ts.SyntaxKind.DoStatement
+ || node.kind === ts.SyntaxKind.WhileStatement
+ || node.kind === ts.SyntaxKind.ForStatement
+ || node.kind === ts.SyntaxKind.ForInStatement
+ || node.kind === ts.SyntaxKind.ForOfStatement;
+}
+exports.isLoop = isLoop;
+/**
+ * Iterate over all tokens of `node`
+ *
+ * @description JsDoc comments are treated like regular comments and only visited if `skipTrivia` === false.
+ *
+ * @param node The node whose tokens should be visited
+ * @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.
+ */
+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
+ var sourceFile = node.getSourceFile();
+ var fullText = sourceFile.text;
+ var iterateFn = filter === undefined ? iterateChildren : iterateWithFilter;
+ var handleTrivia = skipTrivia ? undefined : createTriviaHandler(sourceFile, cb);
+ iterateFn(node);
+ // this function is used to save the if condition for the common case where no filter is provided
+ function iterateWithFilter(child) {
+ if (filter(child)) {
+ return iterateChildren(child);
+ }
+ }
+ function iterateChildren(child) {
+ if (child.kind < ts.SyntaxKind.FirstNode ||
+ // for backwards compatibility to typescript 2.0.10
+ // JsxText was no Token, but a Node in that version
+ child.kind === ts.SyntaxKind.JsxText) {
+ // we found a token, tokens have no children, stop recursing here
+ return callback(child);
+ }
+ /* Exclude everything contained in JsDoc, it will be handled with the other trivia anyway.
+ * When we would handle JsDoc tokens like regular ones, we would scan some trivia multiple times.
+ * Even worse, we would scan for trivia inside the JsDoc comment, which yields unexpected results.*/
+ if (child.kind !== ts.SyntaxKind.JSDocComment) {
+ // recurse into Node's children to find tokens
+ return child.getChildren(sourceFile).forEach(iterateFn);
+ }
+ }
+ function callback(token) {
+ var tokenStart = token.getStart(sourceFile);
+ if (!skipTrivia && tokenStart !== token.pos) {
+ // we only have to handle trivia before each token, because there is nothing after EndOfFileToken
+ handleTrivia(token.pos, tokenStart, token);
+ }
+ return cb(fullText, token.kind, { tokenStart: tokenStart, fullStart: token.pos, end: token.end }, token.parent);
+ }
+}
+exports.forEachToken = forEachToken;
+function createTriviaHandler(sourceFile, cb) {
+ var fullText = sourceFile.text;
+ var scanner = ts.createScanner(sourceFile.languageVersion, false, sourceFile.languageVariant, fullText);
+ /**
+ * Scan the specified range to get all trivia tokens.
+ * This includes trailing trivia of the last token and the leading trivia of the current token
+ */
+ function handleTrivia(start, end, token) {
+ var parent = token.parent;
+ // prevent false positives by not scanning inside JsxText
+ if (!canHaveLeadingTrivia(token.kind, parent)) {
+ return;
+ }
+ scanner.setTextPos(start);
+ var position;
+ // we only get here if start !== end, so we can scan at least one time
+ do {
+ var kind = scanner.scan();
+ position = scanner.getTextPos();
+ cb(fullText, kind, { tokenStart: scanner.getTokenPos(), end: position, fullStart: start }, parent);
+ } while (position < end);
+ }
+ return handleTrivia;
+}
+/** Iterate over all comments owned by `node` or its children */
+function forEachComment(node, cb) {
+ /* Visit all tokens and skip trivia.
+ Comment ranges between tokens are parsed without the need of a scanner.
+ forEachToken also does intentionally not pay attention to the correct comment ownership of nodes as it always
+ scans all trivia before each token, which could include trailing comments of the previous token.
+ Comment onwership is done right in this function*/
+ return forEachToken(node, true, function (fullText, tokenKind, pos, parent) {
+ // don't search for comments inside JsxText
+ if (canHaveLeadingTrivia(tokenKind, parent)) {
+ // Comments before the first token (pos.fullStart === 0) are all considered leading comments, so no need for special treatment
+ var comments = ts.getLeadingCommentRanges(fullText, pos.fullStart);
+ if (comments !== undefined) {
+ for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
+ var comment = comments_1[_i];
+ cb(fullText, comment.kind, { fullStart: pos.fullStart, tokenStart: comment.pos, end: comment.end });
+ }
+ }
+ }
+ if (canHaveTrailingTrivia(tokenKind, parent)) {
+ var comments = ts.getTrailingCommentRanges(fullText, pos.end);
+ if (comments !== undefined) {
+ for (var _a = 0, comments_2 = comments; _a < comments_2.length; _a++) {
+ var comment = comments_2[_a];
+ cb(fullText, comment.kind, { fullStart: pos.fullStart, tokenStart: comment.pos, end: comment.end });
+ }
+ }
+ }
+ });
+}
+exports.forEachComment = forEachComment;
+/** Exclude leading positions that would lead to scanning for trivia inside JsxText */
+function canHaveLeadingTrivia(tokenKind, parent) {
+ switch (tokenKind) {
+ case ts.SyntaxKind.JsxText:
+ return false; // there is no trivia before JsxText
+ case ts.SyntaxKind.OpenBraceToken:
+ // before a JsxExpression inside a JsxElement's body can only be other JsxChild, but no trivia
+ return parent.kind !== ts.SyntaxKind.JsxExpression || parent.parent.kind !== ts.SyntaxKind.JsxElement;
+ case ts.SyntaxKind.LessThanToken:
+ switch (parent.kind) {
+ case ts.SyntaxKind.JsxClosingElement:
+ return false; // would be inside the element body
+ case ts.SyntaxKind.JsxOpeningElement:
+ case ts.SyntaxKind.JsxSelfClosingElement:
+ // there can only be leading trivia if we are at the end of the top level element
+ return parent.parent.parent.kind !== ts.SyntaxKind.JsxElement;
+ default:
+ return true;
+ }
+ default:
+ return true;
+ }
+}
+/** Exclude trailing positions that would lead to scanning for trivia inside JsxText */
+function canHaveTrailingTrivia(tokenKind, parent) {
+ switch (tokenKind) {
+ case ts.SyntaxKind.JsxText:
+ // there is no trivia after JsxText
+ return false;
+ case ts.SyntaxKind.CloseBraceToken:
+ // after a JsxExpression inside a JsxElement's body can only be other JsxChild, but no trivia
+ return parent.kind !== ts.SyntaxKind.JsxExpression || parent.parent.kind !== ts.SyntaxKind.JsxElement;
+ case ts.SyntaxKind.GreaterThanToken:
+ switch (parent.kind) {
+ case ts.SyntaxKind.JsxOpeningElement:
+ return false; // would be inside the element
+ case ts.SyntaxKind.JsxClosingElement:
+ case ts.SyntaxKind.JsxSelfClosingElement:
+ // there can only be trailing trivia if we are at the end of the top level element
+ return parent.parent.parent.kind !== ts.SyntaxKind.JsxElement;
+ default:
+ return true;
+ }
+ default:
+ return true;
+ }
+}
+/**
+ * Checks if there are any comments between `position` and the next non-trivia token
+ *
+ * @param text The text to scan
+ * @param position The position inside `text` where to start scanning. Make sure that this is a valid start position.
+ * This value is typically obtained from `node.getFullStart()` or `node.getEnd()`
+ */
+function hasCommentAfterPosition(text, position) {
+ return ts.getTrailingCommentRanges(text, position) !== undefined ||
+ ts.getLeadingCommentRanges(text, position) !== undefined;
+}
+exports.hasCommentAfterPosition = hasCommentAfterPosition;
+function getEqualsKind(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.EqualsEqualsToken:
+ return { isPositive: true, isStrict: false };
+ case ts.SyntaxKind.EqualsEqualsEqualsToken:
+ return { isPositive: true, isStrict: true };
+ case ts.SyntaxKind.ExclamationEqualsToken:
+ return { isPositive: false, isStrict: false };
+ case ts.SyntaxKind.ExclamationEqualsEqualsToken:
+ return { isPositive: false, isStrict: true };
+ default:
+ return undefined;
+ }
+}
+exports.getEqualsKind = getEqualsKind;
diff --git a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts
new file mode 100644
index 000000000..92a61039d
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.d.ts
@@ -0,0 +1,38 @@
+/**
+ * @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 { IOptions } from "../rule/rule";
+import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";
+/**
+ * @deprecated See comment on ScopeAwareRuleWalker.
+ *
+ * An AST walker that is aware of block scopes in addition to regular scopes. Block scopes
+ * 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;
+ constructor(sourceFile: ts.SourceFile, options: IOptions);
+ abstract createBlockScope(node: ts.Node): U;
+ getAllBlockScopes(): U[];
+ getCurrentBlockScope(): U;
+ getCurrentBlockDepth(): number;
+ onBlockScopeStart(): void;
+ onBlockScopeEnd(): void;
+ findBlockScope(predicate: (scope: U) => boolean): U | undefined;
+ protected visitNode(node: ts.Node): void;
+ private isBlockScopeBoundary(node);
+}
diff --git a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
new file mode 100644
index 000000000..4dd311ddb
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
@@ -0,0 +1,82 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var utils_1 = require("../utils");
+// tslint:disable deprecation
+var scopeAwareRuleWalker_1 = require("./scopeAwareRuleWalker");
+/**
+ * @deprecated See comment on ScopeAwareRuleWalker.
+ *
+ * An AST walker that is aware of block scopes in addition to regular scopes. Block scopes
+ * are a superset of regular scopes (new block scopes are created more frequently in a program).
+ */
+var BlockScopeAwareRuleWalker = (function (_super) {
+ tslib_1.__extends(BlockScopeAwareRuleWalker, _super);
+ function BlockScopeAwareRuleWalker(sourceFile, options) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ // initialize with global scope if file is not a module
+ _this.blockScopeStack = ts.isExternalModule(sourceFile) ? [] : [_this.createBlockScope(sourceFile)];
+ return _this;
+ }
+ // get all block scopes available at this depth
+ BlockScopeAwareRuleWalker.prototype.getAllBlockScopes = function () {
+ return this.blockScopeStack;
+ };
+ BlockScopeAwareRuleWalker.prototype.getCurrentBlockScope = function () {
+ return this.blockScopeStack[this.blockScopeStack.length - 1];
+ };
+ BlockScopeAwareRuleWalker.prototype.getCurrentBlockDepth = function () {
+ return this.blockScopeStack.length;
+ };
+ // callback notifier when a block scope begins
+ BlockScopeAwareRuleWalker.prototype.onBlockScopeStart = function () {
+ return;
+ };
+ // callback notifier when a block scope ends
+ BlockScopeAwareRuleWalker.prototype.onBlockScopeEnd = function () {
+ return;
+ };
+ BlockScopeAwareRuleWalker.prototype.findBlockScope = function (predicate) {
+ // look through block scopes from local -> global
+ for (var i = this.blockScopeStack.length - 1; i >= 0; i--) {
+ if (predicate(this.blockScopeStack[i])) {
+ return this.blockScopeStack[i];
+ }
+ }
+ return undefined;
+ };
+ BlockScopeAwareRuleWalker.prototype.visitNode = function (node) {
+ var isNewBlockScope = this.isBlockScopeBoundary(node);
+ if (isNewBlockScope) {
+ this.blockScopeStack.push(this.createBlockScope(node));
+ this.onBlockScopeStart();
+ }
+ _super.prototype.visitNode.call(this, node);
+ if (isNewBlockScope) {
+ this.onBlockScopeEnd();
+ this.blockScopeStack.pop();
+ }
+ };
+ BlockScopeAwareRuleWalker.prototype.isBlockScopeBoundary = function (node) {
+ return utils_1.isBlockScopeBoundary(node);
+ };
+ return BlockScopeAwareRuleWalker;
+}(scopeAwareRuleWalker_1.ScopeAwareRuleWalker));
+exports.BlockScopeAwareRuleWalker = BlockScopeAwareRuleWalker;
diff --git a/node_modules/tslint/lib/language/walker/index.d.ts b/node_modules/tslint/lib/language/walker/index.d.ts
new file mode 100644
index 000000000..db3dc9492
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/index.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 * from "./blockScopeAwareRuleWalker";
+export * from "./programAwareRuleWalker";
+export * from "./ruleWalker";
+export * from "./scopeAwareRuleWalker";
+export * from "./syntaxWalker";
+export * from "./walkContext";
+export * from "./walker";
diff --git a/node_modules/tslint/lib/language/walker/index.js b/node_modules/tslint/lib/language/walker/index.js
new file mode 100644
index 000000000..c5bcb1b22
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/index.js
@@ -0,0 +1,28 @@
+"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.
+ */
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+Object.defineProperty(exports, "__esModule", { value: true });
+__export(require("./blockScopeAwareRuleWalker"));
+__export(require("./programAwareRuleWalker"));
+__export(require("./ruleWalker"));
+__export(require("./scopeAwareRuleWalker"));
+__export(require("./syntaxWalker"));
+__export(require("./walkContext"));
+__export(require("./walker"));
diff --git a/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts
new file mode 100644
index 000000000..d0ae8af52
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.d.ts
@@ -0,0 +1,26 @@
+/**
+ * @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 { IOptions } from "../rule/rule";
+import { RuleWalker } from "./ruleWalker";
+export declare class ProgramAwareRuleWalker extends RuleWalker {
+ private program;
+ private 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/programAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js
new file mode 100644
index 000000000..de68cb5a6
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js
@@ -0,0 +1,37 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ruleWalker_1 = require("./ruleWalker");
+var ProgramAwareRuleWalker = (function (_super) {
+ tslib_1.__extends(ProgramAwareRuleWalker, _super);
+ function ProgramAwareRuleWalker(sourceFile, options, program) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ _this.program = program;
+ _this.typeChecker = program.getTypeChecker();
+ return _this;
+ }
+ ProgramAwareRuleWalker.prototype.getProgram = function () {
+ return this.program;
+ };
+ ProgramAwareRuleWalker.prototype.getTypeChecker = function () {
+ return this.typeChecker;
+ };
+ return ProgramAwareRuleWalker;
+}(ruleWalker_1.RuleWalker));
+exports.ProgramAwareRuleWalker = ProgramAwareRuleWalker;
diff --git a/node_modules/tslint/lib/language/walker/ruleWalker.d.ts b/node_modules/tslint/lib/language/walker/ruleWalker.d.ts
new file mode 100644
index 000000000..f78b4c0ed
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/ruleWalker.d.ts
@@ -0,0 +1,49 @@
+/**
+ * @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 { 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;
+ constructor(sourceFile: ts.SourceFile, options: IOptions);
+ getSourceFile(): ts.SourceFile;
+ getLineAndCharacterOfPosition(position: number): ts.LineAndCharacter;
+ getFailures(): RuleFailure[];
+ getLimit(): number;
+ getOptions(): any;
+ hasOption(option: string): boolean;
+ /** @deprecated Prefer `addFailureAt` and its variants. */
+ createFailure(start: number, width: number, failure: string, fix?: Fix): RuleFailure;
+ /** @deprecated Prefer `addFailureAt` and its variants. */
+ addFailure(failure: RuleFailure): void;
+ /** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
+ addFailureAt(start: number, width: number, failure: string, fix?: Fix): void;
+ /** Like `addFailureAt` but uses start and end instead of start and width. */
+ addFailureFromStartToEnd(start: number, end: number, failure: string, fix?: Fix): void;
+ /** Add a failure using a node's span. */
+ addFailureAtNode(node: ts.Node, failure: string, fix?: Fix): void;
+ createReplacement(start: number, length: number, text: string): Replacement;
+ appendText(start: number, text: string): Replacement;
+ deleteText(start: number, length: number): Replacement;
+ deleteFromTo(start: number, end: number): Replacement;
+ getRuleName(): string;
+}
diff --git a/node_modules/tslint/lib/language/walker/ruleWalker.js b/node_modules/tslint/lib/language/walker/ruleWalker.js
new file mode 100644
index 000000000..b5146825e
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/ruleWalker.js
@@ -0,0 +1,96 @@
+"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 });
+var tslib_1 = require("tslib");
+var rule_1 = require("../rule/rule");
+var syntaxWalker_1 = require("./syntaxWalker");
+var RuleWalker = (function (_super) {
+ tslib_1.__extends(RuleWalker, _super);
+ function RuleWalker(sourceFile, options) {
+ var _this = _super.call(this) || this;
+ _this.sourceFile = sourceFile;
+ _this.failures = [];
+ _this.options = options.ruleArguments;
+ _this.limit = _this.sourceFile.getFullWidth();
+ _this.ruleName = options.ruleName;
+ return _this;
+ }
+ RuleWalker.prototype.getSourceFile = function () {
+ return this.sourceFile;
+ };
+ RuleWalker.prototype.getLineAndCharacterOfPosition = function (position) {
+ return this.sourceFile.getLineAndCharacterOfPosition(position);
+ };
+ RuleWalker.prototype.getFailures = function () {
+ return this.failures;
+ };
+ RuleWalker.prototype.getLimit = function () {
+ return this.limit;
+ };
+ RuleWalker.prototype.getOptions = function () {
+ return this.options;
+ };
+ RuleWalker.prototype.hasOption = function (option) {
+ if (this.options !== undefined) {
+ return this.options.indexOf(option) !== -1;
+ }
+ else {
+ return false;
+ }
+ };
+ /** @deprecated Prefer `addFailureAt` and its variants. */
+ RuleWalker.prototype.createFailure = function (start, width, failure, fix) {
+ var from = (start > this.limit) ? this.limit : start;
+ var to = ((start + width) > this.limit) ? this.limit : (start + width);
+ return new rule_1.RuleFailure(this.sourceFile, from, to, failure, this.ruleName, fix);
+ };
+ /** @deprecated Prefer `addFailureAt` and its variants. */
+ RuleWalker.prototype.addFailure = function (failure) {
+ this.failures.push(failure);
+ };
+ /** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
+ RuleWalker.prototype.addFailureAt = function (start, width, failure, fix) {
+ // tslint:disable-next-line deprecation
+ this.addFailure(this.createFailure(start, width, failure, fix));
+ };
+ /** Like `addFailureAt` but uses start and end instead of start and width. */
+ RuleWalker.prototype.addFailureFromStartToEnd = function (start, end, failure, fix) {
+ this.addFailureAt(start, end - start, failure, fix);
+ };
+ /** Add a failure using a node's span. */
+ RuleWalker.prototype.addFailureAtNode = function (node, failure, fix) {
+ this.addFailureAt(node.getStart(this.sourceFile), node.getWidth(this.sourceFile), failure, fix);
+ };
+ RuleWalker.prototype.createReplacement = function (start, length, text) {
+ return new rule_1.Replacement(start, length, text);
+ };
+ RuleWalker.prototype.appendText = function (start, text) {
+ return this.createReplacement(start, 0, text);
+ };
+ RuleWalker.prototype.deleteText = function (start, length) {
+ return this.createReplacement(start, length, "");
+ };
+ RuleWalker.prototype.deleteFromTo = function (start, end) {
+ return this.createReplacement(start, end - start, "");
+ };
+ RuleWalker.prototype.getRuleName = function () {
+ return this.ruleName;
+ };
+ return RuleWalker;
+}(syntaxWalker_1.SyntaxWalker));
+exports.RuleWalker = RuleWalker;
diff --git a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts
new file mode 100644
index 000000000..64423e23b
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.d.ts
@@ -0,0 +1,65 @@
+/**
+ * @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 { IOptions } from "../rule/rule";
+import { RuleWalker } from "./ruleWalker";
+/**
+ * @deprecated Prefer to manually maintain any contextual information.
+ *
+ * For example, imagine a `no-break` rule that warns on `break` in `for` but not in `switch`:
+ *
+ * function walk(ctx: Lint.WalkContext<void>): void {
+ * let isInFor = false;
+ * ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void {
+ * switch (node.kind) {
+ * case ts.SyntaxKind.Break:
+ * if (isInFor) {
+ * ctx.addFailureAtNode(node, "!");
+ * }
+ * break;
+ * case ts.SyntaxKind.ForStatement: {
+ * const old = isInFor;
+ * isInFor = true;
+ * ts.forEachChild(node, cb);
+ * isInFor = old;
+ * break;
+ * }
+ * case ts.SyntaxKind.SwitchStatement: {
+ * const old = isInFor;
+ * isInFor = false;
+ * ts.forEachChild(node, cb);
+ * isInFor = old;
+ * break;
+ * }
+ * default:
+ * ts.forEachChild(node, cb);
+ * }
+ * });
+ * }
+ */
+export declare abstract class ScopeAwareRuleWalker<T> extends RuleWalker {
+ private scopeStack;
+ constructor(sourceFile: ts.SourceFile, options: IOptions);
+ abstract createScope(node: ts.Node): T;
+ getCurrentScope(): T;
+ getAllScopes(): T[];
+ getCurrentDepth(): number;
+ onScopeStart(): void;
+ onScopeEnd(): void;
+ protected visitNode(node: ts.Node): void;
+ protected isScopeBoundary(node: ts.Node): boolean;
+}
diff --git a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
new file mode 100644
index 000000000..081c29b6c
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
@@ -0,0 +1,100 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var utils_1 = require("../utils");
+var ruleWalker_1 = require("./ruleWalker");
+/**
+ * @deprecated Prefer to manually maintain any contextual information.
+ *
+ * For example, imagine a `no-break` rule that warns on `break` in `for` but not in `switch`:
+ *
+ * function walk(ctx: Lint.WalkContext<void>): void {
+ * let isInFor = false;
+ * ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void {
+ * switch (node.kind) {
+ * case ts.SyntaxKind.Break:
+ * if (isInFor) {
+ * ctx.addFailureAtNode(node, "!");
+ * }
+ * break;
+ * case ts.SyntaxKind.ForStatement: {
+ * const old = isInFor;
+ * isInFor = true;
+ * ts.forEachChild(node, cb);
+ * isInFor = old;
+ * break;
+ * }
+ * case ts.SyntaxKind.SwitchStatement: {
+ * const old = isInFor;
+ * isInFor = false;
+ * ts.forEachChild(node, cb);
+ * isInFor = old;
+ * break;
+ * }
+ * default:
+ * ts.forEachChild(node, cb);
+ * }
+ * });
+ * }
+ */
+var ScopeAwareRuleWalker = (function (_super) {
+ tslib_1.__extends(ScopeAwareRuleWalker, _super);
+ function ScopeAwareRuleWalker(sourceFile, options) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ // initialize with global scope if file is not a module
+ _this.scopeStack = ts.isExternalModule(sourceFile) ? [] : [_this.createScope(sourceFile)];
+ return _this;
+ }
+ ScopeAwareRuleWalker.prototype.getCurrentScope = function () {
+ return this.scopeStack[this.scopeStack.length - 1];
+ };
+ // get all scopes available at this depth
+ ScopeAwareRuleWalker.prototype.getAllScopes = function () {
+ return this.scopeStack;
+ };
+ ScopeAwareRuleWalker.prototype.getCurrentDepth = function () {
+ return this.scopeStack.length;
+ };
+ // callback notifier when a scope begins
+ ScopeAwareRuleWalker.prototype.onScopeStart = function () {
+ return;
+ };
+ // callback notifier when a scope ends
+ ScopeAwareRuleWalker.prototype.onScopeEnd = function () {
+ return;
+ };
+ ScopeAwareRuleWalker.prototype.visitNode = function (node) {
+ var isNewScope = this.isScopeBoundary(node);
+ if (isNewScope) {
+ this.scopeStack.push(this.createScope(node));
+ this.onScopeStart();
+ }
+ _super.prototype.visitNode.call(this, node);
+ if (isNewScope) {
+ this.onScopeEnd();
+ this.scopeStack.pop();
+ }
+ };
+ ScopeAwareRuleWalker.prototype.isScopeBoundary = function (node) {
+ return utils_1.isScopeBoundary(node);
+ };
+ return ScopeAwareRuleWalker;
+}(ruleWalker_1.RuleWalker));
+exports.ScopeAwareRuleWalker = ScopeAwareRuleWalker;
diff --git a/node_modules/tslint/lib/language/walker/syntaxWalker.d.ts b/node_modules/tslint/lib/language/walker/syntaxWalker.d.ts
new file mode 100644
index 000000000..a676a9de7
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/syntaxWalker.d.ts
@@ -0,0 +1,104 @@
+/**
+ * @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";
+export declare class SyntaxWalker {
+ walk(node: ts.Node): void;
+ protected visitAnyKeyword(node: ts.Node): void;
+ protected visitArrayLiteralExpression(node: ts.ArrayLiteralExpression): void;
+ protected visitArrayType(node: ts.ArrayTypeNode): void;
+ protected visitArrowFunction(node: ts.ArrowFunction): void;
+ protected visitBinaryExpression(node: ts.BinaryExpression): void;
+ protected visitBindingElement(node: ts.BindingElement): void;
+ protected visitBindingPattern(node: ts.BindingPattern): void;
+ protected visitBlock(node: ts.Block): void;
+ protected visitBreakStatement(node: ts.BreakOrContinueStatement): void;
+ protected visitCallExpression(node: ts.CallExpression): void;
+ protected visitCallSignature(node: ts.SignatureDeclaration): void;
+ protected visitCaseClause(node: ts.CaseClause): void;
+ protected visitClassDeclaration(node: ts.ClassDeclaration): void;
+ protected visitClassExpression(node: ts.ClassExpression): void;
+ protected visitCatchClause(node: ts.CatchClause): void;
+ protected visitConditionalExpression(node: ts.ConditionalExpression): void;
+ protected visitConstructSignature(node: ts.ConstructSignatureDeclaration): void;
+ protected visitConstructorDeclaration(node: ts.ConstructorDeclaration): void;
+ protected visitConstructorType(node: ts.FunctionOrConstructorTypeNode): void;
+ protected visitContinueStatement(node: ts.BreakOrContinueStatement): void;
+ protected visitDebuggerStatement(node: ts.Statement): void;
+ protected visitDefaultClause(node: ts.DefaultClause): void;
+ protected visitDoStatement(node: ts.DoStatement): void;
+ protected visitElementAccessExpression(node: ts.ElementAccessExpression): void;
+ protected visitEndOfFileToken(node: ts.Node): void;
+ protected visitEnumDeclaration(node: ts.EnumDeclaration): void;
+ protected visitExportAssignment(node: ts.ExportAssignment): void;
+ protected visitExpressionStatement(node: ts.ExpressionStatement): void;
+ protected visitForStatement(node: ts.ForStatement): void;
+ protected visitForInStatement(node: ts.ForInStatement): void;
+ protected visitForOfStatement(node: ts.ForOfStatement): void;
+ protected visitFunctionDeclaration(node: ts.FunctionDeclaration): void;
+ protected visitFunctionExpression(node: ts.FunctionExpression): void;
+ protected visitFunctionType(node: ts.FunctionOrConstructorTypeNode): void;
+ protected visitGetAccessor(node: ts.AccessorDeclaration): void;
+ protected visitIdentifier(node: ts.Identifier): void;
+ protected visitIfStatement(node: ts.IfStatement): void;
+ protected visitImportDeclaration(node: ts.ImportDeclaration): void;
+ protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void;
+ protected visitIndexSignatureDeclaration(node: ts.IndexSignatureDeclaration): void;
+ protected visitInterfaceDeclaration(node: ts.InterfaceDeclaration): void;
+ protected visitJsxAttribute(node: ts.JsxAttribute): void;
+ protected visitJsxElement(node: ts.JsxElement): void;
+ protected visitJsxExpression(node: ts.JsxExpression): void;
+ protected visitJsxSelfClosingElement(node: ts.JsxSelfClosingElement): void;
+ protected visitJsxSpreadAttribute(node: ts.JsxSpreadAttribute): void;
+ protected visitLabeledStatement(node: ts.LabeledStatement): void;
+ protected visitMethodDeclaration(node: ts.MethodDeclaration): void;
+ protected visitMethodSignature(node: ts.SignatureDeclaration): void;
+ protected visitModuleDeclaration(node: ts.ModuleDeclaration): void;
+ protected visitNamedImports(node: ts.NamedImports): void;
+ protected visitNamespaceImport(node: ts.NamespaceImport): void;
+ protected visitNewExpression(node: ts.NewExpression): void;
+ protected visitNonNullExpression(node: ts.NonNullExpression): void;
+ protected visitNumericLiteral(node: ts.NumericLiteral): void;
+ protected visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): void;
+ protected visitParameterDeclaration(node: ts.ParameterDeclaration): void;
+ protected visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression): void;
+ protected visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression): void;
+ protected visitPropertyAccessExpression(node: ts.PropertyAccessExpression): void;
+ protected visitPropertyAssignment(node: ts.PropertyAssignment): void;
+ protected visitPropertyDeclaration(node: ts.PropertyDeclaration): void;
+ protected visitPropertySignature(node: ts.Node): void;
+ protected visitRegularExpressionLiteral(node: ts.Node): void;
+ protected visitReturnStatement(node: ts.ReturnStatement): void;
+ protected visitSetAccessor(node: ts.AccessorDeclaration): void;
+ protected visitSourceFile(node: ts.SourceFile): void;
+ protected visitStringLiteral(node: ts.StringLiteral): void;
+ protected visitSwitchStatement(node: ts.SwitchStatement): void;
+ protected visitTemplateExpression(node: ts.TemplateExpression): void;
+ protected visitThrowStatement(node: ts.ThrowStatement): void;
+ protected visitTryStatement(node: ts.TryStatement): void;
+ protected visitTupleType(node: ts.TupleTypeNode): void;
+ protected visitTypeAliasDeclaration(node: ts.TypeAliasDeclaration): void;
+ protected visitTypeAssertionExpression(node: ts.TypeAssertion): void;
+ protected visitTypeLiteral(node: ts.TypeLiteralNode): void;
+ protected visitTypeReference(node: ts.TypeReferenceNode): void;
+ protected visitVariableDeclaration(node: ts.VariableDeclaration): void;
+ protected visitVariableDeclarationList(node: ts.VariableDeclarationList): void;
+ protected visitVariableStatement(node: ts.VariableStatement): void;
+ protected visitWhileStatement(node: ts.WhileStatement): void;
+ protected visitWithStatement(node: ts.WithStatement): void;
+ protected visitNode(node: ts.Node): void;
+ protected walkChildren(node: ts.Node): void;
+}
diff --git a/node_modules/tslint/lib/language/walker/syntaxWalker.js b/node_modules/tslint/lib/language/walker/syntaxWalker.js
new file mode 100644
index 000000000..2b800fc61
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/syntaxWalker.js
@@ -0,0 +1,534 @@
+"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 });
+var ts = require("typescript");
+var SyntaxWalker = (function () {
+ function SyntaxWalker() {
+ }
+ SyntaxWalker.prototype.walk = function (node) {
+ this.visitNode(node);
+ };
+ SyntaxWalker.prototype.visitAnyKeyword = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitArrayType = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitArrowFunction = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitBinaryExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitBindingElement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitBindingPattern = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitBlock = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitBreakStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitCallExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitCallSignature = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitCaseClause = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitClassDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitClassExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitCatchClause = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitConditionalExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitConstructSignature = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitConstructorDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitConstructorType = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitContinueStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitDebuggerStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitDefaultClause = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitDoStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitElementAccessExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitEndOfFileToken = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitEnumDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitExportAssignment = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitExpressionStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitForStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitForInStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitForOfStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitFunctionDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitFunctionExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitFunctionType = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitGetAccessor = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitIdentifier = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitIfStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitImportDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitImportEqualsDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitIndexSignatureDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitJsxAttribute = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitJsxElement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitJsxExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitJsxSelfClosingElement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitJsxSpreadAttribute = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitLabeledStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitMethodDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitMethodSignature = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitModuleDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNamedImports = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNamespaceImport = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNewExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNonNullExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNumericLiteral = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitParameterDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPropertyAccessExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPropertyAssignment = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPropertyDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitPropertySignature = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitRegularExpressionLiteral = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitReturnStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitSetAccessor = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitSourceFile = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitStringLiteral = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitSwitchStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTemplateExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitThrowStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTryStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTupleType = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTypeAliasDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTypeAssertionExpression = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTypeLiteral = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitTypeReference = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitVariableDeclaration = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitVariableDeclarationList = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitVariableStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitWhileStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitWithStatement = function (node) {
+ this.walkChildren(node);
+ };
+ SyntaxWalker.prototype.visitNode = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.AnyKeyword:
+ this.visitAnyKeyword(node);
+ break;
+ case ts.SyntaxKind.ArrayBindingPattern:
+ this.visitBindingPattern(node);
+ break;
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ this.visitArrayLiteralExpression(node);
+ break;
+ case ts.SyntaxKind.ArrayType:
+ this.visitArrayType(node);
+ break;
+ case ts.SyntaxKind.ArrowFunction:
+ this.visitArrowFunction(node);
+ break;
+ case ts.SyntaxKind.BinaryExpression:
+ this.visitBinaryExpression(node);
+ break;
+ case ts.SyntaxKind.BindingElement:
+ this.visitBindingElement(node);
+ break;
+ case ts.SyntaxKind.Block:
+ this.visitBlock(node);
+ break;
+ case ts.SyntaxKind.BreakStatement:
+ this.visitBreakStatement(node);
+ break;
+ case ts.SyntaxKind.CallExpression:
+ this.visitCallExpression(node);
+ break;
+ case ts.SyntaxKind.CallSignature:
+ this.visitCallSignature(node);
+ break;
+ case ts.SyntaxKind.CaseClause:
+ this.visitCaseClause(node);
+ break;
+ case ts.SyntaxKind.ClassDeclaration:
+ this.visitClassDeclaration(node);
+ break;
+ case ts.SyntaxKind.ClassExpression:
+ this.visitClassExpression(node);
+ break;
+ case ts.SyntaxKind.CatchClause:
+ this.visitCatchClause(node);
+ break;
+ case ts.SyntaxKind.ConditionalExpression:
+ this.visitConditionalExpression(node);
+ break;
+ case ts.SyntaxKind.ConstructSignature:
+ this.visitConstructSignature(node);
+ break;
+ case ts.SyntaxKind.Constructor:
+ this.visitConstructorDeclaration(node);
+ break;
+ case ts.SyntaxKind.ConstructorType:
+ this.visitConstructorType(node);
+ break;
+ case ts.SyntaxKind.ContinueStatement:
+ this.visitContinueStatement(node);
+ break;
+ case ts.SyntaxKind.DebuggerStatement:
+ this.visitDebuggerStatement(node);
+ break;
+ case ts.SyntaxKind.DefaultClause:
+ this.visitDefaultClause(node);
+ break;
+ case ts.SyntaxKind.DoStatement:
+ this.visitDoStatement(node);
+ break;
+ case ts.SyntaxKind.ElementAccessExpression:
+ this.visitElementAccessExpression(node);
+ break;
+ case ts.SyntaxKind.EndOfFileToken:
+ this.visitEndOfFileToken(node);
+ break;
+ case ts.SyntaxKind.EnumDeclaration:
+ this.visitEnumDeclaration(node);
+ break;
+ case ts.SyntaxKind.ExportAssignment:
+ this.visitExportAssignment(node);
+ break;
+ case ts.SyntaxKind.ExpressionStatement:
+ this.visitExpressionStatement(node);
+ break;
+ case ts.SyntaxKind.ForStatement:
+ this.visitForStatement(node);
+ break;
+ case ts.SyntaxKind.ForInStatement:
+ this.visitForInStatement(node);
+ break;
+ case ts.SyntaxKind.ForOfStatement:
+ this.visitForOfStatement(node);
+ break;
+ case ts.SyntaxKind.FunctionDeclaration:
+ this.visitFunctionDeclaration(node);
+ break;
+ case ts.SyntaxKind.FunctionExpression:
+ this.visitFunctionExpression(node);
+ break;
+ case ts.SyntaxKind.FunctionType:
+ this.visitFunctionType(node);
+ break;
+ case ts.SyntaxKind.GetAccessor:
+ this.visitGetAccessor(node);
+ break;
+ case ts.SyntaxKind.Identifier:
+ this.visitIdentifier(node);
+ break;
+ case ts.SyntaxKind.IfStatement:
+ this.visitIfStatement(node);
+ break;
+ case ts.SyntaxKind.ImportDeclaration:
+ this.visitImportDeclaration(node);
+ break;
+ case ts.SyntaxKind.ImportEqualsDeclaration:
+ this.visitImportEqualsDeclaration(node);
+ break;
+ case ts.SyntaxKind.IndexSignature:
+ this.visitIndexSignatureDeclaration(node);
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ this.visitInterfaceDeclaration(node);
+ break;
+ case ts.SyntaxKind.JsxAttribute:
+ this.visitJsxAttribute(node);
+ break;
+ case ts.SyntaxKind.JsxElement:
+ this.visitJsxElement(node);
+ break;
+ case ts.SyntaxKind.JsxExpression:
+ this.visitJsxExpression(node);
+ break;
+ case ts.SyntaxKind.JsxSelfClosingElement:
+ this.visitJsxSelfClosingElement(node);
+ break;
+ case ts.SyntaxKind.JsxSpreadAttribute:
+ this.visitJsxSpreadAttribute(node);
+ break;
+ case ts.SyntaxKind.LabeledStatement:
+ this.visitLabeledStatement(node);
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ this.visitMethodDeclaration(node);
+ break;
+ case ts.SyntaxKind.MethodSignature:
+ this.visitMethodSignature(node);
+ break;
+ case ts.SyntaxKind.ModuleDeclaration:
+ this.visitModuleDeclaration(node);
+ break;
+ case ts.SyntaxKind.NamedImports:
+ this.visitNamedImports(node);
+ break;
+ case ts.SyntaxKind.NamespaceImport:
+ this.visitNamespaceImport(node);
+ break;
+ case ts.SyntaxKind.NewExpression:
+ this.visitNewExpression(node);
+ break;
+ case ts.SyntaxKind.NonNullExpression:
+ this.visitNonNullExpression(node);
+ break;
+ case ts.SyntaxKind.NumericLiteral:
+ this.visitNumericLiteral(node);
+ break;
+ case ts.SyntaxKind.ObjectBindingPattern:
+ this.visitBindingPattern(node);
+ break;
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ this.visitObjectLiteralExpression(node);
+ break;
+ case ts.SyntaxKind.Parameter:
+ this.visitParameterDeclaration(node);
+ break;
+ case ts.SyntaxKind.PostfixUnaryExpression:
+ this.visitPostfixUnaryExpression(node);
+ break;
+ case ts.SyntaxKind.PrefixUnaryExpression:
+ this.visitPrefixUnaryExpression(node);
+ break;
+ case ts.SyntaxKind.PropertyAccessExpression:
+ this.visitPropertyAccessExpression(node);
+ break;
+ case ts.SyntaxKind.PropertyAssignment:
+ this.visitPropertyAssignment(node);
+ break;
+ case ts.SyntaxKind.PropertyDeclaration:
+ this.visitPropertyDeclaration(node);
+ break;
+ case ts.SyntaxKind.PropertySignature:
+ this.visitPropertySignature(node);
+ break;
+ case ts.SyntaxKind.RegularExpressionLiteral:
+ this.visitRegularExpressionLiteral(node);
+ break;
+ case ts.SyntaxKind.ReturnStatement:
+ this.visitReturnStatement(node);
+ break;
+ case ts.SyntaxKind.SetAccessor:
+ this.visitSetAccessor(node);
+ break;
+ case ts.SyntaxKind.SourceFile:
+ this.visitSourceFile(node);
+ break;
+ case ts.SyntaxKind.StringLiteral:
+ this.visitStringLiteral(node);
+ break;
+ case ts.SyntaxKind.SwitchStatement:
+ this.visitSwitchStatement(node);
+ break;
+ case ts.SyntaxKind.TemplateExpression:
+ this.visitTemplateExpression(node);
+ break;
+ case ts.SyntaxKind.ThrowStatement:
+ this.visitThrowStatement(node);
+ break;
+ case ts.SyntaxKind.TryStatement:
+ this.visitTryStatement(node);
+ break;
+ case ts.SyntaxKind.TupleType:
+ this.visitTupleType(node);
+ break;
+ case ts.SyntaxKind.TypeAliasDeclaration:
+ this.visitTypeAliasDeclaration(node);
+ break;
+ case ts.SyntaxKind.TypeAssertionExpression:
+ this.visitTypeAssertionExpression(node);
+ break;
+ case ts.SyntaxKind.TypeLiteral:
+ this.visitTypeLiteral(node);
+ break;
+ case ts.SyntaxKind.TypeReference:
+ this.visitTypeReference(node);
+ break;
+ case ts.SyntaxKind.VariableDeclaration:
+ this.visitVariableDeclaration(node);
+ break;
+ case ts.SyntaxKind.VariableDeclarationList:
+ this.visitVariableDeclarationList(node);
+ break;
+ case ts.SyntaxKind.VariableStatement:
+ this.visitVariableStatement(node);
+ break;
+ case ts.SyntaxKind.WhileStatement:
+ this.visitWhileStatement(node);
+ break;
+ case ts.SyntaxKind.WithStatement:
+ this.visitWithStatement(node);
+ break;
+ default:
+ this.walkChildren(node);
+ break;
+ }
+ };
+ SyntaxWalker.prototype.walkChildren = function (node) {
+ var _this = this;
+ ts.forEachChild(node, function (child) { return _this.visitNode(child); });
+ };
+ return SyntaxWalker;
+}());
+exports.SyntaxWalker = SyntaxWalker;
diff --git a/node_modules/tslint/lib/language/walker/walkContext.d.ts b/node_modules/tslint/lib/language/walker/walkContext.d.ts
new file mode 100644
index 000000000..38a413f3d
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/walkContext.d.ts
@@ -0,0 +1,30 @@
+/**
+ * @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 { Fix, RuleFailure } from "../rule/rule";
+export declare class WalkContext<T> {
+ readonly sourceFile: ts.SourceFile;
+ readonly ruleName: string;
+ readonly options: T;
+ readonly failures: RuleFailure[];
+ constructor(sourceFile: ts.SourceFile, ruleName: string, options: T);
+ /** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
+ addFailureAt(start: number, width: number, failure: string, fix?: Fix): void;
+ addFailure(start: number, end: number, failure: string, fix?: Fix): void;
+ /** Add a failure using a node's span. */
+ addFailureAtNode(node: ts.Node, failure: string, fix?: Fix): void;
+}
diff --git a/node_modules/tslint/lib/language/walker/walkContext.js b/node_modules/tslint/lib/language/walker/walkContext.js
new file mode 100644
index 000000000..b6d8224d3
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/walkContext.js
@@ -0,0 +1,41 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var rule_1 = require("../rule/rule");
+var WalkContext = (function () {
+ function WalkContext(sourceFile, ruleName, options) {
+ this.sourceFile = sourceFile;
+ this.ruleName = ruleName;
+ this.options = options;
+ this.failures = [];
+ }
+ /** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
+ WalkContext.prototype.addFailureAt = function (start, width, failure, fix) {
+ this.addFailure(start, start + width, failure, fix);
+ };
+ WalkContext.prototype.addFailure = function (start, end, failure, fix) {
+ var fileLength = this.sourceFile.end;
+ this.failures.push(new rule_1.RuleFailure(this.sourceFile, Math.min(start, fileLength), Math.min(end, fileLength), failure, this.ruleName, fix));
+ };
+ /** Add a failure using a node's span. */
+ WalkContext.prototype.addFailureAtNode = function (node, failure, fix) {
+ this.addFailure(node.getStart(this.sourceFile), node.getEnd(), failure, fix);
+ };
+ return WalkContext;
+}());
+exports.WalkContext = WalkContext;
diff --git a/node_modules/tslint/lib/language/walker/walker.d.ts b/node_modules/tslint/lib/language/walker/walker.d.ts
new file mode 100644
index 000000000..dee30ece4
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/walker.d.ts
@@ -0,0 +1,30 @@
+/**
+ * @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 { RuleFailure } from "../rule/rule";
+import { WalkContext } from "./walkContext";
+import { IWalker } from "./walker";
+export interface IWalker {
+ getSourceFile(): ts.SourceFile;
+ walk(sourceFile: ts.SourceFile): void;
+ getFailures(): RuleFailure[];
+}
+export declare abstract class AbstractWalker<T> extends WalkContext<T> implements IWalker {
+ abstract walk(sourceFile: ts.SourceFile): void;
+ getSourceFile(): ts.SourceFile;
+ getFailures(): RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/language/walker/walker.js b/node_modules/tslint/lib/language/walker/walker.js
new file mode 100644
index 000000000..ef0ff1828
--- /dev/null
+++ b/node_modules/tslint/lib/language/walker/walker.js
@@ -0,0 +1,34 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var walkContext_1 = require("./walkContext");
+var AbstractWalker = (function (_super) {
+ tslib_1.__extends(AbstractWalker, _super);
+ function AbstractWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AbstractWalker.prototype.getSourceFile = function () {
+ return this.sourceFile;
+ };
+ AbstractWalker.prototype.getFailures = function () {
+ return this.failures;
+ };
+ return AbstractWalker;
+}(walkContext_1.WalkContext));
+exports.AbstractWalker = AbstractWalker;
diff --git a/node_modules/tslint/lib/linter.d.ts b/node_modules/tslint/lib/linter.d.ts
new file mode 100644
index 000000000..0d1d4b664
--- /dev/null
+++ b/node_modules/tslint/lib/linter.d.ts
@@ -0,0 +1,39 @@
+import * as ts from "typescript";
+import { findConfiguration, findConfigurationPath, getRulesDirectories, IConfigurationFile, loadConfigurationFromPath } from "./configuration";
+import { ILinterOptions, LintResult } from "./index";
+import { RuleFailure } from "./language/rule/rule";
+/**
+ * Linter that can lint multiple files in consecutive runs.
+ */
+declare class Linter {
+ private options;
+ private program;
+ static VERSION: string;
+ static findConfiguration: typeof findConfiguration;
+ static findConfigurationPath: typeof findConfigurationPath;
+ static getRulesDirectories: typeof getRulesDirectories;
+ static loadConfigurationFromPath: typeof loadConfigurationFromPath;
+ private failures;
+ private fixes;
+ /**
+ * Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
+ */
+ static createProgram(configFile: string, projectDirectory?: string): ts.Program;
+ /**
+ * Returns a list of source file names from a TypeScript program. This includes all referenced
+ * files and excludes declaration (".d.ts") files.
+ */
+ static getFileNames(program: ts.Program): string[];
+ constructor(options: ILinterOptions, program?: ts.Program);
+ lint(fileName: string, source: string, configuration?: IConfigurationFile): void;
+ getResult(): LintResult;
+ private getAllFailures(sourceFile, enabledRules);
+ private applyAllFixes(enabledRules, fileFailures, sourceFile, sourceFileName);
+ protected applyFixes(sourceFilePath: string, source: string, fixableFailures: RuleFailure[]): string;
+ private applyRule(rule, sourceFile);
+ private getEnabledRules(configuration, isJs);
+ private getSourceFile(fileName, source);
+}
+declare namespace Linter {
+}
+export = Linter;
diff --git a/node_modules/tslint/lib/linter.js b/node_modules/tslint/lib/linter.js
new file mode 100644
index 000000000..e5581458a
--- /dev/null
+++ b/node_modules/tslint/lib/linter.js
@@ -0,0 +1,234 @@
+"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.
+ */
+var fs = require("fs");
+var path = require("path");
+var ts = require("typescript");
+var configuration_1 = require("./configuration");
+var enableDisableRules_1 = require("./enableDisableRules");
+var error_1 = require("./error");
+var formatterLoader_1 = require("./formatterLoader");
+var rule_1 = require("./language/rule/rule");
+var utils = require("./language/utils");
+var ruleLoader_1 = require("./ruleLoader");
+var utils_1 = require("./utils");
+/**
+ * Linter that can lint multiple files in consecutive runs.
+ */
+var Linter = (function () {
+ function Linter(options, program) {
+ this.options = options;
+ this.program = program;
+ this.failures = [];
+ this.fixes = [];
+ if (typeof options !== "object") {
+ throw new Error("Unknown Linter options type: " + typeof options);
+ }
+ if (options.configuration != null) {
+ throw new Error("ILinterOptions does not contain the property `configuration` as of version 4. " +
+ "Did you mean to pass the `IConfigurationFile` object to lint() ? ");
+ }
+ }
+ /**
+ * Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
+ */
+ Linter.createProgram = function (configFile, projectDirectory) {
+ if (projectDirectory === void 0) { projectDirectory = path.dirname(configFile); }
+ var config = ts.readConfigFile(configFile, ts.sys.readFile).config;
+ 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));
+ var host = ts.createCompilerHost(parsed.options, true);
+ var program = ts.createProgram(parsed.fileNames, parsed.options, host);
+ return program;
+ };
+ /**
+ * Returns a list of source file names from a TypeScript program. This includes all referenced
+ * 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"; });
+ };
+ Linter.prototype.lint = function (fileName, source, configuration) {
+ if (configuration === void 0) { configuration = configuration_1.DEFAULT_CONFIG; }
+ var sourceFile = this.getSourceFile(fileName, source);
+ var isJs = /\.jsx?$/i.test(fileName);
+ var enabledRules = this.getEnabledRules(configuration, isJs);
+ var fileFailures = this.getAllFailures(sourceFile, enabledRules);
+ if (fileFailures.length === 0) {
+ // Usual case: no errors.
+ return;
+ }
+ if (this.options.fix && fileFailures.some(function (f) { return f.hasFix(); })) {
+ fileFailures = this.applyAllFixes(enabledRules, fileFailures, sourceFile, fileName);
+ }
+ // add rule severity to failures
+ var ruleSeverityMap = new Map(enabledRules.map(function (rule) {
+ return [rule.getOptions().ruleName, rule.getOptions().ruleSeverity];
+ }));
+ for (var _i = 0, fileFailures_1 = fileFailures; _i < fileFailures_1.length; _i++) {
+ var failure = fileFailures_1[_i];
+ var severity = ruleSeverityMap.get(failure.getRuleName());
+ if (severity === undefined) {
+ throw new Error("Severity for rule '" + failure.getRuleName() + "' not found");
+ }
+ failure.setRuleSeverity(severity);
+ }
+ 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 {
+ throw new Error("formatter '" + formatterName + "' not found");
+ }
+ var output = formatter.format(this.failures, this.fixes);
+ var errorCount = this.failures.filter(function (failure) { return failure.getRuleSeverity() === "error"; }).length;
+ return {
+ errorCount: errorCount,
+ failures: this.failures,
+ fixes: this.fixes,
+ format: formatterName,
+ output: output,
+ warningCount: this.failures.length - errorCount,
+ };
+ };
+ Linter.prototype.getAllFailures = function (sourceFile, enabledRules) {
+ var _this = this;
+ var failures = utils_1.flatMap(enabledRules, function (rule) { return _this.applyRule(rule, sourceFile); });
+ return enableDisableRules_1.removeDisabledFailures(sourceFile, failures);
+ };
+ Linter.prototype.applyAllFixes = function (enabledRules, fileFailures, sourceFile, sourceFileName) {
+ // When fixing, we need to be careful as a fix in one rule may affect other rules.
+ // So fix each rule separately.
+ var source = sourceFile.text;
+ var _loop_1 = function (rule) {
+ var hasFixes = fileFailures.some(function (f) { return f.hasFix() && f.getRuleName() === rule.getOptions().ruleName; });
+ if (hasFixes) {
+ // Get new failures in case the file changed.
+ var updatedFailures = enableDisableRules_1.removeDisabledFailures(sourceFile, this_1.applyRule(rule, sourceFile));
+ var fixableFailures = updatedFailures.filter(function (f) { return f.hasFix(); });
+ this_1.fixes = this_1.fixes.concat(fixableFailures);
+ source = this_1.applyFixes(sourceFileName, source, fixableFailures);
+ sourceFile = this_1.getSourceFile(sourceFileName, source);
+ }
+ };
+ var this_1 = this;
+ for (var _i = 0, enabledRules_1 = enabledRules; _i < enabledRules_1.length; _i++) {
+ var rule = enabledRules_1[_i];
+ _loop_1(rule);
+ }
+ // If there were fixes, get the *new* list of failures.
+ return this.getAllFailures(sourceFile, enabledRules);
+ };
+ // Only "protected" because a test directly accesses it.
+ // tslint:disable-next-line member-ordering
+ Linter.prototype.applyFixes = function (sourceFilePath, source, fixableFailures) {
+ var fixesByFile = createMultiMap(fixableFailures, function (f) { return [f.getFileName(), f.getFix()]; });
+ fixesByFile.forEach(function (fileFixes, filePath) {
+ var fileNewSource;
+ if (path.resolve(filePath) === path.resolve(sourceFilePath)) {
+ source = rule_1.Replacement.applyFixes(source, fileFixes);
+ fileNewSource = source;
+ }
+ else {
+ var oldSource = fs.readFileSync(filePath, "utf-8");
+ fileNewSource = rule_1.Replacement.applyFixes(oldSource, fileFixes);
+ }
+ fs.writeFileSync(filePath, fileNewSource, "utf-8");
+ });
+ return source;
+ };
+ Linter.prototype.applyRule = function (rule, sourceFile) {
+ try {
+ if (this.program !== undefined && rule_1.isTypedRule(rule)) {
+ return rule.applyWithProgram(sourceFile, this.program);
+ }
+ else {
+ return rule.apply(sourceFile);
+ }
+ }
+ catch (error) {
+ if (error_1.isError(error)) {
+ error_1.showWarningOnce("Warning: " + error.message);
+ }
+ else {
+ console.warn("Warning: " + error);
+ }
+ return [];
+ }
+ };
+ Linter.prototype.getEnabledRules = function (configuration, isJs) {
+ if (configuration === void 0) { configuration = configuration_1.DEFAULT_CONFIG; }
+ var ruleOptionsList = configuration_1.convertRuleOptions(isJs ? configuration.jsRules : configuration.rules);
+ var rulesDirectories = utils_1.arrayify(this.options.rulesDirectory)
+ .concat(utils_1.arrayify(configuration.rulesDirectory));
+ return ruleLoader_1.loadRules(ruleOptionsList, rulesDirectories, isJs);
+ };
+ Linter.prototype.getSourceFile = function (fileName, source) {
+ 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, .js or .jsx extension.\n "], _a.raw = ["\n Invalid source file: ", ". Ensure that the files supplied to lint have a .ts, .tsx, .js or .jsx extension.\n "], utils_1.dedent(_a, fileName));
+ throw new Error(INVALID_SOURCE_ERROR);
+ }
+ // check if the program has been type checked
+ if (!("resolvedModules" in sourceFile)) {
+ throw new Error("Program must be type checked before linting");
+ }
+ return sourceFile;
+ }
+ else {
+ return utils.getSourceFile(fileName, source);
+ }
+ var _a;
+ };
+ return Linter;
+}());
+Linter.VERSION = "5.3.2";
+Linter.findConfiguration = configuration_1.findConfiguration;
+Linter.findConfigurationPath = configuration_1.findConfigurationPath;
+Linter.getRulesDirectories = configuration_1.getRulesDirectories;
+Linter.loadConfigurationFromPath = configuration_1.loadConfigurationFromPath;
+function createMultiMap(inputs, getPair) {
+ var map = new Map();
+ for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {
+ var input = inputs_1[_i];
+ var pair = getPair(input);
+ if (pair !== undefined) {
+ var k = pair[0], v = pair[1];
+ var vs = map.get(k);
+ if (vs !== undefined) {
+ vs.push(v);
+ }
+ else {
+ map.set(k, [v]);
+ }
+ }
+ }
+ return map;
+}
+module.exports = Linter;
diff --git a/node_modules/tslint/lib/ruleLoader.d.ts b/node_modules/tslint/lib/ruleLoader.d.ts
new file mode 100644
index 000000000..0ce93785e
--- /dev/null
+++ b/node_modules/tslint/lib/ruleLoader.d.ts
@@ -0,0 +1,3 @@
+import { IOptions, IRule, RuleConstructor } from "./language/rule/rule";
+export declare function loadRules(ruleOptionsList: IOptions[], rulesDirectories?: string | string[], isJs?: boolean): IRule[];
+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
new file mode 100644
index 000000000..1debe3931
--- /dev/null
+++ b/node_modules/tslint/lib/ruleLoader.js
@@ -0,0 +1,122 @@
+"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 });
+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 cachedRules = new Map();
+function loadRules(ruleOptionsList, rulesDirectories, isJs) {
+ if (isJs === void 0) { isJs = false; }
+ var rules = [];
+ var notFoundRules = [];
+ var notAllowedInJsRules = [];
+ for (var _i = 0, ruleOptionsList_1 = ruleOptionsList; _i < ruleOptionsList_1.length; _i++) {
+ var ruleOptions = ruleOptionsList_1[_i];
+ if (ruleOptions.ruleSeverity === "off") {
+ // Perf: don't bother finding the rule if it's disabled.
+ continue;
+ }
+ var ruleName = ruleOptions.ruleName;
+ var Rule = findRule(ruleName, rulesDirectories);
+ if (Rule === undefined) {
+ notFoundRules.push(ruleName);
+ }
+ else if (isJs && Rule.metadata !== undefined && Rule.metadata.typescriptOnly) {
+ notAllowedInJsRules.push(ruleName);
+ }
+ else {
+ var rule = new Rule(ruleOptions);
+ if (rule.isEnabled()) {
+ rules.push(rule);
+ }
+ if (Rule.metadata !== undefined && Rule.metadata.deprecationMessage !== undefined) {
+ error_1.showWarningOnce(Rule.metadata.ruleName + " is deprecated. " + Rule.metadata.deprecationMessage);
+ }
+ }
+ }
+ 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 ")));
+ 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 ")));
+ error_1.showWarningOnce(warning);
+ }
+ if (rules.length === 0) {
+ error_1.showWarningOnce("No valid rules have been specified");
+ }
+ return rules;
+ var _a, _b;
+}
+exports.loadRules = loadRules;
+function findRule(name, rulesDirectories) {
+ var camelizedName = transformName(name);
+ // first check for core rules
+ var Rule = loadCachedRule(CORE_RULES_DIRECTORY, camelizedName);
+ return Rule !== undefined ? Rule :
+ // then check for rules within the first level of rulesDirectory
+ utils_1.find(utils_1.arrayify(rulesDirectories), function (dir) { return loadCachedRule(dir, camelizedName, true); });
+}
+exports.findRule = findRule;
+function transformName(name) {
+ // camelize strips out leading and trailing underscores and dashes, so make sure they aren't passed to camelize
+ // the regex matches the groups (leading underscores and dashes)(other characters)(trailing underscores and dashes)
+ var nameMatch = name.match(/^([-_]*)(.*?)([-_]*)$/);
+ if (nameMatch === null) {
+ return name + "Rule";
+ }
+ return "" + nameMatch[1] + utils_1.camelize(nameMatch[2]) + nameMatch[3] + "Rule";
+}
+/**
+ * @param directory - An absolute path to a directory of rules
+ * @param ruleName - A name of a rule in filename format. ex) "someLintRule"
+ */
+function loadRule(directory, ruleName) {
+ var fullPath = path.join(directory, ruleName);
+ if (fs.existsSync(fullPath + ".js")) {
+ var ruleModule = require(fullPath);
+ if (ruleModule !== undefined) {
+ return ruleModule.Rule;
+ }
+ }
+ return "not-found";
+}
+function loadCachedRule(directory, ruleName, isCustomPath) {
+ if (isCustomPath === void 0) { isCustomPath = false; }
+ // use cached value if available
+ var fullPath = path.join(directory, ruleName);
+ var cachedRule = cachedRules.get(fullPath);
+ if (cachedRule !== undefined) {
+ return cachedRule === "not-found" ? undefined : cachedRule;
+ }
+ // get absolute path
+ var absolutePath = directory;
+ if (isCustomPath) {
+ absolutePath = configuration_1.getRelativePath(directory);
+ if (absolutePath !== undefined && !fs.existsSync(absolutePath)) {
+ throw new Error("Could not find custom rule directory: " + directory);
+ }
+ }
+ var Rule = absolutePath === undefined ? "not-found" : loadRule(absolutePath, ruleName);
+ cachedRules.set(fullPath, Rule);
+ return Rule === "not-found" ? undefined : Rule;
+}
diff --git a/node_modules/tslint/lib/rules.d.ts b/node_modules/tslint/lib/rules.d.ts
new file mode 100644
index 000000000..d9ff27de9
--- /dev/null
+++ b/node_modules/tslint/lib/rules.d.ts
@@ -0,0 +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 * from "./language/rule/abstractRule";
+export * from "./language/rule/typedRule";
+export * from "./language/rule/optionallyTypedRule";
diff --git a/node_modules/tslint/lib/rules.js b/node_modules/tslint/lib/rules.js
new file mode 100644
index 000000000..814e9a35f
--- /dev/null
+++ b/node_modules/tslint/lib/rules.js
@@ -0,0 +1,24 @@
+"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.
+ */
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+Object.defineProperty(exports, "__esModule", { value: true });
+__export(require("./language/rule/abstractRule"));
+__export(require("./language/rule/typedRule"));
+__export(require("./language/rule/optionallyTypedRule"));
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
new file mode 100644
index 000000000..18d5df0d9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
@@ -0,0 +1,8 @@
+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(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare function getOverloadKey(node: ts.SignatureDeclaration): string | undefined;
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
new file mode 100644
index 000000000..d3fb5ba1e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
@@ -0,0 +1,142 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "All '" + name + "' signatures should be adjacent";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "adjacent-overload-signatures",
+ description: "Enforces function overloads to be consecutive.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ rationale: "Improves readability and organization by grouping naturally related items together.",
+ type: "typescript",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ visitStatements(sourceFile.statements);
+ return ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ModuleBlock:
+ visitStatements(node.statements);
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.TypeLiteral: {
+ var members = node.members;
+ addFailures(getMisplacedOverloads(members, function (member) {
+ return utils.isSignatureDeclaration(member) ? getOverloadKey(member) : undefined;
+ }));
+ break;
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function visitStatements(statements) {
+ addFailures(getMisplacedOverloads(statements, function (statement) {
+ return utils.isFunctionDeclaration(statement) && statement.name !== undefined ? statement.name.text : undefined;
+ }));
+ }
+ function addFailures(misplacedOverloads) {
+ for (var _i = 0, misplacedOverloads_1 = misplacedOverloads; _i < misplacedOverloads_1.length; _i++) {
+ var node = misplacedOverloads_1[_i];
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING(printOverload(node)));
+ }
+ }
+}
+/** 'getOverloadName' may return undefined for nodes that cannot be overloads, e.g. a `const` declaration. */
+function getMisplacedOverloads(overloads, getKey) {
+ var result = [];
+ var lastKey;
+ var seen = new Set();
+ for (var _i = 0, overloads_1 = overloads; _i < overloads_1.length; _i++) {
+ var node = overloads_1[_i];
+ if (node.kind === ts.SyntaxKind.SemicolonClassElement) {
+ continue;
+ }
+ var key = getKey(node);
+ if (key !== undefined) {
+ if (seen.has(key) && lastKey !== key) {
+ result.push(node);
+ }
+ seen.add(key);
+ lastKey = key;
+ }
+ else {
+ lastKey = undefined;
+ }
+ }
+ return result;
+}
+function printOverload(node) {
+ var info = getOverloadInfo(node);
+ return typeof info === "string" ? info : info === undefined ? "<unknown>" : info.name;
+}
+function getOverloadKey(node) {
+ var info = getOverloadInfo(node);
+ if (info === undefined) {
+ return undefined;
+ }
+ var _a = typeof info === "string" ? [false, info] : [info.computed === true, info.name], computed = _a[0], name = _a[1];
+ var isStatic = Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword);
+ return (computed ? "0" : "1") + (isStatic ? "0" : "1") + name;
+}
+exports.getOverloadKey = getOverloadKey;
+function getOverloadInfo(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ConstructSignature:
+ case ts.SyntaxKind.Constructor:
+ return "constructor";
+ case ts.SyntaxKind.CallSignature:
+ return "()";
+ default: {
+ var name = node.name;
+ if (name === undefined) {
+ return undefined;
+ }
+ switch (name.kind) {
+ case ts.SyntaxKind.Identifier:
+ return name.text;
+ case ts.SyntaxKind.ComputedPropertyName:
+ var expression = name.expression;
+ return utils.isLiteralExpression(expression) ? expression.text : { name: expression.getText(), computed: true };
+ default:
+ return utils.isLiteralExpression(name) ? name.text : undefined;
+ }
+ }
+ }
+}
diff --git a/node_modules/tslint/lib/rules/alignRule.d.ts b/node_modules/tslint/lib/rules/alignRule.d.ts
new file mode 100644
index 000000000..051a5bb15
--- /dev/null
+++ b/node_modules/tslint/lib/rules/alignRule.d.ts
@@ -0,0 +1,7 @@
+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_SUFFIX: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/alignRule.js b/node_modules/tslint/lib/rules/alignRule.js
new file mode 100644
index 000000000..d86f2f550
--- /dev/null
+++ b/node_modules/tslint/lib/rules/alignRule.js
@@ -0,0 +1,180 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_STATEMENTS = "statements";
+var OPTION_MEMBERS = "members";
+var OPTION_ELEMENTS = "elements";
+var OPTION_PARAMETERS = "parameters";
+var OPTION_ARGUMENTS = "arguments";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new AlignWalker(sourceFile, this.ruleName, {
+ arguments: this.ruleArguments.indexOf(OPTION_ARGUMENTS) !== -1,
+ elements: this.ruleArguments.indexOf(OPTION_ELEMENTS) !== -1,
+ members: this.ruleArguments.indexOf(OPTION_MEMBERS) !== -1,
+ parameters: this.ruleArguments.indexOf(OPTION_PARAMETERS) !== -1,
+ statements: this.ruleArguments.indexOf(OPTION_STATEMENTS) !== -1,
+ }));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_ARGUMENTS, OPTION_ELEMENTS, OPTION_MEMBERS, OPTION_PARAMETERS, OPTION_STATEMENTS],
+ },
+ minLength: 1,
+ maxLength: 5,
+ },
+ optionExamples: [[true, "parameters", "statements"]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_SUFFIX = " are not aligned";
+exports.Rule = Rule;
+var AlignWalker = (function (_super) {
+ tslib_1.__extends(AlignWalker, _super);
+ function AlignWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AlignWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (_this.options.statements && tsutils_1.isBlockLike(node)) {
+ _this.checkAlignment(node.statements.filter(function (s) { return !tsutils_1.isEmptyStatement(s); }), OPTION_STATEMENTS);
+ }
+ else {
+ switch (node.kind) {
+ case ts.SyntaxKind.NewExpression:
+ if (node.arguments === undefined) {
+ break;
+ }
+ // falls through
+ case ts.SyntaxKind.CallExpression:
+ if (_this.options.arguments) {
+ _this.checkAlignment(node.arguments, OPTION_ARGUMENTS);
+ }
+ break;
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.CallSignature:
+ case ts.SyntaxKind.ConstructSignature:
+ case ts.SyntaxKind.MethodSignature:
+ case ts.SyntaxKind.FunctionType:
+ case ts.SyntaxKind.ConstructorType:
+ if (_this.options.parameters) {
+ _this.checkAlignment(node.parameters, OPTION_PARAMETERS);
+ }
+ break;
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ case ts.SyntaxKind.ArrayBindingPattern:
+ if (_this.options.elements) {
+ _this.checkAlignment(node.elements, OPTION_ELEMENTS);
+ }
+ break;
+ case ts.SyntaxKind.TupleType:
+ if (_this.options.elements) {
+ _this.checkAlignment(node.elementTypes, OPTION_ELEMENTS);
+ }
+ break;
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ if (_this.options.members) {
+ _this.checkAlignment(node.properties, OPTION_MEMBERS);
+ }
+ break;
+ case ts.SyntaxKind.ObjectBindingPattern:
+ if (_this.options.members) {
+ _this.checkAlignment(node.elements, OPTION_MEMBERS);
+ }
+ break;
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.InterfaceDeclaration:
+ case ts.SyntaxKind.TypeLiteral:
+ if (_this.options.members) {
+ _this.checkAlignment(node.members, OPTION_MEMBERS);
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return cb(sourceFile);
+ };
+ AlignWalker.prototype.checkAlignment = function (nodes, kind) {
+ if (nodes.length <= 1) {
+ return;
+ }
+ var sourceFile = this.sourceFile;
+ var pos = getLineAndCharacterWithoutBom(sourceFile, this.getStart(nodes[0]));
+ var alignToColumn = pos.character;
+ var line = pos.line;
+ // skip first node in list
+ for (var i = 1; i < nodes.length; ++i) {
+ var node = nodes[i];
+ var start = this.getStart(node);
+ pos = ts.getLineAndCharacterOfPosition(sourceFile, start);
+ if (line !== pos.line && pos.character !== alignToColumn) {
+ var diff = alignToColumn - pos.character;
+ var fix = void 0;
+ if (0 < diff) {
+ fix = Lint.Replacement.appendText(start, " ".repeat(diff));
+ }
+ else if (node.pos <= start + diff && /^\s+$/.test(sourceFile.text.substring(start + diff, start))) {
+ // only delete text if there is only whitespace
+ fix = Lint.Replacement.deleteText(start + diff, -diff);
+ }
+ this.addFailure(start, Math.max(node.end, start), kind + Rule.FAILURE_STRING_SUFFIX, fix);
+ }
+ line = pos.line;
+ }
+ };
+ AlignWalker.prototype.getStart = function (node) {
+ return node.kind !== ts.SyntaxKind.OmittedExpression
+ ? node.getStart(this.sourceFile)
+ : tsutils_1.getNextToken(node, this.sourceFile).getStart(this.sourceFile);
+ };
+ return AlignWalker;
+}(Lint.AbstractWalker));
+function getLineAndCharacterWithoutBom(sourceFile, pos) {
+ var result = ts.getLineAndCharacterOfPosition(sourceFile, pos);
+ if (result.line === 0 && sourceFile.text[0] === "\uFEFF") {
+ result.character -= 1;
+ }
+ return result;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/arrayTypeRule.d.ts b/node_modules/tslint/lib/rules/arrayTypeRule.d.ts
new file mode 100644
index 000000000..d36189fca
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrayTypeRule.d.ts
@@ -0,0 +1,26 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_ARRAY: string;
+ static FAILURE_STRING_GENERIC: string;
+ static FAILURE_STRING_ARRAY_SIMPLE: string;
+ static FAILURE_STRING_GENERIC_SIMPLE: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/arrayTypeRule.js b/node_modules/tslint/lib/rules/arrayTypeRule.js
new file mode 100644
index 000000000..1c86b72b2
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrayTypeRule.js
@@ -0,0 +1,156 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_ARRAY = "array";
+var OPTION_GENERIC = "generic";
+var OPTION_ARRAY_SIMPLE = "array-simple";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, this.ruleArguments[0]);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "string",
+ enum: [OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE],
+ },
+ optionExamples: [[true, OPTION_ARRAY], [true, OPTION_GENERIC], [true, OPTION_ARRAY_SIMPLE]],
+ type: "style",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_ARRAY = "Array type using 'Array<T>' is forbidden. Use 'T[]' instead.";
+Rule.FAILURE_STRING_GENERIC = "Array type using 'T[]' is forbidden. Use 'Array<T>' instead.";
+Rule.FAILURE_STRING_ARRAY_SIMPLE = "Array type using 'Array<T>' is forbidden for simple types. Use 'T[]' instead.";
+Rule.FAILURE_STRING_GENERIC_SIMPLE = "Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>' instead.";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, option = ctx.options;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ArrayType:
+ checkArrayType(node);
+ break;
+ case ts.SyntaxKind.TypeReference:
+ checkTypeReference(node);
+ break;
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function checkArrayType(node) {
+ var elementType = node.elementType, parent = node.parent;
+ if (option === "array" || option === "array-simple" && isSimpleType(elementType)) {
+ return;
+ }
+ var failureString = option === "generic" ? Rule.FAILURE_STRING_GENERIC : Rule.FAILURE_STRING_GENERIC_SIMPLE;
+ var parens = elementType.kind === ts.SyntaxKind.ParenthesizedType ? 1 : 0;
+ // Add a space if the type is preceded by 'as' and the node has no leading whitespace
+ var space = parens === 0 && parent.kind === ts.SyntaxKind.AsExpression && node.getStart() === node.getFullStart();
+ var fix = [
+ new Lint.Replacement(elementType.getStart(), parens, (space ? " " : "") + "Array<"),
+ // Delete the square brackets and replace with an angle bracket
+ Lint.Replacement.replaceFromTo(elementType.getEnd() - parens, node.getEnd(), ">"),
+ ];
+ ctx.addFailureAtNode(node, failureString, fix);
+ }
+ function checkTypeReference(node) {
+ var typeName = node.typeName, typeArguments = node.typeArguments;
+ if (option === "generic" || !isArrayIdentifier(typeName)) {
+ return;
+ }
+ var failureString = option === "array" ? Rule.FAILURE_STRING_ARRAY : Rule.FAILURE_STRING_ARRAY_SIMPLE;
+ if (typeArguments === undefined || typeArguments.length === 0) {
+ // Create an 'any' array
+ var fix_1 = Lint.Replacement.replaceFromTo(node.getStart(), node.getEnd(), "any[]");
+ ctx.addFailureAtNode(node, failureString, fix_1);
+ return;
+ }
+ if (typeArguments.length !== 1 || (option === "array-simple" && !isSimpleType(typeArguments[0]))) {
+ return;
+ }
+ var type = typeArguments[0];
+ var parens = typeNeedsParentheses(type);
+ var fix = [
+ // Delete 'Array<'
+ Lint.Replacement.replaceFromTo(node.getStart(), type.getStart(), parens ? "(" : ""),
+ // Delete '>' and replace with '[]
+ Lint.Replacement.replaceFromTo(type.getEnd(), node.getEnd(), parens ? ")[]" : "[]"),
+ ];
+ ctx.addFailureAtNode(node, failureString, fix);
+ }
+}
+function typeNeedsParentheses(type) {
+ switch (type.kind) {
+ case ts.SyntaxKind.UnionType:
+ case ts.SyntaxKind.FunctionType:
+ case ts.SyntaxKind.IntersectionType:
+ case ts.SyntaxKind.TypeOperator:
+ return true;
+ default:
+ return false;
+ }
+}
+function isArrayIdentifier(name) {
+ return name.kind === ts.SyntaxKind.Identifier && name.text === "Array";
+}
+function isSimpleType(nodeType) {
+ switch (nodeType.kind) {
+ case ts.SyntaxKind.AnyKeyword:
+ case ts.SyntaxKind.ArrayType:
+ case ts.SyntaxKind.BooleanKeyword:
+ case ts.SyntaxKind.NullKeyword:
+ case ts.SyntaxKind.ObjectKeyword:
+ case ts.SyntaxKind.UndefinedKeyword:
+ case ts.SyntaxKind.NumberKeyword:
+ case ts.SyntaxKind.StringKeyword:
+ case ts.SyntaxKind.SymbolKeyword:
+ case ts.SyntaxKind.VoidKeyword:
+ case ts.SyntaxKind.NeverKeyword:
+ return true;
+ case ts.SyntaxKind.TypeReference:
+ // TypeReferences must be non-generic or be another Array with a simple type
+ var _a = nodeType, typeName = _a.typeName, typeArguments = _a.typeArguments;
+ if (typeArguments === undefined) {
+ return true;
+ }
+ switch (typeArguments.length) {
+ case 0:
+ return true;
+ case 1:
+ return typeName.kind === ts.SyntaxKind.Identifier && typeName.text === "Array" && isSimpleType(typeArguments[0]);
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.d.ts b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
new file mode 100644
index 000000000..32149f7ed
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
@@ -0,0 +1,8 @@
+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_MISSING: string;
+ static FAILURE_STRING_EXISTS: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.js b/node_modules/tslint/lib/rules/arrowParensRule.js
new file mode 100644
index 000000000..9884d62e3
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrowParensRule.js
@@ -0,0 +1,95 @@
+"use strict";
+/**
+ * @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.
+ */
+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 BAN_SINGLE_ARG_PARENS = "ban-single-arg-parens";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, {
+ banSingleArgParens: this.ruleArguments.indexOf(BAN_SINGLE_ARG_PARENS) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "arrow-parens",
+ 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)),
+ options: {
+ type: "string",
+ enum: [BAN_SINGLE_ARG_PARENS],
+ },
+ optionExamples: [true, [true, BAN_SINGLE_ARG_PARENS]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_MISSING = "Parentheses are required around the parameters of an arrow function definition";
+Rule.FAILURE_STRING_EXISTS = "Parentheses are prohibited around the parameter in this single parameter arrow function";
+exports.Rule = Rule;
+function walk(ctx) {
+ function cb(node) {
+ if (tsutils_1.isArrowFunction(node) && parensAreOptional(node)) {
+ var openParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenParenToken);
+ if (openParen === undefined) {
+ if (!ctx.options.banSingleArgParens) {
+ var parameter = node.parameters[0];
+ var start = parameter.getStart(ctx.sourceFile);
+ var end = parameter.end;
+ ctx.addFailure(start, end, Rule.FAILURE_STRING_MISSING, [
+ Lint.Replacement.appendText(start, "("),
+ Lint.Replacement.appendText(end, ")"),
+ ]);
+ }
+ }
+ else if (ctx.options.banSingleArgParens) {
+ var closeParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.CloseParenToken);
+ ctx.addFailureAtNode(node.parameters[0], Rule.FAILURE_STRING_EXISTS, [
+ Lint.Replacement.deleteText(openParen.end - 1, 1),
+ Lint.Replacement.deleteText(closeParen.end - 1, 1),
+ ]);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ }
+ return ts.forEachChild(ctx.sourceFile, cb);
+}
+function parensAreOptional(node) {
+ return node.parameters.length === 1 &&
+ node.typeParameters === undefined &&
+ node.type === undefined &&
+ isSimpleParameter(node.parameters[0]);
+}
+function isSimpleParameter(parameter) {
+ return parameter.name.kind === ts.SyntaxKind.Identifier
+ && parameter.dotDotDotToken === undefined
+ && parameter.initializer === undefined
+ && parameter.questionToken === undefined
+ && parameter.type === undefined;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
new file mode 100644
index 000000000..221a0b522
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
@@ -0,0 +1,7 @@
+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(isObjectLiteral: boolean): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
new file mode 100644
index 000000000..1954d2d17
--- /dev/null
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
@@ -0,0 +1,101 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../language/utils");
+var OPTION_MULTILINE = "multiline";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (isObjectLiteral) {
+ var start = "This arrow function body can be simplified by omitting the curly braces and the keyword 'return'";
+ return start + (isObjectLiteral ? ", and wrapping the object literal in parentheses." : ".");
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, { multiline: this.ruleArguments.indexOf(OPTION_MULTILINE) !== -1 });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "string",
+ enum: [OPTION_MULTILINE],
+ },
+ optionExamples: [
+ true,
+ [true, OPTION_MULTILINE],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, multiline = ctx.options.multiline;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (utils.isArrowFunction(node) && utils.isBlock(node.body)) {
+ var expr = getSimpleReturnExpression(node.body);
+ if (expr !== undefined && (multiline || utils.isSameLine(sourceFile, node.body.getStart(sourceFile), node.body.end))) {
+ var isObjectLiteral = expr.kind === ts.SyntaxKind.ObjectLiteralExpression;
+ ctx.addFailureAtNode(node.body, Rule.FAILURE_STRING(isObjectLiteral), createFix(node, node.body, expr, sourceFile.text));
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+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 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 ? [
+ Lint.Replacement.appendText(expr.getStart(), "("),
+ Lint.Replacement.appendText(expr.getEnd(), ")"),
+ ] : []).concat([
+ // " {"
+ Lint.Replacement.deleteFromTo(arrow.end, openBrace.end),
+ // "return "
+ Lint.Replacement.deleteFromTo(statement.getStart(), expr.getStart()),
+ // " }" (may include semicolon)
+ Lint.Replacement.deleteFromTo(expr.end, closeBrace.end),
+ ]);
+ function hasComments(node) {
+ return utils_1.hasCommentAfterPosition(text, node.getEnd());
+ }
+}
+/** Given `{ return x; }`, return `x`. */
+function getSimpleReturnExpression(block) {
+ return block.statements.length === 1 && block.statements[0].kind === ts.SyntaxKind.ReturnStatement
+ ? block.statements[0].expression
+ : undefined;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
new file mode 100644
index 000000000..d2d51d1d1
--- /dev/null
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.js b/node_modules/tslint/lib/rules/awaitPromiseRule.js
new file mode 100644
index 000000000..18c255e72
--- /dev/null
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.js
@@ -0,0 +1,81 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ var promiseTypes = new Set(["Promise"].concat(this.ruleArguments));
+ var tc = program.getTypeChecker();
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, tc, promiseTypes); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "list",
+ listType: {
+ type: "array",
+ items: { type: "string" },
+ },
+ },
+ optionExamples: [true, [true, "Thenable"]],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "'await' of non-Promise.";
+exports.Rule = Rule;
+function walk(ctx, tc, promiseTypes) {
+ return ts.forEachChild(ctx.sourceFile, cb);
+ function cb(node) {
+ if (tsutils_1.isAwaitExpression(node) && !couldBePromise(tc.getTypeAtLocation(node.expression))) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ }
+ function couldBePromise(type) {
+ if (Lint.isTypeFlagSet(type, ts.TypeFlags.Any) || isPromiseType(type)) {
+ return true;
+ }
+ if (isUnionType(type)) {
+ return type.types.some(couldBePromise);
+ }
+ var bases = type.getBaseTypes();
+ return bases !== undefined && bases.some(couldBePromise);
+ }
+ function isPromiseType(type) {
+ var target = type.target;
+ return target !== undefined && target.symbol !== undefined && promiseTypes.has(target.symbol.name);
+ }
+}
+function isUnionType(type) {
+ return Lint.isTypeFlagSet(type, ts.TypeFlags.Union);
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/banRule.d.ts b/node_modules/tslint/lib/rules/banRule.d.ts
new file mode 100644
index 000000000..182b981ac
--- /dev/null
+++ b/node_modules/tslint/lib/rules/banRule.d.ts
@@ -0,0 +1,31 @@
+/**
+ * @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_FACTORY(expression: string, messageAddition?: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare class BanFunctionWalker extends Lint.RuleWalker {
+ private bannedGlobalFunctions;
+ private bannedFunctions;
+ addBannedFunction(bannedFunction: string[]): void;
+ visitCallExpression(node: ts.CallExpression): void;
+ private checkForObjectMethodBan(expression);
+ private checkForGlobalBan(expression);
+}
diff --git a/node_modules/tslint/lib/rules/banRule.js b/node_modules/tslint/lib/rules/banRule.js
new file mode 100644
index 000000000..e7ee21f15
--- /dev/null
+++ b/node_modules/tslint/lib/rules/banRule.js
@@ -0,0 +1,123 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (expression, messageAddition) {
+ return "Calls to '" + expression + "' are not allowed." + (messageAddition !== undefined ? " " + messageAddition : "");
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var options = this.getOptions();
+ var banFunctionWalker = new BanFunctionWalker(sourceFile, options);
+ var functionsToBan = options.ruleArguments;
+ if (functionsToBan !== undefined) {
+ functionsToBan.forEach(function (f) { return banFunctionWalker.addBannedFunction(f); });
+ }
+ return this.applyWithWalker(banFunctionWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "ban",
+ description: "Bans the use of specific functions or global methods.",
+ optionsDescription: (_a = ["\n A list of `['object', 'method', 'optional explanation here']` or `['globalMethod']` which ban `object.method()`\n or respectively `globalMethod()`."], _a.raw = ["\n A list of \\`['object', 'method', 'optional explanation here']\\` or \\`['globalMethod']\\` which ban \\`object.method()\\`\n or respectively \\`globalMethod()\\`."], Lint.Utils.dedent(_a)),
+ options: {
+ type: "list",
+ listType: {
+ type: "array",
+ items: { type: "string" },
+ minLength: 1,
+ maxLength: 3,
+ },
+ },
+ optionExamples: [
+ [
+ true,
+ ["someGlobalMethod"],
+ ["someObject", "someFunction"],
+ ["someObject", "otherFunction", "Optional explanation"],
+ ],
+ ],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var BanFunctionWalker = (function (_super) {
+ tslib_1.__extends(BanFunctionWalker, _super);
+ function BanFunctionWalker() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.bannedGlobalFunctions = [];
+ _this.bannedFunctions = [];
+ return _this;
+ }
+ BanFunctionWalker.prototype.addBannedFunction = function (bannedFunction) {
+ if (bannedFunction.length === 1) {
+ this.bannedGlobalFunctions.push(bannedFunction[0]);
+ }
+ else if (bannedFunction.length >= 2) {
+ this.bannedFunctions.push(bannedFunction);
+ }
+ };
+ BanFunctionWalker.prototype.visitCallExpression = function (node) {
+ var expression = node.expression;
+ this.checkForObjectMethodBan(expression);
+ this.checkForGlobalBan(expression);
+ _super.prototype.visitCallExpression.call(this, node);
+ };
+ BanFunctionWalker.prototype.checkForObjectMethodBan = function (expression) {
+ if (expression.kind === ts.SyntaxKind.PropertyAccessExpression
+ && expression.getChildCount() >= 3) {
+ var firstToken = expression.getFirstToken();
+ var firstChild = expression.getChildAt(0);
+ var secondChild = expression.getChildAt(1);
+ var thirdChild = expression.getChildAt(2);
+ var rightSideExpression = thirdChild.getFullText();
+ var leftSideExpression = firstChild.getChildCount() > 0
+ ? firstChild.getLastToken().getText()
+ : firstToken.getText();
+ if (secondChild.kind === ts.SyntaxKind.DotToken) {
+ for (var _i = 0, _a = this.bannedFunctions; _i < _a.length; _i++) {
+ var bannedFunction = _a[_i];
+ if (leftSideExpression === bannedFunction[0] && rightSideExpression === bannedFunction[1]) {
+ var failure = Rule.FAILURE_STRING_FACTORY(leftSideExpression + "." + rightSideExpression, bannedFunction[2]);
+ this.addFailureAtNode(expression, failure);
+ }
+ }
+ }
+ }
+ };
+ BanFunctionWalker.prototype.checkForGlobalBan = function (expression) {
+ if (expression.kind === ts.SyntaxKind.Identifier) {
+ var identifierName = expression.text;
+ if (this.bannedGlobalFunctions.indexOf(identifierName) !== -1) {
+ this.addFailureAtNode(expression, Rule.FAILURE_STRING_FACTORY("" + identifierName));
+ }
+ }
+ };
+ return BanFunctionWalker;
+}(Lint.RuleWalker));
+exports.BanFunctionWalker = BanFunctionWalker;
+var _a;
diff --git a/node_modules/tslint/lib/rules/banTypesRule.d.ts b/node_modules/tslint/lib/rules/banTypesRule.d.ts
new file mode 100644
index 000000000..35b876994
--- /dev/null
+++ b/node_modules/tslint/lib/rules/banTypesRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(typeName: string, messageAddition?: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/banTypesRule.js b/node_modules/tslint/lib/rules/banTypesRule.js
new file mode 100644
index 000000000..494f7859a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/banTypesRule.js
@@ -0,0 +1,75 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (typeName, messageAddition) {
+ return "Don't use '" + typeName + "' as a type." + (messageAddition !== undefined ? " " + messageAddition : "");
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, this.ruleArguments.map(parseOption));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ options: {
+ type: "list",
+ listType: {
+ type: "array",
+ items: { type: "string" },
+ minLength: 1,
+ 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)),
+ optionExamples: [[true, ["Object", "Use {} instead."], ["String"]]],
+ type: "typescript",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+function parseOption(_a) {
+ var pattern = _a[0], message = _a[1];
+ return { message: message, pattern: new RegExp("^" + pattern + "$") };
+}
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isTypeReferenceNode(node)) {
+ var typeName = node.getText(ctx.sourceFile);
+ for (var _i = 0, _a = ctx.options; _i < _a.length; _i++) {
+ var ban = _a[_i];
+ if (ban.pattern.test(typeName)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_FACTORY(typeName, ban.message));
+ break;
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.d.ts b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
new file mode 100644
index 000000000..46cb6b262
--- /dev/null
+++ b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(type: string, sigSuggestion: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.js b/node_modules/tslint/lib/rules/callableTypesRule.js
new file mode 100644
index 000000000..485aa230e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/callableTypesRule.js
@@ -0,0 +1,90 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (type, sigSuggestion) {
+ return type + " has only a call signature \u2014 use `" + sigSuggestion + "` instead.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "callable-types",
+ description: "An interface or literal type with just a call signature can be written as a function type.",
+ rationale: "style",
+ optionsDescription: "Not configurable.",
+ options: null,
+ type: "style",
+ typescriptOnly: true,
+ hasFix: true,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if ((tsutils_1.isInterfaceDeclaration(node) && noSupertype(node)
+ || tsutils_1.isTypeLiteralNode(node))
+ && node.members.length === 1) {
+ var member = node.members[0];
+ if (tsutils_1.isCallSignatureDeclaration(member) &&
+ // avoid bad parse
+ member.type !== undefined) {
+ var suggestion = renderSuggestion(member, node, ctx.sourceFile);
+ ctx.addFailureAtNode(member, Rule.FAILURE_STRING_FACTORY(node.kind === ts.SyntaxKind.TypeLiteral ? "Type literal" : "Interface", suggestion), Lint.Replacement.replaceNode(node, suggestion));
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+/** True if there is no supertype or if the supertype is `Function`. */
+function noSupertype(node) {
+ if (node.heritageClauses === undefined) {
+ return true;
+ }
+ if (node.heritageClauses.length !== 1) {
+ return false;
+ }
+ var expr = node.heritageClauses[0].types[0].expression;
+ return tsutils_1.isIdentifier(expr) && expr.text === "Function";
+}
+function renderSuggestion(call, parent, sourceFile) {
+ var start = call.getStart(sourceFile);
+ var colonPos = call.type.pos - 1 - start;
+ var text = sourceFile.text.substring(start, call.end);
+ var suggestion = text.substr(0, colonPos) + " =>" + text.substr(colonPos + 1);
+ if (parent.kind === ts.SyntaxKind.InterfaceDeclaration) {
+ if (parent.typeParameters !== undefined) {
+ return "type" + sourceFile.text.substring(parent.name.pos, parent.typeParameters.end + 1) + " = " + suggestion;
+ }
+ else {
+ return "type " + parent.name.text + " = " + suggestion;
+ }
+ }
+ return suggestion.endsWith(";") ? suggestion.slice(0, -1) : suggestion;
+}
diff --git a/node_modules/tslint/lib/rules/classNameRule.d.ts b/node_modules/tslint/lib/rules/classNameRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/classNameRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/classNameRule.js b/node_modules/tslint/lib/rules/classNameRule.js
new file mode 100644
index 000000000..da5e7d92c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/classNameRule.js
@@ -0,0 +1,61 @@
+"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 });
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Class name must be in pascal case";
+exports.Rule = Rule;
+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)) {
+ ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isPascalCased(name) {
+ return utils_1.isUpperCase(name[0]) && !name.includes("_");
+}
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.d.ts b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
new file mode 100644
index 000000000..5de68b5db
--- /dev/null
+++ b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
@@ -0,0 +1,11 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static LOWERCASE_FAILURE: string;
+ static UPPERCASE_FAILURE: string;
+ static LEADING_SPACE_FAILURE: string;
+ static IGNORE_WORDS_FAILURE_FACTORY: (words: string[]) => string;
+ static IGNORE_PATTERN_FAILURE_FACTORY: (pattern: string) => string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.js b/node_modules/tslint/lib/rules/commentFormatRule.js
new file mode 100644
index 000000000..af7da92c5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/commentFormatRule.js
@@ -0,0 +1,204 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var OPTION_SPACE = "check-space";
+var OPTION_LOWERCASE = "check-lowercase";
+var OPTION_UPPERCASE = "check-uppercase";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new CommentWalker(sourceFile, this.getOptions()));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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 comments starting with `///` are also allowed, for things such as `///<reference>`\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 comments starting with \\`///\\` are also allowed, for things such as \\`///<reference>\\`\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)),
+ options: {
+ type: "array",
+ items: {
+ anyOf: [
+ {
+ type: "string",
+ enum: [
+ "check-space",
+ "check-lowercase",
+ "check-uppercase",
+ ],
+ },
+ {
+ type: "object",
+ properties: {
+ "ignore-words": {
+ type: "array",
+ items: {
+ type: "string",
+ },
+ },
+ "ignore-pattern": {
+ type: "string",
+ },
+ },
+ minProperties: 1,
+ maxProperties: 1,
+ },
+ ],
+ },
+ minLength: 1,
+ maxLength: 4,
+ },
+ optionExamples: [
+ [true, "check-space", "check-uppercase"],
+ [true, "check-lowercase", { "ignore-words": ["TODO", "HACK"] }],
+ [true, "check-lowercase", { "ignore-pattern": "STD\\w{2,3}\\b" }],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.LOWERCASE_FAILURE = "comment must start with lowercase letter";
+Rule.UPPERCASE_FAILURE = "comment must start with uppercase letter";
+Rule.LEADING_SPACE_FAILURE = "comment must start with a space";
+Rule.IGNORE_WORDS_FAILURE_FACTORY = function (words) { return " or the word(s): " + words.join(", "); };
+Rule.IGNORE_PATTERN_FAILURE_FACTORY = function (pattern) { return " or its start must match the regex pattern \"" + pattern + "\""; };
+exports.Rule = Rule;
+var CommentWalker = (function (_super) {
+ tslib_1.__extends(CommentWalker, _super);
+ function CommentWalker(sourceFile, options) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ _this.failureIgnorePart = "";
+ _this.exceptionsRegExp = _this.composeExceptionsRegExp();
+ return _this;
+ }
+ CommentWalker.prototype.visitSourceFile = function (node) {
+ var _this = this;
+ utils.forEachComment(node, function (fullText, comment) {
+ if (comment.kind === ts.SyntaxKind.SingleLineCommentTrivia) {
+ var commentText = fullText.substring(comment.pos, comment.end);
+ var startPosition = comment.pos + 2;
+ var width = commentText.length - 2;
+ if (_this.hasOption(OPTION_SPACE)) {
+ if (!startsWithSpace(commentText)) {
+ _this.addFailureAt(startPosition, width, Rule.LEADING_SPACE_FAILURE);
+ }
+ }
+ if (_this.hasOption(OPTION_LOWERCASE)) {
+ if (!startsWithLowercase(commentText) && !_this.startsWithException(commentText)) {
+ _this.addFailureAt(startPosition, width, Rule.LOWERCASE_FAILURE + _this.failureIgnorePart);
+ }
+ }
+ if (_this.hasOption(OPTION_UPPERCASE)) {
+ if (!startsWithUppercase(commentText) && !isEnableDisableFlag(commentText) && !_this.startsWithException(commentText)) {
+ _this.addFailureAt(startPosition, width, Rule.UPPERCASE_FAILURE + _this.failureIgnorePart);
+ }
+ }
+ }
+ });
+ };
+ CommentWalker.prototype.startsWithException = function (commentText) {
+ if (this.exceptionsRegExp == null) {
+ return false;
+ }
+ return this.exceptionsRegExp.test(commentText);
+ };
+ CommentWalker.prototype.composeExceptionsRegExp = function () {
+ var optionsList = this.getOptions();
+ var exceptionsObject = optionsList[optionsList.length - 1];
+ // early return if last element is string instead of exceptions object
+ if (typeof exceptionsObject === "string" || exceptionsObject === undefined) {
+ return null;
+ }
+ if (exceptionsObject["ignore-pattern"] !== undefined) {
+ var ignorePattern = exceptionsObject["ignore-pattern"];
+ this.failureIgnorePart = Rule.IGNORE_PATTERN_FAILURE_FACTORY(ignorePattern);
+ // regex is "start of string"//"any amount of whitespace" followed by user provided ignore pattern
+ return new RegExp("^//\\s*(" + ignorePattern + ")");
+ }
+ if (exceptionsObject["ignore-words"] !== undefined) {
+ var ignoreWords = exceptionsObject["ignore-words"];
+ this.failureIgnorePart = Rule.IGNORE_WORDS_FAILURE_FACTORY(ignoreWords);
+ // Converts all exceptions values to strings, trim whitespace, escapes RegExp special characters and combines into alternation
+ var wordsPattern = ignoreWords
+ .map(String)
+ .map(function (str) { return str.trim(); })
+ .map(utils_1.escapeRegExp)
+ .join("|");
+ // regex is "start of string"//"any amount of whitespace"("any word from ignore list") followed by non alphanumeric character
+ return new RegExp("^//\\s*(" + wordsPattern + ")\\b");
+ }
+ return null;
+ };
+ return CommentWalker;
+}(Lint.RuleWalker));
+function startsWith(commentText, changeCase) {
+ if (commentText.length <= 2) {
+ return true; // comment is "//"? Technically not a violation.
+ }
+ // regex is "start of string"//"any amount of whitespace"("word character")
+ var firstCharacterMatch = commentText.match(/^\/\/\s*(\w)/);
+ if (firstCharacterMatch != null) {
+ // the first group matched, i.e. the thing in the parens, is the first non-space character, if it's alphanumeric
+ var firstCharacter = firstCharacterMatch[1];
+ return firstCharacter === changeCase(firstCharacter);
+ }
+ else {
+ // first character isn't alphanumeric/doesn't exist? Technically not a violation
+ return true;
+ }
+}
+function startsWithLowercase(commentText) {
+ return startsWith(commentText, function (c) { return c.toLowerCase(); });
+}
+function startsWithUppercase(commentText) {
+ return startsWith(commentText, function (c) { return c.toUpperCase(); });
+}
+function startsWithSpace(commentText) {
+ if (commentText.length <= 2) {
+ return true; // comment is "//"? Technically not a violation.
+ }
+ var commentBody = commentText.substring(2);
+ // whitelist //#region and //#endregion
+ if ((/^#(end)?region/).test(commentBody)) {
+ return true;
+ }
+ // whitelist JetBrains IDEs' "//noinspection ..."
+ if ((/^noinspection\s/).test(commentBody)) {
+ return true;
+ }
+ var firstCharacter = commentBody.charAt(0);
+ // three slashes (///) also works, to allow for ///<reference>
+ return firstCharacter === " " || firstCharacter === "/";
+}
+function isEnableDisableFlag(commentText) {
+ // regex is: start of string followed by "/*" or "//"
+ // followed by any amount of whitespace followed by "tslint:"
+ // followed by either "enable" or "disable"
+ return /^(\/\*|\/\/)\s*tslint:(enable|disable)/.test(commentText);
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.d.ts b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
new file mode 100644
index 000000000..491c4edf5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
@@ -0,0 +1,79 @@
+/**
+ * @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 interface IBlockRequirementDescriptor {
+ visibilities?: Visibility[];
+}
+export interface IClassRequirementDescriptor {
+ locations?: Location[];
+ privacies?: Privacy[];
+}
+export declare type RequirementDescriptor = IBlockRequirementDescriptor | IClassRequirementDescriptor;
+export interface IRequirementDescriptors {
+ [type: string]: RequirementDescriptor;
+}
+export declare const ALL = "all";
+export declare const ARGUMENT_CLASSES = "classes";
+export declare const ARGUMENT_ENUMS = "enums";
+export declare const ARGUMENT_FUNCTIONS = "functions";
+export declare const ARGUMENT_INTERFACES = "interfaces";
+export declare const ARGUMENT_METHODS = "methods";
+export declare const ARGUMENT_NAMESPACES = "namespaces";
+export declare const ARGUMENT_PROPERTIES = "properties";
+export declare const ARGUMENT_TYPES = "types";
+export declare const ARGUMENT_VARIABLES = "variables";
+export declare const DESCRIPTOR_LOCATIONS = "locations";
+export declare const DESCRIPTOR_PRIVACIES = "privacies";
+export declare const DESCRIPTOR_VISIBILITIES = "visibilities";
+export declare const LOCATION_INSTANCE = "instance";
+export declare const LOCATION_STATIC = "static";
+export declare const PRIVACY_PRIVATE = "private";
+export declare const PRIVACY_PROTECTED = "protected";
+export declare const PRIVACY_PUBLIC = "public";
+export declare const VISIBILITY_EXPORTED = "exported";
+export declare const VISIBILITY_INTERNAL = "internal";
+export declare type All = typeof ALL;
+export declare type DocType = All | typeof ARGUMENT_CLASSES | typeof ARGUMENT_ENUMS | typeof ARGUMENT_FUNCTIONS | typeof ARGUMENT_INTERFACES | typeof ARGUMENT_METHODS | typeof ARGUMENT_NAMESPACES | typeof ARGUMENT_PROPERTIES | typeof ARGUMENT_TYPES | typeof ARGUMENT_VARIABLES;
+export declare type Location = All | typeof LOCATION_INSTANCE | typeof LOCATION_STATIC;
+export declare type Privacy = All | typeof PRIVACY_PRIVATE | typeof PRIVACY_PROTECTED | typeof PRIVACY_PUBLIC;
+export declare type Visibility = All | typeof VISIBILITY_EXPORTED | typeof VISIBILITY_INTERNAL;
+export declare class Rule extends Lint.Rules.TypedRule {
+ static FAILURE_STRING_EXIST: string;
+ static defaultArguments: DocType[];
+ static ARGUMENT_DESCRIPTOR_BLOCK: {
+ properties: {
+ [x: string]: {
+ enum: string[];
+ type: string;
+ };
+ };
+ type: string;
+ };
+ static ARGUMENT_DESCRIPTOR_CLASS: {
+ properties: {
+ [x: string]: {
+ enum: string[];
+ type: string;
+ };
+ };
+ type: string;
+ };
+ static metadata: Lint.IRuleMetadata;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+ private getRequirements(ruleArguments);
+}
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.js b/node_modules/tslint/lib/rules/completedDocsRule.js
new file mode 100644
index 000000000..6107859a6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/completedDocsRule.js
@@ -0,0 +1,332 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+exports.ALL = "all";
+exports.ARGUMENT_CLASSES = "classes";
+exports.ARGUMENT_ENUMS = "enums";
+exports.ARGUMENT_FUNCTIONS = "functions";
+exports.ARGUMENT_INTERFACES = "interfaces";
+exports.ARGUMENT_METHODS = "methods";
+exports.ARGUMENT_NAMESPACES = "namespaces";
+exports.ARGUMENT_PROPERTIES = "properties";
+exports.ARGUMENT_TYPES = "types";
+exports.ARGUMENT_VARIABLES = "variables";
+exports.DESCRIPTOR_LOCATIONS = "locations";
+exports.DESCRIPTOR_PRIVACIES = "privacies";
+exports.DESCRIPTOR_VISIBILITIES = "visibilities";
+exports.LOCATION_INSTANCE = "instance";
+exports.LOCATION_STATIC = "static";
+exports.PRIVACY_PRIVATE = "private";
+exports.PRIVACY_PROTECTED = "protected";
+exports.PRIVACY_PUBLIC = "public";
+exports.VISIBILITY_EXPORTED = "exported";
+exports.VISIBILITY_INTERNAL = "internal";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ var options = this.getOptions();
+ var completedDocsWalker = new CompletedDocsWalker(sourceFile, options, program);
+ completedDocsWalker.setRequirements(this.getRequirements(options.ruleArguments));
+ return this.applyWithWalker(completedDocsWalker);
+ };
+ Rule.prototype.getRequirements = function (ruleArguments) {
+ if (ruleArguments.length === 0) {
+ ruleArguments = Rule.defaultArguments;
+ }
+ return Requirement.constructRequirements(ruleArguments);
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+Rule.FAILURE_STRING_EXIST = "Documentation must exist for ";
+Rule.defaultArguments = [
+ exports.ARGUMENT_CLASSES,
+ exports.ARGUMENT_FUNCTIONS,
+ exports.ARGUMENT_METHODS,
+ exports.ARGUMENT_PROPERTIES,
+];
+Rule.ARGUMENT_DESCRIPTOR_BLOCK = {
+ properties: (_a = {},
+ _a[exports.DESCRIPTOR_VISIBILITIES] = {
+ enum: [
+ exports.ALL,
+ exports.VISIBILITY_EXPORTED,
+ exports.VISIBILITY_INTERNAL,
+ ],
+ type: "string",
+ },
+ _a),
+ type: "object",
+};
+Rule.ARGUMENT_DESCRIPTOR_CLASS = {
+ properties: (_b = {},
+ _b[exports.DESCRIPTOR_LOCATIONS] = {
+ enum: [
+ exports.ALL,
+ exports.LOCATION_INSTANCE,
+ exports.LOCATION_STATIC,
+ ],
+ type: "string",
+ },
+ _b[exports.DESCRIPTOR_PRIVACIES] = {
+ enum: [
+ exports.ALL,
+ exports.PRIVACY_PRIVATE,
+ exports.PRIVACY_PROTECTED,
+ exports.PRIVACY_PUBLIC,
+ ],
+ type: "string",
+ },
+ _b),
+ type: "object",
+};
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "completed-docs",
+ description: "Enforces documentation for important items be filled out.",
+ optionsDescription: (_c = ["\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 * All other types may specify `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n\n Types that may be enabled are:\n\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`"], _c.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 * All other types may specify \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n\n Types that may be enabled are:\n\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`"], Lint.Utils.dedent(_c, exports.ARGUMENT_CLASSES, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_METHODS, exports.ARGUMENT_PROPERTIES, 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.ARGUMENT_CLASSES, exports.ARGUMENT_ENUMS, 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: {
+ anyOf: [
+ {
+ enum: Rule.defaultArguments,
+ type: "string",
+ },
+ {
+ type: "object",
+ properties: (_d = {},
+ _d[exports.ARGUMENT_CLASSES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_ENUMS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_FUNCTIONS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_INTERFACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_METHODS] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _d[exports.ARGUMENT_NAMESPACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_PROPERTIES] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _d[exports.ARGUMENT_TYPES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d[exports.ARGUMENT_VARIABLES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _d),
+ },
+ ],
+ },
+ },
+ optionExamples: [
+ true,
+ [true, exports.ARGUMENT_ENUMS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_METHODS],
+ [
+ true,
+ (_e = {},
+ _e[exports.ARGUMENT_ENUMS] = true,
+ _e[exports.ARGUMENT_FUNCTIONS] = (_f = {},
+ _f[exports.DESCRIPTOR_VISIBILITIES] = [exports.VISIBILITY_EXPORTED],
+ _f),
+ _e[exports.ARGUMENT_METHODS] = (_g = {},
+ _g[exports.DESCRIPTOR_LOCATIONS] = exports.LOCATION_INSTANCE,
+ _g[exports.DESCRIPTOR_PRIVACIES] = [exports.PRIVACY_PUBLIC, exports.PRIVACY_PROTECTED],
+ _g),
+ _e),
+ ],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var Requirement = (function () {
+ // tslint:disable-next-line no-object-literal-type-assertion
+ function Requirement(descriptor) {
+ if (descriptor === void 0) { descriptor = {}; }
+ this.descriptor = descriptor;
+ }
+ Requirement.constructRequirements = function (ruleArguments) {
+ var requirements = new Map();
+ for (var _i = 0, ruleArguments_1 = ruleArguments; _i < ruleArguments_1.length; _i++) {
+ var ruleArgument = ruleArguments_1[_i];
+ Requirement.addRequirements(requirements, ruleArgument);
+ }
+ return requirements;
+ };
+ Requirement.addRequirements = function (requirements, descriptor) {
+ if (typeof descriptor === "string") {
+ requirements.set(descriptor, new BlockRequirement());
+ return;
+ }
+ for (var type in descriptor) {
+ if (utils_1.hasOwnProperty(descriptor, type)) {
+ requirements.set(type, (type === "methods" || type === "properties")
+ ? new ClassRequirement(descriptor[type])
+ : new BlockRequirement(descriptor[type]));
+ }
+ }
+ };
+ Requirement.prototype.createSet = function (values) {
+ if (values === undefined || values.length === 0) {
+ values = [exports.ALL];
+ }
+ return new Set(values);
+ };
+ return Requirement;
+}());
+var BlockRequirement = (function (_super) {
+ tslib_1.__extends(BlockRequirement, _super);
+ function BlockRequirement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.visibilities = _this.createSet(_this.descriptor.visibilities);
+ return _this;
+ }
+ BlockRequirement.prototype.shouldNodeBeDocumented = function (node) {
+ if (this.visibilities.has(exports.ALL)) {
+ return true;
+ }
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
+ return this.visibilities.has(exports.VISIBILITY_EXPORTED);
+ }
+ return this.visibilities.has(exports.VISIBILITY_INTERNAL);
+ };
+ return BlockRequirement;
+}(Requirement));
+var ClassRequirement = (function (_super) {
+ tslib_1.__extends(ClassRequirement, _super);
+ function ClassRequirement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.locations = _this.createSet(_this.descriptor.locations);
+ _this.privacies = _this.createSet(_this.descriptor.privacies);
+ return _this;
+ }
+ ClassRequirement.prototype.shouldNodeBeDocumented = function (node) {
+ return this.shouldLocationBeDocumented(node) && this.shouldPrivacyBeDocumented(node);
+ };
+ ClassRequirement.prototype.shouldLocationBeDocumented = function (node) {
+ if (this.locations.has(exports.ALL)) {
+ return true;
+ }
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword)) {
+ return this.locations.has(exports.LOCATION_STATIC);
+ }
+ return this.locations.has(exports.LOCATION_INSTANCE);
+ };
+ ClassRequirement.prototype.shouldPrivacyBeDocumented = function (node) {
+ if (this.privacies.has(exports.ALL)) {
+ return true;
+ }
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword)) {
+ return this.privacies.has(exports.PRIVACY_PRIVATE);
+ }
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword)) {
+ return this.privacies.has(exports.PRIVACY_PROTECTED);
+ }
+ return this.privacies.has(exports.PRIVACY_PUBLIC);
+ };
+ return ClassRequirement;
+}(Requirement));
+var CompletedDocsWalker = (function (_super) {
+ tslib_1.__extends(CompletedDocsWalker, _super);
+ function CompletedDocsWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ CompletedDocsWalker.prototype.setRequirements = function (requirements) {
+ this.requirements = requirements;
+ };
+ 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.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.checkNode(node, exports.ARGUMENT_VARIABLES);
+ _super.prototype.visitVariableDeclaration.call(this, node);
+ };
+ CompletedDocsWalker.prototype.checkNode = function (node, nodeType) {
+ var name = node.name;
+ if (name === undefined) {
+ return;
+ }
+ var requirement = this.requirements.get(nodeType);
+ if (requirement === undefined || !requirement.shouldNodeBeDocumented(node)) {
+ return;
+ }
+ var symbol = this.getTypeChecker().getSymbolAtLocation(name);
+ if (symbol === undefined) {
+ return;
+ }
+ var comments = symbol.getDocumentationComment();
+ this.checkComments(node, nodeType, comments);
+ };
+ CompletedDocsWalker.prototype.checkComments = function (node, nodeDescriptor, comments) {
+ if (comments.map(function (comment) { return comment.text; }).join("").trim() === "") {
+ this.addDocumentationFailure(node, nodeDescriptor);
+ }
+ };
+ CompletedDocsWalker.prototype.addDocumentationFailure = function (node, nodeType) {
+ var start = node.getStart();
+ var width = node.getText().split(/\r|\n/g)[0].length;
+ var description = this.describeDocumentationFailure(node, 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;
+ };
+ return CompletedDocsWalker;
+}(Lint.ProgramAwareRuleWalker));
+CompletedDocsWalker.modifierAliases = {
+ export: "exported",
+};
+var _a, _b, _c, _d, _e, _f, _g;
diff --git a/node_modules/tslint/lib/rules/curlyRule.d.ts b/node_modules/tslint/lib/rules/curlyRule.d.ts
new file mode 100644
index 000000000..1f50117ab
--- /dev/null
+++ b/node_modules/tslint/lib/rules/curlyRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(kind: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/curlyRule.js b/node_modules/tslint/lib/rules/curlyRule.js
new file mode 100644
index 000000000..af2e04d2d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/curlyRule.js
@@ -0,0 +1,92 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_IGNORE_SAME_LINE = "ignore-same-line";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (kind) {
+ return kind + " statements must be braced";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new CurlyWalker(sourceFile, this.ruleName, {
+ ignoreSameLine: this.ruleArguments.indexOf(OPTION_IGNORE_SAME_LINE) !== -1,
+ }));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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 The rule may be set to `true`, or to the following:\n\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 The rule may be set to \\`true\\`, or to the following:\n\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_IGNORE_SAME_LINE)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [
+ OPTION_IGNORE_SAME_LINE,
+ ],
+ },
+ },
+ optionExamples: [true, [true, "ignore-same-line"]],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var CurlyWalker = (function (_super) {
+ tslib_1.__extends(CurlyWalker, _super);
+ function CurlyWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ CurlyWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (tsutils_1.isIterationStatement(node)) {
+ _this.checkStatement(node.statement, node, 0, node.end);
+ }
+ else if (tsutils_1.isIfStatement(node)) {
+ _this.checkStatement(node.thenStatement, node, 0);
+ if (node.elseStatement !== undefined && node.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
+ _this.checkStatement(node.elseStatement, node, 5);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ CurlyWalker.prototype.checkStatement = function (statement, node, childIndex, end) {
+ if (end === void 0) { end = statement.end; }
+ if (statement.kind !== ts.SyntaxKind.Block &&
+ !(this.options.ignoreSameLine && tsutils_1.isSameLine(this.sourceFile, statement.pos, statement.end))) {
+ var token = node.getChildAt(childIndex, this.sourceFile);
+ var tokenText = ts.tokenToString(token.kind);
+ this.addFailure(token.end - tokenText.length, end, Rule.FAILURE_STRING_FACTORY(tokenText));
+ }
+ };
+ return CurlyWalker;
+}(Lint.AbstractWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
new file mode 100644
index 000000000..25f7d9696
--- /dev/null
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
@@ -0,0 +1,11 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static DEFAULT_THRESHOLD: number;
+ static MINIMUM_THRESHOLD: number;
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(expected: number, actual: number, name?: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ isEnabled(): boolean;
+ private readonly threshold;
+}
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
new file mode 100644
index 000000000..f79bbe02c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
@@ -0,0 +1,118 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (expected, actual, name) {
+ return "The function" + (name === undefined ? "" : " " + name) + " has a cyclomatic complexity of " +
+ (actual + " which is higher than the threshold of " + expected);
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, { threshold: this.threshold });
+ };
+ Rule.prototype.isEnabled = function () {
+ // Disable the rule if the option is provided but non-numeric or less than the minimum.
+ var isThresholdValid = typeof this.threshold === "number" && this.threshold >= Rule.MINIMUM_THRESHOLD;
+ return _super.prototype.isEnabled.call(this) && isThresholdValid;
+ };
+ Object.defineProperty(Rule.prototype, "threshold", {
+ get: function () {
+ if (this.ruleArguments[0] !== undefined) {
+ return this.ruleArguments[0];
+ }
+ return Rule.DEFAULT_THRESHOLD;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.DEFAULT_THRESHOLD = 20;
+Rule.MINIMUM_THRESHOLD = 2;
+/* tslint:disable:object-literal-sort-keys */
+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 20\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"], _a.raw = ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 20\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"], 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 $(Rule.DEFAULT_THRESHOLD) 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 $(Rule.DEFAULT_THRESHOLD) will be used."], Lint.Utils.dedent(_c)),
+ options: {
+ type: "number",
+ minimum: "$(Rule.MINIMUM_THRESHOLD)",
+ },
+ optionExamples: [true, [true, 20]],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var threshold = ctx.options.threshold;
+ var complexity = 0;
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isFunctionScopeBoundary(node)) {
+ var old = complexity;
+ complexity = 1;
+ ts.forEachChild(node, cb);
+ if (complexity > threshold) {
+ var name = node.name;
+ var nameStr = name !== undefined && tsutils_1.isIdentifier(name) ? name.text : undefined;
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING(threshold, complexity, nameStr));
+ }
+ complexity = old;
+ }
+ else {
+ if (increasesComplexity(node)) {
+ complexity++;
+ }
+ return ts.forEachChild(node, cb);
+ }
+ });
+}
+function increasesComplexity(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.CaseClause:
+ case ts.SyntaxKind.CatchClause:
+ case ts.SyntaxKind.ConditionalExpression:
+ case ts.SyntaxKind.DoStatement:
+ case ts.SyntaxKind.ForStatement:
+ case ts.SyntaxKind.ForInStatement:
+ case ts.SyntaxKind.ForOfStatement:
+ case ts.SyntaxKind.IfStatement:
+ case ts.SyntaxKind.WhileStatement:
+ return true;
+ case ts.SyntaxKind.BinaryExpression:
+ switch (node.operatorToken.kind) {
+ case ts.SyntaxKind.BarBarToken:
+ case ts.SyntaxKind.AmpersandAmpersandToken:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+}
+var _a, _b, _c;
diff --git a/node_modules/tslint/lib/rules/deprecationRule.d.ts b/node_modules/tslint/lib/rules/deprecationRule.d.ts
new file mode 100644
index 000000000..b5624e93c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/deprecationRule.d.ts
@@ -0,0 +1,22 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/deprecationRule.js b/node_modules/tslint/lib/rules/deprecationRule.js
new file mode 100644
index 000000000..536bf435f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/deprecationRule.js
@@ -0,0 +1,101 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithWalker(new Walker(sourceFile, this.getOptions(), program));
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ rationale: (_b = ["\n Deprecated APIs should be avoided, and usage updated."], _b.raw = ["\n Deprecated APIs should be avoided, and usage updated."], Lint.Utils.dedent(_b)),
+ optionsDescription: "",
+ options: null,
+ optionExamples: [],
+ type: "maintainability",
+ typescriptOnly: false,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+var Walker = (function (_super) {
+ tslib_1.__extends(Walker, _super);
+ function Walker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ // Implementation inspired by angular/tsickle:
+ // https://github.com/angular/tsickle/blob/cad7c180a2155db6f6fb8d22c44151d7e8a9149f/src/decorator-annotator.ts#L42
+ Walker.prototype.visitIdentifier = function (node) {
+ var decSym = this.getTypeChecker().getSymbolAtLocation(node);
+ if (decSym !== undefined && Lint.isSymbolFlagSet(decSym, ts.SymbolFlags.Alias)) {
+ decSym = this.getTypeChecker().getAliasedSymbol(decSym);
+ }
+ var declarations = decSym === undefined ? undefined : decSym.getDeclarations();
+ if (declarations === undefined) {
+ _super.prototype.visitIdentifier.call(this, node);
+ return;
+ }
+ for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
+ var commentNode = declarations_1[_i];
+ // Switch to the TS JSDoc parser in the future to avoid false positives here.
+ // For example using '@deprecated' in a true comment.
+ // However, a new TS API would be needed, track at
+ // https://github.com/Microsoft/TypeScript/issues/7393.
+ if (commentNode.kind === ts.SyntaxKind.VariableDeclaration) {
+ commentNode = commentNode.parent;
+ }
+ // Go up one more level to VariableDeclarationStatement, where usually
+ // the comment lives. If the declaration has an 'export', the
+ // VDList.getFullText will not contain the comment.
+ if (commentNode.kind === ts.SyntaxKind.VariableDeclarationList) {
+ commentNode = commentNode.parent;
+ }
+ // Don't warn on the declaration of the @deprecated symbol.
+ if (commentNode.pos <= node.pos
+ && node.getEnd() <= commentNode.getEnd()
+ && commentNode.getSourceFile() === this.getSourceFile()) {
+ continue;
+ }
+ var range = ts.getLeadingCommentRanges(commentNode.getFullText(), 0);
+ if (range === undefined) {
+ continue;
+ }
+ for (var _a = 0, range_1 = range; _a < range_1.length; _a++) {
+ var _b = range_1[_a], pos = _b.pos, end = _b.end;
+ var jsDocText = commentNode.getFullText().substring(pos, end);
+ if (jsDocText.includes("@deprecated")) {
+ this.addFailureAtNode(node, node.text + " is deprecated.");
+ }
+ }
+ }
+ _super.prototype.visitIdentifier.call(this, node);
+ };
+ return Walker;
+}(Lint.ProgramAwareRuleWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/encodingRule.d.ts b/node_modules/tslint/lib/rules/encodingRule.d.ts
new file mode 100644
index 000000000..ad81e932d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/encodingRule.d.ts
@@ -0,0 +1,8 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+import { Encoding } from "../utils";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(actual: Encoding): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js
new file mode 100644
index 000000000..776bfc4fe
--- /dev/null
+++ b/node_modules/tslint/lib/rules/encodingRule.js
@@ -0,0 +1,72 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var fs = require("fs");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (actual) {
+ return "This file is encoded as " + showEncoding(actual) + " instead of UTF-8.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "encoding",
+ description: "Enforces UTF-8 file encoding.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: ["true"],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var encoding = detectEncoding(ctx.sourceFile.fileName);
+ if (encoding !== "utf8") {
+ ctx.addFailure(0, 1, Rule.FAILURE_STRING(encoding));
+ }
+}
+function showEncoding(encoding) {
+ switch (encoding) {
+ case "utf8":
+ return "UTF-8";
+ case "utf8-bom":
+ return "UTF-8 with byte-order marker (BOM)";
+ case "utf16le":
+ return "UTF-16 (little-endian)";
+ case "utf16be":
+ return "UTF-16 (big-endian)";
+ }
+}
+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 bytesRead = fs.readSync(fd, buffer, /*offset*/ 0, /*length*/ maxBytesRead, /*position*/ 0);
+ return utils_1.detectBufferEncoding(buffer, bytesRead);
+}
diff --git a/node_modules/tslint/lib/rules/eoflineRule.d.ts b/node_modules/tslint/lib/rules/eoflineRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/eoflineRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/eoflineRule.js b/node_modules/tslint/lib/rules/eoflineRule.js
new file mode 100644
index 000000000..92497bbdd
--- /dev/null
+++ b/node_modules/tslint/lib/rules/eoflineRule.js
@@ -0,0 +1,56 @@
+"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 });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var length = sourceFile.text.length;
+ if (length === 0 ||
+ sourceFile.text[length - 1] === "\n") {
+ return [];
+ }
+ var fix;
+ var lines = sourceFile.getLineStarts();
+ if (lines.length > 1) {
+ fix = Lint.Replacement.appendText(length, sourceFile.text[lines[1] - 2] === "\r" ? "\r\n" : "\n");
+ }
+ return [new Lint.RuleFailure(sourceFile, length, length, Rule.FAILURE_STRING, this.ruleName, fix)];
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ hasFix: true,
+ type: "maintainability",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "file should end with a newline";
+exports.Rule = Rule;
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.d.ts b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
new file mode 100644
index 000000000..bd1fcddd6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.js b/node_modules/tslint/lib/rules/fileHeaderRule.js
new file mode 100644
index 000000000..8cd3d11eb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.js
@@ -0,0 +1,59 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var text = sourceFile.text;
+ // 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) {
+ ++offset; // show warning in next line after shebang
+ }
+ return [new Lint.RuleFailure(sourceFile, offset, offset, Rule.FAILURE_STRING, this.ruleName)];
+ }
+ return [];
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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.",
+ options: {
+ type: "string",
+ },
+ optionExamples: [[true, "Copyright \\d{4}"]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "missing file header";
+exports.Rule = Rule;
diff --git a/node_modules/tslint/lib/rules/forinRule.d.ts b/node_modules/tslint/lib/rules/forinRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/forinRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/forinRule.js b/node_modules/tslint/lib/rules/forinRule.js
new file mode 100644
index 000000000..cc501fc6a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/forinRule.js
@@ -0,0 +1,68 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "for (... in ...) statements must be filtered with an if statement";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isForInStatement(node) && tsutils_1.isBlock(node.statement) && !isFiltered(node.statement)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isFiltered(_a) {
+ var statements = _a.statements;
+ switch (statements.length) {
+ case 0: return true;
+ case 1: return statements[0].kind === ts.SyntaxKind.IfStatement;
+ default:
+ return statements[0].kind === ts.SyntaxKind.IfStatement && nodeIsContinue(statements[0].thenStatement);
+ }
+}
+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;
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.d.ts b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
new file mode 100644
index 000000000..93cc48a7d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
@@ -0,0 +1,8 @@
+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;
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.js b/node_modules/tslint/lib/rules/importBlacklistRule.js
new file mode 100644
index 000000000..84acf959a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.js
@@ -0,0 +1,91 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.isEnabled = function () {
+ return _super.prototype.isEnabled.call(this) && this.ruleArguments.length > 0;
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new ImportBlacklistWalker(sourceFile, this.ruleName, this.ruleArguments));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ optionsDescription: "A list of blacklisted modules.",
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ },
+ minLength: 1,
+ },
+ optionExamples: [true, [true, "rxjs", "lodash"]],
+ type: "functionality",
+ typescriptOnly: false,
+};
+Rule.FAILURE_STRING = "This import is blacklisted, import a submodule instead";
+exports.Rule = Rule;
+var ImportBlacklistWalker = (function (_super) {
+ tslib_1.__extends(ImportBlacklistWalker, _super);
+ function ImportBlacklistWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ImportBlacklistWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var findRequire = function (node) {
+ if (tsutils_1.isCallExpression(node) && node.arguments.length === 1 &&
+ tsutils_1.isIdentifier(node.expression) && node.expression.text === "require") {
+ _this.checkForBannedImport(node.arguments[0]);
+ }
+ return ts.forEachChild(node, findRequire);
+ };
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (tsutils_1.isImportDeclaration(statement)) {
+ this.checkForBannedImport(statement.moduleSpecifier);
+ }
+ else if (tsutils_1.isImportEqualsDeclaration(statement)) {
+ if (tsutils_1.isExternalModuleReference(statement.moduleReference) && statement.moduleReference.expression !== undefined) {
+ this.checkForBannedImport(statement.moduleReference.expression);
+ }
+ }
+ else {
+ ts.forEachChild(statement, findRequire);
+ }
+ }
+ };
+ ImportBlacklistWalker.prototype.checkForBannedImport = function (expression) {
+ if (tsutils_1.isTextualLiteral(expression) && this.options.indexOf(expression.text) !== -1) {
+ this.addFailure(expression.getStart(this.sourceFile) + 1, expression.end - 1, Rule.FAILURE_STRING);
+ }
+ };
+ return ImportBlacklistWalker;
+}(Lint.AbstractWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.d.ts b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
new file mode 100644
index 000000000..b1e1f6d7b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
@@ -0,0 +1,31 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static ADD_SPACE_AFTER_IMPORT: string;
+ static TOO_MANY_SPACES_AFTER_IMPORT: string;
+ static ADD_SPACE_AFTER_STAR: string;
+ static TOO_MANY_SPACES_AFTER_STAR: string;
+ static ADD_SPACE_AFTER_FROM: string;
+ static TOO_MANY_SPACES_AFTER_FROM: string;
+ static ADD_SPACE_BEFORE_FROM: string;
+ static TOO_MANY_SPACES_BEFORE_FROM: string;
+ static NO_LINE_BREAKS: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.js b/node_modules/tslint/lib/rules/importSpacingRule.js
new file mode 100644
index 000000000..2794bdfa9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/importSpacingRule.js
@@ -0,0 +1,126 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var LINE_BREAK_REGEX = /\n|\r\n/;
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var comparisonWalker = new ImportStatementWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(comparisonWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "import-spacing",
+ description: "Ensures proper spacing between import statement keywords",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+Rule.ADD_SPACE_AFTER_IMPORT = "Add space after 'import'";
+Rule.TOO_MANY_SPACES_AFTER_IMPORT = "Too many spaces after 'import'";
+Rule.ADD_SPACE_AFTER_STAR = "Add space after '*'";
+Rule.TOO_MANY_SPACES_AFTER_STAR = "Too many spaces after '*'";
+Rule.ADD_SPACE_AFTER_FROM = "Add space after 'from'";
+Rule.TOO_MANY_SPACES_AFTER_FROM = "Too many spaces after 'from'";
+Rule.ADD_SPACE_BEFORE_FROM = "Add space before 'from'";
+Rule.TOO_MANY_SPACES_BEFORE_FROM = "Too many spaces before 'from'";
+Rule.NO_LINE_BREAKS = "Line breaks are not allowed in import declaration";
+exports.Rule = Rule;
+var ImportStatementWalker = (function (_super) {
+ tslib_1.__extends(ImportStatementWalker, _super);
+ function ImportStatementWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ImportStatementWalker.prototype.visitImportDeclaration = function (node) {
+ if (node.importClause === undefined) {
+ this.checkModuleWithSideEffect(node);
+ }
+ else {
+ var nodeStart = node.getStart();
+ var importKeywordEnd = node.getStart() + "import".length;
+ var moduleSpecifierStart = node.moduleSpecifier.getStart();
+ var importClauseEnd = node.importClause.getEnd();
+ var importClauseStart = node.importClause.getStart();
+ if (importKeywordEnd === importClauseStart) {
+ this.addFailureAt(nodeStart, "import".length, Rule.ADD_SPACE_AFTER_IMPORT);
+ }
+ else if (importClauseStart > (importKeywordEnd + 1)) {
+ this.addFailureFromStartToEnd(nodeStart, importClauseStart, Rule.TOO_MANY_SPACES_AFTER_IMPORT);
+ }
+ var fromString = node.getText().substring(importClauseEnd - nodeStart, moduleSpecifierStart - nodeStart);
+ if (/from$/.test(fromString)) {
+ this.addFailureAt(importClauseEnd, fromString.length, Rule.ADD_SPACE_AFTER_FROM);
+ }
+ else if (/from\s{2,}$/.test(fromString)) {
+ this.addFailureAt(importClauseEnd, fromString.length, Rule.TOO_MANY_SPACES_AFTER_FROM);
+ }
+ if (/^\s{2,}from/.test(fromString)) {
+ this.addFailureAt(importClauseEnd, fromString.length, Rule.TOO_MANY_SPACES_BEFORE_FROM);
+ }
+ else if (/^from/.test(fromString)) {
+ this.addFailureAt(importClauseEnd, fromString.length, Rule.ADD_SPACE_BEFORE_FROM);
+ }
+ var text = node.getText();
+ var beforeImportClauseText = text.substring(0, importClauseStart - nodeStart);
+ var afterImportClauseText = text.substring(importClauseEnd - nodeStart);
+ if (LINE_BREAK_REGEX.test(beforeImportClauseText)) {
+ this.addFailureFromStartToEnd(nodeStart, importClauseStart - 1, Rule.NO_LINE_BREAKS);
+ }
+ if (LINE_BREAK_REGEX.test(afterImportClauseText)) {
+ this.addFailureFromStartToEnd(importClauseEnd, node.getEnd(), Rule.NO_LINE_BREAKS);
+ }
+ }
+ _super.prototype.visitImportDeclaration.call(this, node);
+ };
+ ImportStatementWalker.prototype.visitNamespaceImport = function (node) {
+ var text = node.getText();
+ if (text.indexOf("*as") > -1) {
+ this.addFailureAtNode(node, Rule.ADD_SPACE_AFTER_STAR);
+ }
+ else if (/\*\s{2,}as/.test(text)) {
+ this.addFailureAtNode(node, Rule.TOO_MANY_SPACES_AFTER_STAR);
+ }
+ else if (LINE_BREAK_REGEX.test(text)) {
+ this.addFailureAtNode(node, Rule.NO_LINE_BREAKS);
+ }
+ _super.prototype.visitNamespaceImport.call(this, node);
+ };
+ ImportStatementWalker.prototype.checkModuleWithSideEffect = function (node) {
+ var moduleSpecifierStart = node.moduleSpecifier.getStart();
+ var nodeStart = node.getStart();
+ if ((nodeStart + "import".length + 1) < moduleSpecifierStart) {
+ this.addFailureFromStartToEnd(nodeStart, moduleSpecifierStart, Rule.TOO_MANY_SPACES_AFTER_IMPORT);
+ }
+ else if ((nodeStart + "import".length) === moduleSpecifierStart) {
+ this.addFailureAt(nodeStart, "import".length, Rule.ADD_SPACE_AFTER_IMPORT);
+ }
+ if (LINE_BREAK_REGEX.test(node.getText())) {
+ this.addFailureAt(nodeStart, node.getWidth(), Rule.NO_LINE_BREAKS);
+ }
+ };
+ return ImportStatementWalker;
+}(Lint.RuleWalker));
diff --git a/node_modules/tslint/lib/rules/indentRule.d.ts b/node_modules/tslint/lib/rules/indentRule.d.ts
new file mode 100644
index 000000000..71542b985
--- /dev/null
+++ b/node_modules/tslint/lib/rules/indentRule.d.ts
@@ -0,0 +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_TABS: string;
+ static FAILURE_STRING_SPACES: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/indentRule.js b/node_modules/tslint/lib/rules/indentRule.js
new file mode 100644
index 000000000..7d133a13b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/indentRule.js
@@ -0,0 +1,179 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_USE_TABS = "tabs";
+var OPTION_USE_SPACES = "spaces";
+var OPTION_INDENT_SIZE_2 = 2;
+var OPTION_INDENT_SIZE_4 = 4;
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new IndentWalker(sourceFile, this.getOptions()));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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())),
+ options: {
+ type: "array",
+ items: [
+ {
+ type: "string",
+ enum: [OPTION_USE_TABS, OPTION_USE_SPACES],
+ },
+ {
+ type: "number",
+ enum: [OPTION_INDENT_SIZE_2, OPTION_INDENT_SIZE_4],
+ },
+ ],
+ minLength: 0,
+ maxLength: 5,
+ },
+ optionExamples: [
+ [true, OPTION_USE_SPACES],
+ [true, OPTION_USE_SPACES, OPTION_INDENT_SIZE_4],
+ [true, OPTION_USE_TABS, OPTION_INDENT_SIZE_2],
+ ],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_TABS = "tab indentation expected";
+Rule.FAILURE_STRING_SPACES = "space indentation expected";
+exports.Rule = Rule;
+// visit every token and enforce that only the right character is used for indentation
+var IndentWalker = (function (_super) {
+ tslib_1.__extends(IndentWalker, _super);
+ function IndentWalker(sourceFile, options) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ // fixer is only provided with the indent size arg
+ if (_this.getOptions().length === 2 && typeof _this.getOptions()[1] === "number"
+ && (_this.getOptions()[1] === OPTION_INDENT_SIZE_2 || _this.getOptions()[1] === OPTION_INDENT_SIZE_4)) {
+ // tslint:disable-next-line:no-unsafe-any
+ var size_1 = _this.getOptions()[1];
+ var replaceRegExp_1;
+ var replaceIndent_1;
+ if (_this.hasOption(OPTION_USE_TABS)) {
+ _this.regExp = new RegExp(" ".repeat(size_1));
+ _this.failureString = Rule.FAILURE_STRING_TABS;
+ // we want to find every group of `size` spaces, plus up to one 'incomplete' group
+ replaceRegExp_1 = new RegExp("^( {" + size_1 + "})+( {1," + (size_1 - 1) + "})?", "g");
+ replaceIndent_1 = "\t";
+ }
+ else if (_this.hasOption(OPTION_USE_SPACES)) {
+ _this.regExp = new RegExp("\t");
+ _this.failureString = size_1 + " " + Rule.FAILURE_STRING_SPACES;
+ replaceRegExp_1 = new RegExp("\t", "g");
+ replaceIndent_1 = " ".repeat(size_1);
+ }
+ _this.replacementFactory = function (lineStart, fullLeadingWhitespace) {
+ return new Lint.Replacement(lineStart, fullLeadingWhitespace.length, fullLeadingWhitespace.replace(replaceRegExp_1, function (match) { return replaceIndent_1.repeat(Math.ceil(match.length / size_1)); }));
+ };
+ }
+ else {
+ if (_this.hasOption(OPTION_USE_TABS)) {
+ _this.regExp = new RegExp(" ");
+ _this.failureString = Rule.FAILURE_STRING_TABS;
+ }
+ else if (_this.hasOption(OPTION_USE_SPACES)) {
+ _this.regExp = new RegExp("\t");
+ _this.failureString = Rule.FAILURE_STRING_SPACES;
+ }
+ _this.replacementFactory = function () { return undefined; };
+ }
+ return _this;
+ }
+ IndentWalker.prototype.visitSourceFile = function (node) {
+ if (!this.hasOption(OPTION_USE_TABS) && !this.hasOption(OPTION_USE_SPACES)) {
+ // if we don't have either option, no need to check anything, and no need to call super, so just return
+ return;
+ }
+ var endOfComment = -1;
+ var endOfTemplateString = -1;
+ var scanner = ts.createScanner(ts.ScriptTarget.ES5, false, ts.LanguageVariant.Standard, node.text);
+ for (var _i = 0, _a = node.getLineStarts(); _i < _a.length; _i++) {
+ var lineStart = _a[_i];
+ if (lineStart < endOfComment || lineStart < endOfTemplateString) {
+ // skip checking lines inside multi-line comments or template strings
+ continue;
+ }
+ scanner.setTextPos(lineStart);
+ var currentScannedType = scanner.scan();
+ var fullLeadingWhitespace = "";
+ var lastStartPos = -1;
+ while (currentScannedType === ts.SyntaxKind.WhitespaceTrivia) {
+ var startPos = scanner.getStartPos();
+ if (startPos === lastStartPos) {
+ break;
+ }
+ lastStartPos = startPos;
+ fullLeadingWhitespace += scanner.getTokenText();
+ currentScannedType = scanner.scan();
+ }
+ var commentRanges = ts.getTrailingCommentRanges(node.text, lineStart);
+ if (commentRanges !== undefined) {
+ endOfComment = commentRanges[commentRanges.length - 1].end;
+ }
+ else {
+ var scanType = currentScannedType;
+ // scan until we reach end of line, skipping over template strings
+ while (scanType !== ts.SyntaxKind.NewLineTrivia && scanType !== ts.SyntaxKind.EndOfFileToken) {
+ if (scanType === ts.SyntaxKind.NoSubstitutionTemplateLiteral) {
+ // template string without expressions - skip past it
+ endOfTemplateString = scanner.getStartPos() + scanner.getTokenText().length;
+ }
+ else if (scanType === ts.SyntaxKind.TemplateHead) {
+ // find end of template string containing expressions...
+ while (scanType !== ts.SyntaxKind.TemplateTail && scanType !== ts.SyntaxKind.EndOfFileToken) {
+ scanType = scanner.scan();
+ if (scanType === ts.SyntaxKind.CloseBraceToken) {
+ scanType = scanner.reScanTemplateToken();
+ }
+ }
+ // ... and skip past it
+ endOfTemplateString = scanner.getStartPos() + scanner.getTokenText().length;
+ }
+ scanType = scanner.scan();
+ }
+ }
+ switch (currentScannedType) {
+ case ts.SyntaxKind.SingleLineCommentTrivia:
+ case ts.SyntaxKind.MultiLineCommentTrivia:
+ case ts.SyntaxKind.NewLineTrivia:
+ // ignore lines that have comments before the first token
+ continue;
+ }
+ if (this.regExp.test(fullLeadingWhitespace)) {
+ this.addFailureAt(lineStart, fullLeadingWhitespace.length, this.failureString, this.replacementFactory(lineStart, fullLeadingWhitespace));
+ }
+ }
+ // no need to call super to visit the rest of the nodes, so don't call super here
+ };
+ return IndentWalker;
+}(Lint.RuleWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.d.ts b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
new file mode 100644
index 000000000..4e719997a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
@@ -0,0 +1,8 @@
+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 FAILURE_STRING_NO_PREFIX: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.js b/node_modules/tslint/lib/rules/interfaceNameRule.js
new file mode 100644
index 000000000..4b14a487b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.js
@@ -0,0 +1,75 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var OPTION_ALWAYS = "always-prefix";
+var OPTION_NEVER = "never-prefix";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, { never: this.ruleArguments.indexOf(OPTION_NEVER) !== -1 });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "string",
+ enum: [OPTION_ALWAYS, OPTION_NEVER],
+ },
+ optionExamples: [[true, OPTION_ALWAYS], [true, OPTION_NEVER]],
+ type: "style",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "interface name must start with a capitalized I";
+Rule.FAILURE_STRING_NO_PREFIX = 'interface name must not have an "I" prefix';
+exports.Rule = Rule;
+function walk(ctx) {
+ var never = ctx.options.never;
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (utils.isInterfaceDeclaration(node)) {
+ var name = node.name;
+ if (never && hasPrefixI(name.text)) {
+ ctx.addFailureAtNode(name, Rule.FAILURE_STRING_NO_PREFIX);
+ }
+ else if (!never && name.text[0] !== "I") {
+ ctx.addFailureAtNode(name, Rule.FAILURE_STRING);
+ }
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ });
+}
+function hasPrefixI(name) {
+ // Allow IndexedDB interfaces
+ return name.length >= 2 && name[0] === "I" && utils_1.isUpperCase(name[1]) && !name.startsWith("IDB");
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js
new file mode 100644
index 000000000..abda0f111
--- /dev/null
+++ b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js
@@ -0,0 +1,66 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "interface-over-type-literal",
+ description: "Prefer an interface declaration over a type literal (`type T = { ... }`)",
+ rationale: "Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+ hasFix: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use an interface instead of a type literal.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isTypeAliasDeclaration(node) && tsutils_1.isTypeLiteralNode(node.type)) {
+ var typeKeyword = tsutils_1.getChildOfKind(node, ts.SyntaxKind.TypeKeyword, ctx.sourceFile);
+ var fix = [
+ // "type" -> "interface"
+ new Lint.Replacement(typeKeyword.end - 4, 4, "interface"),
+ // remove "=" and trivia up to the open curly brace of the type literal
+ Lint.Replacement.deleteFromTo(node.type.pos - 1, node.type.members.pos - 1),
+ ];
+ // remove trailing semicolon if exists
+ if (ctx.sourceFile.text[node.end - 1] === ";") {
+ fix.push(Lint.Replacement.deleteText(node.end - 1, 1));
+ }
+ ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING, fix);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
new file mode 100644
index 000000000..3bc191dae
--- /dev/null
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
@@ -0,0 +1,8 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static ALIGNMENT_FAILURE_STRING: string;
+ static FORMAT_FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.js b/node_modules/tslint/lib/rules/jsdocFormatRule.js
new file mode 100644
index 000000000..f9b4fea19
--- /dev/null
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.js
@@ -0,0 +1,96 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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 `*/`"], _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 \\`*/\\`"], Lint.Utils.dedent(_a)),
+ rationale: "Helps maintain a consistent, readable style for JSDoc comments.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.ALIGNMENT_FAILURE_STRING = "asterisks in jsdoc must be aligned";
+Rule.FORMAT_FAILURE_STRING = "jsdoc is not formatted correctly on this line";
+exports.Rule = Rule;
+function walk(ctx) {
+ return utils.forEachComment(ctx.sourceFile, function (fullText, _a) {
+ var kind = _a.kind, pos = _a.pos, end = _a.end;
+ if (kind !== ts.SyntaxKind.MultiLineCommentTrivia ||
+ fullText[pos + 2] !== "*" || fullText[pos + 3] === "*" || fullText[pos + 3] === "/") {
+ return;
+ }
+ var lines = fullText.slice(pos + 3, end - 2).split("\n");
+ var firstLine = lines[0];
+ if (lines.length === 1) {
+ if (firstLine[0] !== " " || !firstLine.endsWith(" ")) {
+ ctx.addFailure(pos, end, Rule.FORMAT_FAILURE_STRING);
+ }
+ return;
+ }
+ var alignColumn = getAlignColumn(ctx.sourceFile, pos + 1);
+ var lineStart = pos + firstLine.length + 4; // +3 for the comment start "/**" and +1 for the newline
+ var endIndex = lines.length - 1;
+ for (var i = 1; i < endIndex; ++i) {
+ var line = lines[i].endsWith("\r") ? lines[i].slice(0, -1) : lines[i];
+ // regex is: start of string, followed by any amount of whitespace, followed by *,
+ // followed by either a space or the end of the string
+ if (!/^\s*\*(?: |$)/.test(line)) {
+ ctx.addFailureAt(lineStart, line.length, Rule.FORMAT_FAILURE_STRING);
+ }
+ if (line.indexOf("*") !== alignColumn) {
+ ctx.addFailureAt(lineStart, line.length, Rule.ALIGNMENT_FAILURE_STRING);
+ }
+ lineStart += lines[i].length + 1; // + 1 for the splitted-out newline
+ }
+ var lastLine = lines[endIndex];
+ // last line should only consist of whitespace
+ if (lastLine.search(/\S/) !== -1) {
+ ctx.addFailure(lineStart, end, Rule.FORMAT_FAILURE_STRING);
+ }
+ if (lastLine.length !== alignColumn) {
+ ctx.addFailure(lineStart, end, Rule.ALIGNMENT_FAILURE_STRING);
+ }
+ });
+}
+function getAlignColumn(sourceFile, pos) {
+ var result = ts.getLineAndCharacterOfPosition(sourceFile, pos);
+ // handle files starting with BOM
+ return result.line === 0 && sourceFile.text[0] === "\uFEFF"
+ ? result.character - 1
+ : result.character;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.d.ts b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.js b/node_modules/tslint/lib/rules/labelPositionRule.js
new file mode 100644
index 000000000..e90ee4a77
--- /dev/null
+++ b/node_modules/tslint/lib/rules/labelPositionRule.js
@@ -0,0 +1,69 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "unexpected label on statement";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isLabeledStatement(node) && !isLabelable(node.statement)) {
+ ctx.addFailureAtNode(node.label, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isLabelable(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.DoStatement:
+ case ts.SyntaxKind.ForStatement:
+ case ts.SyntaxKind.ForInStatement:
+ case ts.SyntaxKind.ForOfStatement:
+ case ts.SyntaxKind.WhileStatement:
+ case ts.SyntaxKind.SwitchStatement:
+ return true;
+ default:
+ return false;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/linebreakStyleRule.d.ts b/node_modules/tslint/lib/rules/linebreakStyleRule.d.ts
new file mode 100644
index 000000000..cbd593ead
--- /dev/null
+++ b/node_modules/tslint/lib/rules/linebreakStyleRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_CRLF: string;
+ static FAILURE_LF: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/linebreakStyleRule.js b/node_modules/tslint/lib/rules/linebreakStyleRule.js
new file mode 100644
index 000000000..845438617
--- /dev/null
+++ b/node_modules/tslint/lib/rules/linebreakStyleRule.js
@@ -0,0 +1,67 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var OPTION_LINEBREAK_STYLE_CRLF = "CRLF";
+var OPTION_LINEBREAK_STYLE_LF = "LF";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, this.ruleArguments.indexOf(OPTION_LINEBREAK_STYLE_CRLF) !== -1);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "string",
+ enum: [OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF],
+ },
+ optionExamples: [[true, OPTION_LINEBREAK_STYLE_LF], [true, OPTION_LINEBREAK_STYLE_CRLF]],
+ type: "maintainability",
+ typescriptOnly: false,
+ hasFix: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_CRLF = "Expected linebreak to be '" + OPTION_LINEBREAK_STYLE_CRLF + "'";
+Rule.FAILURE_LF = "Expected linebreak to be '" + OPTION_LINEBREAK_STYLE_LF + "'";
+exports.Rule = Rule;
+function walk(ctx) {
+ var expectedCr = ctx.options;
+ var sourceText = ctx.sourceFile.text;
+ var lineStarts = ctx.sourceFile.getLineStarts();
+ for (var i = 1; i < lineStarts.length; ++i) {
+ var lineEnd = lineStarts[i] - 1;
+ if (sourceText[lineEnd - 1] === "\r") {
+ if (!expectedCr) {
+ ctx.addFailure(lineStarts[i - 1], lineEnd - 1, Rule.FAILURE_LF, Lint.Replacement.deleteText(lineEnd - 1, 1));
+ }
+ }
+ else if (expectedCr) {
+ ctx.addFailure(lineStarts[i - 1], lineEnd, Rule.FAILURE_CRLF, Lint.Replacement.appendText(lineEnd, "\r"));
+ }
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
new file mode 100644
index 000000000..b4f5e6391
--- /dev/null
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(importName: string, exportName: string): string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
new file mode 100644
index 000000000..89d961775
--- /dev/null
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
@@ -0,0 +1,70 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (importName, exportName) {
+ return "Expected import '" + importName + "' to match the default export '" + exportName + "'.";
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function walk(ctx, tc) {
+ for (var _i = 0, _a = ctx.sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (!tsutils_1.isImportDeclaration(statement) ||
+ statement.importClause === undefined || statement.importClause.name === undefined) {
+ continue;
+ }
+ var defaultImport = statement.importClause.name;
+ var symbol = tc.getSymbolAtLocation(defaultImport);
+ if (symbol === undefined || !Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ continue;
+ }
+ var declarations = tc.getAliasedSymbol(symbol).declarations;
+ if (declarations !== undefined && declarations.length !== 0) {
+ var name = declarations[0].name;
+ if (name !== undefined && name.kind === ts.SyntaxKind.Identifier && name.text !== defaultImport.text) {
+ ctx.addFailureAtNode(defaultImport, Rule.FAILURE_STRING(defaultImport.text, name.text));
+ }
+ }
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
new file mode 100644
index 000000000..18e914536
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
@@ -0,0 +1,7 @@
+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(maxCount: number): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
new file mode 100644
index 000000000..0e0ef6c68
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
@@ -0,0 +1,76 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (maxCount) {
+ var maxClassWord = maxCount === 1 ? "class per file is" : "classes per file are";
+ return "A maximum of " + maxCount + " " + maxClassWord + " allowed.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var argument = this.ruleArguments[0];
+ var maxClasses = isNaN(argument) || argument > 0 ? argument : 1;
+ return this.applyWithFunction(sourceFile, walk, { maxClasses: maxClasses });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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 file."], _c.raw = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a file."], Lint.Utils.dedent(_c)),
+ options: {
+ type: "array",
+ items: [
+ {
+ type: "number",
+ minimum: 1,
+ },
+ ],
+ additionalItems: false,
+ minLength: 1,
+ maxLength: 2,
+ },
+ optionExamples: [[true, 1], [true, 5]],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, maxClasses = ctx.options.maxClasses;
+ var classes = 0;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (tsutils_1.isClassLikeDeclaration(node)) {
+ classes++;
+ if (classes > maxClasses) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING(maxClasses));
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a, _b, _c;
diff --git a/node_modules/tslint/lib/rules/maxFileLineCountRule.d.ts b/node_modules/tslint/lib/rules/maxFileLineCountRule.d.ts
new file mode 100644
index 000000000..6cca9f698
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxFileLineCountRule.d.ts
@@ -0,0 +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(lineCount: number, lineLimit: number): string;
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/maxFileLineCountRule.js b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
new file mode 100644
index 000000000..652a76268
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
@@ -0,0 +1,60 @@
+"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 });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (lineCount, lineLimit) {
+ return "This file has " + lineCount + " lines, which exceeds the maximum of " + lineLimit + " lines allowed. " +
+ "Consider breaking this file up into smaller parts";
+ };
+ Rule.prototype.isEnabled = function () {
+ return _super.prototype.isEnabled.call(this) && this.ruleArguments[0] > 0;
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var lineLimit = this.ruleArguments[0];
+ var lineCount = sourceFile.getLineStarts().length;
+ if (lineCount <= lineLimit) {
+ return [];
+ }
+ var len = sourceFile.text.length;
+ return [new Lint.RuleFailure(sourceFile, len - 1, len, Rule.FAILURE_STRING(lineCount, lineLimit), this.ruleName)];
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "An integer indicating the maximum number of lines.",
+ options: {
+ type: "number",
+ minimum: "1",
+ },
+ optionExamples: [[true, 300]],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var _a;
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
new file mode 100644
index 000000000..476a48d7f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
@@ -0,0 +1,8 @@
+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_FACTORY(lineLimit: number): string;
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.js b/node_modules/tslint/lib/rules/maxLineLengthRule.js
new file mode 100644
index 000000000..dc9b89dc8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.js
@@ -0,0 +1,63 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (lineLimit) {
+ return "Exceeds maximum line length of " + lineLimit;
+ };
+ Rule.prototype.isEnabled = function () {
+ return _super.prototype.isEnabled.call(this) && this.ruleArguments[0] > 0;
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, this.ruleArguments[0]);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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.",
+ options: {
+ type: "number",
+ minimum: "1",
+ },
+ optionExamples: [[true, 120]],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var limit = ctx.options;
+ 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));
+ }
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.d.ts b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
new file mode 100644
index 000000000..5aa42a707
--- /dev/null
+++ b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
@@ -0,0 +1,8 @@
+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_NO_PUBLIC: string;
+ static FAILURE_STRING_FACTORY(memberType: string, memberName: string | undefined): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.js b/node_modules/tslint/lib/rules/memberAccessRule.js
new file mode 100644
index 000000000..c25b3826a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/memberAccessRule.js
@@ -0,0 +1,132 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_NO_PUBLIC = "no-public";
+var OPTION_CHECK_ACCESSOR = "check-accessor";
+var OPTION_CHECK_CONSTRUCTOR = "check-constructor";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.FAILURE_STRING_FACTORY = function (memberType, memberName) {
+ memberName = memberName === undefined ? "" : " '" + memberName + "'";
+ return "The " + memberType + memberName + " must be marked either 'private', 'public', or 'protected'";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var options = this.ruleArguments;
+ var noPublic = options.indexOf(OPTION_NO_PUBLIC) !== -1;
+ var checkAccessor = options.indexOf(OPTION_CHECK_ACCESSOR) !== -1;
+ var checkConstructor = options.indexOf(OPTION_CHECK_CONSTRUCTOR) !== -1;
+ if (noPublic) {
+ if (checkAccessor || checkConstructor) {
+ throw new Error("If 'no-public' is present, it should be the only option.");
+ }
+ checkAccessor = checkConstructor = true;
+ }
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, noPublic, checkAccessor, checkConstructor); });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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"], _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"], Lint.Utils.dedent(_a)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_NO_PUBLIC, OPTION_CHECK_ACCESSOR, OPTION_CHECK_CONSTRUCTOR],
+ },
+ minLength: 0,
+ maxLength: 3,
+ },
+ optionExamples: [true, [true, OPTION_NO_PUBLIC], [true, OPTION_CHECK_ACCESSOR]],
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_NO_PUBLIC = "'public' is implicit.";
+exports.Rule = Rule;
+function walk(ctx, noPublic, checkAccessor, checkConstructor) {
+ return ts.forEachChild(ctx.sourceFile, function recur(node) {
+ if (tsutils_1.isClassLikeDeclaration(node)) {
+ for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (shouldCheck(child)) {
+ check(child);
+ }
+ }
+ }
+ return ts.forEachChild(node, recur);
+ });
+ function shouldCheck(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.Constructor:
+ return checkConstructor;
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ return checkAccessor;
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.PropertyDeclaration:
+ return true;
+ default:
+ return false;
+ }
+ }
+ function check(node) {
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
+ return;
+ }
+ var isPublic = Lint.hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword);
+ if (noPublic && isPublic) {
+ var publicKeyword = node.modifiers.find(function (m) { return m.kind === ts.SyntaxKind.PublicKeyword; });
+ ctx.addFailureAtNode(publicKeyword, Rule.FAILURE_STRING_NO_PUBLIC);
+ }
+ if (!noPublic && !isPublic) {
+ var nameNode = tsutils_1.isConstructorDeclaration(node)
+ ? tsutils_1.getChildOfKind(node, ts.SyntaxKind.ConstructorKeyword)
+ : node.name !== undefined ? node.name : node;
+ var memberName = node.name !== undefined && tsutils_1.isIdentifier(node.name) ? node.name.text : undefined;
+ ctx.addFailureAtNode(nameNode, Rule.FAILURE_STRING_FACTORY(memberType(node), memberName));
+ }
+ }
+}
+function memberType(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.MethodDeclaration:
+ return "class method";
+ case ts.SyntaxKind.PropertyDeclaration:
+ return "class property";
+ case ts.SyntaxKind.Constructor:
+ return "class constructor";
+ case ts.SyntaxKind.GetAccessor:
+ return "get property accessor";
+ case ts.SyntaxKind.SetAccessor:
+ return "set property accessor";
+ default:
+ throw new Error("unhandled node type " + ts.SyntaxKind[node.kind]);
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/memberOrderingRule.d.ts b/node_modules/tslint/lib/rules/memberOrderingRule.d.ts
new file mode 100644
index 000000000..dc5c8a97a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/memberOrderingRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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_ALPHABETIZE(prevName: string, curName: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/memberOrderingRule.js b/node_modules/tslint/lib/rules/memberOrderingRule.js
new file mode 100644
index 000000000..e7a27dcf9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/memberOrderingRule.js
@@ -0,0 +1,427 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var OPTION_ORDER = "order";
+var OPTION_ALPHABETIZE = "alphabetize";
+var MemberKind;
+(function (MemberKind) {
+ MemberKind[MemberKind["publicStaticField"] = 0] = "publicStaticField";
+ MemberKind[MemberKind["publicStaticMethod"] = 1] = "publicStaticMethod";
+ MemberKind[MemberKind["protectedStaticField"] = 2] = "protectedStaticField";
+ MemberKind[MemberKind["protectedStaticMethod"] = 3] = "protectedStaticMethod";
+ MemberKind[MemberKind["privateStaticField"] = 4] = "privateStaticField";
+ MemberKind[MemberKind["privateStaticMethod"] = 5] = "privateStaticMethod";
+ MemberKind[MemberKind["publicInstanceField"] = 6] = "publicInstanceField";
+ MemberKind[MemberKind["protectedInstanceField"] = 7] = "protectedInstanceField";
+ MemberKind[MemberKind["privateInstanceField"] = 8] = "privateInstanceField";
+ MemberKind[MemberKind["publicConstructor"] = 9] = "publicConstructor";
+ MemberKind[MemberKind["protectedConstructor"] = 10] = "protectedConstructor";
+ MemberKind[MemberKind["privateConstructor"] = 11] = "privateConstructor";
+ MemberKind[MemberKind["publicInstanceMethod"] = 12] = "publicInstanceMethod";
+ MemberKind[MemberKind["protectedInstanceMethod"] = 13] = "protectedInstanceMethod";
+ MemberKind[MemberKind["privateInstanceMethod"] = 14] = "privateInstanceMethod";
+})(MemberKind || (MemberKind = {}));
+var PRESETS = new Map([
+ ["fields-first", [
+ "public-static-field",
+ "protected-static-field",
+ "private-static-field",
+ "public-instance-field",
+ "protected-instance-field",
+ "private-instance-field",
+ "constructor",
+ "public-static-method",
+ "protected-static-method",
+ "private-static-method",
+ "public-instance-method",
+ "protected-instance-method",
+ "private-instance-method",
+ ]],
+ ["instance-sandwich", [
+ "public-static-field",
+ "protected-static-field",
+ "private-static-field",
+ "public-instance-field",
+ "protected-instance-field",
+ "private-instance-field",
+ "constructor",
+ "public-instance-method",
+ "protected-instance-method",
+ "private-instance-method",
+ "public-static-method",
+ "protected-static-method",
+ "private-static-method",
+ ]],
+ ["statics-first", [
+ "public-static-field",
+ "public-static-method",
+ "protected-static-field",
+ "protected-static-method",
+ "private-static-field",
+ "private-static-method",
+ "public-instance-field",
+ "protected-instance-field",
+ "private-instance-field",
+ "constructor",
+ "public-instance-method",
+ "protected-instance-method",
+ "private-instance-method",
+ ]],
+]);
+var PRESET_NAMES = Array.from(PRESETS.keys());
+var allMemberKindNames = utils_1.mapDefined(Object.keys(MemberKind), function (key) {
+ var mk = MemberKind[key];
+ return typeof mk === "number" ? MemberKind[mk].replace(/[A-Z]/g, function (cap) { return "-" + cap.toLowerCase(); }) : undefined;
+});
+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 Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.FAILURE_STRING_ALPHABETIZE = function (prevName, curName) {
+ return show(curName) + " should come alphabetically before " + show(prevName);
+ function show(s) {
+ return s === "" ? "Computed property" : "'" + s + "'";
+ }
+ };
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new MemberOrderingWalker(sourceFile, this.ruleName, parseOptions(this.ruleArguments)));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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.",
+ optionsDescription: optionsDescription,
+ options: {
+ type: "object",
+ properties: {
+ order: {
+ oneOf: [
+ {
+ type: "string",
+ enum: PRESET_NAMES,
+ },
+ {
+ type: "array",
+ items: {
+ type: "string",
+ enum: allMemberKindNames,
+ },
+ maxLength: 13,
+ },
+ ],
+ },
+ },
+ additionalProperties: false,
+ },
+ optionExamples: [
+ [true, { order: "fields-first" }],
+ [true, {
+ order: [
+ "static-field",
+ "instance-field",
+ "constructor",
+ "public-instance-method",
+ "protected-instance-method",
+ "private-instance-method",
+ ],
+ }],
+ [true, {
+ order: [
+ {
+ name: "static non-private",
+ kinds: [
+ "public-static-field",
+ "protected-static-field",
+ "public-static-method",
+ "protected-static-method",
+ ],
+ },
+ "constructor",
+ ],
+ }],
+ ],
+ type: "typescript",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var MemberOrderingWalker = (function (_super) {
+ tslib_1.__extends(MemberOrderingWalker, _super);
+ function MemberOrderingWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ MemberOrderingWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.ClassExpression:
+ case ts.SyntaxKind.InterfaceDeclaration:
+ case ts.SyntaxKind.TypeLiteral:
+ _this.checkMembers(node.members);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ MemberOrderingWalker.prototype.checkMembers = function (members) {
+ var prevRank = -1;
+ var prevName;
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var member = members_1[_i];
+ var rank = this.memberRank(member);
+ if (rank === -1) {
+ // no explicit ordering for this kind of node specified, so continue
+ continue;
+ }
+ if (rank < prevRank) {
+ var nodeType = this.rankName(rank);
+ var prevNodeType = this.rankName(prevRank);
+ var lowerRank = this.findLowerRank(members, rank);
+ var locationHint = lowerRank !== -1
+ ? "after " + this.rankName(lowerRank) + "s"
+ : "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);
+ }
+ else {
+ if (this.options.alphabetize && member.name !== undefined) {
+ if (rank !== prevRank) {
+ // No alphabetical ordering between different ranks
+ prevName = undefined;
+ }
+ 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));
+ }
+ else {
+ prevName = curName;
+ }
+ }
+ // keep track of last good node
+ prevRank = rank;
+ }
+ }
+ };
+ /** Finds the lowest name higher than 'targetName'. */
+ MemberOrderingWalker.prototype.findLowerName = function (members, targetRank, targetName) {
+ for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
+ var member = members_2[_i];
+ if (member.name === undefined || this.memberRank(member) !== targetRank) {
+ continue;
+ }
+ var name = nameString(member.name);
+ if (caseInsensitiveLess(targetName, name)) {
+ return name;
+ }
+ }
+ throw new Error("Expected to find a name");
+ };
+ /** Finds the highest existing rank lower than `targetRank`. */
+ MemberOrderingWalker.prototype.findLowerRank = function (members, targetRank) {
+ var max = -1;
+ for (var _i = 0, members_3 = members; _i < members_3.length; _i++) {
+ var member = members_3[_i];
+ var rank = this.memberRank(member);
+ if (rank !== -1 && rank < targetRank) {
+ max = Math.max(max, rank);
+ }
+ }
+ return max;
+ };
+ MemberOrderingWalker.prototype.memberRank = function (member) {
+ var optionName = getMemberKind(member);
+ if (optionName === undefined) {
+ return -1;
+ }
+ return this.options.order.findIndex(function (category) { return category.has(optionName); });
+ };
+ MemberOrderingWalker.prototype.rankName = function (rank) {
+ return this.options.order[rank].name;
+ };
+ return MemberOrderingWalker;
+}(Lint.AbstractWalker));
+function caseInsensitiveLess(a, b) {
+ return a.toLowerCase() < b.toLowerCase();
+}
+function memberKindForConstructor(access) {
+ return MemberKind[access + "Constructor"];
+}
+function memberKindForMethodOrField(access, membership, kind) {
+ return MemberKind[access + membership + kind];
+}
+var allAccess = ["public", "protected", "private"];
+function memberKindFromName(name) {
+ var kind = MemberKind[Lint.Utils.camelize(name)];
+ return typeof kind === "number" ? [kind] : allAccess.map(addModifier);
+ function addModifier(modifier) {
+ var modifiedKind = MemberKind[Lint.Utils.camelize(modifier + "-" + name)];
+ if (typeof modifiedKind !== "number") {
+ throw new Error("Bad member kind: " + name);
+ }
+ return modifiedKind;
+ }
+}
+function getMemberKind(member) {
+ var accessLevel = hasModifier(ts.SyntaxKind.PrivateKeyword) ? "private"
+ : hasModifier(ts.SyntaxKind.ProtectedKeyword) ? "protected"
+ : "public";
+ switch (member.kind) {
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.ConstructSignature:
+ return memberKindForConstructor(accessLevel);
+ case ts.SyntaxKind.PropertyDeclaration:
+ case ts.SyntaxKind.PropertySignature:
+ return methodOrField(isFunctionLiteral(member.initializer));
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.MethodSignature:
+ return methodOrField(true);
+ default:
+ return undefined;
+ }
+ function methodOrField(isMethod) {
+ var membership = hasModifier(ts.SyntaxKind.StaticKeyword) ? "Static" : "Instance";
+ return memberKindForMethodOrField(accessLevel, membership, isMethod ? "Method" : "Field");
+ }
+ function hasModifier(kind) {
+ return Lint.hasModifier(member.modifiers, kind);
+ }
+}
+var MemberCategory = (function () {
+ function MemberCategory(name, kinds) {
+ this.name = name;
+ this.kinds = kinds;
+ }
+ MemberCategory.prototype.has = function (kind) { return this.kinds.has(kind); };
+ return MemberCategory;
+}());
+function parseOptions(options) {
+ var _a = getOptionsJson(options), orderJson = _a.order, alphabetize = _a.alphabetize;
+ var order = orderJson.map(function (cat) { return typeof cat === "string"
+ ? new MemberCategory(cat.replace(/-/g, " "), new Set(memberKindFromName(cat)))
+ : new MemberCategory(cat.name, new Set(utils_1.flatMap(cat.kinds, memberKindFromName))); });
+ return { order: order, alphabetize: alphabetize };
+}
+function getOptionsJson(allOptions) {
+ if (allOptions == null || allOptions.length === 0 || allOptions[0] == null) {
+ throw new Error("Got empty options");
+ }
+ var firstOption = allOptions[0];
+ if (typeof firstOption !== "object") {
+ // Undocumented direct string option. Deprecate eventually.
+ return { order: convertFromOldStyleOptions(allOptions), alphabetize: false }; // presume allOptions to be string[]
+ }
+ return { order: categoryFromOption(firstOption[OPTION_ORDER]), alphabetize: firstOption[OPTION_ALPHABETIZE] === true };
+}
+function categoryFromOption(orderOption) {
+ if (Array.isArray(orderOption)) {
+ return orderOption;
+ }
+ var preset = PRESETS.get(orderOption);
+ if (preset === undefined) {
+ throw new Error("Bad order: " + JSON.stringify(orderOption));
+ }
+ return preset;
+}
+/**
+ * Convert from undocumented old-style options.
+ * This is designed to mimic the old behavior and should be removed eventually.
+ */
+function convertFromOldStyleOptions(options) {
+ var categories = [{ name: "member", kinds: allMemberKindNames }];
+ if (hasOption("variables-before-functions")) {
+ categories = splitOldStyleOptions(categories, function (kind) { return kind.includes("field"); }, "field", "method");
+ }
+ if (hasOption("static-before-instance")) {
+ categories = splitOldStyleOptions(categories, function (kind) { return kind.includes("static"); }, "static", "instance");
+ }
+ if (hasOption("public-before-private")) {
+ // 'protected' is considered public
+ categories = splitOldStyleOptions(categories, function (kind) { return !kind.includes("private"); }, "public", "private");
+ }
+ return categories;
+ function hasOption(x) {
+ return options.indexOf(x) !== -1;
+ }
+}
+function splitOldStyleOptions(categories, filter, a, b) {
+ var newCategories = [];
+ var _loop_1 = function (cat) {
+ var yes = [];
+ var no = [];
+ for (var _i = 0, _a = cat.kinds; _i < _a.length; _i++) {
+ var kind = _a[_i];
+ if (filter(kind)) {
+ yes.push(kind);
+ }
+ else {
+ no.push(kind);
+ }
+ }
+ var augmentName = function (s) {
+ if (a === "field") {
+ // Replace "member" with "field"/"method" instead of augmenting.
+ return s;
+ }
+ return s + " " + cat.name;
+ };
+ newCategories.push({ name: augmentName(a), kinds: yes });
+ newCategories.push({ name: augmentName(b), kinds: no });
+ };
+ for (var _i = 0, categories_1 = categories; _i < categories_1.length; _i++) {
+ var cat = categories_1[_i];
+ _loop_1(cat);
+ }
+ return newCategories;
+}
+function isFunctionLiteral(node) {
+ if (node === undefined) {
+ return false;
+ }
+ switch (node.kind) {
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.FunctionExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+function nameString(name) {
+ switch (name.kind) {
+ case ts.SyntaxKind.Identifier:
+ case ts.SyntaxKind.StringLiteral:
+ case ts.SyntaxKind.NumericLiteral:
+ return name.text;
+ default:
+ return "";
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/newParensRule.d.ts b/node_modules/tslint/lib/rules/newParensRule.d.ts
new file mode 100644
index 000000000..bd1fcddd6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/newParensRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/newParensRule.js b/node_modules/tslint/lib/rules/newParensRule.js
new file mode 100644
index 000000000..57144f35c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/newParensRule.js
@@ -0,0 +1,53 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "new-parens",
+ description: "Requires parentheses when invoking a constructor via the `new` keyword.",
+ rationale: "Maintains stylistic consistency with other function calls.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Parentheses are required when invoking a constructor";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.NewExpression && node.arguments === undefined) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js
new file mode 100644
index 000000000..40aac0f39
--- /dev/null
+++ b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js
@@ -0,0 +1,90 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NewlineBeforeReturnWalker(sourceFile, this.ruleName, undefined));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "newline-before-return",
+ description: "Enforces blank line before return when not the only line in the block.",
+ rationale: "Helps maintain a readable style in your codebase.",
+ optionsDescription: "Not configurable.",
+ options: {},
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Missing blank line before return";
+exports.Rule = Rule;
+var NewlineBeforeReturnWalker = (function (_super) {
+ tslib_1.__extends(NewlineBeforeReturnWalker, _super);
+ function NewlineBeforeReturnWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NewlineBeforeReturnWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (node.kind === ts.SyntaxKind.ReturnStatement) {
+ _this.visitReturnStatement(node);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ NewlineBeforeReturnWalker.prototype.visitReturnStatement = function (node) {
+ var prev = tsutils_1.getPreviousStatement(node);
+ if (prev === undefined) {
+ // return is not within a block (e.g. the only child of an IfStatement) or the first statement of the block
+ // no need to check for preceding newline
+ return;
+ }
+ var start = node.getStart(this.sourceFile);
+ var line = ts.getLineAndCharacterOfPosition(this.sourceFile, start).line;
+ var comments = ts.getLeadingCommentRanges(this.sourceFile.text, node.pos);
+ if (comments !== undefined) {
+ // check for blank lines between comments
+ for (var i = comments.length - 1; i >= 0; --i) {
+ var endLine = ts.getLineAndCharacterOfPosition(this.sourceFile, comments[i].end).line;
+ if (endLine < line - 1) {
+ return;
+ }
+ start = comments[i].pos;
+ line = ts.getLineAndCharacterOfPosition(this.sourceFile, start).line;
+ }
+ }
+ var prevLine = ts.getLineAndCharacterOfPosition(this.sourceFile, prev.end).line;
+ if (prevLine >= line - 1) {
+ // Previous statement is on the same or previous line
+ this.addFailure(start, start, Rule.FAILURE_STRING);
+ }
+ };
+ return NewlineBeforeReturnWalker;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
new file mode 100644
index 000000000..9031694f9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
@@ -0,0 +1,60 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isTypeAssertion(node)) {
+ var start = node.getStart(ctx.sourceFile);
+ ctx.addFailure(start, node.end, Rule.FAILURE_STRING, [
+ Lint.Replacement.appendText(node.end, " as " + node.type.getText(ctx.sourceFile)),
+ Lint.Replacement.deleteFromTo(start, node.expression.getStart(ctx.sourceFile)),
+ ]);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noAnyRule.d.ts b/node_modules/tslint/lib/rules/noAnyRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noAnyRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noAnyRule.js b/node_modules/tslint/lib/rules/noAnyRule.js
new file mode 100644
index 000000000..d2e6ecdd7
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noAnyRule.js
@@ -0,0 +1,58 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-any",
+ description: "Disallows usages of `any` as a type declaration.",
+ hasFix: true,
+ rationale: "Using `any` as a type declaration nullifies the compile-time benefits of the type system.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+// tslint:disable-next-line prefer-template (fixed in 5.3)
+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.";
+exports.Rule = Rule;
+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 ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noArgRule.d.ts b/node_modules/tslint/lib/rules/noArgRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noArgRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noArgRule.js b/node_modules/tslint/lib/rules/noArgRule.js
new file mode 100644
index 000000000..dda96d720
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noArgRule.js
@@ -0,0 +1,57 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Access to arguments.callee is forbidden";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isPropertyAccessExpression(node) &&
+ node.name.text === "callee" &&
+ node.expression.kind === ts.SyntaxKind.Identifier && node.expression.text === "arguments") {
+ return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noBitwiseRule.d.ts b/node_modules/tslint/lib/rules/noBitwiseRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noBitwiseRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noBitwiseRule.js b/node_modules/tslint/lib/rules/noBitwiseRule.js
new file mode 100644
index 000000000..cfb75db1d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noBitwiseRule.js
@@ -0,0 +1,73 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Forbidden bitwise operation";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.BinaryExpression) {
+ switch (node.operatorToken.kind) {
+ case ts.SyntaxKind.AmpersandToken:
+ case ts.SyntaxKind.AmpersandEqualsToken:
+ case ts.SyntaxKind.BarToken:
+ case ts.SyntaxKind.BarEqualsToken:
+ case ts.SyntaxKind.CaretToken:
+ case ts.SyntaxKind.CaretEqualsToken:
+ case ts.SyntaxKind.LessThanLessThanToken:
+ case ts.SyntaxKind.LessThanLessThanEqualsToken:
+ case ts.SyntaxKind.GreaterThanGreaterThanToken:
+ case ts.SyntaxKind.GreaterThanGreaterThanEqualsToken:
+ case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
+ case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ else if (node.kind === ts.SyntaxKind.PrefixUnaryExpression &&
+ node.operator === ts.SyntaxKind.TildeToken) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
new file mode 100644
index 000000000..979552d6f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(negate: boolean): string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
new file mode 100644
index 000000000..23cef48d5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
@@ -0,0 +1,121 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (negate) {
+ return "This expression is unnecessarily compared to a boolean. Just " + (negate ? "negate it" : "use it directly") + ".";
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-boolean-literal-compare",
+ description: "Warns on comparison to a boolean literal, as in `x === true`.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (utils.isBinaryExpression(node)) {
+ var cmp = getBooleanComparison(node, checker);
+ if (cmp !== undefined) {
+ ctx.addFailureAtNode(cmp.expression, Rule.FAILURE_STRING(cmp.negate), fix(node, cmp));
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function getBooleanComparison(node, checker) {
+ var cmp = deconstructComparison(node);
+ return cmp === undefined || !Lint.isTypeFlagSet(checker.getTypeAtLocation(cmp.expression), ts.TypeFlags.Boolean) ? undefined : cmp;
+}
+function fix(node, _a) {
+ var negate = _a.negate, expression = _a.expression;
+ var deleted = node.left === expression
+ ? Lint.Replacement.deleteFromTo(node.left.end, node.end)
+ : Lint.Replacement.deleteFromTo(node.getStart(), node.right.getStart());
+ if (!negate) {
+ return deleted;
+ }
+ else if (needsParenthesesForNegate(expression)) {
+ return [
+ deleted,
+ Lint.Replacement.appendText(node.getStart(), "!("),
+ Lint.Replacement.appendText(node.getEnd(), ")"),
+ ];
+ }
+ else {
+ return [
+ deleted,
+ Lint.Replacement.appendText(node.getStart(), "!"),
+ ];
+ }
+}
+function needsParenthesesForNegate(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.AsExpression:
+ case ts.SyntaxKind.BinaryExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+function deconstructComparison(node) {
+ var left = node.left, operatorToken = node.operatorToken, right = node.right;
+ var eq = Lint.getEqualsKind(operatorToken);
+ if (eq === undefined) {
+ return undefined;
+ }
+ var leftValue = booleanFromExpression(left);
+ if (leftValue !== undefined) {
+ return { negate: leftValue !== eq.isPositive, expression: right };
+ }
+ var rightValue = booleanFromExpression(right);
+ if (rightValue !== undefined) {
+ return { negate: rightValue !== eq.isPositive, expression: left };
+ }
+ return undefined;
+}
+function booleanFromExpression(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.TrueKeyword:
+ return true;
+ case ts.SyntaxKind.FalseKeyword:
+ return false;
+ default:
+ return undefined;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
new file mode 100644
index 000000000..06b7c4bbe
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
new file mode 100644
index 000000000..3384b8b29
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
@@ -0,0 +1,99 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var walker = new NoConditionalAssignmentWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(walker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-conditional-assignment",
+ description: "Disallows any type of assignment in conditionals.",
+ descriptionDetails: "This applies to `do-while`, `for`, `if`, and `while` statements.",
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Assignments in conditional expressions are forbidden";
+exports.Rule = Rule;
+var NoConditionalAssignmentWalker = (function (_super) {
+ tslib_1.__extends(NoConditionalAssignmentWalker, _super);
+ function NoConditionalAssignmentWalker() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.isInConditional = false;
+ return _this;
+ }
+ NoConditionalAssignmentWalker.prototype.visitIfStatement = function (node) {
+ this.validateConditionalExpression(node.expression);
+ _super.prototype.visitIfStatement.call(this, node);
+ };
+ NoConditionalAssignmentWalker.prototype.visitWhileStatement = function (node) {
+ this.validateConditionalExpression(node.expression);
+ _super.prototype.visitWhileStatement.call(this, node);
+ };
+ NoConditionalAssignmentWalker.prototype.visitDoStatement = function (node) {
+ this.validateConditionalExpression(node.expression);
+ _super.prototype.visitDoStatement.call(this, node);
+ };
+ NoConditionalAssignmentWalker.prototype.visitForStatement = function (node) {
+ if (node.condition != null) {
+ this.validateConditionalExpression(node.condition);
+ }
+ _super.prototype.visitForStatement.call(this, node);
+ };
+ NoConditionalAssignmentWalker.prototype.visitBinaryExpression = function (expression) {
+ if (this.isInConditional) {
+ this.checkForAssignment(expression);
+ }
+ _super.prototype.visitBinaryExpression.call(this, expression);
+ };
+ NoConditionalAssignmentWalker.prototype.validateConditionalExpression = function (expression) {
+ this.isInConditional = true;
+ if (expression.kind === ts.SyntaxKind.BinaryExpression) {
+ // check for simple assignment in a conditional, like `if (a = 1) {`
+ this.checkForAssignment(expression);
+ }
+ // walk the children of the conditional expression for nested assignments, like `if ((a = 1) && (b == 1)) {`
+ this.walkChildren(expression);
+ this.isInConditional = false;
+ };
+ NoConditionalAssignmentWalker.prototype.checkForAssignment = function (expression) {
+ if (isAssignmentToken(expression.operatorToken)) {
+ this.addFailureAtNode(expression, Rule.FAILURE_STRING);
+ }
+ };
+ return NoConditionalAssignmentWalker;
+}(Lint.RuleWalker));
+function isAssignmentToken(token) {
+ return token.kind >= ts.SyntaxKind.FirstAssignment && token.kind <= ts.SyntaxKind.LastAssignment;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
new file mode 100644
index 000000000..36668bc3f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
@@ -0,0 +1,13 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static DEFAULT_ALLOWED_BLANKS: number;
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_FACTORY(allowed: number): string;
+ /**
+ * Disable the rule if the option is provided but non-numeric or less than the minimum.
+ */
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare function getTemplateRanges(sourceFile: ts.SourceFile): ts.TextRange[];
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
new file mode 100644
index 000000000..b97668024
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
@@ -0,0 +1,128 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (allowed) {
+ return allowed === 1
+ ? "Consecutive blank lines are forbidden"
+ : "Exceeds the " + allowed + " allowed consecutive blank lines";
+ };
+ /**
+ * Disable the rule if the option is provided but non-numeric or less than the minimum.
+ */
+ Rule.prototype.isEnabled = function () {
+ var option = this.ruleArguments[0];
+ return _super.prototype.isEnabled.call(this) && (option === undefined || option > 0);
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var limit = this.ruleArguments[0];
+ return this.applyWithFunction(sourceFile, walk, limit !== undefined ? limit : Rule.DEFAULT_ALLOWED_BLANKS);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.DEFAULT_ALLOWED_BLANKS = 1;
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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 $(Rule.DEFAULT_ALLOWED_BLANKS) 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 $(Rule.DEFAULT_ALLOWED_BLANKS) will be used."], Lint.Utils.dedent(_a)),
+ options: {
+ type: "number",
+ minimum: "$(Rule.MINIMUM_ALLOWED_BLANKS)",
+ },
+ optionExamples: [true, [true, 2]],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceText = ctx.sourceFile.text;
+ var threshold = ctx.options + 1;
+ var possibleFailures = [];
+ var consecutiveBlankLines = 0;
+ for (var _i = 0, _a = utils.getLineRanges(ctx.sourceFile); _i < _a.length; _i++) {
+ var line = _a[_i];
+ if (line.contentLength === 0 || sourceText.substr(line.pos, line.contentLength).search(/\S/) === -1) {
+ ++consecutiveBlankLines;
+ if (consecutiveBlankLines === threshold) {
+ possibleFailures.push({
+ end: line.end,
+ pos: line.pos,
+ });
+ }
+ else if (consecutiveBlankLines > threshold) {
+ possibleFailures[possibleFailures.length - 1].end = line.end;
+ }
+ }
+ else {
+ consecutiveBlankLines = 0;
+ }
+ }
+ if (possibleFailures.length === 0) {
+ return;
+ }
+ var failureString = Rule.FAILURE_STRING_FACTORY(ctx.options);
+ var templateRanges = getTemplateRanges(ctx.sourceFile);
+ var _loop_1 = function (possibleFailure) {
+ if (!templateRanges.some(function (template) { return template.pos < possibleFailure.pos && possibleFailure.pos < template.end; })) {
+ ctx.addFailureAt(possibleFailure.pos, 1, failureString, [
+ Lint.Replacement.deleteFromTo(
+ // special handling for fixing blank lines at the end of the file
+ // to fix this we need to cut off the line break of the last allowed blank line, too
+ possibleFailure.end === sourceText.length ? getStartOfLineBreak(sourceText, possibleFailure.pos) : possibleFailure.pos, possibleFailure.end),
+ ]);
+ }
+ };
+ for (var _b = 0, possibleFailures_1 = possibleFailures; _b < possibleFailures_1.length; _b++) {
+ var possibleFailure = possibleFailures_1[_b];
+ _loop_1(possibleFailure);
+ }
+}
+function getStartOfLineBreak(sourceText, pos) {
+ return sourceText[pos - 2] === "\r" ? pos - 1 : pos - 1;
+}
+function getTemplateRanges(sourceFile) {
+ var intervals = [];
+ var cb = function (node) {
+ if (node.kind >= ts.SyntaxKind.FirstTemplateToken &&
+ node.kind <= ts.SyntaxKind.LastTemplateToken) {
+ intervals.push({
+ end: node.end,
+ pos: node.getStart(sourceFile),
+ });
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ };
+ ts.forEachChild(sourceFile, cb);
+ return intervals;
+}
+exports.getTemplateRanges = getTemplateRanges;
+var _a;
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.d.ts b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
new file mode 100644
index 000000000..0e867ca96
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(method: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.js b/node_modules/tslint/lib/rules/noConsoleRule.js
new file mode 100644
index 000000000..9e5e394f9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConsoleRule.js
@@ -0,0 +1,63 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (method) {
+ return "Calls to 'console." + method + "' are not allowed.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, this.ruleArguments);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-console",
+ description: "Bans the use of specified `console` methods.",
+ rationale: "In general, \`console\` methods aren't appropriate for production code.",
+ optionsDescription: "A list of method names to ban. If no method names are provided, all console methods are banned.",
+ options: {
+ type: "array",
+ items: { type: "string" },
+ },
+ optionExamples: [[true, "log", "error"]],
+ type: "functionality",
+ typescriptOnly: false,
+};
+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));
+ }
+ 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
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConstructRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noConstructRule.js b/node_modules/tslint/lib/rules/noConstructRule.js
new file mode 100644
index 000000000..967a0adb5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noConstructRule.js
@@ -0,0 +1,61 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Forbidden constructor, use a literal or simple function call instead";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isNewExpression(node) && node.expression.kind === ts.SyntaxKind.Identifier) {
+ switch (node.expression.text) {
+ case "Boolean":
+ case "String":
+ case "Number":
+ ctx.addFailure(node.getStart(ctx.sourceFile), node.expression.end, Rule.FAILURE_STRING);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noDebuggerRule.d.ts b/node_modules/tslint/lib/rules/noDebuggerRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDebuggerRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noDebuggerRule.js b/node_modules/tslint/lib/rules/noDebuggerRule.js
new file mode 100644
index 000000000..083f49dc9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDebuggerRule.js
@@ -0,0 +1,53 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-debugger",
+ description: "Disallows `debugger` statements.",
+ rationale: "In general, \`debugger\` statements aren't appropriate for production code.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use of debugger statements is forbidden";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.DebuggerStatement) {
+ return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noDefaultExportRule.d.ts b/node_modules/tslint/lib/rules/noDefaultExportRule.d.ts
new file mode 100644
index 000000000..bd1fcddd6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDefaultExportRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noDefaultExportRule.js b/node_modules/tslint/lib/rules/noDefaultExportRule.js
new file mode 100644
index 000000000..19f713c5a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDefaultExportRule.js
@@ -0,0 +1,65 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use of default exports is forbidden";
+exports.Rule = Rule;
+function walk(ctx) {
+ if (ctx.sourceFile.isDeclarationFile || !ts.isExternalModule(ctx.sourceFile)) {
+ return;
+ }
+ for (var _i = 0, _a = ctx.sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (statement.kind === ts.SyntaxKind.ExportAssignment) {
+ if (statement.isExportEquals !== true) {
+ ctx.addFailureAtNode(statement.getChildAt(1, ctx.sourceFile), Rule.FAILURE_STRING);
+ }
+ }
+ else if (statement.modifiers !== undefined && statement.modifiers.length >= 2 &&
+ statement.modifiers[0].kind === ts.SyntaxKind.ExportKeyword &&
+ statement.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword) {
+ ctx.addFailureAtNode(statement.modifiers[1], Rule.FAILURE_STRING);
+ }
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
new file mode 100644
index 000000000..33c7edd14
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
@@ -0,0 +1,8 @@
+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_DUPLICATE: string;
+ static FAILURE_STRING_LOOP: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
new file mode 100644
index 000000000..4dc91877a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
@@ -0,0 +1,156 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-duplicate-super",
+ description: "Warns if 'super()' appears twice in a constructor.",
+ rationale: "The second call to 'super()' will fail at runtime.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_DUPLICATE = "Multiple calls to 'super()' found. It must be called only once.";
+Rule.FAILURE_STRING_LOOP = "'super()' called in a loop. It must be called only once.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isConstructorDeclaration(node) && node.body !== undefined) {
+ getSuperForNode(node.body);
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function getSuperForNode(node) {
+ if (Lint.isLoop(node)) {
+ var bodySuper = combineSequentialChildren(node);
+ if (typeof bodySuper === "number") {
+ return 0 /* NoSuper */;
+ }
+ if (!bodySuper.break) {
+ ctx.addFailureAtNode(bodySuper.node, Rule.FAILURE_STRING_LOOP);
+ }
+ return tslib_1.__assign({}, bodySuper, { break: false });
+ }
+ switch (node.kind) {
+ case ts.SyntaxKind.ReturnStatement:
+ case ts.SyntaxKind.ThrowStatement:
+ return 1 /* Return */;
+ case ts.SyntaxKind.BreakStatement:
+ return 2 /* Break */;
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.ClassExpression:
+ // 'super()' is bound differently inside, so ignore.
+ return 0 /* NoSuper */;
+ case ts.SyntaxKind.SuperKeyword:
+ return node.parent.kind === ts.SyntaxKind.CallExpression && node.parent.expression === node
+ ? { node: node.parent, break: false }
+ : 0 /* NoSuper */;
+ case ts.SyntaxKind.IfStatement: {
+ var _a = node, thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
+ return worse(getSuperForNode(thenStatement), elseStatement !== undefined ? getSuperForNode(elseStatement) : 0 /* NoSuper */);
+ }
+ case ts.SyntaxKind.SwitchStatement:
+ return getSuperForSwitch(node);
+ default:
+ return combineSequentialChildren(node);
+ }
+ }
+ function getSuperForSwitch(node) {
+ // 'super()' from any clause. Used to track whether 'super()' happens in the switch at all.
+ var foundSingle;
+ // 'super()' from the previous clause if it did not 'break;'.
+ var fallthroughSingle;
+ for (var _i = 0, _a = node.caseBlock.clauses; _i < _a.length; _i++) {
+ var clause = _a[_i];
+ var clauseSuper = combineSequentialChildren(clause);
+ switch (clauseSuper) {
+ case 0 /* NoSuper */:
+ break;
+ case 2 /* Break */:
+ fallthroughSingle = undefined;
+ break;
+ case 1 /* Return */:
+ return 0 /* NoSuper */;
+ default:
+ if (fallthroughSingle !== undefined) {
+ addDuplicateFailure(fallthroughSingle, clauseSuper.node);
+ }
+ if (!clauseSuper.break) {
+ fallthroughSingle = clauseSuper.node;
+ }
+ foundSingle = clauseSuper.node;
+ break;
+ }
+ }
+ return foundSingle !== undefined ? { node: foundSingle, break: false } : 0 /* NoSuper */;
+ }
+ /**
+ * Combines children that come one after another.
+ * (As opposed to if/else, switch, or loops, which need their own handling.)
+ */
+ function combineSequentialChildren(node) {
+ var seenSingle;
+ var res = ts.forEachChild(node, function (child) {
+ var childSuper = getSuperForNode(child);
+ switch (childSuper) {
+ case 0 /* NoSuper */:
+ return undefined;
+ case 2 /* Break */:
+ if (seenSingle !== undefined) {
+ return tslib_1.__assign({}, seenSingle, { break: true });
+ }
+ return childSuper;
+ case 1 /* Return */:
+ return childSuper;
+ default:
+ if (seenSingle !== undefined && !seenSingle.break) {
+ addDuplicateFailure(seenSingle.node, childSuper.node);
+ }
+ seenSingle = childSuper;
+ return undefined;
+ }
+ });
+ return res !== undefined ? res : seenSingle !== undefined ? seenSingle : 0 /* NoSuper */;
+ }
+ function addDuplicateFailure(a, b) {
+ ctx.addFailure(a.getStart(), b.end, Rule.FAILURE_STRING_DUPLICATE);
+ }
+}
+// If/else run separately, so return the branch more likely to result in eventual errors.
+function worse(a, b) {
+ return typeof a === "number"
+ ? typeof b === "number" ? (a < b ? b : a) : b
+ : typeof b === "number" ? a : a.break ? b : a;
+}
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
new file mode 100644
index 000000000..117f46536
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
@@ -0,0 +1,7 @@
+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(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
new file mode 100644
index 000000000..c828bfbff
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
@@ -0,0 +1,87 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "Duplicate variable: '" + name + "'";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var scope = new Set();
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (utils.isFunctionScopeBoundary(node)) {
+ var oldScope = scope;
+ scope = new Set();
+ ts.forEachChild(node, cb);
+ scope = oldScope;
+ return;
+ }
+ else if (utils.isVariableDeclaration(node) && !utils.isBlockScopedVariableDeclaration(node)) {
+ forEachBoundIdentifier(node.name, function (id) {
+ var text = id.text;
+ if (scope.has(text)) {
+ ctx.addFailureAtNode(id, Rule.FAILURE_STRING(text));
+ }
+ else {
+ scope.add(text);
+ }
+ });
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function forEachBoundIdentifier(name, action) {
+ if (name.kind === ts.SyntaxKind.Identifier) {
+ action(name);
+ }
+ else {
+ for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
+ var e = _a[_i];
+ if (e.kind !== ts.SyntaxKind.OmittedExpression) {
+ forEachBoundIdentifier(e.name, action);
+ }
+ }
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
new file mode 100644
index 000000000..0a098d7f6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
@@ -0,0 +1,8 @@
+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 FAILURE_STRING_FOR_EXTENDS: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js
new file mode 100644
index 000000000..8ba57b596
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js
@@ -0,0 +1,59 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-empty-interface",
+ description: "Forbids empty interfaces.",
+ rationale: "An empty interface is equivalent to its supertype (or `{}`).",
+ optionsDescription: "Not configurable.",
+ options: null,
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "An empty interface is equivalent to `{}`.";
+Rule.FAILURE_STRING_FOR_EXTENDS = "An interface declaring no members is equivalent to its supertype.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isInterfaceDeclaration(node) &&
+ node.members.length === 0 &&
+ (node.heritageClauses === undefined ||
+ node.heritageClauses[0].types === undefined ||
+ // allow interfaces that extend 2 or more interfaces
+ node.heritageClauses[0].types.length < 2)) {
+ return ctx.addFailureAtNode(node.name, node.heritageClauses !== undefined ? Rule.FAILURE_STRING_FOR_EXTENDS : Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.d.ts b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.js b/node_modules/tslint/lib/rules/noEmptyRule.js
new file mode 100644
index 000000000..29a0a496d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEmptyRule.js
@@ -0,0 +1,73 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-empty",
+ description: "Disallows empty blocks.",
+ descriptionDetails: "Blocks with a comment inside are not considered empty.",
+ rationale: "Empty blocks are often indicators of missing code.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "block is empty";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.Block &&
+ node.statements.length === 0 &&
+ !isExcludedConstructor(node.parent)) {
+ var start = node.getStart(ctx.sourceFile);
+ // Block always starts with open brace. Adding 1 to its start gives us the end of the brace,
+ // which can be used to conveniently check for comments between braces
+ if (Lint.hasCommentAfterPosition(ctx.sourceFile.text, start + 1)) {
+ return;
+ }
+ return ctx.addFailure(start, node.end, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isExcludedConstructor(node) {
+ return tsutils_1.isConstructorDeclaration(node) &&
+ (
+ /* If constructor is private or protected, the block is allowed to be empty.
+ The constructor is there on purpose to disallow instantiation from outside the class */
+ /* The public modifier does not serve a purpose here. It can only be used to allow instantiation of a base class where
+ the super constructor is protected. But then the block would not be empty, because of the call to super() */
+ tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ProtectedKeyword) ||
+ node.parameters.some(tsutils_1.isParameterProperty));
+}
diff --git a/node_modules/tslint/lib/rules/noEvalRule.d.ts b/node_modules/tslint/lib/rules/noEvalRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEvalRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noEvalRule.js b/node_modules/tslint/lib/rules/noEvalRule.js
new file mode 100644
index 000000000..24649df6d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noEvalRule.js
@@ -0,0 +1,56 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "forbidden eval";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isCallExpression(node) &&
+ node.expression.kind === ts.SyntaxKind.Identifier && node.expression.text === "eval") {
+ ctx.addFailureAtNode(node.expression, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
new file mode 100644
index 000000000..d2d51d1d1
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
new file mode 100644
index 000000000..60839c9dc
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
@@ -0,0 +1,66 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (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, function (ctx) { return walk(ctx, program.getTypeChecker()); }, ["Promise"].concat(this.ruleArguments));
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-floating-promises",
+ description: "Promises returned by functions must be handled appropriately.",
+ descriptionDetails: "Use `no-unused-expressions` 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)),
+ options: {
+ type: "list",
+ listType: {
+ type: "array",
+ items: { type: "string" },
+ },
+ },
+ optionExamples: [true, [true, "JQueryPromise"]],
+ rationale: "Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.",
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Promises must be handled appropriately";
+exports.Rule = Rule;
+function walk(ctx, tc) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isExpressionStatement(node) && node.expression.kind === ts.SyntaxKind.CallExpression) {
+ var symbol = tc.getTypeAtLocation(node.expression).symbol;
+ if (symbol !== undefined && ctx.options.indexOf(symbol.name) !== -1) {
+ ctx.addFailureAtNode(node.expression, Rule.FAILURE_STRING);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noForInArrayRule.d.ts b/node_modules/tslint/lib/rules/noForInArrayRule.d.ts
new file mode 100644
index 000000000..8b31e4da7
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noForInArrayRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noForInArrayRule.js b/node_modules/tslint/lib/rules/noForInArrayRule.js
new file mode 100644
index 000000000..42035e4eb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noForInArrayRule.js
@@ -0,0 +1,60 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (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, function (ctx) { return walk(ctx, program); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ requiresTypeInfo: true,
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "for-in loops over arrays are forbidden. Use for-of or array.forEach instead.";
+exports.Rule = Rule;
+function walk(ctx, program) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.ForInStatement) {
+ var type = program.getTypeChecker().getTypeAtLocation(node.expression);
+ if (type.symbol !== undefined && type.symbol.name === "Array" ||
+ // tslint:disable-next-line:no-bitwise
+ (type.flags & ts.TypeFlags.StringLike) !== 0) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.js b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
new file mode 100644
index 000000000..965a9de3c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
@@ -0,0 +1,75 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var Lint = require("../index");
+var OPTION_IGNORE_MODULE = "ignore-module";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var patternConfig = this.ruleArguments[this.ruleArguments.length - 1];
+ var ignorePattern = patternConfig === undefined ? undefined : new RegExp(patternConfig[OPTION_IGNORE_MODULE]);
+ return this.applyWithFunction(sourceFile, walk, ignorePattern);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.metadata = {
+ description: "Avoid import statements with side-effect.",
+ optionExamples: [true, [true, (_a = {}, _a[OPTION_IGNORE_MODULE] = "(\\.html|\\.css)$", _a)]],
+ options: {
+ items: {
+ properties: {
+ "ignore-module": {
+ type: "string",
+ },
+ },
+ type: "object",
+ },
+ maxLength: 1,
+ 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)),
+ rationale: "Imports with side effects may have behavior which is hard for static verification.",
+ ruleName: "no-import-side-effect",
+ type: "typescript",
+ typescriptOnly: false,
+};
+Rule.FAILURE_STRING = "import with explicit side-effect";
+exports.Rule = Rule;
+function walk(ctx) {
+ var ignorePattern = ctx.options, sourceFile = ctx.sourceFile;
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var statement = _a[_i];
+ if (!utils.isImportDeclaration(statement)) {
+ continue;
+ }
+ var importClause = statement.importClause, moduleSpecifier = statement.moduleSpecifier;
+ if (importClause !== undefined || !utils.isStringLiteral(moduleSpecifier)) {
+ continue;
+ }
+ if (ignorePattern === undefined || !ignorePattern.test(moduleSpecifier.text)) {
+ ctx.addFailureAtNode(statement, Rule.FAILURE_STRING);
+ }
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
new file mode 100644
index 000000000..38e1bc3a5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(type: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.js b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
new file mode 100644
index 000000000..386249225
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
@@ -0,0 +1,123 @@
+"use strict";
+/**
+ * @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.
+ */
+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_IGNORE_PARMS = "ignore-params";
+var OPTION_IGNORE_PROPERTIES = "ignore-properties";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (type) {
+ return "Type " + type + " trivially inferred from a " + type + " literal, remove type annotation";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoInferrableTypesWalker(sourceFile, this.ruleName, {
+ ignoreParameters: this.ruleArguments.indexOf(OPTION_IGNORE_PARMS) !== -1,
+ ignoreProperties: this.ruleArguments.indexOf(OPTION_IGNORE_PROPERTIES) !== -1,
+ }));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES],
+ },
+ minLength: 0,
+ maxLength: 2,
+ },
+ hasFix: true,
+ optionExamples: [
+ true,
+ [true, OPTION_IGNORE_PARMS],
+ [true, OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES],
+ ],
+ type: "typescript",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+var NoInferrableTypesWalker = (function (_super) {
+ tslib_1.__extends(NoInferrableTypesWalker, _super);
+ function NoInferrableTypesWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoInferrableTypesWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (shouldCheck(node, _this.options)) {
+ var name = node.name, type = node.type, initializer = node.initializer;
+ if (type !== undefined && initializer !== undefined && typeIsInferrable(type.kind, initializer.kind)) {
+ var fix = Lint.Replacement.deleteFromTo(name.end, type.end);
+ _this.addFailureAtNode(type, Rule.FAILURE_STRING_FACTORY(ts.tokenToString(type.kind)), fix);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ return NoInferrableTypesWalker;
+}(Lint.AbstractWalker));
+function shouldCheck(node, _a) {
+ var ignoreParameters = _a.ignoreParameters, ignoreProperties = _a.ignoreProperties;
+ switch (node.kind) {
+ case ts.SyntaxKind.Parameter:
+ return !ignoreParameters &&
+ !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ReadonlyKeyword) &&
+ // "ignore-properties" also works for parameter properties
+ !(ignoreProperties && node.modifiers !== undefined);
+ case ts.SyntaxKind.PropertyDeclaration:
+ return !ignoreProperties && !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ReadonlyKeyword);
+ case ts.SyntaxKind.VariableDeclaration:
+ return true;
+ default:
+ return false;
+ }
+}
+function typeIsInferrable(type, initializer) {
+ switch (type) {
+ case ts.SyntaxKind.BooleanKeyword:
+ return initializer === ts.SyntaxKind.TrueKeyword || initializer === ts.SyntaxKind.FalseKeyword;
+ case ts.SyntaxKind.NumberKeyword:
+ return initializer === ts.SyntaxKind.NumericLiteral;
+ case ts.SyntaxKind.StringKeyword:
+ switch (initializer) {
+ case ts.SyntaxKind.StringLiteral:
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
+ case ts.SyntaxKind.TemplateExpression:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
new file mode 100644
index 000000000..6103d1624
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static EMPTY_INTERFACE_INSTANCE: string;
+ static EMPTY_INTERFACE_FUNCTION: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
new file mode 100644
index 000000000..6342ac39f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
@@ -0,0 +1,113 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../language/utils");
+var Rule = (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.applyWithWalker(new NoInferredEmptyObjectTypeRule(sourceFile, this.ruleName, program.getTypeChecker()));
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-inferred-empty-object-type",
+ description: "Disallow type inference of {} (empty object type) at function and constructor call sites",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.EMPTY_INTERFACE_INSTANCE = "Explicit type parameter needs to be provided to the constructor";
+Rule.EMPTY_INTERFACE_FUNCTION = "Explicit type parameter needs to be provided to the function call";
+exports.Rule = Rule;
+var NoInferredEmptyObjectTypeRule = (function (_super) {
+ tslib_1.__extends(NoInferredEmptyObjectTypeRule, _super);
+ function NoInferredEmptyObjectTypeRule(sourceFile, ruleName, checker) {
+ var _this = _super.call(this, sourceFile, ruleName, undefined) || this;
+ _this.checker = checker;
+ return _this;
+ }
+ NoInferredEmptyObjectTypeRule.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (node.kind === ts.SyntaxKind.CallExpression) {
+ _this.checkCallExpression(node);
+ }
+ else if (node.kind === ts.SyntaxKind.NewExpression) {
+ _this.checkNewExpression(node);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ NoInferredEmptyObjectTypeRule.prototype.checkNewExpression = function (node) {
+ var _this = this;
+ if (node.typeArguments === undefined) {
+ var objType = this.checker.getTypeAtLocation(node);
+ if (utils_1.isTypeFlagSet(objType, ts.TypeFlags.Object) && objType.typeArguments !== undefined) {
+ var typeArgs = objType.typeArguments;
+ if (typeArgs.some(function (a) { return _this.isEmptyObjectInterface(a); })) {
+ this.addFailureAtNode(node, Rule.EMPTY_INTERFACE_INSTANCE);
+ }
+ }
+ }
+ };
+ NoInferredEmptyObjectTypeRule.prototype.checkCallExpression = function (node) {
+ if (node.typeArguments !== undefined) {
+ return;
+ }
+ var callSig = this.checker.getResolvedSignature(node);
+ if (callSig === undefined) {
+ return;
+ }
+ var retType = this.checker.getReturnTypeOfSignature(callSig);
+ if (this.isEmptyObjectInterface(retType)) {
+ this.addFailureAtNode(node, Rule.EMPTY_INTERFACE_FUNCTION);
+ }
+ };
+ NoInferredEmptyObjectTypeRule.prototype.isEmptyObjectInterface = function (objType) {
+ var _this = this;
+ var isAnonymous = utils_1.isObjectFlagSet(objType, ts.ObjectFlags.Anonymous);
+ var hasProblematicCallSignatures = false;
+ var hasProperties = (objType.getProperties() !== undefined && objType.getProperties().length > 0);
+ var hasNumberIndexType = objType.getNumberIndexType() !== undefined;
+ var hasStringIndexType = objType.getStringIndexType() !== undefined;
+ var callSig = objType.getCallSignatures();
+ if (callSig !== undefined && callSig.length > 0) {
+ var isClean = callSig.every(function (sig) {
+ var csigRetType = _this.checker.getReturnTypeOfSignature(sig);
+ return _this.isEmptyObjectInterface(csigRetType);
+ });
+ if (!isClean) {
+ hasProblematicCallSignatures = true;
+ }
+ }
+ return (isAnonymous && !hasProblematicCallSignatures && !hasProperties && !hasNumberIndexType && !hasStringIndexType);
+ };
+ return NoInferredEmptyObjectTypeRule;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noInternalModuleRule.d.ts b/node_modules/tslint/lib/rules/noInternalModuleRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInternalModuleRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noInternalModuleRule.js b/node_modules/tslint/lib/rules/noInternalModuleRule.js
new file mode 100644
index 000000000..33be12aed
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInternalModuleRule.js
@@ -0,0 +1,84 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoInternalModuleWalker(sourceFile, this.ruleName, undefined));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-internal-module",
+ description: "Disallows internal `module`",
+ rationale: "Using `module` leads to a confusion of concepts with external modules. Use the newer `namespace` keyword instead.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: true,
+ hasFix: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "The internal 'module' syntax is deprecated, use the 'namespace' keyword instead.";
+exports.Rule = Rule;
+var NoInternalModuleWalker = (function (_super) {
+ tslib_1.__extends(NoInternalModuleWalker, _super);
+ function NoInternalModuleWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoInternalModuleWalker.prototype.walk = function (sourceFile) {
+ return this.checkStatements(sourceFile.statements);
+ };
+ NoInternalModuleWalker.prototype.checkStatements = function (statements) {
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
+ if (statement.kind === ts.SyntaxKind.ModuleDeclaration) {
+ this.checkModuleDeclaration(statement);
+ }
+ }
+ };
+ NoInternalModuleWalker.prototype.checkModuleDeclaration = function (node, nested) {
+ if (nested !== true &&
+ node.name.kind === ts.SyntaxKind.Identifier &&
+ !Lint.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)) {
+ var end = node.name.pos;
+ var start = end - "module".length;
+ this.addFailure(start, end, Rule.FAILURE_STRING, Lint.Replacement.replaceFromTo(start, end, "namespace"));
+ }
+ if (node.body !== undefined) {
+ switch (node.body.kind) {
+ case ts.SyntaxKind.ModuleBlock:
+ return this.checkStatements(node.body.statements);
+ case ts.SyntaxKind.ModuleDeclaration:
+ return this.checkModuleDeclaration(node.body, true);
+ }
+ }
+ };
+ return NoInternalModuleWalker;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
new file mode 100644
index 000000000..c62da3755
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
@@ -0,0 +1,61 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Interpolation will only work for template strings.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (utils.isStringLiteral(node)) {
+ check(node);
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function check(node) {
+ var idx = node.text.search(/\$\{/);
+ if (idx !== -1) {
+ var textStart = node.getStart() + 1;
+ ctx.addFailureAt(textStart + idx, 2, Rule.FAILURE_STRING);
+ }
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
new file mode 100644
index 000000000..43c9599c8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_OUTSIDE: string;
+ static FAILURE_STRING_INSIDE: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.js b/node_modules/tslint/lib/rules/noInvalidThisRule.js
new file mode 100644
index 000000000..b2fb22aa5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.js
@@ -0,0 +1,97 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_FUNCTION_IN_METHOD = "check-function-in-method";
+var DEPRECATED_OPTION_FUNCTION_IN_METHOD = "no-this-in-function-in-method";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var _this = this;
+ var hasOption = function (name) { return _this.ruleArguments.indexOf(name) !== -1; };
+ var checkFuncInMethod = hasOption(DEPRECATED_OPTION_FUNCTION_IN_METHOD) || hasOption(OPTION_FUNCTION_IN_METHOD);
+ return this.applyWithFunction(sourceFile, walk, checkFuncInMethod);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_FUNCTION_IN_METHOD],
+ },
+ minLength: 0,
+ maxLength: 1,
+ },
+ optionExamples: [true, [true, OPTION_FUNCTION_IN_METHOD]],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_OUTSIDE = "the \"this\" keyword is disallowed outside of a class body";
+Rule.FAILURE_STRING_INSIDE = "the \"this\" keyword is disallowed in function bodies inside class methods, " +
+ "use arrow functions instead";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, checkFuncInMethod = ctx.options;
+ var inClass = false;
+ var inFunctionInClass = false;
+ ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ClassDeclaration:
+ case ts.SyntaxKind.ClassExpression:
+ if (!inClass) {
+ inClass = true;
+ ts.forEachChild(node, cb);
+ inClass = false;
+ return;
+ }
+ break;
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ if (inClass) {
+ inFunctionInClass = true;
+ ts.forEachChild(node, cb);
+ inFunctionInClass = false;
+ return;
+ }
+ break;
+ case ts.SyntaxKind.ThisKeyword:
+ if (!inClass) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_OUTSIDE);
+ }
+ else if (checkFuncInMethod && inFunctionInClass) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_INSIDE);
+ }
+ return;
+ }
+ ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.d.ts
new file mode 100644
index 000000000..5f3621472
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare const IRREGULAR_WHITESPACE_REGEX: RegExp;
diff --git a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
new file mode 100644
index 000000000..aae8e31d5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
@@ -0,0 +1,59 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-irregular-whitespace",
+ description: "Disallow irregular whitespace outside of strings and comments",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Irregular whitespace not allowed";
+exports.Rule = Rule;
+/* Inspired by: https://github.com/eslint/eslint/blob/master/lib/rules/no-irregular-whitespace.js */
+/* tslint:disable:max-line-length */
+exports.IRREGULAR_WHITESPACE_REGEX = /[\u000b\u000c\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]+/mg;
+/* tslint:enable:max-line-length */
+function walk(ctx) {
+ exports.IRREGULAR_WHITESPACE_REGEX.lastIndex = 0;
+ var match;
+ // tslint:disable-next-line no-conditional-assignment
+ while ((match = exports.IRREGULAR_WHITESPACE_REGEX.exec(ctx.sourceFile.text)) !== null) {
+ var start = match.index;
+ var len = match[0].length;
+ var fix = new Lint.Replacement(start, len, " ".repeat(len));
+ ctx.addFailureAt(start, len, Rule.FAILURE_STRING, fix);
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noMagicNumbersRule.d.ts b/node_modules/tslint/lib/rules/noMagicNumbersRule.d.ts
new file mode 100644
index 000000000..500d9d5cc
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMagicNumbersRule.d.ts
@@ -0,0 +1,9 @@
+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 ALLOWED_NODES: Set<ts.SyntaxKind>;
+ static DEFAULT_ALLOWED: number[];
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noMagicNumbersRule.js b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
new file mode 100644
index 000000000..1e1b5f5fb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
@@ -0,0 +1,94 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ 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 Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ optionsDescription: "A list of allowed numbers.",
+ options: {
+ type: "array",
+ items: {
+ type: "number",
+ },
+ minLength: 1,
+ },
+ optionExamples: [true, [true, 1, 2, 3]],
+ type: "typescript",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "'magic numbers' are not allowed";
+Rule.ALLOWED_NODES = new Set([
+ ts.SyntaxKind.ExportAssignment,
+ ts.SyntaxKind.FirstAssignment,
+ ts.SyntaxKind.LastAssignment,
+ ts.SyntaxKind.PropertyAssignment,
+ ts.SyntaxKind.ShorthandPropertyAssignment,
+ ts.SyntaxKind.VariableDeclaration,
+ ts.SyntaxKind.VariableDeclarationList,
+ ts.SyntaxKind.EnumMember,
+ ts.SyntaxKind.PropertyDeclaration,
+ ts.SyntaxKind.Parameter,
+]);
+Rule.DEFAULT_ALLOWED = [-1, 0, 1];
+exports.Rule = Rule;
+var NoMagicNumbersWalker = (function (_super) {
+ tslib_1.__extends(NoMagicNumbersWalker, _super);
+ function NoMagicNumbersWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoMagicNumbersWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (node.kind === ts.SyntaxKind.NumericLiteral) {
+ return _this.checkNumericLiteral(node, node.text);
+ }
+ if (tsutils_1.isPrefixUnaryExpression(node) &&
+ node.operator === ts.SyntaxKind.MinusToken &&
+ node.operand.kind === ts.SyntaxKind.NumericLiteral) {
+ return _this.checkNumericLiteral(node, "-" + node.operand.text);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ NoMagicNumbersWalker.prototype.checkNumericLiteral = function (node, num) {
+ if (!Rule.ALLOWED_NODES.has(node.parent.kind) && !this.options.has(num)) {
+ this.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ };
+ return NoMagicNumbersWalker;
+}(Lint.AbstractWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noMergeableNamespaceRule.d.ts b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.d.ts
new file mode 100644
index 000000000..fb9e9ae80
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static failureStringFactory(name: string, seenBeforeLine: number): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js
new file mode 100644
index 000000000..9b644aef4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js
@@ -0,0 +1,95 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.failureStringFactory = function (name, seenBeforeLine) {
+ return "Mergeable namespace '" + name + "' found. Merge its contents with the namespace on line " + seenBeforeLine + ".";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new Walker(sourceFile, this.ruleName, undefined));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-mergeable-namespace",
+ description: "Disallows mergeable namespaces in the same file.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "maintainability",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+var Walker = (function (_super) {
+ tslib_1.__extends(Walker, _super);
+ function Walker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Walker.prototype.walk = function (node) {
+ return this.checkStatements(node.statements);
+ };
+ Walker.prototype.checkStatements = function (statements) {
+ var seen = new Map();
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
+ if (statement.kind !== ts.SyntaxKind.ModuleDeclaration) {
+ continue;
+ }
+ var name = statement.name;
+ if (name.kind === ts.SyntaxKind.Identifier) {
+ var text = name.text;
+ var prev = seen.get(text);
+ if (prev !== undefined) {
+ this.addFailureAtNode(name, Rule.failureStringFactory(text, this.getLineOfNode(prev.name)));
+ }
+ seen.set(text, statement);
+ }
+ // Recursively check in all module declarations
+ this.checkModuleDeclaration(statement);
+ }
+ };
+ Walker.prototype.checkModuleDeclaration = function (decl) {
+ var body = decl.body;
+ if (body === undefined) {
+ return;
+ }
+ switch (body.kind) {
+ case ts.SyntaxKind.ModuleBlock:
+ this.checkStatements(body.statements);
+ break;
+ case ts.SyntaxKind.ModuleDeclaration:
+ this.checkModuleDeclaration(body);
+ break;
+ default:
+ break;
+ }
+ };
+ Walker.prototype.getLineOfNode = function (node) {
+ return ts.getLineAndCharacterOfPosition(this.sourceFile, node.pos).line + 1;
+ };
+ return Walker;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
new file mode 100644
index 000000000..ddc81e37c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
@@ -0,0 +1,8 @@
+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_INTERFACE: string;
+ static FAILURE_STRING_CLASS: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.js b/node_modules/tslint/lib/rules/noMisusedNewRule.js
new file mode 100644
index 000000000..51f34e5f4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.js
@@ -0,0 +1,74 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-misused-new",
+ description: "Warns on apparent attempts to define constructors for interfaces or `new` for classes.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_INTERFACE = "Interfaces cannot be constructed, only classes. Did you mean `declare class`?";
+Rule.FAILURE_STRING_CLASS = '`new` in a class is a method named "new". Did you mean `constructor`?';
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isMethodSignature(node)) {
+ if (tsutils_1.getPropertyName(node.name) === "constructor") {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_INTERFACE);
+ }
+ }
+ else if (tsutils_1.isMethodDeclaration(node)) {
+ if (node.body === undefined &&
+ tsutils_1.getPropertyName(node.name) === "new" &&
+ returnTypeMatchesParent(node.parent, node)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_CLASS);
+ }
+ }
+ else if (tsutils_1.isConstructSignatureDeclaration(node)) {
+ if (returnTypeMatchesParent(node.parent, node)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_INTERFACE);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function returnTypeMatchesParent(parent, decl) {
+ if (parent.name === undefined || decl.type === undefined || !tsutils_1.isTypeReferenceNode(decl.type)) {
+ return false;
+ }
+ return decl.type.typeName.kind === ts.SyntaxKind.Identifier && decl.type.typeName.text === parent.name.text;
+}
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.d.ts b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.js b/node_modules/tslint/lib/rules/noNamespaceRule.js
new file mode 100644
index 000000000..a930e3034
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.js
@@ -0,0 +1,75 @@
+"use strict";
+/**
+ * @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.
+ */
+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_DECLARATIONS = "allow-declarations";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, {
+ allowDeclarations: this.ruleArguments.indexOf(OPTION_ALLOW_DECLARATIONS) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_ALLOW_DECLARATIONS],
+ },
+ minLength: 0,
+ maxLength: 1,
+ },
+ optionExamples: [true, [true, OPTION_ALLOW_DECLARATIONS]],
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "'namespace' and 'module' are disallowed";
+exports.Rule = Rule;
+function walk(ctx) {
+ // Ignore all .d.ts files by returning and not walking their ASTs.
+ // .d.ts declarations do not have the Ambient flag set, but are still declarations.
+ if (ctx.sourceFile.isDeclarationFile && ctx.options.allowDeclarations) {
+ return;
+ }
+ for (var _i = 0, _a = ctx.sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ if (node.kind === ts.SyntaxKind.ModuleDeclaration) {
+ if (node.name.kind !== ts.SyntaxKind.StringLiteral &&
+ (!ctx.options.allowDeclarations || !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword))) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.d.ts b/node_modules/tslint/lib/rules/noNonNullAssertionRule.d.ts
new file mode 100644
index 000000000..65ed5c49f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
new file mode 100644
index 000000000..5af273e18
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
@@ -0,0 +1,53 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-non-null-assertion",
+ description: "Disallows non-null assertions.",
+ rationale: "Using non-null assertion cancels the benefits of the strict null checking mode.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Forbidden non null assertion";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.NonNullExpression) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
new file mode 100644
index 000000000..f4050b9de
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.js b/node_modules/tslint/lib/rules/noNullKeywordRule.js
new file mode 100644
index 000000000..ef9a21db3
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.js
@@ -0,0 +1,59 @@
+"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 });
+var tslib_1 = require("tslib");
+// with due reference to https://github.com/Microsoft/TypeScript/blob/7813121c4d77e50aad0eed3152ef1f1156c7b574/scripts/tslint/noNullRule.ts
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use 'undefined' instead of 'null'";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, cb);
+ function cb(node) {
+ if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) {
+ return; // skip type nodes
+ }
+ if (node.kind === ts.SyntaxKind.NullKeyword) {
+ return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
new file mode 100644
index 000000000..65ed5c49f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
new file mode 100644
index 000000000..18d4ddd41
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
@@ -0,0 +1,73 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Type assertion on object literals is forbidden, use a type annotation instead.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (isTypeAssertionLike(node) && isObjectLiteral(node.expression) && node.type.kind !== ts.SyntaxKind.AnyKeyword) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isTypeAssertionLike(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.TypeAssertionExpression:
+ case ts.SyntaxKind.AsExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+function isObjectLiteral(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ParenthesizedExpression:
+ return isObjectLiteral(node.expression);
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
new file mode 100644
index 000000000..5e78ab8aa
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
@@ -0,0 +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.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_FACTORY(ident: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare class NoParameterPropertiesWalker extends Lint.RuleWalker {
+ visitConstructorDeclaration(node: ts.ConstructorDeclaration): void;
+}
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
new file mode 100644
index 000000000..86fa67bad
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
@@ -0,0 +1,67 @@
+"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 });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (ident) {
+ return "Property '" + ident + "' cannot be declared in the constructor";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoParameterPropertiesWalker(sourceFile, this.getOptions()));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+var NoParameterPropertiesWalker = (function (_super) {
+ tslib_1.__extends(NoParameterPropertiesWalker, _super);
+ function NoParameterPropertiesWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoParameterPropertiesWalker.prototype.visitConstructorDeclaration = function (node) {
+ var parameters = node.parameters;
+ for (var _i = 0, parameters_1 = parameters; _i < parameters_1.length; _i++) {
+ var parameter = parameters_1[_i];
+ if (parameter.modifiers != null && parameter.modifiers.length > 0) {
+ var errorMessage = Rule.FAILURE_STRING_FACTORY(parameter.name.text);
+ var lastModifier = parameter.modifiers[parameter.modifiers.length - 1];
+ this.addFailureFromStartToEnd(parameter.getStart(), lastModifier.getEnd(), errorMessage);
+ }
+ }
+ _super.prototype.visitConstructorDeclaration.call(this, node);
+ };
+ return NoParameterPropertiesWalker;
+}(Lint.RuleWalker));
+exports.NoParameterPropertiesWalker = NoParameterPropertiesWalker;
+var _a;
diff --git a/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
new file mode 100644
index 000000000..65d573ba8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
@@ -0,0 +1,7 @@
+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(moduleReference: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noReferenceImportRule.js b/node_modules/tslint/lib/rules/noReferenceImportRule.js
new file mode 100644
index 000000000..8873d869a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noReferenceImportRule.js
@@ -0,0 +1,98 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (moduleReference) {
+ return "No need to reference \"" + moduleReference + "\", since it is imported.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoReferenceImportWalker(sourceFile, this.ruleName, undefined));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-reference-import",
+ description: 'Don\'t <reference types="foo" /> if you import "foo" anyway.',
+ optionsDescription: "Not configurable.",
+ options: null,
+ type: "style",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+var NoReferenceImportWalker = (function (_super) {
+ tslib_1.__extends(NoReferenceImportWalker, _super);
+ function NoReferenceImportWalker() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.imports = new Set();
+ return _this;
+ }
+ NoReferenceImportWalker.prototype.walk = function (sourceFile) {
+ if (sourceFile.typeReferenceDirectives.length === 0) {
+ return;
+ }
+ this.findImports(sourceFile.statements);
+ for (var _i = 0, _a = sourceFile.typeReferenceDirectives; _i < _a.length; _i++) {
+ var ref = _a[_i];
+ if (this.imports.has(ref.fileName)) {
+ this.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING(ref.fileName));
+ }
+ }
+ };
+ NoReferenceImportWalker.prototype.findImports = function (statements) {
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
+ if (tsutils_1.isImportDeclaration(statement)) {
+ this.addImport(statement.moduleSpecifier);
+ }
+ else if (tsutils_1.isImportEqualsDeclaration(statement)) {
+ if (statement.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference &&
+ statement.moduleReference.expression !== undefined) {
+ this.addImport(statement.moduleReference.expression);
+ }
+ }
+ else if (tsutils_1.isModuleDeclaration(statement) && statement.body !== undefined && this.sourceFile.isDeclarationFile) {
+ // There can't be any imports in a module augmentation or namespace
+ this.findImportsInModule(statement.body);
+ }
+ }
+ };
+ NoReferenceImportWalker.prototype.findImportsInModule = function (body) {
+ if (body.kind === ts.SyntaxKind.ModuleBlock) {
+ return this.findImports(body.statements);
+ }
+ else if (body.kind === ts.SyntaxKind.ModuleDeclaration && body.body !== undefined) {
+ return this.findImportsInModule(body.body);
+ }
+ };
+ NoReferenceImportWalker.prototype.addImport = function (specifier) {
+ if (tsutils_1.isStringLiteral(specifier)) {
+ this.imports.add(specifier.text);
+ }
+ };
+ return NoReferenceImportWalker;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noReferenceRule.d.ts b/node_modules/tslint/lib/rules/noReferenceRule.d.ts
new file mode 100644
index 000000000..bd1fcddd6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noReferenceRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noReferenceRule.js b/node_modules/tslint/lib/rules/noReferenceRule.js
new file mode 100644
index 000000000..4e07beb92
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noReferenceRule.js
@@ -0,0 +1,51 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "<reference> is not allowed, use imports";
+exports.Rule = Rule;
+function walk(ctx) {
+ for (var _i = 0, _a = ctx.sourceFile.referencedFiles; _i < _a.length; _i++) {
+ var ref = _a[_i];
+ ctx.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING);
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noRequireImportsRule.js b/node_modules/tslint/lib/rules/noRequireImportsRule.js
new file mode 100644
index 000000000..194c73eb4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noRequireImportsRule.js
@@ -0,0 +1,61 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-require-imports",
+ description: "Disallows invocation of `require()`.",
+ rationale: "Prefer the newer ES6-style imports over `require()`.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "require() style import is forbidden";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isCallExpression(node)) {
+ if (node.arguments.length !== 0 &&
+ tsutils_1.isIdentifier(node.expression) && node.expression.text === "require") {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ else if (tsutils_1.isImportEqualsDeclaration(node) &&
+ node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
+ ctx.addFailureAtNode(node.moduleReference, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
new file mode 100644
index 000000000..759d5fafb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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_FACTORY(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.js b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
new file mode 100644
index 000000000..53b3db09d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
@@ -0,0 +1,143 @@
+"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 });
+var tslib_1 = require("tslib");
+// tslint:disable deprecation
+// (https://github.com/palantir/tslint/pull/2598)
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (name) {
+ return "Shadowed variable: '" + name + "'";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoShadowedVariableWalker(sourceFile, this.getOptions()));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var NoShadowedVariableWalker = (function (_super) {
+ tslib_1.__extends(NoShadowedVariableWalker, _super);
+ function NoShadowedVariableWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoShadowedVariableWalker.prototype.createScope = function () {
+ return new Set();
+ };
+ NoShadowedVariableWalker.prototype.createBlockScope = function () {
+ return new Set();
+ };
+ NoShadowedVariableWalker.prototype.visitBindingElement = function (node) {
+ var isSingleVariable = node.name.kind === ts.SyntaxKind.Identifier;
+ if (isSingleVariable) {
+ var name = node.name;
+ var variableDeclaration = Lint.getBindingElementVariableDeclaration(node);
+ var isBlockScopedVariable = variableDeclaration !== null && Lint.isBlockScopedVariable(variableDeclaration);
+ this.handleSingleVariableIdentifier(name, isBlockScopedVariable);
+ }
+ _super.prototype.visitBindingElement.call(this, node);
+ };
+ NoShadowedVariableWalker.prototype.visitCatchClause = function (node) {
+ // don't visit the catch clause variable declaration, just visit the block
+ // the catch clause variable declaration has its own special scoping rules
+ this.visitBlock(node.block);
+ };
+ NoShadowedVariableWalker.prototype.visitCallSignature = function (_node) {
+ // don't call super, we don't need to check parameter names in call signatures
+ };
+ NoShadowedVariableWalker.prototype.visitFunctionType = function (_node) {
+ // don't call super, we don't need to check names in function types
+ };
+ NoShadowedVariableWalker.prototype.visitConstructorType = function (_node) {
+ // don't call super, we don't need to check names in constructor types
+ };
+ NoShadowedVariableWalker.prototype.visitIndexSignatureDeclaration = function (_node) {
+ // don't call super, we don't want to walk index signatures
+ };
+ NoShadowedVariableWalker.prototype.visitMethodSignature = function (_node) {
+ // don't call super, we don't want to walk method signatures either
+ };
+ NoShadowedVariableWalker.prototype.visitParameterDeclaration = function (node) {
+ var isSingleParameter = node.name.kind === ts.SyntaxKind.Identifier;
+ if (isSingleParameter) {
+ this.handleSingleVariableIdentifier(node.name, false);
+ }
+ _super.prototype.visitParameterDeclaration.call(this, node);
+ };
+ NoShadowedVariableWalker.prototype.visitTypeLiteral = function (_node) {
+ // don't call super, we don't want to walk the inside of type nodes
+ };
+ NoShadowedVariableWalker.prototype.visitVariableDeclaration = function (node) {
+ var isSingleVariable = node.name.kind === ts.SyntaxKind.Identifier;
+ if (isSingleVariable) {
+ this.handleSingleVariableIdentifier(node.name, Lint.isBlockScopedVariable(node));
+ }
+ _super.prototype.visitVariableDeclaration.call(this, node);
+ };
+ NoShadowedVariableWalker.prototype.handleSingleVariableIdentifier = function (variableIdentifier, isBlockScoped) {
+ var variableName = variableIdentifier.text;
+ if (this.isVarInCurrentScope(variableName) && !this.inCurrentBlockScope(variableName)) {
+ // shadowing if there's already a `var` of the same name in the scope AND
+ // it's not in the current block (handled by the 'no-duplicate-variable' rule)
+ this.addFailureOnIdentifier(variableIdentifier);
+ }
+ else if (this.inPreviousBlockScope(variableName)) {
+ // shadowing if there is a `var`, `let`, 'const`, or parameter in a previous block scope
+ this.addFailureOnIdentifier(variableIdentifier);
+ }
+ if (!isBlockScoped) {
+ // `var` variables go on the scope
+ this.getCurrentScope().add(variableName);
+ }
+ // all variables go on block scope, including `var`
+ this.getCurrentBlockScope().add(variableName);
+ };
+ NoShadowedVariableWalker.prototype.isVarInCurrentScope = function (varName) {
+ return this.getCurrentScope().has(varName);
+ };
+ NoShadowedVariableWalker.prototype.inCurrentBlockScope = function (varName) {
+ return this.getCurrentBlockScope().has(varName);
+ };
+ NoShadowedVariableWalker.prototype.inPreviousBlockScope = function (varName) {
+ var _this = this;
+ return this.getAllBlockScopes().some(function (scopeInfo) {
+ return scopeInfo !== _this.getCurrentBlockScope() && scopeInfo.has(varName);
+ });
+ };
+ NoShadowedVariableWalker.prototype.addFailureOnIdentifier = function (ident) {
+ var failureString = Rule.FAILURE_STRING_FACTORY(ident.text);
+ this.addFailureAtNode(ident, failureString);
+ };
+ return NoShadowedVariableWalker;
+}(Lint.BlockScopeAwareRuleWalker));
diff --git a/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noSparseArraysRule.js b/node_modules/tslint/lib/rules/noSparseArraysRule.js
new file mode 100644
index 000000000..15bf3ff32
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noSparseArraysRule.js
@@ -0,0 +1,98 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-sparse-arrays",
+ description: "Forbids array literals to contain missing elements.",
+ rationale: "Missing elements are probably an accidentally duplicated comma.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Array has a missing element.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (!utils.isArrayLiteralExpression(node)) {
+ if (utils.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
+ // Ignore LHS of assignments.
+ traverseExpressionsInLHS(node.left, cb);
+ return cb(node.right);
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ }
+ for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (utils.isOmittedExpression(element)) {
+ // Node has an empty range, so just use range starting at `element.pos`.
+ ctx.addFailureAt(element.pos, 1, Rule.FAILURE_STRING);
+ }
+ else {
+ ts.forEachChild(element, cb);
+ }
+ }
+ });
+}
+/** Traverse the LHS of an `=` expression, calling `cb` embedded default value, but ignoring binding patterns. */
+function traverseExpressionsInLHS(node, cb) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ParenthesizedExpression:
+ traverseExpressionsInLHS(node.expression, cb);
+ break;
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
+ var e = _a[_i];
+ traverseExpressionsInLHS(e, cb);
+ }
+ break;
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
+ var o = _c[_b];
+ traverseExpressionsInLHS(o, cb);
+ }
+ break;
+ case ts.SyntaxKind.BinaryExpression: {
+ var _d = node, left = _d.left, operatorToken = _d.operatorToken, right = _d.right;
+ if (operatorToken.kind === ts.SyntaxKind.EqualsToken) {
+ traverseExpressionsInLHS(left, cb);
+ cb(right);
+ }
+ break;
+ }
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.js b/node_modules/tslint/lib/rules/noStringLiteralRule.js
new file mode 100644
index 000000000..672e35f89
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.js
@@ -0,0 +1,60 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-string-literal",
+ description: "Disallows object access via string literals.",
+ rationale: "Encourages using strongly-typed property access.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+ hasFix: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "object access via string literals is disallowed";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isElementAccessExpression(node)) {
+ var argument = node.argumentExpression;
+ if (argument !== undefined && tsutils_1.isStringLiteral(argument) && tsutils_1.isValidPropertyAccess(argument.text)) {
+ ctx.addFailureAtNode(argument, Rule.FAILURE_STRING,
+ // expr['foo'] -> expr.foo
+ Lint.Replacement.replaceFromTo(node.expression.end, node.end, "." + argument.text));
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.d.ts b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.js b/node_modules/tslint/lib/rules/noStringThrowRule.js
new file mode 100644
index 000000000..f934407a2
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.js
@@ -0,0 +1,77 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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.",
+ hasFix: true,
+ options: null,
+ optionsDescription: "Not configurable.",
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Throwing plain strings (not instances of Error) gives no stack traces";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isThrowStatement(node)) {
+ var expression = node.expression;
+ if (isString(expression)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING, [
+ Lint.Replacement.appendText(expression.getStart(sourceFile), "new Error("),
+ Lint.Replacement.appendText(expression.getEnd(), ")"),
+ ]);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isString(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.StringLiteral:
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
+ case ts.SyntaxKind.TemplateExpression:
+ return true;
+ case ts.SyntaxKind.BinaryExpression: {
+ var _a = node, operatorToken = _a.operatorToken, left = _a.left, right = _a.right;
+ return operatorToken.kind === ts.SyntaxKind.PlusToken && (isString(left) || isString(right));
+ }
+ case ts.SyntaxKind.ParenthesizedExpression:
+ return isString(node.expression);
+ default:
+ return false;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
new file mode 100644
index 000000000..1fe06743f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
@@ -0,0 +1,12 @@
+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(keyword: ts.SyntaxKind): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
+export declare class NoSwitchCaseFallThroughWalker extends Lint.AbstractWalker<void> {
+ walk(sourceFile: ts.SourceFile): void;
+ private visitSwitchStatement({caseBlock: {clauses}});
+ private isFallThroughAllowed(clause);
+}
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
new file mode 100644
index 000000000..94c570c29
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
@@ -0,0 +1,90 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (keyword) {
+ return "expected a 'break' before '" + ts.tokenToString(keyword) + "'";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new NoSwitchCaseFallThroughWalker(sourceFile, this.ruleName, undefined));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ rationale: "Fall though in switch statements is often unintentional and a bug.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var NoSwitchCaseFallThroughWalker = (function (_super) {
+ tslib_1.__extends(NoSwitchCaseFallThroughWalker, _super);
+ function NoSwitchCaseFallThroughWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoSwitchCaseFallThroughWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (utils.isSwitchStatement(node)) {
+ _this.visitSwitchStatement(node);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ NoSwitchCaseFallThroughWalker.prototype.visitSwitchStatement = function (_a) {
+ var _this = this;
+ var clauses = _a.caseBlock.clauses;
+ clauses.forEach(function (clause, i) {
+ if (i !== clauses.length - 1
+ && clause.statements.length !== 0
+ && !utils.endsControlFlow(clause)
+ && !_this.isFallThroughAllowed(clause)) {
+ var keyword = clauses[i + 1].getChildAt(0);
+ _this.addFailureAtNode(keyword, Rule.FAILURE_STRING(keyword.kind));
+ }
+ });
+ };
+ NoSwitchCaseFallThroughWalker.prototype.isFallThroughAllowed = function (clause) {
+ var _this = this;
+ var comments = ts.getLeadingCommentRanges(this.sourceFile.text, clause.end);
+ return comments !== undefined && comments.some(function (comment) { return commentText(comment, _this.sourceFile).trim() === "falls through"; });
+ };
+ return NoSwitchCaseFallThroughWalker;
+}(Lint.AbstractWalker));
+exports.NoSwitchCaseFallThroughWalker = NoSwitchCaseFallThroughWalker;
+function commentText(_a, sourceFile) {
+ var pos = _a.pos, end = _a.end, kind = _a.kind;
+ return sourceFile.text.slice(pos + 2, kind === ts.SyntaxKind.MultiLineCommentTrivia ? end - 2 : end);
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
new file mode 100644
index 000000000..56615b1b5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
@@ -0,0 +1,129 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var noConsecutiveBlankLinesRule_1 = require("./noConsecutiveBlankLinesRule");
+var OPTION_IGNORE_COMMENTS = "ignore-comments";
+var OPTION_IGNORE_JSDOC = "ignore-jsdoc";
+var OPTION_IGNORE_TEMPLATE_STRINGS = "ignore-template-strings";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var ignoreComments = this.ruleArguments.indexOf(OPTION_IGNORE_COMMENTS) !== -1;
+ return this.applyWithFunction(sourceFile, walk, {
+ ignoreComments: ignoreComments,
+ ignoreJsDoc: ignoreComments || this.ruleArguments.indexOf(OPTION_IGNORE_JSDOC) !== -1,
+ ignoreTemplates: this.ruleArguments.indexOf(OPTION_IGNORE_TEMPLATE_STRINGS) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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."], _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."], Lint.Utils.dedent(_a, OPTION_IGNORE_TEMPLATE_STRINGS, OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC)),
+ hasFix: true,
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC, OPTION_IGNORE_TEMPLATE_STRINGS],
+ },
+ },
+ optionExamples: [
+ true,
+ [true, OPTION_IGNORE_COMMENTS],
+ [true, OPTION_IGNORE_JSDOC],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "trailing whitespace";
+exports.Rule = Rule;
+function walk(ctx) {
+ var possibleFailures = [];
+ var sourceFile = ctx.sourceFile;
+ var text = sourceFile.text;
+ for (var _i = 0, _a = tsutils_1.getLineRanges(sourceFile); _i < _a.length; _i++) {
+ var line = _a[_i];
+ var match = text.substr(line.pos, line.contentLength).match(/\s+$/);
+ if (match !== null) {
+ possibleFailures.push({
+ end: line.pos + line.contentLength,
+ pos: line.pos + match.index,
+ });
+ }
+ }
+ if (possibleFailures.length === 0) {
+ return;
+ }
+ var excludedRanges = ctx.options.ignoreTemplates
+ ? ctx.options.ignoreJsDoc ? getExcludedRanges(sourceFile, ctx.options) : noConsecutiveBlankLinesRule_1.getTemplateRanges(sourceFile)
+ : ctx.options.ignoreJsDoc ? getExcludedComments(sourceFile, ctx.options) : [];
+ var _loop_1 = function (possibleFailure) {
+ if (!excludedRanges.some(function (range) { return range.pos < possibleFailure.pos && possibleFailure.pos < range.end; })) {
+ ctx.addFailure(possibleFailure.pos, possibleFailure.end, Rule.FAILURE_STRING, Lint.Replacement.deleteFromTo(possibleFailure.pos, possibleFailure.end));
+ }
+ };
+ for (var _b = 0, possibleFailures_1 = possibleFailures; _b < possibleFailures_1.length; _b++) {
+ var possibleFailure = possibleFailures_1[_b];
+ _loop_1(possibleFailure);
+ }
+}
+function getExcludedRanges(sourceFile, options) {
+ var intervals = [];
+ tsutils_1.forEachTokenWithTrivia(sourceFile, function (text, kind, range) {
+ if (kind >= ts.SyntaxKind.FirstTemplateToken && kind <= ts.SyntaxKind.LastTemplateToken) {
+ intervals.push(range);
+ }
+ else if (options.ignoreComments) {
+ if (kind === ts.SyntaxKind.SingleLineCommentTrivia || kind === ts.SyntaxKind.MultiLineCommentTrivia) {
+ intervals.push(range);
+ }
+ }
+ else if (options.ignoreJsDoc) {
+ if (isJsDoc(text, kind, range)) {
+ intervals.push(range);
+ }
+ }
+ });
+ return intervals;
+}
+function getExcludedComments(sourceFile, options) {
+ var intervals = [];
+ tsutils_1.forEachComment(sourceFile, function (text, comment) {
+ if (options.ignoreComments ||
+ options.ignoreJsDoc && isJsDoc(text, comment.kind, comment)) {
+ intervals.push(comment);
+ }
+ });
+ return intervals;
+}
+function isJsDoc(sourceText, kind, range) {
+ return kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceText[range.pos + 2] === "*" && sourceText[range.pos + 3] !== "*";
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
new file mode 100644
index 000000000..4df32174e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.js b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
new file mode 100644
index 000000000..388cfa404
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
@@ -0,0 +1,88 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (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.applyWithWalker(new Walker(sourceFile, this.getOptions(), program));
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Avoid referencing unbound methods which may cause unintentional scoping of 'this'.";
+exports.Rule = Rule;
+var Walker = (function (_super) {
+ tslib_1.__extends(Walker, _super);
+ function Walker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Walker.prototype.visitPropertyAccessExpression = function (node) {
+ if (!isSafeUse(node)) {
+ var symbol = this.getTypeChecker().getSymbolAtLocation(node);
+ var declaration = symbol === undefined ? undefined : symbol.valueDeclaration;
+ if (declaration !== undefined && isMethod(declaration)) {
+ this.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ _super.prototype.visitPropertyAccessExpression.call(this, node);
+ };
+ return Walker;
+}(Lint.ProgramAwareRuleWalker));
+function isMethod(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.MethodSignature:
+ return true;
+ default:
+ return false;
+ }
+}
+function isSafeUse(node) {
+ var parent = node.parent;
+ switch (parent.kind) {
+ case ts.SyntaxKind.CallExpression:
+ return parent.expression === node;
+ case ts.SyntaxKind.TaggedTemplateExpression:
+ return parent.tag === node;
+ // E.g. `obj.method.bind(obj)`.
+ case ts.SyntaxKind.PropertyAccessExpression:
+ return true;
+ // Allow most binary operators, but don't allow e.g. `myArray.forEach(obj.method || otherObj.otherMethod)`.
+ case ts.SyntaxKind.BinaryExpression:
+ return parent.operatorToken.kind !== ts.SyntaxKind.BarBarToken;
+ default:
+ return false;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
new file mode 100644
index 000000000..218e9218e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
@@ -0,0 +1,7 @@
+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(cbText: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
new file mode 100644
index 000000000..ad46a3eb8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
@@ -0,0 +1,85 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (cbText) {
+ return "No need to wrap '" + cbText + "' in another function. Just use it directly.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, cb);
+ function cb(node) {
+ if (tsutils_1.isArrowFunction(node) && !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) &&
+ tsutils_1.isCallExpression(node.body) && tsutils_1.isIdentifier(node.body.expression) &&
+ isRedundantCallback(node.parameters, node.body.arguments, node.body.expression)) {
+ var start = node.getStart(ctx.sourceFile);
+ ctx.addFailure(start, node.end, Rule.FAILURE_STRING(node.body.expression.text), [
+ Lint.Replacement.deleteFromTo(start, node.body.getStart(ctx.sourceFile)),
+ Lint.Replacement.deleteFromTo(node.body.expression.end, node.end),
+ ]);
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ }
+}
+function isRedundantCallback(parameters, args, expression) {
+ if (parameters.length !== args.length) {
+ return false;
+ }
+ for (var i = 0; i < parameters.length; ++i) {
+ var _a = parameters[i], dotDotDotToken = _a.dotDotDotToken, name = _a.name;
+ var arg = args[i];
+ if (dotDotDotToken !== undefined) {
+ if (!tsutils_1.isSpreadElement(arg)) {
+ return false;
+ }
+ arg = arg.expression;
+ }
+ if (!tsutils_1.isIdentifier(name) || !tsutils_1.isIdentifier(arg) || name.text !== arg.text
+ || expression.text === name.text) {
+ return false;
+ }
+ }
+ return true;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
new file mode 100644
index 000000000..37c1931a4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
@@ -0,0 +1,8 @@
+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 FAILURE_STRING_PARAMETER: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
new file mode 100644
index 000000000..b147fe076
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
@@ -0,0 +1,105 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-unnecessary-initializer",
+ description: "Forbids a 'var'/'let' statement or destructuring initializer to be initialized to 'undefined'.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Unnecessary initialization to 'undefined'.";
+Rule.FAILURE_STRING_PARAMETER = "Use an optional parameter instead of initializing to 'undefined'. " +
+ "Also, the type declaration does not need to include '| undefined'.";
+exports.Rule = Rule;
+function walk(ctx) {
+ ts.forEachChild(ctx.sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.BindingElement:
+ checkInitializer(node);
+ break;
+ case ts.SyntaxKind.VariableDeclaration:
+ if (!tsutils_1.isBindingPattern(node.name) && !Lint.isNodeFlagSet(node.parent, ts.NodeFlags.Const)) {
+ checkInitializer(node);
+ }
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.Constructor: {
+ var parameters_1 = node.parameters;
+ parameters_1.forEach(function (parameter, i) {
+ if (isUndefined(parameter.initializer)) {
+ if (parametersAllOptionalAfter(parameters_1, i)) {
+ // No fix since they may want to remove '| undefined' from the type.
+ ctx.addFailureAtNode(parameter, Rule.FAILURE_STRING_PARAMETER);
+ }
+ else {
+ failWithFix(parameter);
+ }
+ }
+ });
+ break;
+ }
+ }
+ ts.forEachChild(node, cb);
+ });
+ function checkInitializer(node) {
+ if (isUndefined(node.initializer)) {
+ failWithFix(node);
+ }
+ }
+ function failWithFix(node) {
+ var fix = Lint.Replacement.deleteFromTo(Lint.childOfKind(node, ts.SyntaxKind.EqualsToken).pos, node.end);
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING, fix);
+ }
+}
+function parametersAllOptionalAfter(parameters, idx) {
+ for (var i = idx + 1; i < parameters.length; i++) {
+ if (parameters[i].questionToken !== undefined) {
+ return true;
+ }
+ if (parameters[i].initializer === undefined) {
+ return false;
+ }
+ }
+ return true;
+}
+function isUndefined(node) {
+ return node !== undefined &&
+ node.kind === ts.SyntaxKind.Identifier &&
+ node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
new file mode 100644
index 000000000..af476a3f9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(name: string): string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
new file mode 100644
index 000000000..4d8a1e2da
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
@@ -0,0 +1,118 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "Qualifier is unnecessary since '" + name + "' is in scope.";
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-unnecessary-qualifier",
+ description: "Warns when a namespace qualifier (`A.x`) is unnecessary.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ var namespacesInScope = [];
+ ts.forEachChild(ctx.sourceFile, cb);
+ function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ModuleDeclaration:
+ case ts.SyntaxKind.EnumDeclaration:
+ namespacesInScope.push(node);
+ ts.forEachChild(node, cb);
+ namespacesInScope.pop();
+ break;
+ case ts.SyntaxKind.QualifiedName:
+ var _a = node, left = _a.left, right = _a.right;
+ visitNamespaceAccess(node, left, right);
+ break;
+ case ts.SyntaxKind.PropertyAccessExpression:
+ var _b = node, expression = _b.expression, name = _b.name;
+ if (utils.isEntityNameExpression(expression)) {
+ visitNamespaceAccess(node, expression, name);
+ break;
+ }
+ // falls through
+ default:
+ ts.forEachChild(node, cb);
+ }
+ }
+ function visitNamespaceAccess(node, qualifier, name) {
+ if (qualifierIsUnnecessary(qualifier, name)) {
+ var fix = Lint.Replacement.deleteFromTo(qualifier.getStart(), name.getStart());
+ ctx.addFailureAtNode(qualifier, Rule.FAILURE_STRING(qualifier.getText()), fix);
+ }
+ else {
+ // Only look for nested qualifier errors if we didn't already fail on the outer qualifier.
+ ts.forEachChild(node, cb);
+ }
+ }
+ function qualifierIsUnnecessary(qualifier, name) {
+ var namespaceSymbol = checker.getSymbolAtLocation(qualifier);
+ if (namespaceSymbol === undefined || !symbolIsNamespaceInScope(namespaceSymbol)) {
+ return false;
+ }
+ var accessedSymbol = checker.getSymbolAtLocation(name);
+ if (accessedSymbol === undefined) {
+ return false;
+ }
+ // If the symbol in scope is different, the qualifier is necessary.
+ var fromScope = getSymbolInScope(qualifier, accessedSymbol.flags, name.text);
+ return fromScope === undefined || fromScope === accessedSymbol;
+ }
+ function getSymbolInScope(node, flags, name) {
+ // TODO:PERF `getSymbolsInScope` gets a long list. Is there a better way?
+ var scope = checker.getSymbolsInScope(node, flags);
+ return scope.find(function (scopeSymbol) { return scopeSymbol.name === name; });
+ }
+ function symbolIsNamespaceInScope(symbol) {
+ var symbolDeclarations = symbol.getDeclarations();
+ if (symbolDeclarations == null) {
+ return false;
+ }
+ else if (symbolDeclarations.some(function (decl) { return namespacesInScope.some(function (ns) { return ns === decl; }); })) {
+ return true;
+ }
+ var alias = tryGetAliasedSymbol(symbol, checker);
+ return alias !== undefined && symbolIsNamespaceInScope(alias);
+ }
+}
+function tryGetAliasedSymbol(symbol, checker) {
+ return Lint.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
new file mode 100644
index 000000000..8b31e4da7
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
new file mode 100644
index 000000000..2ee8aa957
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
@@ -0,0 +1,79 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (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.applyWithWalker(new Walker(sourceFile, this.ruleName, program.getTypeChecker()));
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-unnecessary-type-assertion",
+ description: "Warns if a type assertion does not change the type of an expression.",
+ options: null,
+ optionsDescription: "Not configurable",
+ type: "typescript",
+ hasFix: true,
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "This assertion is unnecessary since it does not change the type of the expression.";
+exports.Rule = Rule;
+var Walker = (function (_super) {
+ tslib_1.__extends(Walker, _super);
+ function Walker(sourceFile, ruleName, checker) {
+ var _this = _super.call(this, sourceFile, ruleName, undefined) || this;
+ _this.checker = checker;
+ return _this;
+ }
+ Walker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.TypeAssertionExpression:
+ case ts.SyntaxKind.NonNullExpression:
+ case ts.SyntaxKind.AsExpression:
+ _this.verifyCast(node);
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ Walker.prototype.verifyCast = function (node) {
+ var castType = this.checker.getTypeAtLocation(node);
+ if (castType === undefined) {
+ return;
+ }
+ var uncastType = this.checker.getTypeAtLocation(node.expression);
+ 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()));
+ }
+ };
+ return Walker;
+}(Lint.AbstractWalker));
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
new file mode 100644
index 000000000..2ecf3f4c4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
@@ -0,0 +1,26 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
+declare module "typescript" {
+ function isExpression(node: ts.Node): node is ts.Expression;
+}
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
new file mode 100644
index 000000000..f07eff92b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
@@ -0,0 +1,218 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Unsafe use of expression of type 'any'.";
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ if (ctx.sourceFile.isDeclarationFile) {
+ // Not possible in a declaration file.
+ return;
+ }
+ return ts.forEachChild(ctx.sourceFile, cb);
+ /** @param anyOk If true, this node will be allowed to be of type *any*. (But its children might not.) */
+ function cb(node, anyOk) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ParenthesizedExpression:
+ // Don't warn on a parenthesized expression, warn on its contents.
+ return cb(node.expression, anyOk);
+ case ts.SyntaxKind.Parameter: {
+ var _a = node, type = _a.type, initializer = _a.initializer;
+ if (initializer !== undefined) {
+ return cb(initializer, /*anyOk*/ type !== undefined && type.kind === ts.SyntaxKind.AnyKeyword);
+ }
+ return;
+ }
+ case ts.SyntaxKind.LabeledStatement:
+ // Ignore label
+ return cb(node.statement);
+ case ts.SyntaxKind.BreakStatement: // Ignore label
+ // Ignore types
+ case ts.SyntaxKind.InterfaceDeclaration:
+ case ts.SyntaxKind.TypeAliasDeclaration:
+ case ts.SyntaxKind.QualifiedName:
+ case ts.SyntaxKind.TypePredicate:
+ case ts.SyntaxKind.TypeOfExpression:
+ // Ignore imports
+ case ts.SyntaxKind.ImportEqualsDeclaration:
+ case ts.SyntaxKind.ImportDeclaration:
+ case ts.SyntaxKind.ExportDeclaration:
+ // These show as type "any" if in type position.
+ case ts.SyntaxKind.NumericLiteral:
+ case ts.SyntaxKind.StringLiteral:
+ return;
+ // Recurse through these, but ignore the immediate child because it is allowed to be 'any'.
+ case ts.SyntaxKind.DeleteExpression:
+ case ts.SyntaxKind.ExpressionStatement:
+ case ts.SyntaxKind.TypeAssertionExpression:
+ case ts.SyntaxKind.AsExpression:
+ case ts.SyntaxKind.TemplateSpan: // Allow stringification (works on all values). Note: tagged templates handled differently.
+ case ts.SyntaxKind.ThrowStatement: {
+ var expression = node.expression;
+ return cb(expression, /*anyOk*/ true);
+ }
+ case ts.SyntaxKind.PropertyAssignment: {
+ // Only check RHS.
+ var _b = node, name = _b.name, initializer = _b.initializer;
+ // The LHS will be 'any' if the RHS is, so just handle the RHS.
+ // Still need to check the LHS in case it is a computed key.
+ cb(name, /*anyOk*/ true);
+ cb(initializer);
+ return;
+ }
+ case ts.SyntaxKind.PropertyDeclaration: {
+ var _c = node, name = _c.name, initializer = _c.initializer;
+ if (initializer !== undefined) {
+ return cb(initializer, /*anyOk*/ isNodeAny(name, checker));
+ }
+ return;
+ }
+ case ts.SyntaxKind.TaggedTemplateExpression: {
+ var _d = node, tag = _d.tag, template = _d.template;
+ cb(tag);
+ if (template.kind === ts.SyntaxKind.TemplateExpression) {
+ for (var _i = 0, _e = template.templateSpans; _i < _e.length; _i++) {
+ var expression = _e[_i].expression;
+ checkContextual(expression);
+ }
+ }
+ // Also check the template expression itself
+ check();
+ return;
+ }
+ case ts.SyntaxKind.CallExpression:
+ case ts.SyntaxKind.NewExpression: {
+ var _f = node, expression = _f.expression, args = _f.arguments;
+ cb(expression);
+ if (args !== undefined) {
+ for (var _g = 0, args_1 = args; _g < args_1.length; _g++) {
+ var arg = args_1[_g];
+ checkContextual(arg);
+ }
+ }
+ // Also check the call expression itself
+ check();
+ return;
+ }
+ case ts.SyntaxKind.PropertyAccessExpression:
+ // Don't warn for right hand side; this is redundant if we warn for the access itself.
+ cb(node.expression);
+ check();
+ return;
+ case ts.SyntaxKind.VariableDeclaration:
+ return checkVariableDeclaration(node);
+ case ts.SyntaxKind.BinaryExpression:
+ return checkBinaryExpression(node);
+ case ts.SyntaxKind.ReturnStatement: {
+ var expression = node.expression;
+ if (expression !== undefined) {
+ return checkContextual(expression);
+ }
+ return;
+ }
+ default:
+ if (!(ts.isExpression(node) && check())) {
+ return ts.forEachChild(node, cb);
+ }
+ return;
+ }
+ function check() {
+ var isUnsafe = anyOk !== true && isNodeAny(node, checker);
+ if (isUnsafe) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return isUnsafe;
+ }
+ }
+ /** OK for this value to be 'any' if that's its contextual type. */
+ function checkContextual(arg) {
+ return cb(arg, /*anyOk*/ isAny(checker.getContextualType(arg)));
+ }
+ // Allow `const x = foo;` and `const x: any = foo`, but not `const x: Foo = foo;`.
+ function checkVariableDeclaration(_a) {
+ var type = _a.type, initializer = _a.initializer;
+ // Always allow the LHS to be `any`. Just don't allow RHS to be `any` when LHS isn't.
+ // TODO: handle destructuring
+ if (initializer !== undefined) {
+ return cb(initializer, /*anyOk*/ type === undefined || type.kind === ts.SyntaxKind.AnyKeyword);
+ }
+ return;
+ }
+ function checkBinaryExpression(node) {
+ var _a = node, left = _a.left, right = _a.right, operatorToken = _a.operatorToken;
+ // Allow equality since all values support equality.
+ if (Lint.getEqualsKind(operatorToken) !== undefined) {
+ return;
+ }
+ switch (operatorToken.kind) {
+ case ts.SyntaxKind.InstanceOfKeyword:
+ return cb(right);
+ case ts.SyntaxKind.CommaToken:
+ cb(left, /*anyOk*/ true);
+ return cb(right, /*anyOk*/ true);
+ case ts.SyntaxKind.EqualsToken:
+ // Allow assignment if the lhs is also *any*.
+ // TODO: handle destructuring
+ cb(right, /*anyOk*/ isNodeAny(left, checker));
+ return;
+ case ts.SyntaxKind.PlusToken: // Allow implicit stringification
+ case ts.SyntaxKind.PlusEqualsToken:
+ var anyOk = isStringLike(left, checker)
+ || (isStringLike(right, checker) && operatorToken.kind === ts.SyntaxKind.PlusToken);
+ cb(left, anyOk);
+ return cb(right, anyOk);
+ default:
+ cb(left);
+ return cb(right);
+ }
+ }
+}
+function isNodeAny(node, checker) {
+ return isAny(checker.getTypeAtLocation(node));
+}
+function isStringLike(expr, checker) {
+ return Lint.isTypeFlagSet(checker.getTypeAtLocation(expr), ts.TypeFlags.StringLike);
+}
+function isAny(type) {
+ return type !== undefined && Lint.isTypeFlagSet(type, ts.TypeFlags.Any);
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
new file mode 100644
index 000000000..117f46536
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
@@ -0,0 +1,7 @@
+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(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
new file mode 100644
index 000000000..74710ce46
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
@@ -0,0 +1,136 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "'" + name + "' statements in finally blocks are forbidden.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var inFinally = false;
+ ts.forEachChild(ctx.sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.TryStatement:
+ var _a = node, tryBlock = _a.tryBlock, catchClause = _a.catchClause, finallyBlock = _a.finallyBlock;
+ ts.forEachChild(tryBlock, cb);
+ if (catchClause !== undefined) {
+ ts.forEachChild(catchClause, cb);
+ }
+ if (finallyBlock !== undefined) {
+ var old = inFinally;
+ inFinally = true;
+ cb(finallyBlock);
+ inFinally = old;
+ }
+ break;
+ case ts.SyntaxKind.BreakStatement:
+ case ts.SyntaxKind.ContinueStatement:
+ case ts.SyntaxKind.ThrowStatement:
+ case ts.SyntaxKind.ReturnStatement:
+ if (inFinally && !jumpIsLocalToFinallyBlock(node)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING(printJumpKind(node)));
+ }
+ // falls through
+ default:
+ return ts.forEachChild(node, cb);
+ }
+ });
+}
+function jumpIsLocalToFinallyBlock(jump) {
+ var isBreakOrContinue = utils.isBreakOrContinueStatement(jump);
+ var label = isBreakOrContinue ? jump.label : undefined;
+ var node = jump;
+ // This should only be called inside a finally block, so we'll eventually reach the TryStatement case and return.
+ while (true) {
+ var parent = node.parent;
+ switch (parent.kind) {
+ case ts.SyntaxKind.TryStatement:
+ if (parent.finallyBlock === node) {
+ return false;
+ }
+ break;
+ case ts.SyntaxKind.SwitchStatement:
+ if (jump.kind === ts.SyntaxKind.BreakStatement && label === undefined) {
+ return true;
+ }
+ break;
+ case ts.SyntaxKind.ForInStatement:
+ case ts.SyntaxKind.ForOfStatement:
+ case ts.SyntaxKind.ForStatement:
+ case ts.SyntaxKind.WhileStatement:
+ case ts.SyntaxKind.DoStatement:
+ if (isBreakOrContinue && label === undefined) {
+ return true;
+ }
+ break;
+ case ts.SyntaxKind.LabeledStatement: {
+ var text = parent.label.text;
+ if (label !== undefined && label.text === text) {
+ return true;
+ }
+ break;
+ }
+ default:
+ if (utils.isFunctionScopeBoundary(parent)) {
+ // Haven't seen TryStatement yet, so the function is inside it.
+ // No jump statement can escape a function, so the jump is local.
+ return true;
+ }
+ }
+ node = parent;
+ }
+}
+function printJumpKind(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.BreakStatement:
+ return "break";
+ case ts.SyntaxKind.ContinueStatement:
+ return "continue";
+ case ts.SyntaxKind.ThrowStatement:
+ return "throw";
+ case ts.SyntaxKind.ReturnStatement:
+ return "return";
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
new file mode 100644
index 000000000..5e62e79e8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
@@ -0,0 +1,214 @@
+"use strict";
+/**
+ * @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.
+ */
+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 ALLOW_FAST_NULL_CHECKS = "allow-fast-null-checks";
+var ALLOW_NEW = "allow-new";
+var ALLOW_TAGGED_TEMPLATE = "allow-tagged-template";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, {
+ allowFastNullChecks: this.ruleArguments.indexOf(ALLOW_FAST_NULL_CHECKS) !== -1,
+ allowNew: this.ruleArguments.indexOf(ALLOW_NEW) !== -1,
+ allowTaggedTemplate: this.ruleArguments.indexOf(ALLOW_TAGGED_TEMPLATE) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [ALLOW_FAST_NULL_CHECKS, ALLOW_NEW, ALLOW_TAGGED_TEMPLATE],
+ },
+ minLength: 0,
+ maxLength: 3,
+ },
+ optionExamples: [true, [true, ALLOW_FAST_NULL_CHECKS]],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "unused expression, expected an assignment or function call";
+exports.Rule = Rule;
+function walk(ctx) {
+ var checking = false;
+ var allowFastNullChecks = true;
+ return ts.forEachChild(ctx.sourceFile, cb);
+ function cb(node) {
+ if (checking) {
+ if (tsutils_1.isParenthesizedExpression(node) || tsutils_1.isVoidExpression(node)) {
+ return cb(node.expression);
+ }
+ else if (tsutils_1.isConditionalExpression(node)) {
+ noCheck(node.condition, cb);
+ return both(node.whenTrue, node.whenFalse);
+ }
+ else if (tsutils_1.isBinaryExpression(node)) {
+ switch (node.operatorToken.kind) {
+ case ts.SyntaxKind.CommaToken:
+ if (isIndirectEval(node)) {
+ return false;
+ }
+ return both(node.left, node.right);
+ case ts.SyntaxKind.AmpersandAmpersandToken:
+ case ts.SyntaxKind.BarBarToken:
+ if (allowFastNullChecks) {
+ noCheck(node.left, cb);
+ return cb(node.right);
+ }
+ }
+ }
+ noCheck(node, forEachChild);
+ return isUnusedExpression(node, ctx.options);
+ }
+ if (tsutils_1.isExpressionStatement(node)) {
+ allowFastNullChecks = ctx.options.allowFastNullChecks;
+ if (!isDirective(node)) {
+ check(node.expression, node);
+ }
+ allowFastNullChecks = true;
+ return false;
+ }
+ else if (tsutils_1.isVoidExpression(node)) {
+ // allow `void 0` and `void(0)`
+ if (!isLiteralZero(tsutils_1.isParenthesizedExpression(node.expression) ? node.expression.expression : node.expression)) {
+ check(node.expression);
+ }
+ return false;
+ }
+ else if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.CommaToken && !isIndirectEval(node)) {
+ check(node.left);
+ return cb(node.right);
+ }
+ return ts.forEachChild(node, cb);
+ }
+ function forEachChild(node) {
+ return ts.forEachChild(node, cb);
+ }
+ function check(node, failNode) {
+ checking = true;
+ if (cb(node)) {
+ ctx.addFailureAtNode(failNode === undefined ? node : failNode, Rule.FAILURE_STRING);
+ }
+ checking = false;
+ }
+ function noCheck(node, callback) {
+ var old = allowFastNullChecks;
+ checking = false;
+ allowFastNullChecks = true;
+ callback(node);
+ allowFastNullChecks = old;
+ checking = true;
+ }
+ function both(one, two) {
+ if (cb(one)) {
+ if (cb(two)) {
+ return true;
+ }
+ else {
+ ctx.addFailureAtNode(one, Rule.FAILURE_STRING);
+ }
+ }
+ else if (cb(two)) {
+ ctx.addFailureAtNode(two, Rule.FAILURE_STRING);
+ }
+ return false;
+ }
+}
+function isUnusedExpression(node, options) {
+ switch (node.kind) {
+ case ts.SyntaxKind.CallExpression:
+ case ts.SyntaxKind.YieldExpression:
+ case ts.SyntaxKind.DeleteExpression:
+ case ts.SyntaxKind.AwaitExpression:
+ case ts.SyntaxKind.PostfixUnaryExpression:
+ return false;
+ case ts.SyntaxKind.NewExpression:
+ return !options.allowNew;
+ case ts.SyntaxKind.TaggedTemplateExpression:
+ return !options.allowTaggedTemplate;
+ case ts.SyntaxKind.BinaryExpression:
+ return !tsutils_1.isAssignmentKind(node.operatorToken.kind);
+ case ts.SyntaxKind.PrefixUnaryExpression:
+ return node.operator !== ts.SyntaxKind.PlusPlusToken &&
+ node.operator !== ts.SyntaxKind.MinusMinusToken;
+ default:
+ return true;
+ }
+}
+function isLiteralZero(node) {
+ return tsutils_1.isNumericLiteral(node) && node.text === "0";
+}
+function isIndirectEval(node) {
+ return tsutils_1.isIdentifier(node.right) && node.right.text === "eval" &&
+ isLiteralZero(node.left) &&
+ node.parent.kind === ts.SyntaxKind.ParenthesizedExpression &&
+ node.parent.parent.kind === ts.SyntaxKind.CallExpression;
+}
+function isDirective(node) {
+ if (node.expression.kind !== ts.SyntaxKind.StringLiteral || !canContainDirective(node.parent)) {
+ return false;
+ }
+ var parent = node.parent;
+ // check if all previous statements in block are also directives
+ for (var i = parent.statements.indexOf(node) - 1; i >= 0; --i) {
+ var statement = parent.statements[i];
+ if (!tsutils_1.isExpressionStatement(statement) || statement.expression.kind !== ts.SyntaxKind.StringLiteral) {
+ return false;
+ }
+ }
+ return true;
+}
+function canContainDirective(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.SourceFile:
+ case ts.SyntaxKind.ModuleBlock:
+ return true;
+ case ts.SyntaxKind.Block:
+ switch (node.parent.kind) {
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+}
+var _a, _b, _c;
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
new file mode 100644
index 000000000..60ae7f538
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
@@ -0,0 +1,6 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.js b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
new file mode 100644
index 000000000..79fcb599d
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
@@ -0,0 +1,350 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_CHECK_PARAMETERS = "check-parameters";
+var OPTION_IGNORE_PATTERN = "ignore-pattern";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ var _this = this;
+ var x = program.getCompilerOptions();
+ if (x.noUnusedLocals === true && x.noUnusedParameters === true) {
+ console.warn("WARNING: 'no-unused-variable' lint rule does not need to be set if " +
+ "the 'no-unused-locals' and 'no-unused-parameters' compiler options are enabled.");
+ }
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program, parseOptions(_this.ruleArguments)); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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)),
+ hasFix: true,
+ optionsDescription: (_b = ["\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 that match the pattern will be ignored."], _b.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 that match the pattern will be ignored."], Lint.Utils.dedent(_b)),
+ options: {
+ type: "array",
+ items: {
+ oneOf: [
+ {
+ type: "string",
+ enum: ["check-parameters"],
+ },
+ {
+ type: "object",
+ properties: {
+ "ignore-pattern": { type: "string" },
+ },
+ additionalProperties: false,
+ },
+ ],
+ },
+ minLength: 0,
+ maxLength: 3,
+ },
+ optionExamples: [true, [true, { "ignore-pattern": "^_" }]],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function parseOptions(options) {
+ var checkParameters = options.indexOf(OPTION_CHECK_PARAMETERS) !== -1;
+ var ignorePattern;
+ for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
+ var o = options_1[_i];
+ if (typeof o === "object") {
+ // tslint:disable-next-line no-unsafe-any
+ var ignore = o[OPTION_IGNORE_PATTERN];
+ if (ignore != null) {
+ ignorePattern = new RegExp(ignore);
+ break;
+ }
+ }
+ }
+ return { checkParameters: checkParameters, ignorePattern: ignorePattern };
+}
+function walk(ctx, program, _a) {
+ var checkParameters = _a.checkParameters, ignorePattern = _a.ignorePattern;
+ var sourceFile = ctx.sourceFile;
+ var unusedCheckedProgram = getUnusedCheckedProgram(program, checkParameters);
+ var diagnostics = ts.getPreEmitDiagnostics(unusedCheckedProgram, sourceFile);
+ var checker = unusedCheckedProgram.getTypeChecker(); // Doesn't matter which program is used for this.
+ // If all specifiers in an import are unused, we elide the entire import.
+ var importSpecifierFailures = new Map();
+ for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
+ var diag = diagnostics_1[_i];
+ var kind = getUnusedDiagnostic(diag);
+ if (kind === undefined) {
+ continue;
+ }
+ var failure = ts.flattenDiagnosticMessageText(diag.messageText, "\n");
+ if (kind === 0 /* VARIABLE_OR_PARAMETER */) {
+ var importName = findImport(diag.start, sourceFile);
+ if (importName !== undefined) {
+ if (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);
+ continue;
+ }
+ }
+ if (ignorePattern !== undefined) {
+ var varName = /'(.*)'/.exec(failure)[1];
+ if (ignorePattern.test(varName)) {
+ continue;
+ }
+ }
+ ctx.addFailureAt(diag.start, diag.length, failure);
+ }
+ if (importSpecifierFailures.size !== 0) {
+ addImportSpecifierFailures(ctx, importSpecifierFailures, sourceFile);
+ }
+}
+/**
+ * Handle import-specifier failures separately.
+ * - If all of the import specifiers in an import are unused, add a combined failure for them all.
+ * - Unused imports are fixable.
+ */
+function addImportSpecifierFailures(ctx, failures, sourceFile) {
+ // tslint:disable return-undefined
+ // (fixed in tslint 5.3)
+ forEachImport(sourceFile, function (importNode) {
+ if (importNode.kind === ts.SyntaxKind.ImportEqualsDeclaration) {
+ tryRemoveAll(importNode.name);
+ return;
+ }
+ if (importNode.importClause === undefined) {
+ // Error node
+ return;
+ }
+ var _a = importNode.importClause, defaultName = _a.name, namedBindings = _a.namedBindings;
+ if (namedBindings !== undefined && namedBindings.kind === ts.SyntaxKind.NamespaceImport) {
+ tryRemoveAll(namedBindings.name);
+ return;
+ }
+ var allNamedBindingsAreFailures = namedBindings === undefined || namedBindings.elements.every(function (e) { return failures.has(e.name); });
+ if (namedBindings !== undefined && allNamedBindingsAreFailures) {
+ for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
+ var e = _b[_i];
+ failures.delete(e.name);
+ }
+ }
+ if ((defaultName === undefined || failures.has(defaultName)) && allNamedBindingsAreFailures) {
+ if (defaultName !== undefined) {
+ failures.delete(defaultName);
+ }
+ removeAll(importNode, "All imports are unused.");
+ return;
+ }
+ if (defaultName !== undefined) {
+ var failure = tryDelete(defaultName);
+ if (failure !== undefined) {
+ var start = defaultName.getStart();
+ var end = namedBindings !== undefined ? namedBindings.getStart() : importNode.moduleSpecifier.getStart();
+ var fix = Lint.Replacement.deleteFromTo(start, end);
+ ctx.addFailureAtNode(defaultName, failure, fix);
+ }
+ }
+ if (namedBindings !== undefined) {
+ if (allNamedBindingsAreFailures) {
+ var start = defaultName !== undefined ? defaultName.getEnd() : namedBindings.getStart();
+ var fix = Lint.Replacement.deleteFromTo(start, namedBindings.getEnd());
+ var failure = "All named bindings are unused.";
+ ctx.addFailureAtNode(namedBindings, failure, fix);
+ }
+ else {
+ var elements = namedBindings.elements;
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ var failure = tryDelete(element.name);
+ if (failure === undefined) {
+ continue;
+ }
+ var prevElement = elements[i - 1];
+ var nextElement = elements[i + 1];
+ var start = prevElement !== undefined ? prevElement.getEnd() : element.getStart();
+ var end = nextElement !== undefined && prevElement == undefined ? nextElement.getStart() : element.getEnd();
+ var fix = Lint.Replacement.deleteFromTo(start, end);
+ ctx.addFailureAtNode(element.name, failure, fix);
+ }
+ }
+ }
+ function tryRemoveAll(name) {
+ var failure = tryDelete(name);
+ if (failure !== undefined) {
+ removeAll(name, failure);
+ }
+ }
+ function removeAll(errorNode, failure) {
+ var fix = Lint.Replacement.deleteFromTo(importNode.getStart(), importNode.getEnd());
+ ctx.addFailureAtNode(errorNode, failure, fix);
+ }
+ });
+ if (failures.size !== 0) {
+ throw new Error("Should have revisited all import specifier failures.");
+ }
+ function tryDelete(name) {
+ var failure = failures.get(name);
+ if (failure !== undefined) {
+ failures.delete(name);
+ return failure;
+ }
+ return undefined;
+ }
+}
+/**
+ * Ignore this import if it's used as an implicit type somewhere.
+ * Workround for https://github.com/Microsoft/TypeScript/issues/9944
+ */
+function isImportUsed(importSpecifier, sourceFile, checker) {
+ var importedSymbol = checker.getSymbolAtLocation(importSpecifier);
+ if (importedSymbol === undefined) {
+ return false;
+ }
+ var symbol = checker.getAliasedSymbol(importedSymbol);
+ if (!Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
+ return false;
+ }
+ return ts.forEachChild(sourceFile, function cb(child) {
+ if (isImportLike(child)) {
+ return false;
+ }
+ var type = getImplicitType(child, checker);
+ // TODO: checker.typeEquals https://github.com/Microsoft/TypeScript/issues/13502
+ if (type !== undefined && checker.typeToString(type) === checker.symbolToString(symbol)) {
+ return true;
+ }
+ return ts.forEachChild(child, cb);
+ });
+}
+function getImplicitType(node, checker) {
+ if ((utils.isPropertyDeclaration(node) || utils.isVariableDeclaration(node)) && node.type === undefined) {
+ return checker.getTypeAtLocation(node);
+ }
+ else if (utils.isSignatureDeclaration(node) && node.type === undefined) {
+ var sig = checker.getSignatureFromDeclaration(node);
+ return sig === undefined ? undefined : sig.getReturnType();
+ }
+ else {
+ return undefined;
+ }
+}
+function isImportLike(node) {
+ return node.kind === ts.SyntaxKind.ImportDeclaration || node.kind === ts.SyntaxKind.ImportEqualsDeclaration;
+}
+function forEachImport(sourceFile, f) {
+ return ts.forEachChild(sourceFile, function (child) {
+ if (isImportLike(child)) {
+ var res = f(child);
+ if (res !== undefined) {
+ return res;
+ }
+ }
+ return undefined;
+ });
+}
+function findImport(pos, sourceFile) {
+ return forEachImport(sourceFile, function (i) {
+ if (i.kind === ts.SyntaxKind.ImportEqualsDeclaration) {
+ if (i.name.getStart() === pos) {
+ return i.name;
+ }
+ }
+ else {
+ if (i.importClause === undefined) {
+ // Error node
+ return undefined;
+ }
+ 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 undefined;
+ }
+ if (defaultName !== undefined && defaultName.getStart() === pos) {
+ return defaultName;
+ }
+ else if (namedBindings !== undefined) {
+ for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
+ var name = _b[_i].name;
+ if (name.getStart() === pos) {
+ return name;
+ }
+ }
+ }
+ }
+ return undefined;
+ });
+}
+function getUnusedDiagnostic(diag) {
+ switch (diag.code) {
+ case 6133:
+ return 0 /* VARIABLE_OR_PARAMETER */; // "'{0}' is declared but never used.
+ case 6138:
+ return 1 /* PROPERTY */; // "Property '{0}' is declared but never used."
+ default:
+ return undefined;
+ }
+}
+var programToUnusedCheckedProgram = new WeakMap();
+function getUnusedCheckedProgram(program, checkParameters) {
+ // Assuming checkParameters will always have the same value, so only lookup by program.
+ var checkedProgram = programToUnusedCheckedProgram.get(program);
+ if (checkedProgram !== undefined) {
+ return checkedProgram;
+ }
+ checkedProgram = makeUnusedCheckedProgram(program, checkParameters);
+ programToUnusedCheckedProgram.set(program, checkedProgram);
+ return checkedProgram;
+}
+function makeUnusedCheckedProgram(program, checkParameters) {
+ var options = tslib_1.__assign({}, program.getCompilerOptions(), { noUnusedLocals: true }, (checkParameters ? { noUnusedParameters: true } : null));
+ var sourceFilesByName = new Map(program.getSourceFiles().map(function (s) { return [s.fileName, s]; }));
+ // tslint:disable object-literal-sort-keys
+ return ts.createProgram(Array.from(sourceFilesByName.keys()), options, {
+ fileExists: function (f) { return sourceFilesByName.has(f); },
+ readFile: function (f) {
+ var s = sourceFilesByName.get(f);
+ return s.text;
+ },
+ getSourceFile: function (f) { return sourceFilesByName.get(f); },
+ getDefaultLibFileName: function () { return ts.getDefaultLibFileName(options); },
+ writeFile: function () { },
+ getCurrentDirectory: function () { return ""; },
+ getDirectories: function () { return []; },
+ getCanonicalFileName: function (f) { return f; },
+ useCaseSensitiveFileNames: function () { return true; },
+ getNewLine: function () { return "\n"; },
+ });
+ // tslint:enable object-literal-sort-keys
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.d.ts b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.d.ts
new file mode 100644
index 000000000..558e2645c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(name: string): string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
new file mode 100644
index 000000000..0c0100dcb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
@@ -0,0 +1,87 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "variable '" + name + "' used before declaration";
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ return ts.forEachChild(ctx.sourceFile, function recur(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.TypeReference:
+ // Ignore types.
+ return;
+ case ts.SyntaxKind.PropertyAccessExpression:
+ // Ignore `y` in `x.y`, but recurse to `x`.
+ return recur(node.expression);
+ case ts.SyntaxKind.Identifier:
+ return checkIdentifier(node, checker.getSymbolAtLocation(node));
+ case ts.SyntaxKind.ExportSpecifier:
+ return checkIdentifier(node.name, checker.getExportSpecifierLocalTargetSymbol(node));
+ default:
+ return ts.forEachChild(node, recur);
+ }
+ });
+ function checkIdentifier(node, symbol) {
+ var declarations = symbol === undefined ? undefined : symbol.declarations;
+ if (declarations === undefined || declarations.length === 0) {
+ return;
+ }
+ var declaredBefore = declarations.some(function (decl) {
+ switch (decl.kind) {
+ case ts.SyntaxKind.FunctionDeclaration:
+ // Functions may be declared later.
+ return true;
+ default:
+ // Use `<=` in case this *is* the declaration.
+ // If it's a global declared in a different file, OK.
+ return decl.pos <= node.pos || decl.getSourceFile() !== ctx.sourceFile;
+ }
+ });
+ if (!declaredBefore) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING(node.text));
+ }
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.js b/node_modules/tslint/lib/rules/noVarKeywordRule.js
new file mode 100644
index 000000000..ecfcec88e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.js
@@ -0,0 +1,69 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "no-var-keyword",
+ description: "Disallows usage of the `var` keyword.",
+ descriptionDetails: "Use `let` or `const` instead.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Forbidden 'var' keyword, use 'let' or 'const' instead";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ var parent = node.parent;
+ if (tsutils_1.isVariableDeclarationList(node)
+ && !tsutils_1.isBlockScopedVariableDeclarationList(node)
+ && (!tsutils_1.isVariableStatement(parent) || !isGlobalVarDeclaration(parent))) {
+ var start = node.getStart(sourceFile);
+ var width = "var".length;
+ // Don't apply fix in a declaration file, because may have meant 'const'.
+ var fix = sourceFile.isDeclarationFile ? undefined : new Lint.Replacement(start, width, "let");
+ ctx.addFailureAt(start, width, Rule.FAILURE_STRING, fix);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+// 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);
+}
diff --git a/node_modules/tslint/lib/rules/noVarRequiresRule.d.ts b/node_modules/tslint/lib/rules/noVarRequiresRule.d.ts
new file mode 100644
index 000000000..cb4dfbb50
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVarRequiresRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noVarRequiresRule.js b/node_modules/tslint/lib/rules/noVarRequiresRule.js
new file mode 100644
index 000000000..47c537b1b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVarRequiresRule.js
@@ -0,0 +1,70 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+// tslint:disable deprecation
+// (https://github.com/palantir/tslint/pull/2341)
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var requiresWalker = new NoVarRequiresWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(requiresWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "require statement not part of an import statement";
+exports.Rule = Rule;
+var NoVarRequiresWalker = (function (_super) {
+ tslib_1.__extends(NoVarRequiresWalker, _super);
+ function NoVarRequiresWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ NoVarRequiresWalker.prototype.createScope = function () {
+ return {};
+ };
+ NoVarRequiresWalker.prototype.visitCallExpression = function (node) {
+ var expression = node.expression;
+ if (this.getCurrentDepth() <= 1 && expression.kind === ts.SyntaxKind.Identifier) {
+ var identifierName = expression.text;
+ if (identifierName === "require") {
+ // if we're calling (invoking) require, then it's not part of an import statement
+ this.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ _super.prototype.visitCallExpression.call(this, node);
+ };
+ return NoVarRequiresWalker;
+}(Lint.ScopeAwareRuleWalker));
+var _a;
diff --git a/node_modules/tslint/lib/rules/noVoidExpressionRule.d.ts b/node_modules/tslint/lib/rules/noVoidExpressionRule.d.ts
new file mode 100644
index 000000000..8b31e4da7
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVoidExpressionRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noVoidExpressionRule.js b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
new file mode 100644
index 000000000..e80ec2cf6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
@@ -0,0 +1,87 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ var ignoreArrowFunctionShorthand = this.ruleArguments.indexOf(OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND) !== -1;
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); }, { ignoreArrowFunctionShorthand: ignoreArrowFunctionShorthand });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND],
+ },
+ minLength: 0,
+ maxLength: 1,
+ },
+ requiresTypeInfo: true,
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Expression has type `void`. Put it on its own line as a statement.";
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ var sourceFile = ctx.sourceFile, ignoreArrowFunctionShorthand = ctx.options.ignoreArrowFunctionShorthand;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (isPossiblyVoidExpression(node)
+ && !isParentAllowedVoid(node)
+ && utils_1.isTypeFlagSet(checker.getTypeAtLocation(node), ts.TypeFlags.Void)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function isParentAllowedVoid(node) {
+ switch (node.parent.kind) {
+ case ts.SyntaxKind.ExpressionStatement:
+ return true;
+ case ts.SyntaxKind.ArrowFunction:
+ return ignoreArrowFunctionShorthand;
+ default:
+ return false;
+ }
+ }
+}
+function isPossiblyVoidExpression(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.AwaitExpression:
+ case ts.SyntaxKind.CallExpression:
+ case ts.SyntaxKind.TaggedTemplateExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
new file mode 100644
index 000000000..352592b23
--- /dev/null
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
@@ -0,0 +1,11 @@
+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_LEADING_0: string;
+ static FAILURE_STRING_TRAILING_0: string;
+ static FAILURE_STRING_TRAILING_DECIMAL: string;
+ static FAILURE_STRING_LEADING_DECIMAL: string;
+ static FAILURE_STRING_NOT_UPPERCASE: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
new file mode 100644
index 000000000..b902a30eb
--- /dev/null
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
@@ -0,0 +1,104 @@
+"use strict";
+/**
+ * @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.
+ */
+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("../utils");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "number-literal-format",
+ description: "Checks that decimal literals should begin with '0.' instead of just '.', and should not end with a trailing '0'.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_LEADING_0 = "Number literal should not have a leading '0'.";
+Rule.FAILURE_STRING_TRAILING_0 = "Number literal should not have a trailing '0'.";
+Rule.FAILURE_STRING_TRAILING_DECIMAL = "Number literal should not end in '.'.";
+Rule.FAILURE_STRING_LEADING_DECIMAL = "Number literal should begin with '0.' and not just '.'.";
+Rule.FAILURE_STRING_NOT_UPPERCASE = "Hexadecimal number literal should be uppercase.";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (tsutils_1.isNumericLiteral(node)) {
+ return check(node);
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function check(node) {
+ // Apparently the number literal '0.0' has a '.text' of '0', so use '.getText()' instead.
+ var text = node.getText(sourceFile);
+ if (text.length <= 1) {
+ return;
+ }
+ if (text.startsWith("0")) {
+ // Hex/octal/binary number can't have decimal point or exponent, so no other errors possible.
+ switch (text[1]) {
+ case "x":
+ if (!utils_1.isUpperCase(text.slice(2))) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_NOT_UPPERCASE);
+ }
+ return;
+ case "o":
+ case "b":
+ return;
+ case ".":
+ break;
+ default:
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_LEADING_0);
+ return;
+ }
+ }
+ var _a = text.split(/e/i), num = _a[0], exp = _a[1];
+ if (exp !== undefined && (exp.startsWith("-0") || exp.startsWith("0"))) {
+ ctx.addFailureAt(node.getEnd() - exp.length, exp.length, Rule.FAILURE_STRING_LEADING_0);
+ }
+ if (!num.includes(".")) {
+ return;
+ }
+ if (num.startsWith(".")) {
+ fail(Rule.FAILURE_STRING_LEADING_DECIMAL);
+ }
+ if (num.endsWith(".")) {
+ fail(Rule.FAILURE_STRING_TRAILING_DECIMAL);
+ }
+ // Allow '10', but not '1.0'
+ if (num.endsWith("0")) {
+ fail(Rule.FAILURE_STRING_TRAILING_0);
+ }
+ function fail(message) {
+ ctx.addFailureAt(node.getStart(sourceFile), num.length, message);
+ }
+ }
+}
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
new file mode 100644
index 000000000..41a6e7c56
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
@@ -0,0 +1,9 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static INCONSISTENT_PROPERTY: string;
+ static UNNEEDED_QUOTES(name: string): string;
+ static UNQUOTED_PROPERTY(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
new file mode 100644
index 000000000..073bdf035
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
@@ -0,0 +1,150 @@
+"use strict";
+/**
+ * @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.
+ */
+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_ALWAYS = "always";
+var OPTION_AS_NEEDED = "as-needed";
+var OPTION_CONSISTENT = "consistent";
+var OPTION_CONSISTENT_AS_NEEDED = "consistent-as-needed";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.UNNEEDED_QUOTES = function (name) {
+ return "Unnecessarily quoted property '" + name + "' found.";
+ };
+ Rule.UNQUOTED_PROPERTY = function (name) {
+ return "Unquoted property '" + name + "' found.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new ObjectLiteralKeyQuotesWalker(sourceFile, this.ruleName, {
+ option: this.ruleArguments.length === 0 ? "always" : this.ruleArguments[0],
+ }));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ 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)),
+ options: {
+ type: "string",
+ enum: [OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED],
+ },
+ optionExamples: [[true, OPTION_AS_NEEDED], [true, OPTION_ALWAYS]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.INCONSISTENT_PROPERTY = "All property names in this object literal must be consistently quoted or unquoted.";
+exports.Rule = Rule;
+var ObjectLiteralKeyQuotesWalker = (function (_super) {
+ tslib_1.__extends(ObjectLiteralKeyQuotesWalker, _super);
+ function ObjectLiteralKeyQuotesWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ObjectLiteralKeyQuotesWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (tsutils_1.isObjectLiteralExpression(node)) {
+ var propertyNames = Lint.Utils.mapDefined(node.properties, mapPropertyName);
+ outer: switch (_this.options.option) {
+ case "always":
+ for (var _i = 0, propertyNames_1 = propertyNames; _i < propertyNames_1.length; _i++) {
+ var name = propertyNames_1[_i];
+ if (name.kind !== ts.SyntaxKind.StringLiteral) {
+ _this.reportMissing(name);
+ }
+ }
+ break;
+ case "as-needed":
+ for (var _a = 0, propertyNames_2 = propertyNames; _a < propertyNames_2.length; _a++) {
+ var name = propertyNames_2[_a];
+ if (name.kind === ts.SyntaxKind.StringLiteral && tsutils_1.isValidPropertyName(name.text)) {
+ _this.reportUnnecessary(name);
+ }
+ }
+ break;
+ case "consistent":
+ if (hasInconsistentQuotes(propertyNames)) {
+ // No fix -- don't know if they would want to add quotes or remove them.
+ _this.addFailureAt(node.getStart(_this.sourceFile), 1, Rule.INCONSISTENT_PROPERTY);
+ }
+ break;
+ case "consistent-as-needed":
+ for (var _b = 0, propertyNames_3 = propertyNames; _b < propertyNames_3.length; _b++) {
+ var name = propertyNames_3[_b];
+ if (name.kind === ts.SyntaxKind.StringLiteral && !tsutils_1.isValidPropertyName(name.text)) {
+ for (var _c = 0, propertyNames_4 = propertyNames; _c < propertyNames_4.length; _c++) {
+ var propertyName = propertyNames_4[_c];
+ if (propertyName.kind !== ts.SyntaxKind.StringLiteral) {
+ _this.reportMissing(propertyName);
+ }
+ }
+ break outer;
+ }
+ }
+ for (var _d = 0, propertyNames_5 = propertyNames; _d < propertyNames_5.length; _d++) {
+ var name = propertyNames_5[_d];
+ if (name.kind === ts.SyntaxKind.StringLiteral) {
+ _this.reportUnnecessary(name);
+ }
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ ObjectLiteralKeyQuotesWalker.prototype.reportMissing = function (node) {
+ var start = node.getStart(this.sourceFile);
+ this.addFailure(start, node.end, Rule.UNQUOTED_PROPERTY(node.text), Lint.Replacement.replaceFromTo(start, node.end, "\"" + node.text + "\""));
+ };
+ ObjectLiteralKeyQuotesWalker.prototype.reportUnnecessary = function (node) {
+ this.addFailureAtNode(node, Rule.UNNEEDED_QUOTES(node.text), Lint.Replacement.replaceNode(node, node.text, this.sourceFile));
+ };
+ return ObjectLiteralKeyQuotesWalker;
+}(Lint.AbstractWalker));
+function mapPropertyName(property) {
+ if (property.kind === ts.SyntaxKind.ShorthandPropertyAssignment ||
+ property.kind === ts.SyntaxKind.SpreadAssignment ||
+ property.name.kind === ts.SyntaxKind.ComputedPropertyName) {
+ return undefined;
+ }
+ return property.name;
+}
+function hasInconsistentQuotes(properties) {
+ if (properties.length < 2) {
+ return false;
+ }
+ var quoted = properties[0].kind === ts.SyntaxKind.StringLiteral;
+ for (var i = 1; i < properties.length; ++i) {
+ if (quoted !== (properties[i].kind === ts.SyntaxKind.StringLiteral)) {
+ return true;
+ }
+ }
+ return false;
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
new file mode 100644
index 000000000..f8528cbbc
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static LONGHAND_PROPERTY: string;
+ static LONGHAND_METHOD: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
new file mode 100644
index 000000000..90a0b34ef
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
@@ -0,0 +1,75 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var objectLiteralShorthandWalker = new ObjectLiteralShorthandWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(objectLiteralShorthandWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "object-literal-shorthand",
+ description: "Enforces use of ES6 object literal shorthand when possible.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.LONGHAND_PROPERTY = "Expected property shorthand in object literal ";
+Rule.LONGHAND_METHOD = "Expected method shorthand in object literal ";
+exports.Rule = Rule;
+var ObjectLiteralShorthandWalker = (function (_super) {
+ tslib_1.__extends(ObjectLiteralShorthandWalker, _super);
+ function ObjectLiteralShorthandWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ObjectLiteralShorthandWalker.prototype.visitPropertyAssignment = function (node) {
+ var name = node.name;
+ var value = node.initializer;
+ if (name.kind === ts.SyntaxKind.Identifier &&
+ value.kind === ts.SyntaxKind.Identifier &&
+ name.getText() === value.getText()) {
+ // Delete from name start up to value to include the ':'.
+ var lengthToValueStart = value.getStart() - name.getStart();
+ var fix = this.deleteText(name.getStart(), lengthToValueStart);
+ this.addFailureAtNode(node, Rule.LONGHAND_PROPERTY + "('{" + name.getText() + "}').", fix);
+ }
+ if (value.kind === ts.SyntaxKind.FunctionExpression) {
+ var fnNode = value;
+ if (fnNode.name !== undefined) {
+ return; // named function expressions are OK.
+ }
+ var star = fnNode.asteriskToken !== undefined ? fnNode.asteriskToken.getText() : "";
+ this.addFailureAtNode(node, Rule.LONGHAND_METHOD + "('{" + name.getText() + star + "() {...}}').");
+ }
+ _super.prototype.visitPropertyAssignment.call(this, node);
+ };
+ return ObjectLiteralShorthandWalker;
+}(Lint.RuleWalker));
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
new file mode 100644
index 000000000..1cd1b8c5c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
@@ -0,0 +1,7 @@
+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_FACTORY(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
new file mode 100644
index 000000000..fc116ec1e
--- /dev/null
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
@@ -0,0 +1,87 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_IGNORE_CASE = "ignore-case";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (name) {
+ return "The key '" + name + "' is not sorted alphabetically";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, {
+ ignoreCase: this.ruleArguments.indexOf(OPTION_IGNORE_CASE) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "object-literal-sort-keys",
+ description: "Requires keys in object literals to be sorted alphabetically",
+ rationale: "Useful in preventing merge conflicts",
+ optionsDescription: "You may optionally pass \"" + OPTION_IGNORE_CASE + "\" to compare keys case insensitive.",
+ options: {
+ type: "string",
+ enum: [OPTION_IGNORE_CASE],
+ },
+ optionExamples: [
+ true,
+ [true, OPTION_IGNORE_CASE],
+ ],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isObjectLiteralExpression(node) && node.properties.length > 1 &&
+ !tsutils_1.isSameLine(ctx.sourceFile, node.properties.pos, node.end)) {
+ var lastKey = void 0;
+ var ignoreCase = ctx.options.ignoreCase;
+ outer: 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
+ break;
+ case ts.SyntaxKind.ShorthandPropertyAssignment:
+ case ts.SyntaxKind.PropertyAssignment:
+ if (property.name.kind === ts.SyntaxKind.Identifier ||
+ property.name.kind === ts.SyntaxKind.StringLiteral) {
+ var key = ignoreCase ? property.name.text.toLowerCase() : property.name.text;
+ // comparison with undefined is expected
+ if (lastKey > key) {
+ ctx.addFailureAtNode(property.name, Rule.FAILURE_STRING_FACTORY(property.name.text));
+ break outer; // only show warning on first out-of-order property
+ }
+ lastKey = key;
+ }
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/oneLineRule.d.ts b/node_modules/tslint/lib/rules/oneLineRule.d.ts
new file mode 100644
index 000000000..0110ef383
--- /dev/null
+++ b/node_modules/tslint/lib/rules/oneLineRule.d.ts
@@ -0,0 +1,27 @@
+/**
+ * @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 BRACE_FAILURE_STRING: string;
+ static CATCH_FAILURE_STRING: string;
+ static ELSE_FAILURE_STRING: string;
+ static FINALLY_FAILURE_STRING: string;
+ static WHITESPACE_FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/oneLineRule.js b/node_modules/tslint/lib/rules/oneLineRule.js
new file mode 100644
index 000000000..be8ebd0c6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/oneLineRule.js
@@ -0,0 +1,275 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_BRACE = "check-open-brace";
+var OPTION_CATCH = "check-catch";
+var OPTION_ELSE = "check-else";
+var OPTION_FINALLY = "check-finally";
+var OPTION_WHITESPACE = "check-whitespace";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var oneLineWalker = new OneLineWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(oneLineWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE, OPTION_BRACE, OPTION_WHITESPACE],
+ },
+ minLength: 0,
+ maxLength: 5,
+ },
+ optionExamples: [[true, OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.BRACE_FAILURE_STRING = "misplaced opening brace";
+Rule.CATCH_FAILURE_STRING = "misplaced 'catch'";
+Rule.ELSE_FAILURE_STRING = "misplaced 'else'";
+Rule.FINALLY_FAILURE_STRING = "misplaced 'finally'";
+Rule.WHITESPACE_FAILURE_STRING = "missing whitespace";
+exports.Rule = Rule;
+var OneLineWalker = (function (_super) {
+ tslib_1.__extends(OneLineWalker, _super);
+ function OneLineWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ OneLineWalker.prototype.visitIfStatement = function (node) {
+ var thenStatement = node.thenStatement;
+ var thenIsBlock = thenStatement.kind === ts.SyntaxKind.Block;
+ if (thenIsBlock) {
+ var expressionCloseParen = node.getChildAt(3);
+ var thenOpeningBrace = thenStatement.getChildAt(0);
+ this.handleOpeningBrace(expressionCloseParen, thenOpeningBrace);
+ }
+ var elseStatement = node.elseStatement;
+ if (elseStatement != null) {
+ // find the else keyword
+ var elseKeyword = Lint.childOfKind(node, ts.SyntaxKind.ElseKeyword);
+ if (elseStatement.kind === ts.SyntaxKind.Block) {
+ var elseOpeningBrace = elseStatement.getChildAt(0);
+ this.handleOpeningBrace(elseKeyword, elseOpeningBrace);
+ }
+ if (thenIsBlock && this.hasOption(OPTION_ELSE)) {
+ var thenStatementEndLine = this.getLineAndCharacterOfPosition(thenStatement.getEnd()).line;
+ var elseKeywordLine = this.getLineAndCharacterOfPosition(elseKeyword.getStart()).line;
+ if (thenStatementEndLine !== elseKeywordLine) {
+ this.addFailureAtNode(elseKeyword, Rule.ELSE_FAILURE_STRING);
+ }
+ }
+ }
+ _super.prototype.visitIfStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitCatchClause = function (node) {
+ var catchClosingParen = Lint.childOfKind(node, ts.SyntaxKind.CloseParenToken);
+ var catchOpeningBrace = node.block.getChildAt(0);
+ this.handleOpeningBrace(catchClosingParen, catchOpeningBrace);
+ _super.prototype.visitCatchClause.call(this, node);
+ };
+ OneLineWalker.prototype.visitTryStatement = function (node) {
+ var catchClause = node.catchClause;
+ var finallyBlock = node.finallyBlock;
+ var finallyKeyword = Lint.childOfKind(node, ts.SyntaxKind.FinallyKeyword);
+ // "visit" try block
+ var tryKeyword = node.getChildAt(0);
+ var tryBlock = node.tryBlock;
+ var tryOpeningBrace = tryBlock.getChildAt(0);
+ this.handleOpeningBrace(tryKeyword, tryOpeningBrace);
+ if (this.hasOption(OPTION_CATCH) && catchClause != null) {
+ var tryClosingBrace = node.tryBlock.getChildAt(node.tryBlock.getChildCount() - 1);
+ var catchKeyword = catchClause.getChildAt(0);
+ var tryClosingBraceLine = this.getLineAndCharacterOfPosition(tryClosingBrace.getEnd()).line;
+ var catchKeywordLine = this.getLineAndCharacterOfPosition(catchKeyword.getStart()).line;
+ if (tryClosingBraceLine !== catchKeywordLine) {
+ this.addFailureAtNode(catchKeyword, Rule.CATCH_FAILURE_STRING);
+ }
+ }
+ if (finallyBlock != null && finallyKeyword != null) {
+ var finallyOpeningBrace = finallyBlock.getChildAt(0);
+ this.handleOpeningBrace(finallyKeyword, finallyOpeningBrace);
+ if (this.hasOption(OPTION_FINALLY)) {
+ var previousBlock = catchClause != null ? catchClause.block : node.tryBlock;
+ var closingBrace = previousBlock.getChildAt(previousBlock.getChildCount() - 1);
+ var closingBraceLine = this.getLineAndCharacterOfPosition(closingBrace.getEnd()).line;
+ var finallyKeywordLine = this.getLineAndCharacterOfPosition(finallyKeyword.getStart()).line;
+ if (closingBraceLine !== finallyKeywordLine) {
+ this.addFailureAtNode(finallyKeyword, Rule.FINALLY_FAILURE_STRING);
+ }
+ }
+ }
+ _super.prototype.visitTryStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitForStatement = function (node) {
+ this.handleIterationStatement(node);
+ _super.prototype.visitForStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitForInStatement = function (node) {
+ this.handleIterationStatement(node);
+ _super.prototype.visitForInStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitWhileStatement = function (node) {
+ this.handleIterationStatement(node);
+ _super.prototype.visitWhileStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitBinaryExpression = function (node) {
+ var rightkind = node.right.kind;
+ var opkind = node.operatorToken.kind;
+ if (opkind === ts.SyntaxKind.EqualsToken && rightkind === ts.SyntaxKind.ObjectLiteralExpression) {
+ var equalsToken = node.getChildAt(1);
+ var openBraceToken = node.right.getChildAt(0);
+ this.handleOpeningBrace(equalsToken, openBraceToken);
+ }
+ _super.prototype.visitBinaryExpression.call(this, node);
+ };
+ OneLineWalker.prototype.visitVariableDeclaration = function (node) {
+ var initializer = node.initializer;
+ if (initializer != null && initializer.kind === ts.SyntaxKind.ObjectLiteralExpression) {
+ var equalsToken = Lint.childOfKind(node, ts.SyntaxKind.EqualsToken);
+ var openBraceToken = initializer.getChildAt(0);
+ this.handleOpeningBrace(equalsToken, openBraceToken);
+ }
+ _super.prototype.visitVariableDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitDoStatement = function (node) {
+ var doKeyword = node.getChildAt(0);
+ var statement = node.statement;
+ if (statement.kind === ts.SyntaxKind.Block) {
+ var openBraceToken = statement.getChildAt(0);
+ this.handleOpeningBrace(doKeyword, openBraceToken);
+ }
+ _super.prototype.visitDoStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitModuleDeclaration = function (node) {
+ var nameNode = node.name;
+ var body = node.body;
+ if (body != null && body.kind === ts.SyntaxKind.ModuleBlock) {
+ var openBraceToken = body.getChildAt(0);
+ this.handleOpeningBrace(nameNode, openBraceToken);
+ }
+ _super.prototype.visitModuleDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitEnumDeclaration = function (node) {
+ var nameNode = node.name;
+ var openBraceToken = Lint.childOfKind(node, ts.SyntaxKind.OpenBraceToken);
+ this.handleOpeningBrace(nameNode, openBraceToken);
+ _super.prototype.visitEnumDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitSwitchStatement = function (node) {
+ var closeParenToken = node.getChildAt(3);
+ var openBraceToken = node.caseBlock.getChildAt(0);
+ this.handleOpeningBrace(closeParenToken, openBraceToken);
+ _super.prototype.visitSwitchStatement.call(this, node);
+ };
+ OneLineWalker.prototype.visitInterfaceDeclaration = function (node) {
+ this.handleClassLikeDeclaration(node);
+ _super.prototype.visitInterfaceDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitClassDeclaration = function (node) {
+ this.handleClassLikeDeclaration(node);
+ _super.prototype.visitClassDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitFunctionDeclaration = function (node) {
+ this.handleFunctionLikeDeclaration(node);
+ _super.prototype.visitFunctionDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitMethodDeclaration = function (node) {
+ this.handleFunctionLikeDeclaration(node);
+ _super.prototype.visitMethodDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitConstructorDeclaration = function (node) {
+ this.handleFunctionLikeDeclaration(node);
+ _super.prototype.visitConstructorDeclaration.call(this, node);
+ };
+ OneLineWalker.prototype.visitArrowFunction = function (node) {
+ var body = node.body;
+ if (body != null && body.kind === ts.SyntaxKind.Block) {
+ var arrowToken = Lint.childOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken);
+ var openBraceToken = body.getChildAt(0);
+ this.handleOpeningBrace(arrowToken, openBraceToken);
+ }
+ _super.prototype.visitArrowFunction.call(this, node);
+ };
+ OneLineWalker.prototype.handleFunctionLikeDeclaration = function (node) {
+ var body = node.body;
+ if (body != null && body.kind === ts.SyntaxKind.Block) {
+ var openBraceToken = body.getChildAt(0);
+ if (node.type != null) {
+ this.handleOpeningBrace(node.type, openBraceToken);
+ }
+ else {
+ var closeParenToken = Lint.childOfKind(node, ts.SyntaxKind.CloseParenToken);
+ this.handleOpeningBrace(closeParenToken, openBraceToken);
+ }
+ }
+ };
+ OneLineWalker.prototype.handleClassLikeDeclaration = function (node) {
+ var lastNodeOfDeclaration = node.name;
+ var openBraceToken = Lint.childOfKind(node, ts.SyntaxKind.OpenBraceToken);
+ if (node.heritageClauses != null) {
+ lastNodeOfDeclaration = node.heritageClauses[node.heritageClauses.length - 1];
+ }
+ else if (node.typeParameters != null) {
+ lastNodeOfDeclaration = node.typeParameters[node.typeParameters.length - 1];
+ }
+ this.handleOpeningBrace(lastNodeOfDeclaration, openBraceToken);
+ };
+ OneLineWalker.prototype.handleIterationStatement = function (node) {
+ // last child is the statement, second to last child is the close paren
+ var closeParenToken = node.getChildAt(node.getChildCount() - 2);
+ var statement = node.statement;
+ if (statement.kind === ts.SyntaxKind.Block) {
+ var openBraceToken = statement.getChildAt(0);
+ this.handleOpeningBrace(closeParenToken, openBraceToken);
+ }
+ };
+ OneLineWalker.prototype.handleOpeningBrace = function (previousNode, openBraceToken) {
+ if (previousNode == null || openBraceToken == null) {
+ return;
+ }
+ var previousNodeLine = this.getLineAndCharacterOfPosition(previousNode.getEnd()).line;
+ var openBraceLine = this.getLineAndCharacterOfPosition(openBraceToken.getStart()).line;
+ var failure;
+ if (this.hasOption(OPTION_BRACE) && previousNodeLine !== openBraceLine) {
+ failure = Rule.BRACE_FAILURE_STRING;
+ }
+ else if (this.hasOption(OPTION_WHITESPACE) && previousNode.getEnd() === openBraceToken.getStart()) {
+ failure = Rule.WHITESPACE_FAILURE_STRING;
+ }
+ if (failure !== undefined) {
+ this.addFailureAtNode(openBraceToken, failure);
+ }
+ };
+ return OneLineWalker;
+}(Lint.RuleWalker));
+var _a;
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
new file mode 100644
index 000000000..5d1f42191
--- /dev/null
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
@@ -0,0 +1,71 @@
+"use strict";
+/**
+ * @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.
+ */
+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_IGNORE_FOR_LOOP = "ignore-for-loop";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, { ignoreForLoop: this.ruleArguments.indexOf(OPTION_IGNORE_FOR_LOOP) !== -1 });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_IGNORE_FOR_LOOP],
+ },
+ minLength: 0,
+ maxLength: 1,
+ },
+ optionExamples: [true, [true, OPTION_IGNORE_FOR_LOOP]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Multiple variable declarations in the same statement are forbidden";
+exports.Rule = Rule;
+function walk(ctx) {
+ ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isVariableStatement(node) && node.declarationList.declarations.length > 1) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ else if (tsutils_1.isForStatement(node) && !ctx.options.ignoreForLoop) {
+ var initializer = node.initializer;
+ if (initializer !== undefined
+ && initializer.kind === ts.SyntaxKind.VariableDeclarationList
+ && initializer.declarations.length > 1) {
+ ctx.addFailureAtNode(initializer, Rule.FAILURE_STRING);
+ }
+ }
+ ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
new file mode 100644
index 000000000..f5d8187f8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
@@ -0,0 +1,97 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_ALLOW_DECLARATIONS = "allow-declarations";
+var OPTION_ALLOW_NAMED_FUNCTIONS = "allow-named-functions";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS],
+ },
+ minLength: 0,
+ maxLength: 1,
+ },
+ optionExamples: [true, [true, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS]],
+ type: "typescript",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "non-arrow functions are forbidden";
+exports.Rule = Rule;
+function parseOptions(ruleArguments) {
+ return {
+ allowDeclarations: hasOption(OPTION_ALLOW_DECLARATIONS),
+ allowNamedFunctions: hasOption(OPTION_ALLOW_NAMED_FUNCTIONS),
+ };
+ function hasOption(name) {
+ return ruleArguments.indexOf(name) !== -1;
+ }
+}
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, _a = ctx.options, allowDeclarations = _a.allowDeclarations, allowNamedFunctions = _a.allowNamedFunctions;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.FunctionDeclaration:
+ if (allowDeclarations) {
+ break;
+ }
+ // falls through
+ 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);
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+/** Generator functions and functions using `this` are allowed. */
+function functionIsExempt(node) {
+ return node.asteriskToken !== undefined || hasThisParameter(node) || node.body !== undefined && usesThisInBody(node.body);
+}
+function hasThisParameter(node) {
+ var first = node.parameters[0];
+ return first !== undefined && first.name.kind === ts.SyntaxKind.Identifier &&
+ first.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword;
+}
+function usesThisInBody(node) {
+ return node.kind === ts.SyntaxKind.ThisKeyword || !utils.hasOwnThisReference(node) && ts.forEachChild(node, usesThisInBody);
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.d.ts b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
new file mode 100644
index 000000000..878b820e2
--- /dev/null
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static IMPORT_SOURCES_UNORDERED: string;
+ static NAMED_IMPORTS_UNORDERED: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.js b/node_modules/tslint/lib/rules/orderedImportsRule.js
new file mode 100644
index 000000000..1d90c1677
--- /dev/null
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.js
@@ -0,0 +1,263 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var orderedImportsWalker = new OrderedImportsWalker(sourceFile, this.getOptions());
+ return this.applyWithWalker(orderedImportsWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "ordered-imports",
+ description: "Requires that import statements be alphabetized.",
+ 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."], _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."], Lint.Utils.dedent(_a)),
+ 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 `\"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 "], _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 \\`\"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 "], Lint.Utils.dedent(_b)),
+ options: {
+ type: "object",
+ properties: {
+ "import-sources-order": {
+ type: "string",
+ enum: ["case-insensitive", "lowercase-first", "lowercase-last", "any"],
+ },
+ "named-imports-order": {
+ type: "string",
+ enum: ["case-insensitive", "lowercase-first", "lowercase-last", "any"],
+ },
+ },
+ additionalProperties: false,
+ },
+ optionExamples: [
+ true,
+ [true, { "import-sources-order": "lowercase-last", "named-imports-order": "lowercase-first" }],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.IMPORT_SOURCES_UNORDERED = "Import sources within a group must be alphabetized.";
+Rule.NAMED_IMPORTS_UNORDERED = "Named imports must be alphabetized.";
+exports.Rule = Rule;
+// Convert aBcD --> AbCd
+function flipCase(x) {
+ return x.split("").map(function (char) {
+ if (char >= "a" && char <= "z") {
+ return char.toUpperCase();
+ }
+ else if (char >= "A" && char <= "Z") {
+ return char.toLowerCase();
+ }
+ return char;
+ }).join("");
+}
+// After applying a transformation, are the nodes sorted according to the text they contain?
+// If not, return the pair of nodes which are out of order.
+function findUnsortedPair(xs, transform) {
+ for (var i = 1; i < xs.length; i++) {
+ if (transform(xs[i].getText()) < transform(xs[i - 1].getText())) {
+ return [xs[i - 1], xs[i]];
+ }
+ }
+ return null;
+}
+function compare(a, b) {
+ function isLow(value) {
+ return value[0] === "." || value[0] === "/";
+ }
+ if (isLow(a) && !isLow(b)) {
+ return 1;
+ }
+ else if (!isLow(a) && isLow(b)) {
+ return -1;
+ }
+ else if (a > b) {
+ return 1;
+ }
+ else if (a < b) {
+ return -1;
+ }
+ return 0;
+}
+function removeQuotes(value) {
+ // strip out quotes
+ if (value.length > 1 && (value[0] === "'" || value[0] === "\"")) {
+ value = value.substr(1, value.length - 2);
+ }
+ return value;
+}
+function sortByKey(xs, getSortKey) {
+ return xs.slice().sort(function (a, b) {
+ return compare(getSortKey(a), getSortKey(b));
+ });
+}
+// Transformations to apply to produce the desired ordering of imports.
+// The imports must be lexicographically sorted after applying the transform.
+var TRANSFORMS = {
+ "any": function () { return ""; },
+ "case-insensitive": function (x) { return x.toLowerCase(); },
+ "lowercase-first": flipCase,
+ "lowercase-last": function (x) { return x; },
+};
+var OrderedImportsWalker = (function (_super) {
+ tslib_1.__extends(OrderedImportsWalker, _super);
+ function OrderedImportsWalker(sourceFile, options) {
+ var _this = _super.call(this, sourceFile, options) || this;
+ _this.currentImportsBlock = new ImportsBlock();
+ var optionSet = _this.getOptions()[0];
+ var _a = optionSet === undefined ? {} : optionSet, _b = _a["import-sources-order"], sources = _b === void 0 ? "case-insensitive" : _b, _c = _a["named-imports-order"], named = _c === void 0 ? "case-insensitive" : _c;
+ _this.importSourcesOrderTransform = TRANSFORMS[sources];
+ _this.namedImportsOrderTransform = TRANSFORMS[named];
+ return _this;
+ }
+ // e.g. "import Foo from "./foo";"
+ OrderedImportsWalker.prototype.visitImportDeclaration = function (node) {
+ var source = node.moduleSpecifier.getText();
+ source = removeQuotes(source);
+ source = this.importSourcesOrderTransform(source);
+ var previousSource = this.currentImportsBlock.getLastImportSource();
+ this.currentImportsBlock.addImportDeclaration(this.getSourceFile(), node, source);
+ if (previousSource !== null && compare(source, previousSource) === -1) {
+ this.lastFix = [];
+ this.addFailureAtNode(node, Rule.IMPORT_SOURCES_UNORDERED, this.lastFix);
+ }
+ _super.prototype.visitImportDeclaration.call(this, node);
+ };
+ // This is the "{A, B, C}" of "import {A, B, C} from "./foo";".
+ // We need to make sure they're alphabetized.
+ OrderedImportsWalker.prototype.visitNamedImports = function (node) {
+ var _this = this;
+ var imports = node.elements;
+ var pair = findUnsortedPair(imports, this.namedImportsOrderTransform);
+ if (pair !== null) {
+ var a = pair[0], b = pair[1];
+ var sortedDeclarations = sortByKey(imports, function (x) { return _this.namedImportsOrderTransform(x.getText()); }).map(function (x) { return x.getText(); });
+ // replace in reverse order to preserve earlier offsets
+ for (var i = imports.length - 1; i >= 0; i--) {
+ var start = imports[i].getStart();
+ var length = imports[i].getText().length;
+ // replace the named imports one at a time to preserve whitespace
+ this.currentImportsBlock.replaceNamedImports(start, length, sortedDeclarations[i]);
+ }
+ this.lastFix = [];
+ this.addFailureFromStartToEnd(a.getStart(), b.getEnd(), Rule.NAMED_IMPORTS_UNORDERED, this.lastFix);
+ }
+ _super.prototype.visitNamedImports.call(this, node);
+ };
+ // keep reading the block of import declarations until the block ends, then replace the entire block
+ // this allows the reorder of named imports to work well with reordering lines
+ OrderedImportsWalker.prototype.visitNode = function (node) {
+ var prefixLength = node.getStart() - node.getFullStart();
+ var prefix = node.getFullText().slice(0, prefixLength);
+ var hasBlankLine = prefix.indexOf("\n\n") >= 0 || prefix.indexOf("\r\n\r\n") >= 0;
+ var notImportDeclaration = node.parent != null
+ && node.parent.kind === ts.SyntaxKind.SourceFile
+ && node.kind !== ts.SyntaxKind.ImportDeclaration;
+ if (hasBlankLine || notImportDeclaration) {
+ // end of block
+ if (this.lastFix != null) {
+ var replacement = this.currentImportsBlock.getReplacement();
+ if (replacement != null) {
+ this.lastFix.push(replacement);
+ }
+ this.lastFix = null;
+ }
+ this.currentImportsBlock = new ImportsBlock();
+ }
+ _super.prototype.visitNode.call(this, node);
+ };
+ return OrderedImportsWalker;
+}(Lint.RuleWalker));
+var ImportsBlock = (function () {
+ function ImportsBlock() {
+ this.importDeclarations = [];
+ }
+ ImportsBlock.prototype.addImportDeclaration = function (sourceFile, node, sourcePath) {
+ var start = this.getStartOffset(node);
+ var end = this.getEndOffset(sourceFile, node);
+ var text = sourceFile.text.substring(start, end);
+ if (start > node.getStart() || end === 0) {
+ // skip block if any statements don't end with a newline to simplify implementation
+ this.importDeclarations = [];
+ return;
+ }
+ this.importDeclarations.push({
+ node: node,
+ nodeEndOffset: end,
+ nodeStartOffset: start,
+ sourcePath: sourcePath,
+ text: text,
+ });
+ };
+ // replaces the named imports on the most recent import declaration
+ ImportsBlock.prototype.replaceNamedImports = function (fileOffset, length, replacement) {
+ var importDeclaration = this.getLastImportDeclaration();
+ if (importDeclaration == null) {
+ // nothing to replace. This can happen if the block is skipped
+ return;
+ }
+ var start = fileOffset - importDeclaration.nodeStartOffset;
+ if (start < 0 || start + length > importDeclaration.node.getEnd()) {
+ throw new Error("Unexpected named import position");
+ }
+ var initialText = importDeclaration.text;
+ importDeclaration.text = initialText.substring(0, start) + replacement + initialText.substring(start + length);
+ };
+ ImportsBlock.prototype.getLastImportSource = function () {
+ if (this.importDeclarations.length === 0) {
+ return null;
+ }
+ return this.getLastImportDeclaration().sourcePath;
+ };
+ // creates a Lint.Replacement object with ordering fixes for the entire block
+ ImportsBlock.prototype.getReplacement = function () {
+ if (this.importDeclarations.length === 0) {
+ return null;
+ }
+ var sortedDeclarations = sortByKey(this.importDeclarations.slice(), function (x) { return x.sourcePath; });
+ var fixedText = sortedDeclarations.map(function (x) { return x.text; }).join("");
+ var start = this.importDeclarations[0].nodeStartOffset;
+ var end = this.getLastImportDeclaration().nodeEndOffset;
+ return new Lint.Replacement(start, end - start, fixedText);
+ };
+ // gets the offset immediately after the end of the previous declaration to include comment above
+ ImportsBlock.prototype.getStartOffset = function (node) {
+ if (this.importDeclarations.length === 0) {
+ return node.getStart();
+ }
+ return this.getLastImportDeclaration().nodeEndOffset;
+ };
+ // gets the offset of the end of the import's line, including newline, to include comment to the right
+ ImportsBlock.prototype.getEndOffset = function (sourceFile, node) {
+ var endLineOffset = sourceFile.text.indexOf("\n", node.end) + 1;
+ return endLineOffset;
+ };
+ ImportsBlock.prototype.getLastImportDeclaration = function () {
+ return this.importDeclarations[this.importDeclarations.length - 1];
+ };
+ return ImportsBlock;
+}());
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
new file mode 100644
index 000000000..6054ed924
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
@@ -0,0 +1,7 @@
+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(assigned: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
new file mode 100644
index 000000000..7be4cbcbe
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
@@ -0,0 +1,96 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (assigned) {
+ return "Use a conditional expression instead of assigning to '" + assigned + "' in multiple places.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (tsutils_1.isIfStatement(node)) {
+ var assigned = detect(node, sourceFile);
+ if (assigned !== undefined) {
+ ctx.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.IfKeyword), Rule.FAILURE_STRING(assigned.getText(sourceFile)));
+ // 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;
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function detect(_a, sourceFile) {
+ var thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
+ if (elseStatement === undefined) {
+ return undefined;
+ }
+ var elze = tsutils_1.isIfStatement(elseStatement) ? detect(elseStatement, sourceFile) : getAssigned(elseStatement, sourceFile);
+ if (elze === undefined) {
+ return 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.isExpressionStatement(node) && tsutils_1.isBinaryExpression(node.expression)) {
+ var _a = node.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 {
+ return undefined;
+ }
+}
+function nodeEquals(a, b, sourceFile) {
+ return a.getText(sourceFile) === b.getText(sourceFile);
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/preferConstRule.d.ts b/node_modules/tslint/lib/rules/preferConstRule.d.ts
new file mode 100644
index 000000000..66430863b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferConstRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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_FACTORY(identifier: string, blockScoped: boolean): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferConstRule.js b/node_modules/tslint/lib/rules/preferConstRule.js
new file mode 100644
index 000000000..674a44755
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferConstRule.js
@@ -0,0 +1,310 @@
+"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 });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils = require("tsutils");
+var OPTION_DESTRUCTURING_ALL = "all";
+var OPTION_DESTRUCTURING_ANY = "any";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_FACTORY = function (identifier, blockScoped) {
+ return "Identifier '" + identifier + "' is never reassigned; use 'const' instead of '" + (blockScoped ? "let" : "var") + "'.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var options = {
+ destructuringAll: this.ruleArguments.length !== 0 &&
+ this.ruleArguments[0].destructuring === OPTION_DESTRUCTURING_ALL,
+ };
+ var preferConstWalker = new PreferConstWalker(sourceFile, this.ruleName, options);
+ return this.applyWithWalker(preferConstWalker);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ 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)),
+ options: {
+ type: "object",
+ properties: {
+ destructuring: {
+ type: "string",
+ enum: [OPTION_DESTRUCTURING_ALL, OPTION_DESTRUCTURING_ANY],
+ },
+ },
+ },
+ optionExamples: [
+ true,
+ [true, { destructuring: OPTION_DESTRUCTURING_ALL }],
+ ],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+var Scope = (function () {
+ function Scope(functionScope) {
+ this.variables = new Map();
+ this.reassigned = new Set();
+ // 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 ? this : functionScope;
+ }
+ Scope.prototype.addVariable = function (identifier, declarationInfo, destructuringInfo) {
+ // block scoped variables go to the block scope, function scoped variables to the containing function scope
+ var scope = declarationInfo.isBlockScoped ? this : this.functionScope;
+ scope.variables.set(identifier.text, {
+ declarationInfo: declarationInfo,
+ destructuringInfo: destructuringInfo,
+ identifier: identifier,
+ reassigned: false,
+ });
+ };
+ return Scope;
+}());
+var PreferConstWalker = (function (_super) {
+ tslib_1.__extends(PreferConstWalker, _super);
+ function PreferConstWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PreferConstWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ // don't check anything on declaration files
+ if (sourceFile.isDeclarationFile) {
+ return;
+ }
+ this.scope = new Scope();
+ var cb = function (node) {
+ var savedScope = _this.scope;
+ var boundary = utils.isScopeBoundary(node);
+ if (boundary !== 0 /* None */) {
+ if (boundary === 1 /* Function */) {
+ if (node.kind === ts.SyntaxKind.ModuleDeclaration && utils.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ // don't check ambient namespaces
+ return;
+ }
+ _this.scope = new Scope();
+ if (utils.isFunctionDeclaration(node) ||
+ utils.isMethodDeclaration(node) ||
+ utils.isFunctionExpression(node) ||
+ utils.isArrowFunction(node) ||
+ utils.isConstructorDeclaration(node)) {
+ // special handling for function parameters
+ // each parameter initializer can only reassign preceding parameters of variables of the containing scope
+ if (node.body !== undefined) {
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var param = _a[_i];
+ cb(param);
+ _this.settle(savedScope);
+ }
+ cb(node.body);
+ _this.onScopeEnd(savedScope);
+ }
+ _this.scope = savedScope;
+ return;
+ }
+ }
+ else {
+ _this.scope = new Scope(_this.scope.functionScope);
+ if ((utils.isForInStatement(node) || utils.isForOfStatement(node)) &&
+ node.initializer.kind !== ts.SyntaxKind.VariableDeclarationList) {
+ _this.handleExpression(node.initializer);
+ }
+ }
+ }
+ if (node.kind === ts.SyntaxKind.VariableDeclarationList) {
+ _this.handleVariableDeclaration(node);
+ }
+ else if (node.kind === ts.SyntaxKind.CatchClause) {
+ _this.handleBindingName(node.variableDeclaration.name, {
+ canBeConst: false,
+ isBlockScoped: true,
+ });
+ }
+ else if (node.kind === ts.SyntaxKind.Parameter) {
+ _this.handleBindingName(node.name, {
+ canBeConst: false,
+ isBlockScoped: true,
+ });
+ }
+ else if (utils.isPostfixUnaryExpression(node) ||
+ utils.isPrefixUnaryExpression(node) &&
+ (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken)) {
+ if (utils.isIdentifier(node.operand)) {
+ _this.scope.reassigned.add(node.operand.text);
+ }
+ }
+ else if (utils.isBinaryExpression(node) && utils.isAssignmentKind(node.operatorToken.kind)) {
+ _this.handleExpression(node.left);
+ }
+ if (boundary !== 0 /* None */) {
+ ts.forEachChild(node, cb);
+ _this.onScopeEnd(savedScope);
+ _this.scope = savedScope;
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ };
+ if (ts.isExternalModule(sourceFile)) {
+ ts.forEachChild(sourceFile, cb);
+ this.onScopeEnd();
+ }
+ else {
+ return ts.forEachChild(sourceFile, cb);
+ }
+ };
+ PreferConstWalker.prototype.handleExpression = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.Identifier:
+ this.scope.reassigned.add(node.text);
+ break;
+ case ts.SyntaxKind.ParenthesizedExpression:
+ this.handleExpression(node.expression);
+ break;
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (element.kind === ts.SyntaxKind.SpreadElement) {
+ this.handleExpression(element.expression);
+ }
+ else {
+ this.handleExpression(element);
+ }
+ }
+ break;
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
+ var property = _c[_b];
+ switch (property.kind) {
+ case ts.SyntaxKind.ShorthandPropertyAssignment:
+ this.scope.reassigned.add(property.name.text);
+ break;
+ case ts.SyntaxKind.SpreadAssignment:
+ if (property.name !== undefined) {
+ this.scope.reassigned.add(property.name.text);
+ }
+ else {
+ // handle `...(variable)`
+ this.handleExpression(property.expression);
+ }
+ break;
+ default:
+ this.handleExpression(property.initializer);
+ }
+ }
+ break;
+ }
+ };
+ PreferConstWalker.prototype.handleBindingName = function (name, declarationInfo) {
+ var _this = this;
+ if (name.kind === ts.SyntaxKind.Identifier) {
+ this.scope.addVariable(name, declarationInfo);
+ }
+ else {
+ var destructuringInfo_1 = {
+ reassignedSiblings: false,
+ };
+ utils.forEachDestructuringIdentifier(name, function (declaration) { return _this.scope.addVariable(declaration.name, declarationInfo, destructuringInfo_1); });
+ }
+ };
+ PreferConstWalker.prototype.handleVariableDeclaration = function (declarationList) {
+ var declarationInfo;
+ var kind = utils.getVariableDeclarationKind(declarationList);
+ if (kind === 2 /* Const */ ||
+ utils.hasModifier(declarationList.parent.modifiers, ts.SyntaxKind.ExportKeyword, ts.SyntaxKind.DeclareKeyword)) {
+ declarationInfo = {
+ canBeConst: false,
+ isBlockScoped: kind !== 0 /* Var */,
+ };
+ }
+ else {
+ declarationInfo = {
+ allInitialized: declarationList.parent.kind === ts.SyntaxKind.ForOfStatement ||
+ declarationList.parent.kind === ts.SyntaxKind.ForInStatement ||
+ declarationList.declarations.every(function (declaration) { return declaration.initializer !== undefined; }),
+ canBeConst: true,
+ declarationList: declarationList,
+ isBlockScoped: kind === 1 /* Let */,
+ isForLoop: declarationList.parent.kind === ts.SyntaxKind.ForStatement,
+ reassignedSiblings: false,
+ };
+ }
+ for (var _i = 0, _a = declarationList.declarations; _i < _a.length; _i++) {
+ var declaration = _a[_i];
+ this.handleBindingName(declaration.name, declarationInfo);
+ }
+ };
+ PreferConstWalker.prototype.settle = function (parent) {
+ var _a = this.scope, variables = _a.variables, reassigned = _a.reassigned;
+ reassigned.forEach(function (name) {
+ var variableInfo = variables.get(name);
+ if (variableInfo !== undefined) {
+ if (variableInfo.declarationInfo.canBeConst) {
+ variableInfo.reassigned = true;
+ variableInfo.declarationInfo.reassignedSiblings = true;
+ if (variableInfo.destructuringInfo !== undefined) {
+ variableInfo.destructuringInfo.reassignedSiblings = true;
+ }
+ }
+ }
+ else if (parent !== undefined) {
+ // if the reassigned variable was not declared in this scope we defer to the parent scope
+ parent.reassigned.add(name);
+ }
+ });
+ reassigned.clear();
+ };
+ PreferConstWalker.prototype.onScopeEnd = function (parent) {
+ var _this = this;
+ this.settle(parent);
+ var appliedFixes = new Set();
+ this.scope.variables.forEach(function (info, name) {
+ if (info.declarationInfo.canBeConst &&
+ !info.reassigned &&
+ // don't add failures for reassigned variables in for loop initializer
+ !(info.declarationInfo.reassignedSiblings && info.declarationInfo.isForLoop) &&
+ // if {destructuring: "all"} is set, only add a failure if all variables in a destructuring assignment can be const
+ (!_this.options.destructuringAll ||
+ info.destructuringInfo === undefined ||
+ !info.destructuringInfo.reassignedSiblings)) {
+ var fix = void 0;
+ // only apply fixes if the VariableDeclarationList has no reassigned variables
+ // and the variable is block scoped aka `let` and initialized
+ if (info.declarationInfo.allInitialized &&
+ !info.declarationInfo.reassignedSiblings &&
+ info.declarationInfo.isBlockScoped &&
+ !appliedFixes.has(info.declarationInfo.declarationList)) {
+ fix = new Lint.Replacement(info.declarationInfo.declarationList.getStart(_this.sourceFile), 3, "const");
+ // add only one fixer per VariableDeclarationList
+ appliedFixes.add(info.declarationInfo.declarationList);
+ }
+ _this.addFailureAtNode(info.identifier, Rule.FAILURE_STRING_FACTORY(name, info.declarationInfo.isBlockScoped), fix);
+ }
+ });
+ };
+ return PreferConstWalker;
+}(Lint.AbstractWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/preferForOfRule.d.ts b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferForOfRule.js b/node_modules/tslint/lib/rules/preferForOfRule.js
new file mode 100644
index 000000000..a9a66dabd
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferForOfRule.js
@@ -0,0 +1,183 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../language/utils");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "prefer-for-of",
+ description: "Recommends a 'for-of' loop over a standard 'for' loop if the index is only used to access the array being iterated.",
+ rationale: "A for(... of ...) loop is easier to implement and read when the index is not needed.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Expected a 'for-of' loop instead of a 'for' loop with this simple iteration";
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ var scopes = [];
+ return ts.forEachChild(sourceFile, cb);
+ function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ForStatement:
+ return visitForStatement(node);
+ case ts.SyntaxKind.Identifier:
+ return visitIdentifier(node);
+ default:
+ return ts.forEachChild(node, cb);
+ }
+ }
+ function visitForStatement(node) {
+ var arrayNodeInfo = getForLoopHeaderInfo(node);
+ if (arrayNodeInfo === undefined) {
+ return ts.forEachChild(node, cb);
+ }
+ var indexVariable = arrayNodeInfo.indexVariable, arrayExpr = arrayNodeInfo.arrayExpr;
+ var indexVariableName = indexVariable.text;
+ // store `for` loop state
+ var state = { indexVariableName: indexVariableName, arrayExpr: arrayExpr, onlyArrayReadAccess: true };
+ scopes.push(state);
+ ts.forEachChild(node.statement, cb);
+ scopes.pop();
+ if (state.onlyArrayReadAccess) {
+ ctx.addFailure(node.getStart(), node.statement.getFullStart(), Rule.FAILURE_STRING);
+ }
+ }
+ function visitIdentifier(node) {
+ var state = getStateForVariable(node.text);
+ if (state !== undefined && state.onlyArrayReadAccess && isNonSimpleIncrementorUse(node, state.arrayExpr, sourceFile)) {
+ state.onlyArrayReadAccess = false;
+ }
+ }
+ function getStateForVariable(name) {
+ for (var i = scopes.length - 1; i >= 0; i--) {
+ var scope = scopes[i];
+ if (scope.indexVariableName === name) {
+ return scope;
+ }
+ }
+ return undefined;
+ }
+}
+function isNonSimpleIncrementorUse(node, arrayExpr, sourceFile) {
+ // check if iterator is used for something other than reading data from array
+ var elementAccess = node.parent;
+ var accessParent = elementAccess.parent;
+ return !utils.isElementAccessExpression(elementAccess)
+ || utils_1.isAssignment(accessParent)
+ || accessParent.kind === ts.SyntaxKind.DeleteExpression
+ || !nodeEquals(arrayExpr, utils_1.unwrapParentheses(elementAccess.expression), sourceFile);
+}
+function nodeEquals(a, b, sourceFile) {
+ return a.getText(sourceFile) === b.getText(sourceFile);
+}
+// returns the iterator and array of a `for` loop if the `for` loop is basic.
+function getForLoopHeaderInfo(forLoop) {
+ var initializer = forLoop.initializer, condition = forLoop.condition, incrementor = forLoop.incrementor;
+ if (initializer === undefined || condition === undefined || incrementor === undefined) {
+ return undefined;
+ }
+ // Must start with `var i = 0;` or `let i = 0;`
+ if (!utils.isVariableDeclarationList(initializer) || initializer.declarations.length !== 1) {
+ return undefined;
+ }
+ var _a = initializer.declarations[0], indexVariable = _a.name, indexInit = _a.initializer;
+ if (indexVariable.kind !== ts.SyntaxKind.Identifier || indexInit === undefined || !isNumber(indexInit, "0")) {
+ return undefined;
+ }
+ // Must end with `i++`
+ if (!isIncremented(incrementor, indexVariable.text)) {
+ return undefined;
+ }
+ // Condition must be `i < arr.length;`
+ if (!utils.isBinaryExpression(condition)) {
+ return undefined;
+ }
+ var left = condition.left, operatorToken = condition.operatorToken, right = condition.right;
+ if (!isIdentifierNamed(left, indexVariable.text) ||
+ operatorToken.kind !== ts.SyntaxKind.LessThanToken ||
+ !utils.isPropertyAccessExpression(right)) {
+ return undefined;
+ }
+ var arrayExpr = right.expression, name = right.name;
+ if (name.text !== "length") {
+ return undefined;
+ }
+ return { indexVariable: indexVariable, arrayExpr: arrayExpr };
+}
+function isIncremented(node, indexVariableName) {
+ switch (node.kind) {
+ case ts.SyntaxKind.PrefixUnaryExpression:
+ case ts.SyntaxKind.PostfixUnaryExpression: {
+ var _a = node, operator = _a.operator, operand = _a.operand;
+ // `++x` or `x++`
+ return operator === ts.SyntaxKind.PlusPlusToken && isVar(operand);
+ }
+ case ts.SyntaxKind.BinaryExpression:
+ var _b = node, operatorToken = _b.operatorToken, updatedVar = _b.left, rhs = _b.right;
+ if (!isVar(updatedVar)) {
+ return false;
+ }
+ switch (operatorToken.kind) {
+ case ts.SyntaxKind.PlusEqualsToken:
+ // x += 1
+ return isOne(rhs);
+ case ts.SyntaxKind.EqualsToken: {
+ if (!utils.isBinaryExpression(rhs)) {
+ return false;
+ }
+ var rhsOp = rhs.operatorToken, left = rhs.left, right = rhs.right;
+ // `x = 1 + x` or `x = x + 1`
+ return rhsOp.kind === ts.SyntaxKind.PlusToken && (isVar(left) && isOne(right) || isOne(left) && isVar(right));
+ }
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ function isVar(id) {
+ return isIdentifierNamed(id, indexVariableName);
+ }
+}
+function isIdentifierNamed(node, text) {
+ return utils.isIdentifier(node) && node.text === text;
+}
+function isOne(node) {
+ return isNumber(node, "1");
+}
+function isNumber(node, value) {
+ return utils.isNumericLiteral(node) && node.text === value;
+}
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
new file mode 100644
index 000000000..d703adda3
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
@@ -0,0 +1,111 @@
+"use strict";
+/**
+ * @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.
+ */
+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_PUBLIC = "allow-public";
+var OPTION_ALLOW_PROTECTED = "allow-protected";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new PreferFunctionOverMethodWalker(sourceFile, this.ruleName, {
+ allowProtected: this.ruleArguments.indexOf(OPTION_ALLOW_PROTECTED) !== -1,
+ allowPublic: this.ruleArguments.indexOf(OPTION_ALLOW_PUBLIC) !== -1,
+ }));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "string",
+ enum: [OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED],
+ },
+ optionExamples: [
+ true,
+ [true, OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Class method does not use 'this'. Use a function instead.";
+exports.Rule = Rule;
+var PreferFunctionOverMethodWalker = (function (_super) {
+ tslib_1.__extends(PreferFunctionOverMethodWalker, _super);
+ function PreferFunctionOverMethodWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PreferFunctionOverMethodWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ if (tsutils_1.isMethodDeclaration(node) && !_this.isExempt(node)) {
+ // currentScope is always undefined here, so we don't need to save it and just set it to undefined afterwards
+ _this.currentScope = {
+ isThisUsed: false,
+ name: tsutils_1.getPropertyName(node.name),
+ };
+ ts.forEachChild(node, cb);
+ if (!_this.currentScope.isThisUsed) {
+ _this.addFailureAtNode(node.name, Rule.FAILURE_STRING);
+ }
+ _this.currentScope = undefined;
+ }
+ else if (tsutils_1.hasOwnThisReference(node)) {
+ var scope = _this.currentScope;
+ _this.currentScope = undefined;
+ ts.forEachChild(node, cb);
+ _this.currentScope = scope;
+ }
+ else if (_this.currentScope !== undefined &&
+ (node.kind === ts.SyntaxKind.ThisKeyword && !isRecursiveCall(node, _this.currentScope.name) ||
+ node.kind === ts.SyntaxKind.SuperKeyword)) {
+ _this.currentScope.isThisUsed = true;
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ PreferFunctionOverMethodWalker.prototype.isExempt = function (node) {
+ // TODO: handle the override keyword once it lands in the language
+ return node.body === undefined ||
+ // exclude object methods
+ node.parent.kind !== ts.SyntaxKind.ClassDeclaration && node.parent.kind !== ts.SyntaxKind.ClassExpression ||
+ tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword) ||
+ this.options.allowProtected && tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword) ||
+ this.options.allowPublic && (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword) ||
+ !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword));
+ };
+ return PreferFunctionOverMethodWalker;
+}(Lint.AbstractWalker));
+function isRecursiveCall(node, name) {
+ return name !== undefined &&
+ node.parent.kind === ts.SyntaxKind.PropertyAccessExpression &&
+ node.parent.name.text === name;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
new file mode 100644
index 000000000..1fec5e6cf
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
@@ -0,0 +1,60 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "prefer-method-signature",
+ description: "Prefer `foo(): void` over `foo: () => void` in interfaces and types.",
+ hasFix: true,
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use a method signature instead of a property signature of function type.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isPropertySignature(node)) {
+ 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, ":"),
+ ]);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
new file mode 100644
index 000000000..34aff8cc4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
@@ -0,0 +1,8 @@
+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 ASSIGNMENT_FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferObjectSpreadRule.js b/node_modules/tslint/lib/rules/preferObjectSpreadRule.js
new file mode 100644
index 000000000..f08a648ca
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferObjectSpreadRule.js
@@ -0,0 +1,116 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "prefer-object-spread",
+ description: "Enforces the use of the ES2015 object spread operator over `Object.assign()` where appropriate.",
+ rationale: "Object spread allows for better type checking and inference.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+ hasFix: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use the object spread operator instead.";
+Rule.ASSIGNMENT_FAILURE_STRING = "'Object.assign' returns the first argument. Prefer object spread if you want a new object.";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isCallExpression(node) && node.arguments.length !== 0 &&
+ tsutils_1.isPropertyAccessExpression(node.expression) && node.expression.name.text === "assign" &&
+ tsutils_1.isIdentifier(node.expression.expression) && node.expression.expression.text === "Object" &&
+ // Object.assign(...someArray) cannot be written as object spread
+ !node.arguments.some(tsutils_1.isSpreadElement)) {
+ if (node.arguments[0].kind === ts.SyntaxKind.ObjectLiteralExpression) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING, createFix(node, ctx.sourceFile));
+ }
+ else {
+ var parent = node.parent;
+ if (parent.kind === ts.SyntaxKind.VariableDeclaration ||
+ tsutils_1.isBinaryExpression(parent) && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) {
+ ctx.addFailureAtNode(node, Rule.ASSIGNMENT_FAILURE_STRING, createFix(node, ctx.sourceFile));
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function createFix(node, sourceFile) {
+ var args = node.arguments;
+ var fix = [
+ Lint.Replacement.replaceFromTo(node.getStart(sourceFile), args[0].getStart(sourceFile), "{"),
+ new Lint.Replacement(node.end - 1, 1, "}"),
+ ];
+ for (var i = 0; i < args.length; ++i) {
+ var arg = args[i];
+ if (tsutils_1.isObjectLiteralExpression(arg)) {
+ if (arg.properties.length === 0) {
+ var end = arg.end;
+ if (i !== args.length - 1) {
+ end = args[i + 1].getStart(sourceFile);
+ }
+ else if (args.hasTrailingComma === true) {
+ end = args.end;
+ }
+ // remove empty object iteral and the following comma if exists
+ fix.push(Lint.Replacement.deleteFromTo(arg.getStart(sourceFile), end));
+ }
+ else {
+ fix.push(
+ // remove open brace
+ Lint.Replacement.deleteText(arg.getStart(sourceFile), 1),
+ // remove trailing comma if exists and close brace
+ Lint.Replacement.deleteFromTo(arg.properties[arg.properties.length - 1].end, arg.end));
+ }
+ }
+ else {
+ var parens = needsParens(arg);
+ fix.push(Lint.Replacement.appendText(arg.getStart(sourceFile), parens ? "...(" : "..."));
+ if (parens) {
+ fix.push(Lint.Replacement.appendText(arg.end, ")"));
+ }
+ }
+ }
+ return fix;
+}
+function needsParens(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ConditionalExpression:
+ case ts.SyntaxKind.BinaryExpression:
+ return true;
+ default:
+ return false;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.d.ts b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.js b/node_modules/tslint/lib/rules/preferSwitchRule.js
new file mode 100644
index 000000000..da57daad9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.js
@@ -0,0 +1,139 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_MIN_CASES = "min-cases";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var minCases = 3;
+ if (this.ruleArguments.length !== 0) {
+ var obj = this.ruleArguments[0];
+ minCases = obj[OPTION_MIN_CASES];
+ }
+ return this.applyWithFunction(sourceFile, walk, minCases);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "object",
+ properties: (_b = {},
+ _b[OPTION_MIN_CASES] = { type: "number" },
+ _b),
+ },
+ optionExamples: [true, [true, (_c = {}, _c[OPTION_MIN_CASES] = 2, _c)]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use a switch statement instead of using multiple '===' checks.";
+exports.Rule = Rule;
+function walk(ctx) {
+ var minCases = ctx.options, sourceFile = ctx.sourceFile;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (utils.isIfStatement(node) && check(node, sourceFile, minCases)) {
+ var expression = node.expression, thenStatement = node.thenStatement, elseStatement = node.elseStatement;
+ ctx.addFailureAtNode(expression, Rule.FAILURE_STRING);
+ // Be careful not to fail again for the "else if"
+ ts.forEachChild(expression, cb);
+ ts.forEachChild(thenStatement, cb);
+ if (elseStatement !== undefined) {
+ ts.forEachChild(elseStatement, cb);
+ }
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ });
+}
+function check(node, sourceFile, minCases) {
+ var switchVariable;
+ var casesSeen = 0;
+ var couldBeSwitch = everyCase(node, function (expr) {
+ casesSeen++;
+ if (switchVariable !== undefined) {
+ return nodeEquals(expr, switchVariable, sourceFile);
+ }
+ else {
+ switchVariable = expr;
+ return true;
+ }
+ });
+ return couldBeSwitch && casesSeen >= minCases;
+}
+function everyCase(_a, test) {
+ var expression = _a.expression, elseStatement = _a.elseStatement;
+ if (!everyCondition(expression, test)) {
+ return false;
+ }
+ return elseStatement === undefined || !utils.isIfStatement(elseStatement) || everyCase(elseStatement, test);
+}
+function everyCondition(node, test) {
+ if (!utils.isBinaryExpression(node)) {
+ return false;
+ }
+ var operatorToken = node.operatorToken, left = node.left, right = node.right;
+ switch (operatorToken.kind) {
+ case ts.SyntaxKind.BarBarToken:
+ return everyCondition(left, test) && everyCondition(right, test);
+ case ts.SyntaxKind.EqualsEqualsEqualsToken:
+ return isSimple(left) && isSimple(right) && test(left);
+ default:
+ return false;
+ }
+}
+function nodeEquals(a, b, sourceFile) {
+ return a.getText(sourceFile) === b.getText(sourceFile);
+}
+function isSimple(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.PropertyAccessExpression:
+ return isSimple(node.expression);
+ case ts.SyntaxKind.PrefixUnaryExpression:
+ switch (node.operator) {
+ case ts.SyntaxKind.PlusPlusToken:
+ case ts.SyntaxKind.MinusMinusToken:
+ return false;
+ default:
+ return isSimple(node.operand);
+ }
+ case ts.SyntaxKind.Identifier:
+ case ts.SyntaxKind.NumericLiteral:
+ case ts.SyntaxKind.StringLiteral:
+ case ts.SyntaxKind.ThisKeyword:
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
+ case ts.SyntaxKind.TrueKeyword:
+ case ts.SyntaxKind.FalseKeyword:
+ case ts.SyntaxKind.NullKeyword:
+ return true;
+ default:
+ return false;
+ }
+}
+var _a, _b, _c;
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.d.ts b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
new file mode 100644
index 000000000..0b4ebc00c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
@@ -0,0 +1,8 @@
+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 FAILURE_STRING_MULTILINE: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.js b/node_modules/tslint/lib/rules/preferTemplateRule.js
new file mode 100644
index 000000000..1b0ae6f69
--- /dev/null
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.js
@@ -0,0 +1,123 @@
+"use strict";
+/**
+ * @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.
+ */
+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_SINGLE_CONCAT = "allow-single-concat";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ if (sourceFile.isDeclarationFile) {
+ return []; // Not possible in a declaration file
+ }
+ var allowSingleConcat = this.ruleArguments.indexOf(OPTION_SINGLE_CONCAT) !== -1;
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, allowSingleConcat); });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "string",
+ enum: [OPTION_SINGLE_CONCAT],
+ },
+ optionExamples: [true, [true, OPTION_SINGLE_CONCAT]],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Use a template literal instead of concatenating with a string literal.";
+Rule.FAILURE_STRING_MULTILINE = "Use a multiline template literal instead of concatenating string literals with newlines.";
+exports.Rule = Rule;
+function walk(ctx, allowSingleConcat) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ var failure = getError(node, allowSingleConcat);
+ if (failure !== undefined) {
+ ctx.addFailureAtNode(node, failure);
+ }
+ else {
+ return ts.forEachChild(node, cb);
+ }
+ });
+}
+function getError(node, allowSingleConcat) {
+ if (!isPlusExpression(node)) {
+ return undefined;
+ }
+ var left = node.left, right = node.right;
+ var l = isStringLike(left);
+ var r = isStringLike(right);
+ if (l && r) {
+ // They're both strings.
+ // If they're joined by a newline, recommend a template expression instead.
+ // Otherwise ignore. ("a" + "b", probably writing a long newline-less string on many lines.)
+ return containsNewline(left) || containsNewline(right) ? Rule.FAILURE_STRING_MULTILINE : undefined;
+ }
+ else if (!l && !r) {
+ // Watch out for `"a" + b + c`. Parsed as `("a" + b) + c`.
+ return containsAnyStringLiterals(left) ? Rule.FAILURE_STRING : undefined;
+ }
+ else if (l) {
+ // `"x" + y`
+ return !allowSingleConcat ? Rule.FAILURE_STRING : undefined;
+ }
+ else {
+ // `? + "b"`
+ // If LHS consists of only string literals (as in `"a" + "b" + "c"`, allow it.)
+ return !containsOnlyStringLiterals(left) && (!allowSingleConcat || isPlusExpression(left)) ? Rule.FAILURE_STRING : undefined;
+ }
+}
+function containsNewline(node) {
+ if (node.kind === ts.SyntaxKind.TemplateExpression) {
+ return node.templateSpans.some(function (_a) {
+ var text = _a.literal.text;
+ return text.includes("\n");
+ });
+ }
+ else {
+ return node.text.includes("\n");
+ }
+}
+function containsOnlyStringLiterals(node) {
+ return isPlusExpression(node) && isStringLike(node.right) && (isStringLike(node.left) || containsAnyStringLiterals(node.left));
+}
+function containsAnyStringLiterals(node) {
+ return isPlusExpression(node) && (isStringLike(node.right) || isStringLike(node.left) || containsAnyStringLiterals(node.left));
+}
+function isPlusExpression(node) {
+ return tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.PlusToken;
+}
+function isStringLike(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.StringLiteral:
+ case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
+ case ts.SyntaxKind.TemplateExpression:
+ return true;
+ default:
+ return false;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
new file mode 100644
index 000000000..d2d51d1d1
--- /dev/null
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
new file mode 100644
index 000000000..c035b6095
--- /dev/null
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
@@ -0,0 +1,70 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: false,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "functions that return promises must be async";
+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);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function returnsPromise(node, tc) {
+ var type = tc.getReturnTypeOfSignature(tc.getTypeAtLocation(node).getCallSignatures()[0]);
+ return type.symbol !== undefined && type.symbol.name === "Promise";
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.d.ts b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
new file mode 100644
index 000000000..2a96c3409
--- /dev/null
+++ b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
@@ -0,0 +1,8 @@
+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(actual: string, expected: string): string;
+ isEnabled(): boolean;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.js b/node_modules/tslint/lib/rules/quotemarkRule.js
new file mode 100644
index 000000000..4226e8ed1
--- /dev/null
+++ b/node_modules/tslint/lib/rules/quotemarkRule.js
@@ -0,0 +1,120 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_SINGLE = "single";
+var OPTION_DOUBLE = "double";
+var OPTION_JSX_SINGLE = "jsx-single";
+var OPTION_JSX_DOUBLE = "jsx-double";
+var OPTION_AVOID_TEMPLATE = "avoid-template";
+var OPTION_AVOID_ESCAPE = "avoid-escape";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (actual, expected) {
+ return actual + " should be " + expected;
+ };
+ Rule.prototype.isEnabled = function () {
+ return _super.prototype.isEnabled.call(this) && (this.ruleArguments[0] === OPTION_SINGLE || this.ruleArguments[0] === OPTION_DOUBLE);
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var args = this.ruleArguments;
+ if (args.length > 0) {
+ if (args[0] !== OPTION_SINGLE && args[0] !== OPTION_DOUBLE) {
+ throw new Error("First argument to 'quotemark' rule should be \"" + OPTION_SINGLE + "\" or \"" + OPTION_DOUBLE + "\"");
+ }
+ }
+ var quoteMark = args[0] === OPTION_SINGLE ? "'" : '"';
+ return this.applyWithFunction(sourceFile, walk, {
+ avoidEscape: hasArg(OPTION_AVOID_ESCAPE),
+ avoidTemplate: hasArg(OPTION_AVOID_TEMPLATE),
+ jsxQuoteMark: hasArg(OPTION_JSX_SINGLE) ? "'" : hasArg(OPTION_JSX_DOUBLE) ? '"' : quoteMark,
+ quoteMark: quoteMark,
+ });
+ function hasArg(name) {
+ return args.indexOf(name) !== -1;
+ }
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_ESCAPE],
+ },
+ minLength: 0,
+ maxLength: 5,
+ },
+ optionExamples: [
+ [true, OPTION_SINGLE, OPTION_AVOID_ESCAPE, OPTION_AVOID_TEMPLATE],
+ [true, OPTION_SINGLE, OPTION_JSX_DOUBLE],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, options = ctx.options;
+ ts.forEachChild(sourceFile, function cb(node) {
+ if (tsutils_1.isStringLiteral(node)
+ || options.avoidTemplate && tsutils_1.isNoSubstitutionTemplateLiteral(node)
+ && node.parent.kind !== ts.SyntaxKind.TaggedTemplateExpression
+ && tsutils_1.isSameLine(sourceFile, node.getStart(sourceFile), node.end)) {
+ var expectedQuoteMark = node.parent.kind === ts.SyntaxKind.JsxAttribute ? options.jsxQuoteMark : options.quoteMark;
+ var actualQuoteMark = sourceFile.text[node.end - 1];
+ if (actualQuoteMark === expectedQuoteMark) {
+ return;
+ }
+ var fixQuoteMark = expectedQuoteMark;
+ var needsQuoteEscapes = node.text.includes(expectedQuoteMark);
+ if (needsQuoteEscapes && options.avoidEscape) {
+ if (node.kind === ts.SyntaxKind.StringLiteral) {
+ return;
+ }
+ // If expecting double quotes, fix a template `a "quote"` to `a 'quote'` anyway,
+ // always preferring *some* quote mark over a template.
+ fixQuoteMark = expectedQuoteMark === '"' ? "'" : '"';
+ if (node.text.includes(fixQuoteMark)) {
+ return;
+ }
+ }
+ var start = node.getStart(sourceFile);
+ var text = sourceFile.text.substring(start + 1, node.end - 1);
+ if (needsQuoteEscapes) {
+ text = text.replace(new RegExp(fixQuoteMark, "g"), "\\" + fixQuoteMark);
+ }
+ text = text.replace(new RegExp("\\\\" + actualQuoteMark, "g"), actualQuoteMark);
+ return ctx.addFailure(start, node.end, Rule.FAILURE_STRING(actualQuoteMark, fixQuoteMark), new Lint.Replacement(start, node.end - start, fixQuoteMark + text + fixQuoteMark));
+ }
+ ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/radixRule.d.ts b/node_modules/tslint/lib/rules/radixRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/radixRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/radixRule.js b/node_modules/tslint/lib/rules/radixRule.js
new file mode 100644
index 000000000..13daded51
--- /dev/null
+++ b/node_modules/tslint/lib/rules/radixRule.js
@@ -0,0 +1,64 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Missing radix parameter";
+exports.Rule = Rule;
+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"))) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
new file mode 100644
index 000000000..21b50bfe4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static INVALID_TYPES_ERROR: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
new file mode 100644
index 000000000..229d170be
--- /dev/null
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
@@ -0,0 +1,79 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (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, function (ctx) { return walk(ctx, program); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "restrict-plus-operands",
+ description: "When adding two variables, operands must both be of type number or of type string.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.INVALID_TYPES_ERROR = "Operands of '+' operation must either be both strings or both numbers";
+exports.Rule = Rule;
+function walk(ctx, program) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.PlusToken) {
+ var tc = program.getTypeChecker();
+ var leftType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.left));
+ var rightType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.right));
+ if (leftType === "invalid" || rightType === "invalid" || leftType !== rightType) {
+ return ctx.addFailureAtNode(node, Rule.INVALID_TYPES_ERROR);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function getBaseTypeOfLiteralType(type) {
+ if (Lint.isTypeFlagSet(type, ts.TypeFlags.StringLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.String)) {
+ return "string";
+ }
+ else if (Lint.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.Number)) {
+ return "number";
+ }
+ else if (tsutils_1.isUnionType(type) && !Lint.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)) {
+ // Compatibility for TypeScript pre-2.4, which used EnumLiteralType instead of LiteralType
+ getBaseTypeOfLiteralType(type.baseType);
+ }
+ return "invalid";
+}
+function allSame(array) {
+ return array.every(function (value) { return value === array[0]; });
+}
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
new file mode 100644
index 000000000..e2bae0d7c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
@@ -0,0 +1,8 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_VALUE_RETURN: string;
+ static FAILURE_STRING_VOID_RETURN: string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.js b/node_modules/tslint/lib/rules/returnUndefinedRule.js
new file mode 100644
index 000000000..313fec4e4
--- /dev/null
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.js
@@ -0,0 +1,146 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "return-undefined",
+ description: "Prefer `return;` in void functions and `return undefined;` in value-returning functions.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "style",
+ typescriptOnly: false,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_VALUE_RETURN = "Value-returning function should use `return undefined;`, not just `return;`.";
+Rule.FAILURE_STRING_VOID_RETURN = "`void` function should use `return;`, not `return undefined;`.";
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isReturnStatement(node)) {
+ check(node);
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function check(node) {
+ var actualReturnKind = returnKindFromReturn(node);
+ if (actualReturnKind === undefined) {
+ return;
+ }
+ var functionReturningFrom = Lint.ancestorWhere(node, isFunctionLike);
+ if (functionReturningFrom === undefined) {
+ // Return outside of function is invalid
+ return;
+ }
+ var returnKindFromType = getReturnKind(functionReturningFrom, checker);
+ if (returnKindFromType !== undefined && returnKindFromType !== actualReturnKind) {
+ ctx.addFailureAtNode(node, returnKindFromType === ReturnKind.Void ? Rule.FAILURE_STRING_VOID_RETURN : Rule.FAILURE_STRING_VALUE_RETURN);
+ }
+ }
+}
+function returnKindFromReturn(node) {
+ if (node.expression === undefined) {
+ return ReturnKind.Void;
+ }
+ else if (tsutils_1.isIdentifier(node.expression) && node.expression.text === "undefined") {
+ return ReturnKind.Value;
+ }
+ else {
+ return undefined;
+ }
+}
+var ReturnKind;
+(function (ReturnKind) {
+ ReturnKind[ReturnKind["Void"] = 0] = "Void";
+ ReturnKind[ReturnKind["Value"] = 1] = "Value";
+})(ReturnKind || (ReturnKind = {}));
+function getReturnKind(node, checker) {
+ switch (node.kind) {
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.SetAccessor:
+ return ReturnKind.Void;
+ case ts.SyntaxKind.GetAccessor:
+ return ReturnKind.Value;
+ }
+ var contextual = isFunctionExpressionLike(node) ? tryGetReturnType(checker.getContextualType(node), checker) : undefined;
+ var returnType = contextual !== undefined ? contextual : tryGetReturnType(checker.getTypeAtLocation(node), checker);
+ if (returnType === undefined) {
+ return undefined;
+ }
+ else if (isEffectivelyVoid(returnType)) {
+ return ReturnKind.Void;
+ }
+ else if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)) {
+ // 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.
+ var typeArguments = returnType.typeArguments;
+ if (typeArguments !== undefined && typeArguments.length === 1) {
+ return isEffectivelyVoid(typeArguments[0]) ? ReturnKind.Void : ReturnKind.Value;
+ }
+ }
+ return ReturnKind.Value;
+}
+/** 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) ||
+ tsutils_1.isUnionType(type) && type.types.every(isEffectivelyVoid);
+}
+function tryGetReturnType(fnType, checker) {
+ if (fnType === undefined) {
+ return undefined;
+ }
+ var sigs = checker.getSignaturesOfType(fnType, ts.SignatureKind.Call);
+ if (sigs.length !== 1) {
+ return undefined;
+ }
+ var ret = checker.getReturnTypeOfSignature(sigs[0]);
+ return Lint.isTypeFlagSet(ret, ts.TypeFlags.Any) ? undefined : ret;
+}
+function isFunctionLike(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ return true;
+ default:
+ return false;
+ }
+}
+function isFunctionExpressionLike(node) {
+ return node.kind === ts.SyntaxKind.FunctionExpression || node.kind === ts.SyntaxKind.ArrowFunction;
+}
diff --git a/node_modules/tslint/lib/rules/semicolonRule.d.ts b/node_modules/tslint/lib/rules/semicolonRule.d.ts
new file mode 100644
index 000000000..1e32e4a09
--- /dev/null
+++ b/node_modules/tslint/lib/rules/semicolonRule.d.ts
@@ -0,0 +1,9 @@
+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_MISSING: string;
+ static FAILURE_STRING_COMMA: string;
+ static FAILURE_STRING_UNNECESSARY: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/semicolonRule.js b/node_modules/tslint/lib/rules/semicolonRule.js
new file mode 100644
index 000000000..747a2acd2
--- /dev/null
+++ b/node_modules/tslint/lib/rules/semicolonRule.js
@@ -0,0 +1,232 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_ALWAYS = "always";
+var OPTION_NEVER = "never";
+var OPTION_IGNORE_BOUND_CLASS_METHODS = "ignore-bound-class-methods";
+var OPTION_IGNORE_INTERFACES = "ignore-interfaces";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var options = {
+ always: this.ruleArguments.indexOf(OPTION_NEVER) === -1,
+ boundClassMethods: this.ruleArguments.indexOf(OPTION_IGNORE_BOUND_CLASS_METHODS) === -1,
+ interfaces: this.ruleArguments.indexOf(OPTION_IGNORE_INTERFACES) === -1,
+ };
+ return this.applyWithWalker(new SemicolonWalker(sourceFile, this.ruleName, options));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ 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."], _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."], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS)),
+ options: {
+ type: "array",
+ items: [
+ {
+ type: "string",
+ enum: [OPTION_ALWAYS, OPTION_NEVER],
+ },
+ {
+ type: "string",
+ enum: [OPTION_IGNORE_INTERFACES],
+ },
+ ],
+ additionalItems: false,
+ },
+ optionExamples: [
+ [true, OPTION_ALWAYS],
+ [true, OPTION_NEVER],
+ [true, OPTION_ALWAYS, OPTION_IGNORE_INTERFACES],
+ [true, OPTION_ALWAYS, OPTION_IGNORE_BOUND_CLASS_METHODS],
+ ],
+ type: "style",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_MISSING = "Missing semicolon";
+Rule.FAILURE_STRING_COMMA = "Properties should be separated by semicolons";
+Rule.FAILURE_STRING_UNNECESSARY = "Unnecessary semicolon";
+exports.Rule = Rule;
+var SemicolonWalker = (function (_super) {
+ tslib_1.__extends(SemicolonWalker, _super);
+ function SemicolonWalker() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scanner = undefined;
+ return _this;
+ }
+ SemicolonWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.VariableStatement:
+ case ts.SyntaxKind.ExpressionStatement:
+ case ts.SyntaxKind.ReturnStatement:
+ case ts.SyntaxKind.BreakStatement:
+ case ts.SyntaxKind.ContinueStatement:
+ case ts.SyntaxKind.ThrowStatement:
+ case ts.SyntaxKind.ImportEqualsDeclaration:
+ case ts.SyntaxKind.DoStatement:
+ case ts.SyntaxKind.ExportAssignment:
+ _this.checkSemicolonAt(node);
+ break;
+ case ts.SyntaxKind.TypeAliasDeclaration:
+ case ts.SyntaxKind.ImportDeclaration:
+ case ts.SyntaxKind.ExportDeclaration:
+ case ts.SyntaxKind.DebuggerStatement:
+ _this.checkSemicolonOrLineBreak(node);
+ break;
+ case ts.SyntaxKind.ModuleDeclaration:
+ // shorthand module declaration
+ if (node.body === undefined) {
+ _this.checkSemicolonOrLineBreak(node);
+ }
+ break;
+ case ts.SyntaxKind.PropertyDeclaration:
+ _this.visitPropertyDeclaration(node);
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.FunctionDeclaration:
+ if (node.body === undefined) {
+ _this.checkSemicolonOrLineBreak(node);
+ }
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ if (_this.options.interfaces) {
+ _this.checkInterface(node);
+ }
+ break;
+ case ts.SyntaxKind.SemicolonClassElement:
+ return _this.reportUnnecessary(node.end - 1);
+ case ts.SyntaxKind.EmptyStatement:
+ return _this.checkEmptyStatement(node);
+ default:
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ SemicolonWalker.prototype.visitPropertyDeclaration = function (node) {
+ // check if this is a multi-line arrow function
+ if (node.initializer !== undefined &&
+ node.initializer.kind === ts.SyntaxKind.ArrowFunction &&
+ !utils.isSameLine(this.sourceFile, node.getStart(this.sourceFile), node.end)) {
+ if (this.options.boundClassMethods) {
+ if (this.sourceFile.text[node.end - 1] === ";" &&
+ this.isFollowedByLineBreak(node.end)) {
+ this.reportUnnecessary(node.end - 1);
+ }
+ }
+ }
+ else {
+ this.checkSemicolonOrLineBreak(node);
+ }
+ };
+ SemicolonWalker.prototype.isFollowedByLineBreak = function (pos) {
+ var scanner = this.scanner !== undefined ? this.scanner :
+ (this.scanner = ts.createScanner(this.sourceFile.languageVersion, true, this.sourceFile.languageVariant, this.sourceFile.text));
+ scanner.setTextPos(pos);
+ return scanner.scan() === ts.SyntaxKind.EndOfFileToken || scanner.hasPrecedingLineBreak();
+ };
+ SemicolonWalker.prototype.checkSemicolonOrLineBreak = function (node) {
+ var hasSemicolon = this.sourceFile.text[node.end - 1] === ";";
+ if (this.options.always && !hasSemicolon) {
+ this.reportMissing(node.end);
+ }
+ else if (!this.options.always && hasSemicolon && this.isFollowedByLineBreak(node.end)) {
+ // semicolon can be removed if followed by line break;
+ this.reportUnnecessary(node.end - 1);
+ }
+ };
+ SemicolonWalker.prototype.checkEmptyStatement = function (node) {
+ // An empty statement is only ever useful when it is the only statement inside a loop
+ if (!utils.isIterationStatement(node.parent)) {
+ var parentKind = node.parent.kind;
+ // don't remove empty statement if it is a direct child of if, with or a LabeledStatement
+ // otherwise this would unintentionally change control flow
+ var noFix = parentKind === ts.SyntaxKind.IfStatement ||
+ parentKind === ts.SyntaxKind.LabeledStatement ||
+ parentKind === ts.SyntaxKind.WithStatement;
+ this.reportUnnecessary(node.end - 1, noFix);
+ }
+ };
+ SemicolonWalker.prototype.checkInterface = function (node) {
+ for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
+ var member = _a[_i];
+ var lastChar = this.sourceFile.text[member.end - 1];
+ var hasSemicolon = lastChar === ";";
+ if (this.options.always && !hasSemicolon) {
+ if (lastChar === ",") {
+ this.addFailureAt(member.end - 1, 1, Rule.FAILURE_STRING_COMMA, new Lint.Replacement(member.end - 1, 1, ";"));
+ }
+ else {
+ this.reportMissing(member.end);
+ }
+ }
+ else if (!this.options.always && hasSemicolon &&
+ (member === node.members[node.members.length - 1] || this.isFollowedByLineBreak(member.end))) {
+ this.reportUnnecessary(member.end - 1);
+ }
+ }
+ };
+ SemicolonWalker.prototype.reportMissing = function (pos) {
+ this.addFailureAt(pos, 0, Rule.FAILURE_STRING_MISSING, Lint.Replacement.appendText(pos, ";"));
+ };
+ SemicolonWalker.prototype.reportUnnecessary = function (pos, noFix) {
+ this.addFailureAt(pos, 1, Rule.FAILURE_STRING_UNNECESSARY, noFix === true ? undefined : Lint.Replacement.deleteText(pos, 1));
+ };
+ SemicolonWalker.prototype.checkSemicolonAt = function (node) {
+ var hasSemicolon = this.sourceFile.text[node.end - 1] === ";";
+ if (this.options.always && !hasSemicolon) {
+ this.reportMissing(node.end);
+ }
+ else if (!this.options.always && hasSemicolon) {
+ switch (utils.getNextToken(node, this.sourceFile).kind) {
+ case ts.SyntaxKind.OpenParenToken:
+ case ts.SyntaxKind.OpenBracketToken:
+ case ts.SyntaxKind.PlusToken:
+ case ts.SyntaxKind.MinusToken:
+ case ts.SyntaxKind.RegularExpressionLiteral:
+ break;
+ default:
+ if (!this.isFollowedByStatement(node)) {
+ this.reportUnnecessary(node.end - 1);
+ }
+ }
+ }
+ };
+ SemicolonWalker.prototype.isFollowedByStatement = function (node) {
+ var nextStatement = utils.getNextStatement(node);
+ if (nextStatement === undefined) {
+ return false;
+ }
+ return utils.isSameLine(this.sourceFile, node.end, nextStatement.getStart(this.sourceFile));
+ };
+ return SemicolonWalker;
+}(Lint.AbstractWalker));
+var _a;
diff --git a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.d.ts b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.d.ts
new file mode 100644
index 000000000..3806be5e9
--- /dev/null
+++ b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ static INVALID_WHITESPACE_ERROR: string;
+ static MISSING_WHITESPACE_ERROR: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
new file mode 100644
index 000000000..cad09c6d3
--- /dev/null
+++ b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
@@ -0,0 +1,111 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var ALWAYS_OR_NEVER = {
+ enum: ["always", "never"],
+ type: "string",
+};
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments[0]));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.metadata = {
+ description: "Require or disallow a space before function parenthesis",
+ hasFix: true,
+ optionExamples: [
+ true,
+ [true, "always"],
+ [true, "never"],
+ [true, { anonymous: "always", named: "never", asyncArrow: "always" }],
+ ],
+ options: {
+ properties: {
+ anonymous: ALWAYS_OR_NEVER,
+ asyncArrow: ALWAYS_OR_NEVER,
+ constructor: ALWAYS_OR_NEVER,
+ method: ALWAYS_OR_NEVER,
+ named: ALWAYS_OR_NEVER,
+ },
+ 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)),
+ ruleName: "space-before-function-paren",
+ type: "style",
+ typescriptOnly: false,
+};
+Rule.INVALID_WHITESPACE_ERROR = "Spaces before function parens are disallowed";
+Rule.MISSING_WHITESPACE_ERROR = "Missing whitespace before function parens";
+exports.Rule = Rule;
+var optionNames = ["anonymous", "asyncArrow", "constructor", "method", "named"];
+function parseOptions(json) {
+ // Need to specify constructor or it will be Object
+ var options = { constructor: undefined };
+ for (var _i = 0, optionNames_1 = optionNames; _i < optionNames_1.length; _i++) {
+ var optionName = optionNames_1[_i];
+ options[optionName] = typeof json === "object" ? json[optionName] : json === undefined ? "always" : json;
+ }
+ return options;
+}
+function walk(ctx) {
+ var options = ctx.options, sourceFile = ctx.sourceFile;
+ ts.forEachChild(sourceFile, function cb(node) {
+ var option = getOption(node, options);
+ if (option !== undefined) {
+ var openParen = Lint.childOfKind(node, ts.SyntaxKind.OpenParenToken);
+ var hasSpace = ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(openParen.end - 2));
+ if (hasSpace && option === "never") {
+ var pos = openParen.getStart() - 1;
+ ctx.addFailureAt(pos, 1, Rule.INVALID_WHITESPACE_ERROR, Lint.Replacement.deleteText(pos, 1));
+ }
+ else if (!hasSpace && option === "always") {
+ var pos = openParen.getStart();
+ ctx.addFailureAt(pos, 1, Rule.MISSING_WHITESPACE_ERROR, Lint.Replacement.appendText(pos, " "));
+ }
+ }
+ ts.forEachChild(node, cb);
+ });
+}
+function getOption(node, options) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ArrowFunction:
+ return Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? options.asyncArrow : undefined;
+ case ts.SyntaxKind.Constructor:
+ return options.constructor;
+ case ts.SyntaxKind.FunctionDeclaration:
+ return options.named;
+ case ts.SyntaxKind.FunctionExpression:
+ return node.name !== undefined ? options.named : options.anonymous;
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.MethodSignature:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ return options.method;
+ default:
+ return undefined;
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
new file mode 100644
index 000000000..8a360c959
--- /dev/null
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
@@ -0,0 +1,38 @@
+/**
+ * @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 {
+ static metadata: Lint.IRuleMetadata;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
+export declare type Location = ts.PrefixUnaryExpression | ts.IfStatement | ts.WhileStatement | ts.DoStatement | ts.ForStatement | ts.ConditionalExpression | ts.BinaryExpression;
+export declare const enum TypeFailure {
+ AlwaysTruthy = 0,
+ AlwaysFalsy = 1,
+ String = 2,
+ Number = 3,
+ Null = 4,
+ Undefined = 5,
+ Enum = 6,
+ Mixes = 7,
+}
+declare module "typescript" {
+ interface IntrinsicType extends ts.Type {
+ intrinsicName: string;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
new file mode 100644
index 000000000..a202e2c49
--- /dev/null
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
@@ -0,0 +1,335 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_ALLOW_NULL_UNION = "allow-null-union";
+var OPTION_ALLOW_UNDEFINED_UNION = "allow-undefined-union";
+var OPTION_ALLOW_STRING = "allow-string";
+var OPTION_ALLOW_NUMBER = "allow-number";
+var OPTION_ALLOW_MIX = "allow-mix";
+// tslint:disable object-literal-sort-keys switch-default
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ var options = parseOptions(this.ruleArguments, program.getCompilerOptions().strictNullChecks === true);
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); }, options);
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+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 * `", "` allow 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."], _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 * \\`", "\\` allow 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."], Lint.Utils.dedent(_b, OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER, OPTION_ALLOW_MIX)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER],
+ },
+ minLength: 0,
+ maxLength: 5,
+ },
+ optionExamples: [
+ true,
+ [true, OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER],
+ ],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+exports.Rule = Rule;
+function parseOptions(ruleArguments, strictNullChecks) {
+ return {
+ strictNullChecks: strictNullChecks,
+ allowNullUnion: has(OPTION_ALLOW_NULL_UNION),
+ allowUndefinedUnion: has(OPTION_ALLOW_UNDEFINED_UNION),
+ allowString: has(OPTION_ALLOW_STRING),
+ allowNumber: has(OPTION_ALLOW_NUMBER),
+ allowMix: has(OPTION_ALLOW_MIX),
+ };
+ function has(name) {
+ return ruleArguments.indexOf(name) !== -1;
+ }
+}
+function walk(ctx, checker) {
+ var sourceFile = ctx.sourceFile, options = ctx.options;
+ ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.BinaryExpression: {
+ var b_1 = node;
+ if (binaryBooleanExpressionKind(b_1) !== undefined) {
+ var left = b_1.left, right = b_1.right;
+ var checkHalf = function (expr) {
+ // If it's another boolean binary expression, we'll check it when recursing.
+ if (!isBooleanBinaryExpression(expr)) {
+ checkExpression(expr, b_1);
+ }
+ };
+ checkHalf(left);
+ checkHalf(right);
+ }
+ break;
+ }
+ case ts.SyntaxKind.PrefixUnaryExpression: {
+ var _a = node, operator = _a.operator, operand = _a.operand;
+ if (operator === ts.SyntaxKind.ExclamationToken) {
+ checkExpression(operand, node);
+ }
+ break;
+ }
+ case ts.SyntaxKind.IfStatement:
+ case ts.SyntaxKind.WhileStatement:
+ case ts.SyntaxKind.DoStatement: {
+ var c = node;
+ // If it's a boolean binary expression, we'll check it when recursing.
+ if (!isBooleanBinaryExpression(c.expression)) {
+ checkExpression(c.expression, c);
+ }
+ break;
+ }
+ case ts.SyntaxKind.ConditionalExpression:
+ checkExpression(node.condition, node);
+ break;
+ case ts.SyntaxKind.ForStatement: {
+ var condition = node.condition;
+ if (condition !== undefined) {
+ checkExpression(condition, node);
+ }
+ break;
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function checkExpression(node, location) {
+ var type = checker.getTypeAtLocation(node);
+ var failure = getTypeFailure(type, options);
+ if (failure !== undefined) {
+ if (failure === 0 /* AlwaysTruthy */ &&
+ !options.strictNullChecks &&
+ (options.allowNullUnion || options.allowUndefinedUnion)) {
+ // OK; It might be null/undefined.
+ return;
+ }
+ ctx.addFailureAtNode(node, showFailure(location, failure, isUnionType(type), options));
+ }
+ }
+}
+function getTypeFailure(type, options) {
+ if (isUnionType(type)) {
+ return handleUnion(type, options);
+ }
+ var kind = getKind(type);
+ var failure = failureForKind(kind, /*isInUnion*/ false, options);
+ if (failure !== undefined) {
+ return failure;
+ }
+ switch (triState(kind)) {
+ case true:
+ return 0 /* AlwaysTruthy */;
+ case false:
+ return 1 /* AlwaysFalsy */;
+ case undefined:
+ return undefined;
+ }
+}
+function handleUnion(type, options) {
+ // Tracks whether it's possibly truthy.
+ var anyTruthy = false;
+ // Counts falsy kinds to see if there's a mix. Also tracks whether it's possibly falsy.
+ var seenFalsy = 0;
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var ty = _a[_i];
+ var kind = getKind(ty);
+ var failure = failureForKind(kind, /*isInUnion*/ true, options);
+ if (failure !== undefined) {
+ return failure;
+ }
+ switch (triState(kind)) {
+ case true:
+ anyTruthy = true;
+ break;
+ case false:
+ seenFalsy++;
+ break;
+ default:
+ anyTruthy = true;
+ seenFalsy++;
+ }
+ }
+ return seenFalsy === 0 ? 0 /* AlwaysTruthy */
+ : !anyTruthy ? 1 /* AlwaysFalsy */
+ : !options.allowMix && seenFalsy > 1 ? 7 /* Mixes */ : undefined;
+}
+/** Fails if a kind of falsiness is not allowed. */
+function failureForKind(kind, isInUnion, options) {
+ switch (kind) {
+ case 0 /* String */:
+ case 1 /* FalseStringLiteral */:
+ return options.allowString ? undefined : 2 /* String */;
+ case 2 /* Number */:
+ case 3 /* FalseNumberLiteral */:
+ return options.allowNumber ? undefined : 3 /* Number */;
+ case 8 /* Enum */:
+ return 6 /* Enum */;
+ case 6 /* Null */:
+ return isInUnion && !options.allowNullUnion ? 4 /* Null */ : undefined;
+ case 7 /* Undefined */:
+ return isInUnion && !options.allowUndefinedUnion ? 5 /* Undefined */ : undefined;
+ default:
+ return undefined;
+ }
+}
+/** Divides a type into always true, always false, or unknown. */
+function triState(kind) {
+ switch (kind) {
+ case 0 /* String */:
+ case 2 /* Number */:
+ case 4 /* Boolean */:
+ case 8 /* Enum */:
+ return undefined;
+ case 6 /* Null */:
+ case 7 /* Undefined */:
+ case 3 /* FalseNumberLiteral */:
+ case 1 /* FalseStringLiteral */:
+ case 5 /* FalseBooleanLiteral */:
+ return false;
+ case 9 /* AlwaysTruthy */:
+ return true;
+ }
+}
+function getKind(type) {
+ return is(ts.TypeFlags.String) ? 0 /* String */
+ : is(ts.TypeFlags.Number) ? 2 /* Number */
+ : is(ts.TypeFlags.Boolean) ? 4 /* Boolean */
+ : is(ts.TypeFlags.Null) ? 6 /* Null */
+ : is(ts.TypeFlags.Undefined | ts.TypeFlags.Void) ? 7 /* Undefined */
+ : is(ts.TypeFlags.EnumLike) ? 8 /* Enum */
+ : is(ts.TypeFlags.NumberLiteral) ?
+ (numberLiteralIsZero(type) ? 3 /* FalseNumberLiteral */ : 9 /* AlwaysTruthy */)
+ : is(ts.TypeFlags.StringLiteral) ?
+ (stringLiteralIsEmpty(type) ? 1 /* FalseStringLiteral */ : 9 /* AlwaysTruthy */)
+ : is(ts.TypeFlags.BooleanLiteral) ?
+ (type.intrinsicName === "true" ? 9 /* AlwaysTruthy */ : 5 /* FalseBooleanLiteral */)
+ : 9 /* AlwaysTruthy */;
+ function is(flags) {
+ return Lint.isTypeFlagSet(type, flags);
+ }
+}
+function numberLiteralIsZero(type) {
+ // Uses 'value' in TypeScript>=2.4.
+ return type.value !== undefined ? type.value === 0 : type.text === "0";
+}
+function stringLiteralIsEmpty(type) {
+ return (type.value !== undefined ? type.value : type.text) === "";
+}
+/** Matches `&&` and `||` operators. */
+function isBooleanBinaryExpression(node) {
+ return node.kind === ts.SyntaxKind.BinaryExpression && binaryBooleanExpressionKind(node) !== undefined;
+}
+function binaryBooleanExpressionKind(node) {
+ switch (node.operatorToken.kind) {
+ case ts.SyntaxKind.AmpersandAmpersandToken:
+ return "&&";
+ case ts.SyntaxKind.BarBarToken:
+ return "||";
+ default:
+ return undefined;
+ }
+}
+function stringOr(parts) {
+ switch (parts.length) {
+ case 1:
+ return parts[0];
+ case 2:
+ return parts[0] + " or " + parts[1];
+ default:
+ var res = "";
+ for (var i = 0; i < parts.length - 1; i++) {
+ res += parts[i] + ", ";
+ }
+ return res + "or " + parts[parts.length - 1];
+ }
+}
+function isUnionType(type) {
+ return Lint.isTypeFlagSet(type, ts.TypeFlags.Union) && !Lint.isTypeFlagSet(type, ts.TypeFlags.Enum);
+}
+function showLocation(n) {
+ switch (n.kind) {
+ case ts.SyntaxKind.PrefixUnaryExpression:
+ return "operand for the '!' operator";
+ case ts.SyntaxKind.ConditionalExpression:
+ return "condition";
+ case ts.SyntaxKind.ForStatement:
+ return "'for' condition";
+ case ts.SyntaxKind.IfStatement:
+ return "'if' condition";
+ case ts.SyntaxKind.WhileStatement:
+ return "'while' condition";
+ case ts.SyntaxKind.DoStatement:
+ return "'do-while' condition";
+ case ts.SyntaxKind.BinaryExpression:
+ return "operand for the '" + binaryBooleanExpressionKind(n) + "' operator";
+ }
+}
+function showFailure(location, ty, isUnionType, options) {
+ var expectedTypes = showExpectedTypes(options);
+ var expected = expectedTypes.length === 1
+ ? "Only " + expectedTypes[0] + "s are allowed"
+ : "Allowed types are " + stringOr(expectedTypes);
+ var tyFail = showTypeFailure(ty, isUnionType, options.strictNullChecks);
+ return "This type is not allowed in the " + showLocation(location) + " because it " + tyFail + ". " + expected + ".";
+}
+function showExpectedTypes(options) {
+ var parts = ["boolean"];
+ if (options.allowNullUnion) {
+ parts.push("null-union");
+ }
+ if (options.allowUndefinedUnion) {
+ parts.push("undefined-union");
+ }
+ if (options.allowString) {
+ parts.push("string");
+ }
+ if (options.allowNumber) {
+ parts.push("number");
+ }
+ return parts;
+}
+function showTypeFailure(ty, isUnionType, strictNullChecks) {
+ var is = isUnionType ? "could be" : "is";
+ switch (ty) {
+ case 0 /* AlwaysTruthy */:
+ return strictNullChecks
+ ? "is always truthy"
+ : "is always truthy. It may be null/undefined, but neither " +
+ ("'" + OPTION_ALLOW_NULL_UNION + "' nor '" + OPTION_ALLOW_UNDEFINED_UNION + "' is set");
+ case 1 /* AlwaysFalsy */: return "is always falsy";
+ case 2 /* String */: return is + " a string";
+ case 3 /* Number */: return is + " a number";
+ case 4 /* Null */: return is + " null";
+ case 5 /* Undefined */: return is + " undefined";
+ case 6 /* Enum */: return is + " an enum";
+ case 7 /* Mixes */: return "unions more than one truthy/falsy type";
+ }
+}
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
new file mode 100644
index 000000000..85b7194c3
--- /dev/null
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
@@ -0,0 +1,9 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.TypedRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING_BAD_TYPEOF: string;
+ static FAILURE_STRING(value: boolean): string;
+ static FAILURE_STRICT_PREFER_STRICT_EQUALS(value: "null" | "undefined", isPositive: boolean): string;
+ applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
new file mode 100644
index 000000000..20dd3f9d0
--- /dev/null
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
@@ -0,0 +1,217 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+// tslint:disable:no-bitwise
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.FAILURE_STRING = function (value) {
+ return "Expression is always " + value + ".";
+ };
+ Rule.FAILURE_STRICT_PREFER_STRICT_EQUALS = function (value, isPositive) {
+ return "Use '" + (isPositive ? "===" : "!==") + " " + value + "' instead.";
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ };
+ return Rule;
+}(Lint.Rules.TypedRule));
+/* 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."], _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."], Lint.Utils.dedent(_a)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: true,
+ requiresTypeInfo: true,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_BAD_TYPEOF = "Bad comparison for 'typeof'.";
+exports.Rule = Rule;
+function walk(ctx, checker) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isBinaryExpression(node)) {
+ var equals = Lint.getEqualsKind(node.operatorToken);
+ if (equals !== undefined) {
+ checkEquals(node, equals);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function checkEquals(node, _a) {
+ var isStrict = _a.isStrict, isPositive = _a.isPositive;
+ var exprPred = getTypePredicate(node, isStrict);
+ if (exprPred === undefined) {
+ return;
+ }
+ if (exprPred.kind === 2 /* TypeofTypo */) {
+ fail(Rule.FAILURE_STRING_BAD_TYPEOF);
+ return;
+ }
+ 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)) {
+ return;
+ }
+ switch (exprPred.kind) {
+ case 0 /* Plain */: {
+ var predicate = exprPred.predicate, isNullOrUndefined = exprPred.isNullOrUndefined;
+ var value = getConstantBoolean(exprType, predicate);
+ // 'null'/'undefined' are the only two values *not* assignable to '{}'.
+ if (value !== undefined && (isNullOrUndefined || !isEmptyType(checker, exprType))) {
+ fail(Rule.FAILURE_STRING(value === isPositive));
+ }
+ break;
+ }
+ case 1 /* NonStructNullUndefined */: {
+ var result = testNonStrictNullUndefined(exprType);
+ if (result !== undefined) {
+ fail(typeof result === "boolean"
+ ? Rule.FAILURE_STRING(result === isPositive)
+ : Rule.FAILURE_STRICT_PREFER_STRICT_EQUALS(result, isPositive));
+ }
+ break;
+ }
+ }
+ function fail(failure) {
+ ctx.addFailureAtNode(node, failure);
+ }
+ }
+}
+/** Detects a type predicate given `left === right`. */
+function getTypePredicate(node, isStrictEquals) {
+ var left = node.left, right = node.right;
+ var lr = getTypePredicateOneWay(left, right, isStrictEquals);
+ return lr !== undefined ? lr : getTypePredicateOneWay(right, left, isStrictEquals);
+}
+/** Only gets the type predicate if the expression is on the left. */
+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);
+ return predicate === undefined
+ ? { kind: 2 /* TypeofTypo */ }
+ : { kind: 0 /* Plain */, expression: expression, predicate: predicate, isNullOrUndefined: kind === "undefined" };
+ case ts.SyntaxKind.NullKeyword:
+ return nullOrUndefined(ts.TypeFlags.Null);
+ case ts.SyntaxKind.Identifier:
+ if (right.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword) {
+ return nullOrUndefined(undefinedFlags);
+ }
+ return undefined;
+ default:
+ return undefined;
+ }
+ function nullOrUndefined(flags) {
+ return isStrictEquals
+ ? { kind: 0 /* Plain */, expression: left, predicate: flagPredicate(flags), isNullOrUndefined: true }
+ : { kind: 1 /* NonStructNullUndefined */, expression: left };
+ }
+}
+function isEmptyType(checker, type) {
+ return checker.typeToString(type) === "{}";
+}
+var undefinedFlags = ts.TypeFlags.Undefined | ts.TypeFlags.Void;
+function getTypePredicateForKind(kind) {
+ switch (kind) {
+ case "undefined":
+ return flagPredicate(undefinedFlags);
+ case "boolean":
+ return flagPredicate(ts.TypeFlags.BooleanLike);
+ case "number":
+ return flagPredicate(ts.TypeFlags.NumberLike);
+ case "string":
+ return flagPredicate(ts.TypeFlags.StringLike);
+ case "symbol":
+ return flagPredicate(ts.TypeFlags.ESSymbol);
+ case "function":
+ return isFunction;
+ case "object":
+ // 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); };
+ default:
+ return undefined;
+ }
+}
+function flagPredicate(testedFlag) {
+ return function (type) { return Lint.isTypeFlagSet(type, testedFlag); };
+}
+function isFunction(t) {
+ if (t.getConstructSignatures().length !== 0 || t.getCallSignatures().length !== 0) {
+ return true;
+ }
+ var symbol = t.getSymbol();
+ return symbol !== undefined && symbol.getName() === "Function";
+}
+/** Returns a boolean value if that should always be the result of a type predicate. */
+function getConstantBoolean(type, predicate) {
+ var anyTrue = false;
+ var anyFalse = false;
+ for (var _i = 0, _a = unionParts(type); _i < _a.length; _i++) {
+ var ty = _a[_i];
+ if (predicate(ty)) {
+ anyTrue = true;
+ }
+ else {
+ anyFalse = true;
+ }
+ if (anyTrue && anyFalse) {
+ return undefined;
+ }
+ }
+ return anyTrue;
+}
+/** Returns bool for always/never true, or a string to recommend strict equality. */
+function testNonStrictNullUndefined(type) {
+ var anyNull = false;
+ var anyUndefined = false;
+ 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)) {
+ anyNull = true;
+ }
+ else if (Lint.isTypeFlagSet(ty, undefinedFlags)) {
+ anyUndefined = true;
+ }
+ else {
+ anyOther = true;
+ }
+ }
+ return !anyOther ? true
+ : anyNull && anyUndefined ? undefined
+ : anyNull ? "null"
+ : anyUndefined ? "undefined"
+ : false;
+}
+function unionParts(type) {
+ return tsutils_1.isUnionType(type) ? type.types : [type];
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/switchDefaultRule.d.ts b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/switchDefaultRule.js b/node_modules/tslint/lib/rules/switchDefaultRule.js
new file mode 100644
index 000000000..ac24a8370
--- /dev/null
+++ b/node_modules/tslint/lib/rules/switchDefaultRule.js
@@ -0,0 +1,54 @@
+"use strict";
+/**
+ * @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.
+ */
+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 = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "switch-default",
+ description: "Require a `default` case in all `switch` statements.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Switch statement should include a 'default' case";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (node.kind === ts.SyntaxKind.SwitchStatement &&
+ !node.caseBlock.clauses.some(tsutils_1.isDefaultClause)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.d.ts b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
new file mode 100644
index 000000000..10b449342
--- /dev/null
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
@@ -0,0 +1,9 @@
+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_NEVER: string;
+ static FAILURE_STRING_ALWAYS: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ isEnabled(): boolean;
+}
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.js b/node_modules/tslint/lib/rules/trailingCommaRule.js
new file mode 100644
index 000000000..a91e57fe8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.js
@@ -0,0 +1,211 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var defaultOptions = fillOptions("ignore");
+function fillOptions(value) {
+ return {
+ arrays: value,
+ exports: value,
+ functions: value,
+ imports: value,
+ objects: value,
+ typeLiterals: value,
+ };
+}
+function normalizeOptions(options) {
+ return { multiline: normalize(options.multiline), singleline: normalize(options.singleline) };
+ function normalize(value) {
+ return typeof value === "string" ? fillOptions(value) : tslib_1.__assign({}, defaultOptions, value);
+ }
+}
+/* tslint:disable:object-literal-sort-keys */
+var metadataOptionShape = {
+ anyOf: [
+ {
+ type: "string",
+ enum: ["always", "never"],
+ },
+ {
+ type: "object",
+ properties: fillOptions({
+ type: "string",
+ enum: ["always", "never", "ignore"],
+ }),
+ },
+ ],
+};
+/* tslint:enable:object-literal-sort-keys */
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ var options = normalizeOptions(this.ruleArguments[0]);
+ return this.applyWithWalker(new TrailingCommaWalker(sourceFile, this.ruleName, options));
+ };
+ Rule.prototype.isEnabled = function () {
+ return _super.prototype.isEnabled.call(this) && this.ruleArguments.length !== 0;
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* 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)),
+ 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."], _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."], Lint.Utils.dedent(_b)),
+ options: {
+ type: "object",
+ properties: {
+ multiline: metadataOptionShape,
+ singleline: metadataOptionShape,
+ },
+ additionalProperties: false,
+ },
+ optionExamples: [
+ [true, { multiline: "always", singleline: "never" }],
+ [
+ true,
+ {
+ multiline: {
+ objects: "always",
+ arrays: "always",
+ functions: "never",
+ typeLiterals: "ignore",
+ },
+ },
+ ],
+ ],
+ type: "maintainability",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING_NEVER = "Unnecessary trailing comma";
+Rule.FAILURE_STRING_ALWAYS = "Missing trailing comma";
+exports.Rule = Rule;
+var TrailingCommaWalker = (function (_super) {
+ tslib_1.__extends(TrailingCommaWalker, _super);
+ function TrailingCommaWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TrailingCommaWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ case ts.SyntaxKind.ArrayBindingPattern:
+ _this.checkList(node.elements, node.end, "arrays");
+ break;
+ case ts.SyntaxKind.ObjectBindingPattern:
+ _this.checkList(node.elements, node.end, "objects");
+ break;
+ case ts.SyntaxKind.NamedImports:
+ _this.checkList(node.elements, node.end, "imports");
+ break;
+ case ts.SyntaxKind.NamedExports:
+ _this.checkList(node.elements, node.end, "exports");
+ break;
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ _this.checkList(node.properties, node.end, "objects");
+ break;
+ case ts.SyntaxKind.EnumDeclaration:
+ _this.checkList(node.members, node.end, "objects");
+ break;
+ case ts.SyntaxKind.NewExpression:
+ if (node.arguments === undefined) {
+ break;
+ }
+ // falls through
+ case ts.SyntaxKind.CallExpression:
+ _this.checkList(node.arguments, node.end, "functions");
+ break;
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.SetAccessor:
+ case ts.SyntaxKind.MethodSignature:
+ case ts.SyntaxKind.ConstructSignature:
+ case ts.SyntaxKind.ConstructorType:
+ case ts.SyntaxKind.FunctionType:
+ case ts.SyntaxKind.CallSignature:
+ _this.checkListWithEndToken(node, node.parameters, ts.SyntaxKind.CloseParenToken, "functions");
+ break;
+ case ts.SyntaxKind.TypeLiteral:
+ _this.checkTypeLiteral(node);
+ break;
+ default:
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ TrailingCommaWalker.prototype.checkTypeLiteral = function (node) {
+ var members = node.members;
+ if (members.length === 0) {
+ return;
+ }
+ var sourceText = this.sourceFile.text;
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var member = members_1[_i];
+ // PropertySignature in TypeLiteral can end with semicolon or comma. If one ends with a semicolon don't check for trailing comma
+ if (sourceText[member.end - 1] === ";") {
+ return;
+ }
+ }
+ // The trailing comma is part of the last member and therefore not present as hasTrailingComma on the NodeArray
+ var hasTrailingComma = sourceText[members.end - 1] === ",";
+ return this.checkComma(hasTrailingComma, members, node.end, "typeLiterals");
+ };
+ TrailingCommaWalker.prototype.checkListWithEndToken = function (node, list, closeTokenKind, optionKey) {
+ if (list.length === 0) {
+ return;
+ }
+ var token = tsutils_1.getChildOfKind(node, closeTokenKind, this.sourceFile);
+ if (token !== undefined) {
+ return this.checkComma(list.hasTrailingComma === true, list, token.end, optionKey);
+ }
+ };
+ TrailingCommaWalker.prototype.checkList = function (list, closeElementPos, optionKey) {
+ if (list.length === 0) {
+ return;
+ }
+ return this.checkComma(list.hasTrailingComma === true, list, closeElementPos, optionKey);
+ };
+ /* Expects `list.length !== 0` */
+ TrailingCommaWalker.prototype.checkComma = function (hasTrailingComma, list, closeTokenPos, optionKey) {
+ var options = tsutils_1.isSameLine(this.sourceFile, list[list.length - 1].end, closeTokenPos)
+ ? this.options.singleline
+ : this.options.multiline;
+ var option = options[optionKey];
+ if (option === "always" && !hasTrailingComma) {
+ this.addFailureAt(list.end, 0, Rule.FAILURE_STRING_ALWAYS, Lint.Replacement.appendText(list.end, ","));
+ }
+ else if (option === "never" && hasTrailingComma) {
+ this.addFailureAt(list.end - 1, 1, Rule.FAILURE_STRING_NEVER, Lint.Replacement.deleteText(list.end - 1, 1));
+ }
+ };
+ return TrailingCommaWalker;
+}(Lint.AbstractWalker));
+var _a, _b;
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
new file mode 100644
index 000000000..7a87690b6
--- /dev/null
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
@@ -0,0 +1,8 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static EQ_FAILURE_STRING: string;
+ static NEQ_FAILURE_STRING: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.js b/node_modules/tslint/lib/rules/tripleEqualsRule.js
new file mode 100644
index 000000000..c20d45f18
--- /dev/null
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.js
@@ -0,0 +1,86 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_ALLOW_NULL_CHECK = "allow-null-check";
+var OPTION_ALLOW_UNDEFINED_CHECK = "allow-undefined-check";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, {
+ allowNull: this.ruleArguments.indexOf(OPTION_ALLOW_NULL_CHECK) !== -1,
+ allowUndefined: this.ruleArguments.indexOf(OPTION_ALLOW_UNDEFINED_CHECK) !== -1,
+ });
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [OPTION_ALLOW_NULL_CHECK, OPTION_ALLOW_UNDEFINED_CHECK],
+ },
+ minLength: 0,
+ maxLength: 2,
+ },
+ optionExamples: [
+ true,
+ [true, "allow-null-check"],
+ [true, "allow-undefined-check"],
+ ],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.EQ_FAILURE_STRING = "== should be ===";
+Rule.NEQ_FAILURE_STRING = "!= should be !==";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isBinaryExpression(node)) {
+ if ((node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsToken ||
+ node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsToken) &&
+ !(isExpressionAllowed(node.right, ctx.options) || isExpressionAllowed(node.left, ctx.options))) {
+ ctx.addFailureAtNode(node.operatorToken, node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsToken
+ ? Rule.EQ_FAILURE_STRING
+ : Rule.NEQ_FAILURE_STRING);
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isExpressionAllowed(node, options) {
+ if (node.kind === ts.SyntaxKind.NullKeyword) {
+ return options.allowNull;
+ }
+ return options.allowUndefined &&
+ node.kind === ts.SyntaxKind.Identifier &&
+ node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/typedefRule.d.ts b/node_modules/tslint/lib/rules/typedefRule.d.ts
new file mode 100644
index 000000000..180453e09
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typedefRule.d.ts
@@ -0,0 +1,6 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/typedefRule.js b/node_modules/tslint/lib/rules/typedefRule.js
new file mode 100644
index 000000000..c53358b4f
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typedefRule.js
@@ -0,0 +1,193 @@
+"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 });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_CALL_SIGNATURE = "call-signature";
+var OPTION_ARROW_CALL_SIGNATURE = "arrow-call-signature";
+var OPTION_PARAMETER = "parameter";
+var OPTION_ARROW_PARAMETER = "arrow-parameter";
+var OPTION_PROPERTY_DECLARATION = "property-declaration";
+var OPTION_VARIABLE_DECLARATION = "variable-declaration";
+var OPTION_MEMBER_VARIABLE_DECLARATION = "member-variable-declaration";
+var OPTION_OBJECT_DESTRUCTURING = "object-destructuring";
+var OPTION_ARRAY_DESTRUCTURING = "array-destructuring";
+function parseOptions(ruleArguments) {
+ var options = {};
+ for (var _i = 0, ruleArguments_1 = ruleArguments; _i < ruleArguments_1.length; _i++) {
+ var arg = ruleArguments_1[_i];
+ options[arg] = true;
+ }
+ return options;
+}
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithWalker(new TypedefWalker(sourceFile, this.ruleName, parseOptions(this.ruleArguments)));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [
+ 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,
+ ],
+ },
+ minLength: 0,
+ maxLength: 7,
+ },
+ optionExamples: [[true, OPTION_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_MEMBER_VARIABLE_DECLARATION]],
+ type: "typescript",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+var TypedefWalker = (function (_super) {
+ tslib_1.__extends(TypedefWalker, _super);
+ function TypedefWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TypedefWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.MethodSignature: {
+ var _a = node, name = _a.name, parameters = _a.parameters, type = _a.type;
+ _this.checkTypeAnnotation("call-signature", name !== undefined ? name : parameters, type, name);
+ break;
+ }
+ case ts.SyntaxKind.ArrowFunction:
+ _this.checkArrowFunction(node);
+ break;
+ case ts.SyntaxKind.Parameter:
+ _this.checkParameter(node);
+ break;
+ case ts.SyntaxKind.PropertyDeclaration:
+ _this.checkPropertyDeclaration(node);
+ break;
+ case ts.SyntaxKind.PropertySignature: {
+ var _b = node, name = _b.name, type = _b.type;
+ _this.checkTypeAnnotation("property-declaration", name, type, name);
+ break;
+ }
+ case ts.SyntaxKind.VariableDeclaration:
+ _this.checkVariableDeclaration(node);
+ break;
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ TypedefWalker.prototype.checkArrowFunction = function (_a) {
+ var parent = _a.parent, parameters = _a.parameters, type = _a.type;
+ if (parent.kind !== ts.SyntaxKind.CallExpression && !isTypedPropertyDeclaration(parent)) {
+ this.checkTypeAnnotation("arrow-call-signature", parameters, type);
+ }
+ };
+ TypedefWalker.prototype.checkParameter = function (_a) {
+ var parent = _a.parent, name = _a.name, type = _a.type;
+ var isArrowFunction = parent.kind === ts.SyntaxKind.ArrowFunction;
+ var option = (function () {
+ if (!isArrowFunction) {
+ return "parameter";
+ }
+ else if (isTypedPropertyDeclaration(parent.parent)) {
+ return undefined;
+ }
+ else if (utils.isPropertyDeclaration(parent.parent)) {
+ return "member-variable-declaration";
+ }
+ else {
+ return "arrow-parameter";
+ }
+ })();
+ if (option !== undefined) {
+ this.checkTypeAnnotation(option, name, type, name);
+ }
+ };
+ TypedefWalker.prototype.checkPropertyDeclaration = function (_a) {
+ var initializer = _a.initializer, name = _a.name, type = _a.type;
+ // If this is an arrow function, it doesn't need to have a typedef on the property declaration
+ // as the typedefs can be on the function's parameters instead
+ if (initializer === undefined || initializer.kind !== ts.SyntaxKind.ArrowFunction) {
+ this.checkTypeAnnotation("member-variable-declaration", name, type, name);
+ }
+ };
+ TypedefWalker.prototype.checkVariableDeclaration = function (_a) {
+ var parent = _a.parent, name = _a.name, type = _a.type;
+ // variable declarations should always have a grandparent, but check that to be on the safe side.
+ // catch statements will be the parent of the variable declaration
+ // for-in/for-of loops will be the gradparent of the variable declaration
+ if (parent.kind === ts.SyntaxKind.CatchClause
+ || parent.parent.kind === ts.SyntaxKind.ForInStatement
+ || parent.parent.kind === ts.SyntaxKind.ForOfStatement) {
+ return;
+ }
+ var option = (function () {
+ switch (name.kind) {
+ case ts.SyntaxKind.ObjectBindingPattern:
+ return "object-destructuring";
+ case ts.SyntaxKind.ArrayBindingPattern:
+ return "array-destructuring";
+ default:
+ return "variable-declaration";
+ }
+ })();
+ this.checkTypeAnnotation(option, name, type, name);
+ };
+ TypedefWalker.prototype.checkTypeAnnotation = function (option, location, typeAnnotation, name) {
+ if (this.options[option] === true && typeAnnotation === undefined) {
+ var failure = "expected " + option + (name === undefined ? "" : ": '" + name.getText() + "'") + " to have a typedef";
+ if (Array.isArray(location)) {
+ this.addFailure(location.pos - 1, location.end + 1, failure);
+ }
+ else {
+ this.addFailureAtNode(location, failure);
+ }
+ }
+ };
+ return TypedefWalker;
+}(Lint.AbstractWalker));
+function isTypedPropertyDeclaration(node) {
+ return utils.isPropertyDeclaration(node) && node.type !== undefined;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
new file mode 100644
index 000000000..1f72293ed
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
@@ -0,0 +1,7 @@
+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(option: string, location: "before" | "after", type: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
new file mode 100644
index 000000000..3fc253e6c
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
@@ -0,0 +1,194 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+/* tslint:disable:object-literal-sort-keys */
+var SPACE_OPTIONS = {
+ type: "string",
+ enum: ["nospace", "onespace", "space"],
+};
+var SPACE_OBJECT = {
+ type: "object",
+ properties: {
+ "call-signature": SPACE_OPTIONS,
+ "index-signature": SPACE_OPTIONS,
+ "parameter": SPACE_OPTIONS,
+ "property-declaration": SPACE_OPTIONS,
+ "variable-declaration": SPACE_OPTIONS,
+ },
+ additionalProperties: false,
+};
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (option, location, type) {
+ return "expected " + option + " " + location + " colon in " + type;
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ var args = this.ruleArguments;
+ var options = {
+ left: args[0],
+ right: args[1],
+ };
+ return this.applyWithWalker(new TypedefWhitespaceWalker(sourceFile, this.ruleName, options));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.metadata = {
+ 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)),
+ options: {
+ type: "array",
+ items: [SPACE_OBJECT, SPACE_OBJECT],
+ additionalItems: false,
+ },
+ optionExamples: [
+ [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace",
+ },
+ {
+ "call-signature": "onespace",
+ "index-signature": "onespace",
+ "parameter": "onespace",
+ "property-declaration": "onespace",
+ "variable-declaration": "onespace",
+ },
+ ],
+ ],
+ type: "typescript",
+ typescriptOnly: true,
+ hasFix: true,
+};
+exports.Rule = Rule;
+var TypedefWhitespaceWalker = (function (_super) {
+ tslib_1.__extends(TypedefWhitespaceWalker, _super);
+ function TypedefWhitespaceWalker() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TypedefWhitespaceWalker.prototype.walk = function (sourceFile) {
+ var _this = this;
+ var cb = function (node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ case ts.SyntaxKind.MethodSignature:
+ case ts.SyntaxKind.ConstructSignature:
+ case ts.SyntaxKind.CallSignature:
+ _this.checkSpace(node, "call-signature");
+ break;
+ case ts.SyntaxKind.IndexSignature:
+ _this.checkSpace(node, "index-signature");
+ break;
+ case ts.SyntaxKind.VariableDeclaration:
+ _this.checkSpace(node, "variable-declaration");
+ break;
+ case ts.SyntaxKind.Parameter:
+ _this.checkSpace(node, "parameter");
+ break;
+ case ts.SyntaxKind.PropertySignature:
+ case ts.SyntaxKind.PropertyDeclaration:
+ _this.checkSpace(node, "property-declaration");
+ }
+ return ts.forEachChild(node, cb);
+ };
+ return ts.forEachChild(sourceFile, cb);
+ };
+ TypedefWhitespaceWalker.prototype.checkSpace = function (node, key) {
+ if (node.type === undefined) {
+ return;
+ }
+ var _a = this.options, left = _a.left, right = _a.right;
+ var colon = tsutils_1.getChildOfKind(node, ts.SyntaxKind.ColonToken, this.sourceFile);
+ if (right !== undefined && right[key] !== undefined) {
+ this.checkRight(colon.end, right[key], key);
+ }
+ if (left !== undefined && left[key] !== undefined) {
+ this.checkLeft(colon.end - 1, left[key], key);
+ }
+ };
+ TypedefWhitespaceWalker.prototype.checkRight = function (colonEnd, option, key) {
+ var pos = colonEnd;
+ var text = this.sourceFile.text;
+ var current = text.charCodeAt(pos);
+ if (ts.isLineBreak(current)) {
+ return;
+ }
+ while (ts.isWhiteSpaceSingleLine(current)) {
+ ++pos;
+ current = text.charCodeAt(pos);
+ }
+ return this.validateWhitespace(colonEnd, pos, option, "after", key);
+ };
+ TypedefWhitespaceWalker.prototype.checkLeft = function (colonStart, option, key) {
+ var pos = colonStart;
+ var text = this.sourceFile.text;
+ var current = text.charCodeAt(pos - 1);
+ while (ts.isWhiteSpaceSingleLine(current)) {
+ --pos;
+ current = text.charCodeAt(pos - 1);
+ }
+ if (ts.isLineBreak(current)) {
+ return;
+ }
+ return this.validateWhitespace(pos, colonStart, option, "before", key);
+ };
+ TypedefWhitespaceWalker.prototype.validateWhitespace = function (start, end, option, location, key) {
+ switch (option) {
+ case "nospace":
+ if (start !== end) {
+ this.addFailure(start, end, Rule.FAILURE_STRING(option, location, key), Lint.Replacement.deleteFromTo(start, end));
+ }
+ break;
+ case "space":
+ if (start === end) {
+ this.addFailure(end, end, Rule.FAILURE_STRING(option, location, key), Lint.Replacement.appendText(end, " "));
+ }
+ break;
+ case "onespace":
+ switch (end - start) {
+ case 0:
+ this.addFailure(end, end, Rule.FAILURE_STRING(option, location, key), Lint.Replacement.appendText(end, " "));
+ break;
+ case 1:
+ break;
+ default:
+ this.addFailure(start + 1, end, Rule.FAILURE_STRING(option, location, key), Lint.Replacement.deleteFromTo(start + 1, end));
+ }
+ }
+ };
+ return TypedefWhitespaceWalker;
+}(Lint.AbstractWalker));
+var _a;
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.d.ts b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.js b/node_modules/tslint/lib/rules/typeofCompareRule.js
new file mode 100644
index 000000000..4526cd296
--- /dev/null
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.js
@@ -0,0 +1,77 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var LEGAL_TYPEOF_RESULTS = new Set(["undefined", "string", "boolean", "number", "function", "object", "symbol"]);
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "typeof-compare",
+ description: "Makes sure result of `typeof` is compared to correct string values",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "'typeof' expression must be compared to one of: " + Array.from(LEGAL_TYPEOF_RESULTS).map(function (x) { return "\"" + x + "\""; }).join(", ");
+exports.Rule = Rule;
+function walk(ctx) {
+ ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils.isBinaryExpression(node)) {
+ var operatorToken = node.operatorToken, left = node.left, right = node.right;
+ if (Lint.getEqualsKind(operatorToken) !== undefined && (isFaultyTypeof(left, right) || isFaultyTypeof(right, left))) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
+ }
+ }
+ ts.forEachChild(node, cb);
+ });
+}
+function isFaultyTypeof(left, right) {
+ return left.kind === ts.SyntaxKind.TypeOfExpression && isFaultyTypeofResult(right);
+}
+function isFaultyTypeofResult(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.StringLiteral:
+ return !LEGAL_TYPEOF_RESULTS.has(node.text);
+ case ts.SyntaxKind.Identifier:
+ return node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
+ case ts.SyntaxKind.NullKeyword:
+ case ts.SyntaxKind.NumericLiteral:
+ case ts.SyntaxKind.TrueKeyword:
+ case ts.SyntaxKind.FalseKeyword:
+ case ts.SyntaxKind.ObjectLiteralExpression:
+ case ts.SyntaxKind.ArrayLiteralExpression:
+ return true;
+ default:
+ return false;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
new file mode 100644
index 000000000..0a461d4d2
--- /dev/null
+++ b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
@@ -0,0 +1,10 @@
+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_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?);
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/unifiedSignaturesRule.js b/node_modules/tslint/lib/rules/unifiedSignaturesRule.js
new file mode 100644
index 000000000..578dae231
--- /dev/null
+++ b/node_modules/tslint/lib/rules/unifiedSignaturesRule.js
@@ -0,0 +1,308 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var adjacentOverloadSignaturesRule_1 = require("./adjacentOverloadSignaturesRule");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING_OMITTING_SINGLE_PARAMETER = function (otherLine) {
+ return this.FAILURE_STRING_START(otherLine) + " with an optional parameter.";
+ };
+ Rule.FAILURE_STRING_OMITTING_REST_PARAMETER = function (otherLine) {
+ return this.FAILURE_STRING_START(otherLine) + " with a rest parameter.";
+ };
+ Rule.FAILURE_STRING_SINGLE_PARAMETER_DIFFERENCE = function (otherLine, type1, type2) {
+ return this.FAILURE_STRING_START(otherLine) + " taking `" + type1 + " | " + type2 + "`.";
+ };
+ Rule.FAILURE_STRING_START = function (otherLine) {
+ // For only 2 overloads we don't need to specify which is the other one.
+ var overloads = otherLine === undefined ? "These overloads" : "This overload and the one on line " + otherLine;
+ return overloads + " can be combined into one signature";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+Rule.metadata = {
+ ruleName: "unified-signatures",
+ description: "Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: true,
+};
+exports.Rule = Rule;
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile;
+ checkStatements(sourceFile.statements);
+ return ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ModuleBlock:
+ checkStatements(node.statements);
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ case ts.SyntaxKind.ClassDeclaration: {
+ var _a = node, members = _a.members, typeParameters = _a.typeParameters;
+ checkMembers(members, typeParameters);
+ break;
+ }
+ case ts.SyntaxKind.TypeLiteral:
+ checkMembers(node.members);
+ break;
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function checkStatements(statements) {
+ addFailures(checkOverloads(statements, undefined, function (statement) {
+ if (utils.isFunctionDeclaration(statement)) {
+ var body = statement.body, name = statement.name;
+ return body === undefined && name !== undefined ? { signature: statement, key: name.text } : undefined;
+ }
+ else {
+ return undefined;
+ }
+ }));
+ }
+ function checkMembers(members, typeParameters) {
+ addFailures(checkOverloads(members, typeParameters, function (member) {
+ switch (member.kind) {
+ case ts.SyntaxKind.CallSignature:
+ case ts.SyntaxKind.ConstructSignature:
+ case ts.SyntaxKind.MethodSignature:
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.Constructor:
+ if (member.body !== undefined) {
+ return undefined;
+ }
+ break;
+ default:
+ return undefined;
+ }
+ var signature = member;
+ var key = adjacentOverloadSignaturesRule_1.getOverloadKey(signature);
+ return key === undefined ? undefined : { signature: signature, key: key };
+ }));
+ }
+ function addFailures(failures) {
+ for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
+ var failure = failures_1[_i];
+ var unify = failure.unify, only2 = failure.only2;
+ switch (unify.kind) {
+ case "single-parameter-difference": {
+ var p0 = unify.p0, p1 = unify.p1;
+ var lineOfOtherOverload = only2 ? undefined : getLine(p0.getStart());
+ ctx.addFailureAtNode(p1, Rule.FAILURE_STRING_SINGLE_PARAMETER_DIFFERENCE(lineOfOtherOverload, typeText(p0), typeText(p1)));
+ break;
+ }
+ case "extra-parameter": {
+ var extraParameter = unify.extraParameter, otherSignature = unify.otherSignature;
+ var lineOfOtherOverload = only2 ? undefined : getLine(otherSignature.pos);
+ ctx.addFailureAtNode(extraParameter, extraParameter.dotDotDotToken !== undefined
+ ? Rule.FAILURE_STRING_OMITTING_REST_PARAMETER(lineOfOtherOverload)
+ : Rule.FAILURE_STRING_OMITTING_SINGLE_PARAMETER(lineOfOtherOverload));
+ break;
+ }
+ }
+ }
+ }
+ function getLine(pos) {
+ return ts.getLineAndCharacterOfPosition(sourceFile, pos).line + 1;
+ }
+}
+function checkOverloads(signatures, typeParameters, getOverload) {
+ var result = [];
+ var isTypeParameter = getIsTypeParameter(typeParameters);
+ for (var _i = 0, _a = collectOverloads(signatures, getOverload); _i < _a.length; _i++) {
+ var overloads = _a[_i];
+ if (overloads.length === 2) {
+ var unify = compareSignatures(overloads[0], overloads[1], isTypeParameter);
+ if (unify !== undefined) {
+ result.push({ unify: unify, only2: true });
+ }
+ }
+ else {
+ forEachPair(overloads, function (a, b) {
+ var unify = compareSignatures(a, b, isTypeParameter);
+ if (unify !== undefined) {
+ result.push({ unify: unify, only2: false });
+ }
+ });
+ }
+ }
+ return result;
+}
+function compareSignatures(a, b, isTypeParameter) {
+ if (!signaturesCanBeUnified(a, b, isTypeParameter)) {
+ return undefined;
+ }
+ return a.parameters.length === b.parameters.length
+ ? signaturesDifferBySingleParameter(a.parameters, b.parameters)
+ : signaturesDifferByOptionalOrRestParameter(a.parameters, b.parameters);
+}
+function signaturesCanBeUnified(a, b, isTypeParameter) {
+ // Must return the same type.
+ return typesAreEqual(a.type, b.type) &&
+ // Must take the same type parameters.
+ utils_1.arraysAreEqual(a.typeParameters, b.typeParameters, typeParametersAreEqual) &&
+ // If one uses a type parameter (from outside) and the other doesn't, they shouldn't be joined.
+ signatureUsesTypeParameter(a, isTypeParameter) === signatureUsesTypeParameter(b, isTypeParameter);
+}
+/** Detect `a(x: number, y: number, z: number)` and `a(x: number, y: string, z: number)`. */
+function signaturesDifferBySingleParameter(types1, types2) {
+ var index = getIndexOfFirstDifference(types1, types2, parametersAreEqual);
+ if (index === undefined) {
+ return undefined;
+ }
+ // If remaining arrays are equal, the signatures differ by just one parameter type
+ if (!utils_1.arraysAreEqual(types1.slice(index + 1), types2.slice(index + 1), parametersAreEqual)) {
+ return undefined;
+ }
+ var a = types1[index];
+ var b = types2[index];
+ return parametersHaveEqualSigils(a, b) ? { kind: "single-parameter-difference", p0: a, p1: b } : undefined;
+}
+/**
+ * Detect `a(): void` and `a(x: number): void`.
+ * Returns the parameter declaration (`x: number` in this example) that should be optional/rest, and overload it's a part of.
+ */
+function signaturesDifferByOptionalOrRestParameter(sig1, sig2) {
+ var minLength = Math.min(sig1.length, sig2.length);
+ var longer = sig1.length < sig2.length ? sig2 : sig1;
+ var shorter = sig1.length < sig2.length ? sig1 : sig2;
+ // If one is has 2+ parameters more than the other, they must all be optional/rest.
+ // Differ by optional parameters: f() and f(x), f() and f(x, ?y, ...z)
+ // Not allowed: f() and f(x, y)
+ for (var i = minLength + 1; i < longer.length; i++) {
+ if (!parameterMayBeMissing(longer[i])) {
+ return undefined;
+ }
+ }
+ for (var i = 0; i < minLength; i++) {
+ if (!typesAreEqual(sig1[i].type, sig2[i].type)) {
+ return undefined;
+ }
+ }
+ if (minLength > 0 && shorter[minLength - 1].dotDotDotToken !== undefined) {
+ return undefined;
+ }
+ return { kind: "extra-parameter", extraParameter: longer[longer.length - 1], otherSignature: shorter };
+}
+/** Given type parameters, returns a function to test whether a type is one of those parameters. */
+function getIsTypeParameter(typeParameters) {
+ if (typeParameters === undefined) {
+ return function () { return false; };
+ }
+ var set = new Set();
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var t = typeParameters_1[_i];
+ set.add(t.getText());
+ }
+ return function (typeName) { return set.has(typeName); };
+}
+/** True if any of the outer type parameters are used in a signature. */
+function signatureUsesTypeParameter(sig, isTypeParameter) {
+ return sig.parameters.some(function (p) { return p.type !== undefined && typeContainsTypeParameter(p.type); });
+ function typeContainsTypeParameter(type) {
+ if (utils.isTypeReferenceNode(type)) {
+ var typeName = type.typeName;
+ if (typeName.kind === ts.SyntaxKind.Identifier && isTypeParameter(typeName.text)) {
+ return true;
+ }
+ }
+ return ts.forEachChild(type, typeContainsTypeParameter);
+ }
+}
+/**
+ * Given all signatures, collects an array of arrays of signatures which are all overloads.
+ * Does not rely on overloads being adjacent. This is similar to code in adjacentOverloadSignaturesRule.ts, but not the same.
+ */
+function collectOverloads(nodes, getOverload) {
+ var map = new Map();
+ for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
+ var sig = nodes_1[_i];
+ var overload = getOverload(sig);
+ if (overload === undefined) {
+ continue;
+ }
+ var signature = overload.signature, key = overload.key;
+ var overloads = map.get(key);
+ if (overloads !== undefined) {
+ overloads.push(signature);
+ }
+ else {
+ map.set(key, [signature]);
+ }
+ }
+ return Array.from(map.values());
+}
+function parametersAreEqual(a, b) {
+ return parametersHaveEqualSigils(a, b) && typesAreEqual(a.type, b.type);
+}
+/** True for optional/rest parameters. */
+function parameterMayBeMissing(p) {
+ return p.dotDotDotToken !== undefined || p.questionToken !== undefined;
+}
+/** False if one is optional and the other isn't, or one is a rest parameter and the other isn't. */
+function parametersHaveEqualSigils(a, b) {
+ return (a.dotDotDotToken !== undefined) === (b.dotDotDotToken !== undefined) &&
+ (a.questionToken !== undefined) === (b.questionToken !== undefined);
+}
+function typeParametersAreEqual(a, b) {
+ return a.name.text === b.name.text && typesAreEqual(a.constraint, b.constraint);
+}
+function typesAreEqual(a, b) {
+ // TODO: Could traverse AST so that formatting differences don't affect this.
+ return a === b || a !== undefined && b !== undefined && a.getText() === b.getText();
+}
+/** Returns the first index where `a` and `b` differ. */
+function getIndexOfFirstDifference(a, b, equal) {
+ for (var i = 0; i < a.length && i < b.length; i++) {
+ if (!equal(a[i], b[i])) {
+ return i;
+ }
+ }
+ return undefined;
+}
+/** Calls `action` for every pair of values in `values`. */
+function forEachPair(values, action) {
+ for (var i = 0; i < values.length; i++) {
+ for (var j = i + 1; j < values.length; j++) {
+ var result = action(values[i], values[j]);
+ if (result !== undefined) {
+ return result;
+ }
+ }
+ }
+ return undefined;
+}
+function typeText(_a) {
+ var type = _a.type;
+ return type === undefined ? "any" : type.getText();
+}
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.d.ts b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.js b/node_modules/tslint/lib/rules/useIsnanRule.js
new file mode 100644
index 000000000..4b7f3738a
--- /dev/null
+++ b/node_modules/tslint/lib/rules/useIsnanRule.js
@@ -0,0 +1,70 @@
+"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 });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+/* tslint:disable:object-literal-sort-keys */
+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)),
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "functionality",
+ typescriptOnly: false,
+};
+/* tslint:enable:object-literal-sort-keys */
+Rule.FAILURE_STRING = "Found an invalid comparison for NaN: ";
+exports.Rule = Rule;
+function walk(ctx) {
+ return ts.forEachChild(ctx.sourceFile, function cb(node) {
+ if (tsutils_1.isBinaryExpression(node)) {
+ switch (node.operatorToken.kind) {
+ case ts.SyntaxKind.LessThanToken:
+ case ts.SyntaxKind.GreaterThanToken:
+ case ts.SyntaxKind.LessThanEqualsToken:
+ case ts.SyntaxKind.GreaterThanEqualsToken:
+ case ts.SyntaxKind.EqualsEqualsToken:
+ case ts.SyntaxKind.ExclamationEqualsToken:
+ case ts.SyntaxKind.EqualsEqualsEqualsToken:
+ case ts.SyntaxKind.ExclamationEqualsEqualsToken:
+ if (isExpressionNaN(node.right) || isExpressionNaN(node.left)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING + node.getText(ctx.sourceFile));
+ }
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+}
+function isExpressionNaN(node) {
+ return node.kind === ts.SyntaxKind.Identifier && node.text === "NaN";
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/variableNameRule.d.ts b/node_modules/tslint/lib/rules/variableNameRule.d.ts
new file mode 100644
index 000000000..548ff0300
--- /dev/null
+++ b/node_modules/tslint/lib/rules/variableNameRule.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @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 KEYWORD_FAILURE: string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/variableNameRule.js b/node_modules/tslint/lib/rules/variableNameRule.js
new file mode 100644
index 000000000..23528202b
--- /dev/null
+++ b/node_modules/tslint/lib/rules/variableNameRule.js
@@ -0,0 +1,178 @@
+"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 });
+var tslib_1 = require("tslib");
+// tslint:disable object-literal-sort-keys
+var ts = require("typescript");
+var Lint = require("../index");
+var utils_1 = require("../utils");
+var BANNED_KEYWORDS = ["any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"];
+var bannedKeywordsSet = new Set(BANNED_KEYWORDS);
+var bannedKeywordsStr = BANNED_KEYWORDS.map(function (kw) { return "`" + kw + "`"; }).join(", ");
+var OPTION_LEADING_UNDERSCORE = "allow-leading-underscore";
+var OPTION_TRAILING_UNDERSCORE = "allow-trailing-underscore";
+var OPTION_BAN_KEYWORDS = "ban-keywords";
+var OPTION_CHECK_FORMAT = "check-format";
+var OPTION_ALLOW_PASCAL_CASE = "allow-pascal-case";
+var OPTION_ALLOW_SNAKE_CASE = "allow-snake-case";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+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)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [
+ OPTION_CHECK_FORMAT,
+ OPTION_LEADING_UNDERSCORE,
+ OPTION_TRAILING_UNDERSCORE,
+ OPTION_ALLOW_PASCAL_CASE,
+ OPTION_ALLOW_SNAKE_CASE,
+ OPTION_BAN_KEYWORDS,
+ ],
+ },
+ minLength: 0,
+ maxLength: 5,
+ },
+ optionExamples: [[true, "ban-keywords", "check-format", "allow-leading-underscore"]],
+ type: "style",
+ typescriptOnly: false,
+};
+Rule.KEYWORD_FAILURE = "variable name clashes with keyword/type";
+exports.Rule = Rule;
+function parseOptions(ruleArguments) {
+ var banKeywords = hasOption(OPTION_BAN_KEYWORDS);
+ return {
+ banKeywords: banKeywords,
+ // check variable name formatting by default if no options are specified
+ checkFormat: !banKeywords || hasOption(OPTION_CHECK_FORMAT),
+ leadingUnderscore: hasOption(OPTION_LEADING_UNDERSCORE),
+ trailingUnderscore: hasOption(OPTION_TRAILING_UNDERSCORE),
+ allowPascalCase: hasOption(OPTION_ALLOW_PASCAL_CASE),
+ allowSnakeCase: hasOption(OPTION_ALLOW_SNAKE_CASE),
+ };
+ function hasOption(name) {
+ return ruleArguments.indexOf(name) !== -1;
+ }
+}
+function walk(ctx) {
+ var options = ctx.options, sourceFile = ctx.sourceFile;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.BindingElement: {
+ var _a = node, initializer = _a.initializer, name = _a.name, propertyName = _a.propertyName;
+ if (name.kind === ts.SyntaxKind.Identifier) {
+ handleVariableNameKeyword(name);
+ // A destructuring pattern that does not rebind an expression is always an alias, e.g. `var {Foo} = ...;`.
+ // Only check if the name is rebound (`var {Foo: bar} = ...;`).
+ if (node.parent.kind !== ts.SyntaxKind.ObjectBindingPattern || propertyName !== undefined) {
+ handleVariableNameFormat(name, initializer);
+ }
+ }
+ break;
+ }
+ case ts.SyntaxKind.VariableStatement:
+ // skip 'declare' keywords
+ if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ return;
+ }
+ break;
+ case ts.SyntaxKind.Parameter:
+ case ts.SyntaxKind.PropertyDeclaration:
+ case ts.SyntaxKind.VariableDeclaration: {
+ var _b = node, name = _b.name, initializer = _b.initializer;
+ if (name.kind === ts.SyntaxKind.Identifier) {
+ handleVariableNameFormat(name, initializer);
+ // do not check property declarations for keywords, they are allowed to be keywords
+ if (node.kind !== ts.SyntaxKind.PropertyDeclaration) {
+ handleVariableNameKeyword(name);
+ }
+ }
+ break;
+ }
+ }
+ return ts.forEachChild(node, cb);
+ });
+ function handleVariableNameFormat(name, initializer) {
+ if (!options.checkFormat) {
+ return;
+ }
+ var text = name.text;
+ if (initializer !== undefined && isAlias(text, initializer)) {
+ return;
+ }
+ if (!isCamelCase(text, options) && !utils_1.isUpperCase(text)) {
+ ctx.addFailureAtNode(name, formatFailure());
+ }
+ }
+ function handleVariableNameKeyword(name) {
+ if (options.banKeywords && bannedKeywordsSet.has(name.text)) {
+ ctx.addFailureAtNode(name, Rule.KEYWORD_FAILURE);
+ }
+ }
+ function formatFailure() {
+ var failureMessage = "variable name must be in lowerCamelCase";
+ if (options.allowPascalCase) {
+ failureMessage += ", PascalCase";
+ }
+ if (options.allowSnakeCase) {
+ failureMessage += ", snake_case";
+ }
+ return failureMessage + " or UPPER_CASE";
+ }
+}
+function isAlias(name, initializer) {
+ switch (initializer.kind) {
+ case ts.SyntaxKind.PropertyAccessExpression:
+ return initializer.name.text === name;
+ case ts.SyntaxKind.Identifier:
+ return initializer.text === name;
+ default:
+ return false;
+ }
+}
+function isCamelCase(name, options) {
+ var firstCharacter = name[0];
+ var lastCharacter = name[name.length - 1];
+ var middle = name.slice(1, -1);
+ if (!options.leadingUnderscore && firstCharacter === "_") {
+ return false;
+ }
+ if (!options.trailingUnderscore && lastCharacter === "_") {
+ return false;
+ }
+ if (!options.allowPascalCase && !utils_1.isLowerCase(firstCharacter)) {
+ return false;
+ }
+ if (!options.allowSnakeCase && middle.indexOf("_") !== -1) {
+ return false;
+ }
+ return true;
+}
+var _a;
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.d.ts b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
new file mode 100644
index 000000000..cce59d100
--- /dev/null
+++ b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
@@ -0,0 +1,7 @@
+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;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.js b/node_modules/tslint/lib/rules/whitespaceRule.js
new file mode 100644
index 000000000..b92a075e5
--- /dev/null
+++ b/node_modules/tslint/lib/rules/whitespaceRule.js
@@ -0,0 +1,238 @@
+"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 });
+var tslib_1 = require("tslib");
+// tslint:disable object-literal-sort-keys
+var utils = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var OPTION_BRANCH = "check-branch";
+var OPTION_DECL = "check-decl";
+var OPTION_OPERATOR = "check-operator";
+var OPTION_MODULE = "check-module";
+var OPTION_SEPARATOR = "check-separator";
+var OPTION_TYPE = "check-type";
+var OPTION_TYPECAST = "check-typecast";
+var OPTION_PREBLOCK = "check-preblock";
+var Rule = (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments));
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+Rule.metadata = {
+ ruleName: "whitespace",
+ description: "Enforces whitespace style conventions.",
+ rationale: "Helps maintain a readable, consistent style in your codebase.",
+ optionsDescription: (_a = ["\n Eight 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-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], _a.raw = ["\n Eight 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-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"], Lint.Utils.dedent(_a)),
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: ["check-branch", "check-decl", "check-operator", "check-module",
+ "check-separator", "check-type", "check-typecast", "check-preblock"],
+ },
+ minLength: 0,
+ maxLength: 7,
+ },
+ optionExamples: [[true, "check-branch", "check-operator", "check-typecast"]],
+ type: "style",
+ typescriptOnly: false,
+};
+Rule.FAILURE_STRING = "missing whitespace";
+exports.Rule = Rule;
+function parseOptions(ruleArguments) {
+ return {
+ branch: has(OPTION_BRANCH),
+ decl: has(OPTION_DECL),
+ operator: has(OPTION_OPERATOR),
+ module: has(OPTION_MODULE),
+ separator: has(OPTION_SEPARATOR),
+ type: has(OPTION_TYPE),
+ typecast: has(OPTION_TYPECAST),
+ preblock: has(OPTION_PREBLOCK),
+ };
+ function has(option) {
+ return ruleArguments.indexOf(option) !== -1;
+ }
+}
+function walk(ctx) {
+ var sourceFile = ctx.sourceFile, options = ctx.options;
+ ts.forEachChild(sourceFile, function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ArrowFunction:
+ checkEqualsGreaterThanTokenInNode(node);
+ break;
+ // check for spaces between the operator symbol (except in the case of comma statements)
+ case ts.SyntaxKind.BinaryExpression: {
+ var _a = node, left = _a.left, operatorToken = _a.operatorToken, right = _a.right;
+ if (options.operator && operatorToken.kind !== ts.SyntaxKind.CommaToken) {
+ checkForTrailingWhitespace(left.getEnd());
+ checkForTrailingWhitespace(right.getFullStart());
+ }
+ break;
+ }
+ case ts.SyntaxKind.Block:
+ if (options.preblock) {
+ checkForTrailingWhitespace(node.getFullStart());
+ }
+ break;
+ // check for spaces between ternary operator symbols
+ case ts.SyntaxKind.ConditionalExpression:
+ if (options.operator) {
+ var _b = node, condition = _b.condition, whenTrue = _b.whenTrue;
+ checkForTrailingWhitespace(condition.getEnd());
+ checkForTrailingWhitespace(whenTrue.getFullStart());
+ checkForTrailingWhitespace(whenTrue.getEnd());
+ }
+ break;
+ case ts.SyntaxKind.ConstructorType:
+ checkEqualsGreaterThanTokenInNode(node);
+ break;
+ case ts.SyntaxKind.ExportAssignment:
+ if (options.module) {
+ var exportKeyword = node.getChildAt(0);
+ var position = exportKeyword.getEnd();
+ checkForTrailingWhitespace(position);
+ }
+ break;
+ case ts.SyntaxKind.FunctionType:
+ checkEqualsGreaterThanTokenInNode(node);
+ break;
+ case ts.SyntaxKind.ImportDeclaration: {
+ var importClause = node.importClause;
+ if (options.module && importClause !== undefined) {
+ // an import clause can have _both_ named bindings and a name (the latter for the default import)
+ // but the named bindings always come last, so we only need to check that for whitespace
+ var position = void 0;
+ var name_1 = importClause.name, namedBindings = importClause.namedBindings;
+ if (namedBindings !== undefined) {
+ position = namedBindings.getEnd();
+ }
+ else if (name_1 !== undefined) {
+ position = name_1.getEnd();
+ }
+ if (position !== undefined) {
+ checkForTrailingWhitespace(position);
+ }
+ }
+ break;
+ }
+ case ts.SyntaxKind.ImportEqualsDeclaration:
+ if (options.module) {
+ var position = node.name.getEnd();
+ checkForTrailingWhitespace(position);
+ }
+ break;
+ case ts.SyntaxKind.TypeAssertionExpression:
+ if (options.typecast) {
+ var position = node.expression.getFullStart();
+ checkForTrailingWhitespace(position);
+ }
+ break;
+ case ts.SyntaxKind.VariableDeclaration:
+ var _c = node, name = _c.name, type = _c.type, initializer = _c.initializer;
+ if (options.decl && initializer !== undefined) {
+ checkForTrailingWhitespace((type !== undefined ? type : name).getEnd());
+ }
+ break;
+ }
+ ts.forEachChild(node, cb);
+ });
+ var prevTokenShouldBeFollowedByWhitespace = false;
+ utils.forEachTokenWithTrivia(sourceFile, function (_text, tokenKind, range, parent) {
+ if (tokenKind === ts.SyntaxKind.WhitespaceTrivia ||
+ tokenKind === ts.SyntaxKind.NewLineTrivia ||
+ tokenKind === ts.SyntaxKind.EndOfFileToken) {
+ prevTokenShouldBeFollowedByWhitespace = false;
+ return;
+ }
+ else if (prevTokenShouldBeFollowedByWhitespace) {
+ addMissingWhitespaceErrorAt(range.pos);
+ prevTokenShouldBeFollowedByWhitespace = false;
+ }
+ // check for trailing space after the given tokens
+ switch (tokenKind) {
+ case ts.SyntaxKind.CatchKeyword:
+ case ts.SyntaxKind.ForKeyword:
+ case ts.SyntaxKind.IfKeyword:
+ case ts.SyntaxKind.SwitchKeyword:
+ case ts.SyntaxKind.WhileKeyword:
+ case ts.SyntaxKind.WithKeyword:
+ if (options.branch) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
+ case ts.SyntaxKind.CommaToken:
+ case ts.SyntaxKind.SemicolonToken:
+ if (options.separator) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
+ case ts.SyntaxKind.EqualsToken:
+ if (options.decl && parent.kind !== ts.SyntaxKind.JsxAttribute) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
+ case ts.SyntaxKind.ColonToken:
+ if (options.type) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
+ case ts.SyntaxKind.ImportKeyword:
+ case ts.SyntaxKind.ExportKeyword:
+ case ts.SyntaxKind.FromKeyword:
+ if (options.typecast) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
+ default:
+ break;
+ }
+ });
+ function checkEqualsGreaterThanTokenInNode(node) {
+ if (!options.operator) {
+ return;
+ }
+ var equalsGreaterThanToken = Lint.childOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken);
+ // condition so we don't crash if the arrow is somehow missing
+ if (equalsGreaterThanToken === undefined) {
+ return;
+ }
+ checkForTrailingWhitespace(equalsGreaterThanToken.getFullStart());
+ checkForTrailingWhitespace(equalsGreaterThanToken.getEnd());
+ }
+ function checkForTrailingWhitespace(position) {
+ if (position !== sourceFile.end && !ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(position))) {
+ addMissingWhitespaceErrorAt(position);
+ }
+ }
+ function addMissingWhitespaceErrorAt(position) {
+ // TODO: this rule occasionally adds duplicate failures.
+ if (ctx.failures.some(function (f) { return f.getStartPosition().getPosition() === position; })) {
+ return;
+ }
+ var fix = Lint.Replacement.appendText(position, " ");
+ ctx.addFailureAt(position, 1, Rule.FAILURE_STRING, fix);
+ }
+}
+var _a;
diff --git a/node_modules/tslint/lib/runner.d.ts b/node_modules/tslint/lib/runner.d.ts
new file mode 100644
index 000000000..d2347f34e
--- /dev/null
+++ b/node_modules/tslint/lib/runner.d.ts
@@ -0,0 +1,71 @@
+/// <reference types="node" />
+export interface IRunnerOptions {
+ /**
+ * Path to a configuration file.
+ */
+ config?: string;
+ /**
+ * Exclude globs from path expansion.
+ */
+ exclude?: string | string[];
+ /**
+ * File paths to lint.
+ */
+ files?: string[];
+ /**
+ * Whether to return status code 0 even if there are lint errors.
+ */
+ force?: boolean;
+ /**
+ * Whether to fixes linting errors for select rules. This may overwrite linted files.
+ */
+ fix?: boolean;
+ /**
+ * Output format.
+ */
+ format?: string;
+ /**
+ * Formatters directory path.
+ */
+ formattersDirectory?: string;
+ /**
+ * Whether to generate a tslint.json config file in the current working directory.
+ */
+ init?: boolean;
+ /**
+ * Output file path.
+ */
+ out?: string;
+ /**
+ * Whether to output absolute paths
+ */
+ outputAbsolutePaths?: boolean;
+ /**
+ * tsconfig.json file.
+ */
+ project?: string;
+ /**
+ * Rules directory paths.
+ */
+ rulesDirectory?: string | string[];
+ /**
+ * That TSLint produces the correct output for the specified directory.
+ */
+ test?: string;
+ /**
+ * Whether to enable type checking when linting a project.
+ */
+ typeCheck?: boolean;
+ /**
+ * Whether to show the current TSLint version.
+ */
+ version?: boolean;
+}
+export declare class Runner {
+ private options;
+ private outputStream;
+ private static trimSingleQuotes(str);
+ constructor(options: IRunnerOptions, outputStream: NodeJS.WritableStream);
+ run(onComplete: (status: number) => void): void;
+ private processFiles(onComplete, files, program?);
+}
diff --git a/node_modules/tslint/lib/runner.js b/node_modules/tslint/lib/runner.js
new file mode 100644
index 000000000..594d595bb
--- /dev/null
+++ b/node_modules/tslint/lib/runner.js
@@ -0,0 +1,195 @@
+"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 strict-boolean-expressions prefer-template
+// (wait on https://github.com/palantir/tslint/pull/2572)
+var fs = require("fs");
+var glob = require("glob");
+var path = require("path");
+var ts = require("typescript");
+var configuration_1 = require("./configuration");
+var error_1 = require("./error");
+var Linter = require("./linter");
+var test_1 = require("./test");
+var Runner = (function () {
+ function Runner(options, outputStream) {
+ this.options = options;
+ this.outputStream = outputStream;
+ }
+ Runner.trimSingleQuotes = function (str) {
+ return str.replace(/^'|'$/g, "");
+ };
+ Runner.prototype.run = function (onComplete) {
+ var _this = this;
+ if (this.options.version) {
+ this.outputStream.write(Linter.VERSION + "\n");
+ return onComplete(0);
+ }
+ if (this.options.init) {
+ if (fs.existsSync(configuration_1.CONFIG_FILENAME)) {
+ console.error("Cannot generate " + configuration_1.CONFIG_FILENAME + ": file already exists");
+ return onComplete(1);
+ }
+ var tslintJSON = JSON.stringify(configuration_1.DEFAULT_CONFIG, undefined, " ");
+ fs.writeFileSync(configuration_1.CONFIG_FILENAME, tslintJSON);
+ return onComplete(0);
+ }
+ if (this.options.test) {
+ var results = test_1.runTests((this.options.files || []).map(Runner.trimSingleQuotes), this.options.rulesDirectory);
+ var didAllTestsPass = test_1.consoleTestResultsHandler(results);
+ return onComplete(didAllTestsPass ? 0 : 1);
+ }
+ // when provided, it should point to an existing location
+ if (this.options.config && !fs.existsSync(this.options.config)) {
+ console.error("Invalid option for configuration: " + this.options.config);
+ return onComplete(1);
+ }
+ // if both files and tsconfig are present, use files
+ var files = this.options.files === undefined ? [] : this.options.files;
+ var program;
+ if (this.options.project != null) {
+ var project = findTsconfig(this.options.project);
+ if (project === undefined) {
+ console.error("Invalid option for project: " + this.options.project);
+ return onComplete(1);
+ }
+ program = Linter.createProgram(project);
+ if (files.length === 0) {
+ files = Linter.getFileNames(program);
+ }
+ if (this.options.typeCheck) {
+ // if type checking, run the type checker
+ var diagnostics = ts.getPreEmitDiagnostics(program);
+ if (diagnostics.length > 0) {
+ var messages = diagnostics.map(function (diag) {
+ // emit any error messages
+ var message = ts.DiagnosticCategory[diag.category];
+ if (diag.file) {
+ var _a = diag.file.getLineAndCharacterOfPosition(diag.start), line = _a.line, character = _a.character;
+ var file = void 0;
+ var currentDirectory = program.getCurrentDirectory();
+ file = _this.options.outputAbsolutePaths
+ ? path.resolve(currentDirectory, diag.file.fileName)
+ : path.relative(currentDirectory, diag.file.fileName);
+ message += " at " + file + ":" + (line + 1) + ":" + (character + 1) + ":";
+ }
+ message += " " + ts.flattenDiagnosticMessageText(diag.messageText, "\n");
+ return message;
+ });
+ console.error(messages.join("\n"));
+ return onComplete(this.options.force ? 0 : 1);
+ }
+ }
+ else {
+ // if not type checking, we don't need to pass in a program object
+ program = undefined;
+ }
+ }
+ var ignorePatterns = [];
+ if (this.options.exclude) {
+ var excludeArguments = Array.isArray(this.options.exclude) ? this.options.exclude : [this.options.exclude];
+ ignorePatterns = excludeArguments.map(Runner.trimSingleQuotes);
+ }
+ files = files
+ .map(Runner.trimSingleQuotes)
+ .map(function (file) { return glob.sync(file, { ignore: ignorePatterns, nodir: true }); })
+ .reduce(function (a, b) { return a.concat(b); }, [])
+ .map(function (file) {
+ if (_this.options.outputAbsolutePaths) {
+ return path.resolve(file);
+ }
+ return path.relative(process.cwd(), file);
+ });
+ try {
+ this.processFiles(onComplete, files, program);
+ }
+ catch (error) {
+ if (error.name === error_1.FatalError.NAME) {
+ console.error(error.message);
+ return onComplete(1);
+ }
+ // rethrow unhandled error
+ throw error;
+ }
+ };
+ Runner.prototype.processFiles = function (onComplete, files, program) {
+ var _this = this;
+ var possibleConfigAbsolutePath = this.options.config != null ? path.resolve(this.options.config) : null;
+ var linter = new Linter({
+ fix: !!this.options.fix,
+ formatter: this.options.format,
+ formattersDirectory: this.options.formattersDirectory || "",
+ rulesDirectory: this.options.rulesDirectory || "",
+ }, program);
+ var lastFolder;
+ var configFile;
+ for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
+ var file = files_1[_i];
+ if (!fs.existsSync(file)) {
+ console.error("Unable to open file: " + file);
+ return onComplete(1);
+ }
+ var buffer = new Buffer(256);
+ var fd = fs.openSync(file, "r");
+ try {
+ fs.readSync(fd, buffer, 0, 256, 0);
+ if (buffer.readInt8(0, true) === 0x47 && buffer.readInt8(188, true) === 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.
+ console.warn(file + ": ignoring MPEG transport stream");
+ continue;
+ }
+ }
+ finally {
+ fs.closeSync(fd);
+ }
+ var contents = fs.readFileSync(file, "utf8");
+ var folder = path.dirname(file);
+ if (lastFolder !== folder) {
+ configFile = configuration_1.findConfiguration(possibleConfigAbsolutePath, folder).results;
+ lastFolder = folder;
+ }
+ linter.lint(file, contents, configFile);
+ }
+ var lintResult = linter.getResult();
+ this.outputStream.write(lintResult.output, function () {
+ if (_this.options.force || lintResult.errorCount === 0) {
+ onComplete(0);
+ }
+ else {
+ onComplete(2);
+ }
+ });
+ };
+ return Runner;
+}());
+exports.Runner = Runner;
+function findTsconfig(project) {
+ try {
+ var stats = fs.statSync(project); // throws if file does not exist
+ if (stats.isDirectory()) {
+ project = path.join(project, "tsconfig.json");
+ fs.accessSync(project); // throws if file does not exist
+ }
+ }
+ catch (e) {
+ return undefined;
+ }
+ return project;
+}
diff --git a/node_modules/tslint/lib/test.d.ts b/node_modules/tslint/lib/test.d.ts
new file mode 100644
index 000000000..d021ceb99
--- /dev/null
+++ b/node_modules/tslint/lib/test.d.ts
@@ -0,0 +1,24 @@
+import { LintError } from "./test/lintError";
+export interface TestOutput {
+ skipped: false;
+ errorsFromLinter: LintError[];
+ errorsFromMarkup: LintError[];
+ fixesFromLinter: string;
+ fixesFromMarkup: string;
+ markupFromLinter: string;
+ markupFromMarkup: string;
+}
+export interface SkippedTest {
+ skipped: true;
+ requirement: string;
+}
+export interface TestResult {
+ directory: string;
+ results: {
+ [fileName: string]: TestOutput | SkippedTest;
+ };
+}
+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;
diff --git a/node_modules/tslint/lib/test.js b/node_modules/tslint/lib/test.js
new file mode 100644
index 000000000..88c2fa764
--- /dev/null
+++ b/node_modules/tslint/lib/test.js
@@ -0,0 +1,234 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var colors = require("colors");
+var diff = require("diff");
+var fs = require("fs");
+var glob = require("glob");
+var path = require("path");
+var semver = require("semver");
+var ts = require("typescript");
+var rule_1 = require("./language/rule/rule");
+var Linter = require("./linter");
+var parse = require("./test/parse");
+var utils_1 = require("./utils");
+var MARKUP_FILE_EXTENSION = ".lint";
+var FIXES_FILE_EXTENSION = ".fix";
+function runTests(patterns, rulesDirectory) {
+ var files = [];
+ for (var _i = 0, patterns_1 = patterns; _i < patterns_1.length; _i++) {
+ var pattern = patterns_1[_i];
+ files.push.apply(files, glob.sync(pattern + "/tslint.json"));
+ }
+ return files.map(function (directory) { return runTest(path.dirname(directory), rulesDirectory); });
+}
+exports.runTests = runTests;
+function runTest(testDirectory, rulesDirectory) {
+ // needed to get colors to show up when passing through Grunt
+ colors.enabled = true;
+ var filesToLint = glob.sync(path.join(testDirectory, "**/*" + MARKUP_FILE_EXTENSION));
+ var tslintConfig = 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));
+ }
+ var parseConfigHost = {
+ fileExists: fs.existsSync,
+ readDirectory: ts.sys.readDirectory,
+ readFile: function (file) { return fs.readFileSync(file, "utf8"); },
+ useCaseSensitiveFileNames: true,
+ };
+ compilerOptions = ts.parseJsonConfigFileContent(config, parseConfigHost, testDirectory).options;
+ }
+ var results = { directory: testDirectory, results: {} };
+ var _loop_1 = function (fileToLint) {
+ var isEncodingRule = path.basename(testDirectory) === "encoding";
+ var fileBasename = path.basename(fileToLint, MARKUP_FILE_EXTENSION);
+ var fileCompileName = fileBasename.replace(/\.lint$/, "");
+ var fileText = isEncodingRule ? utils_1.readBufferWithDetectedEncoding(fs.readFileSync(fileToLint)) : fs.readFileSync(fileToLint, "utf-8");
+ var tsVersionRequirement = parse.getTypescriptVersionRequirement(fileText);
+ if (tsVersionRequirement !== undefined) {
+ var tsVersion = new semver.SemVer(ts.version);
+ // remove prerelease suffix when matching to allow testing with nightly builds
+ if (!semver.satisfies(tsVersion.major + "." + tsVersion.minor + "." + tsVersion.patch, tsVersionRequirement)) {
+ results.results[fileToLint] = {
+ requirement: tsVersionRequirement,
+ skipped: true,
+ };
+ return "continue";
+ }
+ // remove the first line from the file before continuing
+ var lineBreak = fileText.search(/\n/);
+ fileText = lineBreak === -1 ? "" : fileText.substr(lineBreak + 1);
+ }
+ var fileTextWithoutMarkup = parse.removeErrorMarkup(fileText);
+ var errorsFromMarkup = parse.parseErrorsFromMarkup(fileText);
+ var program = void 0;
+ if (hasConfig) {
+ var compilerHost = {
+ fileExists: function () { return true; },
+ getCanonicalFileName: function (filename) { return filename; },
+ getCurrentDirectory: function () { return ""; },
+ getDefaultLibFileName: function () { return ts.getDefaultLibFileName(compilerOptions); },
+ getDirectories: function (_path) { return []; },
+ getNewLine: function () { return "\n"; },
+ getSourceFile: function (filenameToGet) {
+ var target = compilerOptions.target === undefined ? ts.ScriptTarget.ES5 : compilerOptions.target;
+ if (filenameToGet === ts.getDefaultLibFileName(compilerOptions)) {
+ var fileContent = fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions), "utf8");
+ return ts.createSourceFile(filenameToGet, fileContent, target);
+ }
+ else if (filenameToGet === fileCompileName) {
+ return ts.createSourceFile(fileBasename, fileTextWithoutMarkup, target, true);
+ }
+ else if (fs.existsSync(path.resolve(path.dirname(fileToLint), filenameToGet))) {
+ var text = fs.readFileSync(path.resolve(path.dirname(fileToLint), filenameToGet), "utf8");
+ return ts.createSourceFile(filenameToGet, text, target, true);
+ }
+ throw new Error("Couldn't get source file '" + filenameToGet + "'");
+ },
+ readFile: function (x) { return x; },
+ useCaseSensitiveFileNames: function () { return true; },
+ writeFile: function () { return null; },
+ };
+ program = ts.createProgram([fileCompileName], compilerOptions, compilerHost);
+ }
+ var lintOptions = {
+ fix: false,
+ formatter: "prose",
+ formattersDirectory: "",
+ rulesDirectory: rulesDirectory,
+ };
+ var linter = new 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 : fileBasename, fileTextWithoutMarkup, tslintConfig);
+ var failures = linter.getResult().failures;
+ var errorsFromLinter = failures.map(function (failure) {
+ var startLineAndCharacter = failure.getStartPosition().getLineAndCharacter();
+ var endLineAndCharacter = failure.getEndPosition().getLineAndCharacter();
+ return {
+ endPos: {
+ col: endLineAndCharacter.character,
+ line: endLineAndCharacter.line,
+ },
+ message: failure.getFailure(),
+ startPos: {
+ col: startLineAndCharacter.character,
+ line: startLineAndCharacter.line,
+ },
+ };
+ });
+ // test against fixed files
+ var fixedFileText = "";
+ var newFileText = "";
+ try {
+ var fixedFile = fileToLint.replace(/\.lint$/, FIXES_FILE_EXTENSION);
+ var stat = fs.statSync(fixedFile);
+ if (stat.isFile()) {
+ fixedFileText = fs.readFileSync(fixedFile, "utf8");
+ var fixes = utils_1.mapDefined(failures, function (f) { return f.getFix(); });
+ newFileText = rule_1.Replacement.applyFixes(fileTextWithoutMarkup, fixes);
+ }
+ }
+ catch (e) {
+ fixedFileText = "";
+ newFileText = "";
+ }
+ results.results[fileToLint] = {
+ errorsFromLinter: errorsFromLinter,
+ errorsFromMarkup: errorsFromMarkup,
+ fixesFromLinter: newFileText,
+ fixesFromMarkup: fixedFileText,
+ markupFromLinter: parse.createMarkupFromErrors(fileTextWithoutMarkup, errorsFromMarkup),
+ markupFromMarkup: parse.createMarkupFromErrors(fileTextWithoutMarkup, errorsFromLinter),
+ skipped: false,
+ };
+ };
+ for (var _i = 0, filesToLint_1 = filesToLint; _i < filesToLint_1.length; _i++) {
+ var fileToLint = filesToLint_1[_i];
+ _loop_1(fileToLint);
+ }
+ return results;
+}
+exports.runTest = runTest;
+function consoleTestResultsHandler(testResults) {
+ var didAllTestsPass = true;
+ for (var _i = 0, testResults_1 = testResults; _i < testResults_1.length; _i++) {
+ var testResult = testResults_1[_i];
+ if (!consoleTestResultHandler(testResult)) {
+ didAllTestsPass = false;
+ }
+ }
+ return didAllTestsPass;
+}
+exports.consoleTestResultsHandler = consoleTestResultsHandler;
+function consoleTestResultHandler(testResult) {
+ 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 */
+ if (results.skipped) {
+ console.log(colors.yellow(" Skipped, requires typescript " + results.requirement));
+ }
+ else {
+ var markupDiffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
+ var fixesDiffResults = diff.diffLines(results.fixesFromLinter, results.fixesFromMarkup);
+ var didMarkupTestPass = !markupDiffResults.some(function (diff) { return diff.added === true || diff.removed === true; });
+ var didFixesTestPass = !fixesDiffResults.some(function (diff) { return diff.added === true || diff.removed === true; });
+ if (didMarkupTestPass && didFixesTestPass) {
+ console.log(colors.green(" Passed"));
+ }
+ else {
+ console.log(colors.red(" Failed!"));
+ didAllTestsPass = false;
+ if (!didMarkupTestPass) {
+ displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION);
+ }
+ if (!didFixesTestPass) {
+ displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION);
+ }
+ }
+ }
+ /* tslint:enable:no-console */
+ }
+ return didAllTestsPass;
+}
+exports.consoleTestResultHandler = consoleTestResultHandler;
+function displayDiffResults(diffResults, extension) {
+ /* tslint:disable:no-console */
+ console.log(colors.green("Expected (from " + extension + " file)"));
+ console.log(colors.red("Actual (from TSLint)"));
+ for (var _i = 0, diffResults_1 = diffResults; _i < diffResults_1.length; _i++) {
+ var diffResult = diffResults_1[_i];
+ var color = colors.grey;
+ if (diffResult.added === true) {
+ color = colors.green.underline;
+ }
+ else if (diffResult.removed === true) {
+ color = colors.red.underline;
+ }
+ process.stdout.write(color(diffResult.value));
+ }
+ /* tslint:enable:no-console */
+}
diff --git a/node_modules/tslint/lib/test/lines.d.ts b/node_modules/tslint/lib/test/lines.d.ts
new file mode 100644
index 000000000..4c3c5b252
--- /dev/null
+++ b/node_modules/tslint/lib/test/lines.d.ts
@@ -0,0 +1,37 @@
+export declare class Line {
+}
+export declare class CodeLine extends Line {
+ contents: string;
+ constructor(contents: string);
+}
+export declare class MessageSubstitutionLine extends Line {
+ key: string;
+ message: string;
+ constructor(key: string, message: string);
+}
+export declare class ErrorLine extends Line {
+ startCol: number;
+ constructor(startCol: number);
+}
+export declare class MultilineErrorLine extends ErrorLine {
+ constructor(startCol: number);
+}
+export declare class EndErrorLine extends ErrorLine {
+ endCol: number;
+ message: string;
+ constructor(startCol: number, endCol: number, message: string);
+}
+export declare const ZERO_LENGTH_ERROR = "~nil";
+/**
+ * Maps a line of text from a .lint file to an appropriate Line object
+ */
+export declare function parseLine(text: string): Line;
+/**
+ * Maps a Line object to a matching line of text that could be in a .lint file.
+ * This is almost the inverse of parseLine.
+ * If you ran `printLine(parseLine(someText), code)`, the whitespace in the result may be different than in someText
+ * @param line - A Line object to convert to text
+ * @param code - If line represents error markup, this is the line of code preceding the markup.
+ * Otherwise, this parameter is not required.
+ */
+export declare function printLine(line: Line, code?: string): string | null;
diff --git a/node_modules/tslint/lib/test/lines.js b/node_modules/tslint/lib/test/lines.js
new file mode 100644
index 000000000..9d86bc865
--- /dev/null
+++ b/node_modules/tslint/lib/test/lines.js
@@ -0,0 +1,157 @@
+"use strict";
+/*
+ * 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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+// Use classes here instead of interfaces because we want runtime type data
+var Line = (function () {
+ function Line() {
+ }
+ return Line;
+}());
+exports.Line = Line;
+var CodeLine = (function (_super) {
+ tslib_1.__extends(CodeLine, _super);
+ function CodeLine(contents) {
+ var _this = _super.call(this) || this;
+ _this.contents = contents;
+ return _this;
+ }
+ return CodeLine;
+}(Line));
+exports.CodeLine = CodeLine;
+var MessageSubstitutionLine = (function (_super) {
+ tslib_1.__extends(MessageSubstitutionLine, _super);
+ function MessageSubstitutionLine(key, message) {
+ var _this = _super.call(this) || this;
+ _this.key = key;
+ _this.message = message;
+ return _this;
+ }
+ return MessageSubstitutionLine;
+}(Line));
+exports.MessageSubstitutionLine = MessageSubstitutionLine;
+var ErrorLine = (function (_super) {
+ tslib_1.__extends(ErrorLine, _super);
+ function ErrorLine(startCol) {
+ var _this = _super.call(this) || this;
+ _this.startCol = startCol;
+ return _this;
+ }
+ return ErrorLine;
+}(Line));
+exports.ErrorLine = ErrorLine;
+var MultilineErrorLine = (function (_super) {
+ tslib_1.__extends(MultilineErrorLine, _super);
+ function MultilineErrorLine(startCol) {
+ return _super.call(this, startCol) || this;
+ }
+ return MultilineErrorLine;
+}(ErrorLine));
+exports.MultilineErrorLine = MultilineErrorLine;
+var EndErrorLine = (function (_super) {
+ tslib_1.__extends(EndErrorLine, _super);
+ function EndErrorLine(startCol, endCol, message) {
+ var _this = _super.call(this, startCol) || this;
+ _this.endCol = endCol;
+ _this.message = message;
+ return _this;
+ }
+ return EndErrorLine;
+}(ErrorLine));
+exports.EndErrorLine = EndErrorLine;
+// example matches (between the quotes):
+// " ~~~~~~~~"
+var multilineErrorRegex = /^\s*(~+|~nil)$/;
+// " ~~~~~~~~~ [some error message]"
+var endErrorRegex = /^\s*(~+|~nil)\s*\[(.+)\]\s*$/;
+// "[shortcut]: full messages goes here!! "
+var messageSubstitutionRegex = /^\[([-\w]+?)]: \s*(.+?)\s*$/;
+exports.ZERO_LENGTH_ERROR = "~nil";
+/**
+ * Maps a line of text from a .lint file to an appropriate Line object
+ */
+function parseLine(text) {
+ var multilineErrorMatch = text.match(multilineErrorRegex);
+ if (multilineErrorMatch != null) {
+ var startErrorCol = text.indexOf("~");
+ return new MultilineErrorLine(startErrorCol);
+ }
+ var endErrorMatch = text.match(endErrorRegex);
+ if (endErrorMatch != null) {
+ var squiggles = endErrorMatch[1], message = endErrorMatch[2];
+ var startErrorCol = text.indexOf("~");
+ var zeroLengthError = (squiggles === exports.ZERO_LENGTH_ERROR);
+ var endErrorCol = zeroLengthError ? startErrorCol : text.lastIndexOf("~") + 1;
+ return new EndErrorLine(startErrorCol, endErrorCol, message);
+ }
+ var messageSubstitutionMatch = text.match(messageSubstitutionRegex);
+ if (messageSubstitutionMatch != null) {
+ var key = messageSubstitutionMatch[1], message = messageSubstitutionMatch[2];
+ return new MessageSubstitutionLine(key, message);
+ }
+ // line doesn't match any syntax for error markup, so it's a line of code to be linted
+ return new CodeLine(text);
+}
+exports.parseLine = parseLine;
+/**
+ * Maps a Line object to a matching line of text that could be in a .lint file.
+ * This is almost the inverse of parseLine.
+ * If you ran `printLine(parseLine(someText), code)`, the whitespace in the result may be different than in someText
+ * @param line - A Line object to convert to text
+ * @param code - If line represents error markup, this is the line of code preceding the markup.
+ * Otherwise, this parameter is not required.
+ */
+function printLine(line, code) {
+ if (line instanceof ErrorLine) {
+ if (code == null) {
+ throw new Error("Must supply argument for code parameter when line is an ErrorLine");
+ }
+ var leadingSpaces = " ".repeat(line.startCol);
+ if (line instanceof MultilineErrorLine) {
+ // special case for when the line of code is simply a newline.
+ // use "~nil" to indicate the error continues on that line
+ if (code.length === 0 && line.startCol === 0) {
+ return exports.ZERO_LENGTH_ERROR;
+ }
+ var tildes = "~".repeat(code.length - leadingSpaces.length);
+ return "" + leadingSpaces + tildes;
+ }
+ else if (line instanceof EndErrorLine) {
+ var tildes = "~".repeat(line.endCol - line.startCol);
+ if (code.length < line.endCol) {
+ // Better than crashing in String.repeat
+ throw new Error("Bad error marker at " + JSON.stringify(line));
+ }
+ var endSpaces = " ".repeat(code.length - line.endCol);
+ if (tildes.length === 0) {
+ tildes = exports.ZERO_LENGTH_ERROR;
+ // because we add "~nil" we need four less spaces than normal at the end
+ // always make sure we have at least one space though
+ endSpaces = endSpaces.substring(0, Math.max(endSpaces.length - 4, 1));
+ }
+ return "" + leadingSpaces + tildes + endSpaces + " [" + line.message + "]";
+ }
+ }
+ else if (line instanceof MessageSubstitutionLine) {
+ return "[" + line.key + "]: " + line.message;
+ }
+ else if (line instanceof CodeLine) {
+ return line.contents;
+ }
+ return null;
+}
+exports.printLine = printLine;
diff --git a/node_modules/tslint/lib/test/lintError.d.ts b/node_modules/tslint/lib/test/lintError.d.ts
new file mode 100644
index 000000000..c00b4b535
--- /dev/null
+++ b/node_modules/tslint/lib/test/lintError.d.ts
@@ -0,0 +1,12 @@
+import { Error } from "../error";
+export interface PositionInFile {
+ line: number;
+ col: number;
+}
+export interface LintError {
+ startPos: PositionInFile;
+ endPos: PositionInFile;
+ message: string;
+}
+export declare function errorComparator(err1: LintError, err2: LintError): number;
+export declare function lintSyntaxError(message: string): Error;
diff --git a/node_modules/tslint/lib/test/lintError.js b/node_modules/tslint/lib/test/lintError.js
new file mode 100644
index 000000000..d784537c1
--- /dev/null
+++ b/node_modules/tslint/lib/test/lintError.js
@@ -0,0 +1,40 @@
+"use strict";
+/*
+ * 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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var error_1 = require("../error");
+function errorComparator(err1, err2) {
+ if (err1.startPos.line !== err2.startPos.line) {
+ return err1.startPos.line - err2.startPos.line;
+ }
+ else if (err1.startPos.col !== err2.startPos.col) {
+ return err1.startPos.col - err2.startPos.col;
+ }
+ else if (err1.endPos.line !== err2.endPos.line) {
+ return err1.endPos.line - err2.endPos.line;
+ }
+ else if (err1.endPos.col !== err2.endPos.col) {
+ return err1.endPos.col - err2.endPos.col;
+ }
+ else {
+ return err1.message.localeCompare(err2.message);
+ }
+}
+exports.errorComparator = errorComparator;
+function lintSyntaxError(message) {
+ return new error_1.Error("Lint File Syntax Error: " + message);
+}
+exports.lintSyntaxError = lintSyntaxError;
diff --git a/node_modules/tslint/lib/test/parse.d.ts b/node_modules/tslint/lib/test/parse.d.ts
new file mode 100644
index 000000000..db31418a1
--- /dev/null
+++ b/node_modules/tslint/lib/test/parse.d.ts
@@ -0,0 +1,13 @@
+import { LintError } from "./lintError";
+export declare function getTypescriptVersionRequirement(text: string): string | undefined;
+/**
+ * Takes the full text of a .lint file and returns the contents of the file
+ * with all error markup removed
+ */
+export declare function removeErrorMarkup(text: string): string;
+/**
+ * Takes the full text of a .lint file and returns an array of LintErrors
+ * corresponding to the error markup in the file.
+ */
+export declare function parseErrorsFromMarkup(text: string): LintError[];
+export declare function createMarkupFromErrors(code: string, lintErrors: LintError[]): string;
diff --git a/node_modules/tslint/lib/test/parse.js b/node_modules/tslint/lib/test/parse.js
new file mode 100644
index 000000000..5242878c4
--- /dev/null
+++ b/node_modules/tslint/lib/test/parse.js
@@ -0,0 +1,219 @@
+"use strict";
+/*
+ * 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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var ts = require("typescript");
+var util_1 = require("util");
+var lines_1 = require("./lines");
+var lintError_1 = require("./lintError");
+var scanner;
+function getTypescriptVersionRequirement(text) {
+ var lines = text.split(/\r?\n/);
+ var firstLine = lines_1.parseLine(lines[0]);
+ if (firstLine instanceof lines_1.MessageSubstitutionLine && firstLine.key === "typescript") {
+ return firstLine.message;
+ }
+ return undefined;
+}
+exports.getTypescriptVersionRequirement = getTypescriptVersionRequirement;
+/**
+ * Takes the full text of a .lint file and returns the contents of the file
+ * with all error markup removed
+ */
+function removeErrorMarkup(text) {
+ var textWithMarkup = text.split("\n");
+ var lines = textWithMarkup.map(lines_1.parseLine);
+ var codeText = lines.filter(function (line) { return (line instanceof lines_1.CodeLine); }).map(function (line) { return line.contents; });
+ return codeText.join("\n");
+}
+exports.removeErrorMarkup = removeErrorMarkup;
+/* tslint:disable:object-literal-sort-keys */
+/**
+ * Takes the full text of a .lint file and returns an array of LintErrors
+ * corresponding to the error markup in the file.
+ */
+function parseErrorsFromMarkup(text) {
+ var textWithMarkup = text.split("\n");
+ var lines = textWithMarkup.map(lines_1.parseLine);
+ if (lines.length > 0 && !(lines[0] instanceof lines_1.CodeLine)) {
+ throw lintError_1.lintSyntaxError("text cannot start with an error mark line.");
+ }
+ var messageSubstitutionLines = lines.filter(function (l) { return l instanceof lines_1.MessageSubstitutionLine; });
+ var messageSubstitutions = new Map();
+ for (var _i = 0, messageSubstitutionLines_1 = messageSubstitutionLines; _i < messageSubstitutionLines_1.length; _i++) {
+ var _a = messageSubstitutionLines_1[_i], key = _a.key, message = _a.message;
+ messageSubstitutions.set(key, formatMessage(messageSubstitutions, message));
+ }
+ // errorLineForCodeLine[5] contains all the ErrorLine objects associated with the 5th line of code, for example
+ var errorLinesForCodeLines = createCodeLineNoToErrorsMap(lines);
+ var lintErrors = [];
+ function addError(errorLine, errorStartPos, lineNo) {
+ lintErrors.push({
+ startPos: errorStartPos,
+ endPos: { line: lineNo, col: errorLine.endCol },
+ message: substituteMessage(messageSubstitutions, errorLine.message),
+ });
+ }
+ // for each line of code...
+ errorLinesForCodeLines.forEach(function (errorLinesForLineOfCode, lineNo) {
+ // for each error marking on that line...
+ while (errorLinesForLineOfCode.length > 0) {
+ var errorLine = errorLinesForLineOfCode.shift();
+ var errorStartPos = { line: lineNo, col: errorLine.startCol };
+ // if the error starts and ends on this line, add it now to list of errors
+ if (errorLine instanceof lines_1.EndErrorLine) {
+ addError(errorLine, errorStartPos, lineNo);
+ // if the error is the start of a multiline error
+ }
+ else if (errorLine instanceof lines_1.MultilineErrorLine) {
+ // iterate through the MultilineErrorLines until we get to an EndErrorLine
+ for (var nextLineNo = lineNo + 1;; ++nextLineNo) {
+ if (!isValidErrorMarkupContinuation(errorLinesForCodeLines, nextLineNo)) {
+ throw lintError_1.lintSyntaxError("Error mark starting at " + errorStartPos.line + ":" + errorStartPos.col + " does not end correctly.");
+ }
+ else {
+ var nextErrorLine = errorLinesForCodeLines[nextLineNo].shift();
+ // if end of multiline error, add it it list of errors
+ if (nextErrorLine instanceof lines_1.EndErrorLine) {
+ addError(nextErrorLine, errorStartPos, nextLineNo);
+ break;
+ }
+ }
+ }
+ }
+ }
+ });
+ lintErrors.sort(lintError_1.errorComparator);
+ return lintErrors;
+}
+exports.parseErrorsFromMarkup = parseErrorsFromMarkup;
+/**
+ * Process `message` as follows:
+ * - search `substitutions` for an exact match and return the substitution
+ * - try to format the message when it looks like: name % ('substitution1' [, "substitution2" [, ...]])
+ * - or return it unchanged
+ */
+function substituteMessage(templates, message) {
+ var substitution = templates.get(message);
+ if (substitution !== undefined) {
+ return substitution;
+ }
+ return formatMessage(templates, message);
+}
+/**
+ * Tries to format the message when it has the correct format or returns it unchanged: name % ('substitution1' [, "substitution2" [, ...]])
+ * Where `name` is the name of a message substitution that is used as template.
+ * If `name` is not found in `templates`, `message` is returned unchanged.
+ */
+function formatMessage(templates, message) {
+ var formatMatch = /^([-\w]+) % \((.+)\)$/.exec(message);
+ if (formatMatch !== null) {
+ var template = templates.get(formatMatch[1]);
+ if (template !== undefined) {
+ var formatArgs = parseFormatArguments(formatMatch[2]);
+ if (formatArgs !== undefined) {
+ message = util_1.format.apply(void 0, [template].concat(formatArgs));
+ }
+ }
+ }
+ return message;
+}
+/**
+ * Parse a list of comma separated string literals.
+ * This function bails out if it sees something unexpected.
+ * Whitespace between tokens is ignored.
+ * Trailing comma is allowed.
+ */
+function parseFormatArguments(text) {
+ if (scanner === undefined) {
+ // once the scanner is created, it is cached for subsequent calls
+ scanner = ts.createScanner(ts.ScriptTarget.Latest, false);
+ }
+ scanner.setText(text);
+ var result = [];
+ var expectValue = true;
+ for (var token = scanner.scan(); token !== ts.SyntaxKind.EndOfFileToken; token = scanner.scan()) {
+ if (token === ts.SyntaxKind.StringLiteral) {
+ if (!expectValue) {
+ return undefined;
+ }
+ result.push(scanner.getTokenValue());
+ expectValue = false;
+ }
+ else if (token === ts.SyntaxKind.CommaToken) {
+ if (expectValue) {
+ return undefined;
+ }
+ expectValue = true;
+ }
+ else if (token !== ts.SyntaxKind.WhitespaceTrivia) {
+ // only ignore whitespace, other trivia like comments makes this function bail out
+ return undefined;
+ }
+ }
+ return result.length === 0 ? undefined : result;
+}
+function createMarkupFromErrors(code, lintErrors) {
+ lintErrors.sort(lintError_1.errorComparator);
+ var codeText = code.split("\n");
+ var errorLinesForCodeText = codeText.map(function () { return []; });
+ for (var _i = 0, lintErrors_1 = lintErrors; _i < lintErrors_1.length; _i++) {
+ var error = lintErrors_1[_i];
+ var startPos = error.startPos, endPos = error.endPos, message = error.message;
+ if (startPos.line === endPos.line) {
+ // single line error
+ errorLinesForCodeText[startPos.line].push(new lines_1.EndErrorLine(startPos.col, endPos.col, message));
+ }
+ else {
+ // multiline error
+ errorLinesForCodeText[startPos.line].push(new lines_1.MultilineErrorLine(startPos.col));
+ for (var lineNo = startPos.line + 1; lineNo < endPos.line; ++lineNo) {
+ errorLinesForCodeText[lineNo].push(new lines_1.MultilineErrorLine(0));
+ }
+ errorLinesForCodeText[endPos.line].push(new lines_1.EndErrorLine(0, endPos.col, message));
+ }
+ }
+ var finalText = combineCodeTextAndErrorLines(codeText, errorLinesForCodeText);
+ return finalText.join("\n");
+}
+exports.createMarkupFromErrors = createMarkupFromErrors;
+/* tslint:enable:object-literal-sort-keys */
+function combineCodeTextAndErrorLines(codeText, errorLinesForCodeText) {
+ return codeText.reduce(function (resultText, code, i) {
+ resultText.push(code);
+ var errorPrintLines = errorLinesForCodeText[i].map(function (line) { return lines_1.printLine(line, code); }).filter(function (line) { return line !== null; });
+ resultText.push.apply(resultText, errorPrintLines);
+ return resultText;
+ }, []);
+}
+function createCodeLineNoToErrorsMap(lines) {
+ var errorLinesForCodeLine = [];
+ for (var _i = 0, lines_2 = lines; _i < lines_2.length; _i++) {
+ var line = lines_2[_i];
+ if (line instanceof lines_1.CodeLine) {
+ errorLinesForCodeLine.push([]);
+ }
+ else if (line instanceof lines_1.ErrorLine) {
+ errorLinesForCodeLine[errorLinesForCodeLine.length - 1].push(line);
+ }
+ }
+ return errorLinesForCodeLine;
+}
+function isValidErrorMarkupContinuation(errorLinesForCodeLines, lineNo) {
+ return lineNo < errorLinesForCodeLines.length
+ && errorLinesForCodeLines[lineNo].length !== 0
+ && errorLinesForCodeLines[lineNo][0].startCol === 0;
+}
diff --git a/node_modules/tslint/lib/tslint-cli.d.ts b/node_modules/tslint/lib/tslint-cli.d.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/node_modules/tslint/lib/tslint-cli.d.ts
diff --git a/node_modules/tslint/lib/tslint-cli.js b/node_modules/tslint/lib/tslint-cli.js
new file mode 100644
index 000000000..f5ac31942
--- /dev/null
+++ b/node_modules/tslint/lib/tslint-cli.js
@@ -0,0 +1,153 @@
+"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 });
+var fs = require("fs");
+var optimist = require("optimist");
+var runner_1 = require("./runner");
+var processed = optimist
+ .usage("Usage: $0 [options] file ...")
+ .check(function (argv) {
+ // at least one of file, help, version, project or unqualified argument must be present
+ // tslint:disable-next-line strict-boolean-expressions
+ if (!(argv.h || argv.i || argv.test || argv.v || argv.project || argv._.length > 0)) {
+ // throw a string, otherwise a call stack is printed for this message
+ // tslint:disable-next-line:no-string-throw
+ throw "Missing files";
+ }
+ // tslint:disable-next-line strict-boolean-expressions
+ if (argv["type-check"] && !argv.project) {
+ // tslint:disable-next-line:no-string-throw
+ throw "--project must be specified in order to enable type checking.";
+ }
+ // tslint:disable-next-line strict-boolean-expressions
+ if (argv.f) {
+ // throw a string, otherwise a call stack is printed for this message
+ // tslint:disable-next-line:no-string-throw
+ throw "-f option is no longer available. Supply files directly to the tslint command instead.";
+ }
+})
+ .options({
+ "c": {
+ alias: "config",
+ describe: "configuration file",
+ type: "string",
+ },
+ "e": {
+ alias: "exclude",
+ describe: "exclude globs from path expansion",
+ type: "string",
+ },
+ "fix": {
+ describe: "fixes linting errors for select rules (this may overwrite linted files)",
+ type: "boolean",
+ },
+ "force": {
+ describe: "return status code 0 even if there are lint errors",
+ type: "boolean",
+ },
+ "h": {
+ alias: "help",
+ describe: "display detailed help",
+ type: "boolean",
+ },
+ "i": {
+ alias: "init",
+ describe: "generate a tslint.json config file in the current working directory",
+ type: "boolean",
+ },
+ "o": {
+ alias: "out",
+ describe: "output file",
+ type: "string",
+ },
+ "outputAbsolutePaths": {
+ describe: "whether or not outputted file paths are absolute",
+ type: "boolean",
+ },
+ "p": {
+ alias: "project",
+ describe: "tsconfig.json file",
+ type: "string",
+ },
+ "r": {
+ alias: "rules-dir",
+ describe: "rules directory",
+ type: "string",
+ },
+ "s": {
+ alias: "formatters-dir",
+ describe: "formatters directory",
+ type: "string",
+ },
+ "t": {
+ alias: "format",
+ default: "prose",
+ describe: "output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist, codeFrame)",
+ type: "string",
+ },
+ "test": {
+ describe: "test that tslint produces the correct output for the specified directory",
+ type: "boolean",
+ },
+ "type-check": {
+ describe: "enable type checking when linting a project",
+ type: "boolean",
+ },
+ "v": {
+ alias: "version",
+ describe: "current version",
+ type: "boolean",
+ },
+});
+var argv = processed.argv;
+var outputStream;
+if (argv.o != null) {
+ outputStream = fs.createWriteStream(argv.o, {
+ flags: "w+",
+ mode: 420,
+ });
+}
+else {
+ outputStream = process.stdout;
+}
+// tslint:disable-next-line strict-boolean-expressions
+if (argv.help) {
+ outputStream.write(processed.help());
+ var outputString = "\ntslint accepts the following commandline options:\n\n -c, --config:\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).\n\n -e, --exclude:\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.\n\n --fix:\n Fixes linting errors for select rules. This may overwrite linted files.\n\n --force:\n Return status code 0 even if there are any lint errors.\n Useful while running as npm script.\n\n -i, --init:\n Generates a tslint.json config file in the current working directory.\n\n -o, --out:\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.\n\n -r, --rules-dir:\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.\n\n -s, --formatters-dir:\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.\n\n -t, --format:\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.\n\n --test:\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.\n\n -p, --project:\n The path or directory containing a tsconfig.json file that will be used to determine which\n files will be linted.\n\n --type-check\n Enables the type checker when running linting rules. --project must be\n specified in order to enable type checking.\n\n -v, --version:\n The current version of tslint.\n\n -h, --help:\n Prints this help message.\n";
+ outputStream.write(outputString);
+ process.exit(0);
+}
+var options = {
+ config: argv.c,
+ exclude: argv.exclude,
+ files: argv._,
+ fix: argv.fix,
+ force: argv.force,
+ format: argv.t,
+ formattersDirectory: argv.s,
+ init: argv.init,
+ out: argv.out,
+ outputAbsolutePaths: argv.outputAbsolutePaths,
+ project: argv.p,
+ rulesDirectory: argv.r,
+ test: argv.test,
+ typeCheck: argv["type-check"],
+ version: argv.v,
+};
+new runner_1.Runner(options, outputStream)
+ .run(function (status) { return process.exit(status); });
diff --git a/node_modules/tslint/lib/utils.d.ts b/node_modules/tslint/lib/utils.d.ts
new file mode 100644
index 000000000..cd75a6f20
--- /dev/null
+++ b/node_modules/tslint/lib/utils.d.ts
@@ -0,0 +1,58 @@
+/// <reference types="node" />
+/**
+ * @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.
+ */
+/**
+ * Enforces the invariant that the input is an array.
+ */
+export declare function arrayify<T>(arg?: T | T[]): T[];
+/**
+ * @deprecated (no longer used)
+ * Enforces the invariant that the input is an object.
+ */
+export declare function objectify(arg: any): any;
+export declare function hasOwnProperty(arg: {}, key: string): boolean;
+/**
+ * Replace hyphens in a rule name by upper-casing the letter after them.
+ * E.g. "foo-bar" -> "fooBar"
+ */
+export declare function camelize(stringWithHyphens: string): string;
+export declare function isUpperCase(str: string): boolean;
+export declare function isLowerCase(str: string): boolean;
+/**
+ * Removes leading indents from a template string without removing all leading whitespace
+ */
+export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string;
+/**
+ * Strip comments from file content.
+ */
+export declare function stripComments(content: string): string;
+/**
+ * Escapes all special characters in RegExp pattern to avoid broken regular expressions and ensure proper matches
+ */
+export declare function escapeRegExp(re: string): string;
+/** Return true if both parameters are equal. */
+export declare type Equal<T> = (a: T, b: T) => boolean;
+export declare function arraysAreEqual<T>(a: T[] | undefined, b: T[] | undefined, eq: Equal<T>): boolean;
+/** Returns the first non-`undefined` result. */
+export declare function find<T, U>(inputs: T[], getResult: (t: T) => U | undefined): U | undefined;
+/** Returns an array that is the concatenation of all output arrays. */
+export declare function flatMap<T, U>(inputs: T[], getOutputs: (input: T) => U[]): U[];
+/** Returns an array of all outputs that are not `undefined`. */
+export declare function mapDefined<T, U>(inputs: T[], getOutput: (input: T) => U | undefined): U[];
+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;
diff --git a/node_modules/tslint/lib/utils.js b/node_modules/tslint/lib/utils.js
new file mode 100644
index 000000000..04dbd1496
--- /dev/null
+++ b/node_modules/tslint/lib/utils.js
@@ -0,0 +1,216 @@
+"use strict";
+/**
+ * @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.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * Enforces the invariant that the input is an array.
+ */
+function arrayify(arg) {
+ if (Array.isArray(arg)) {
+ return arg;
+ }
+ else if (arg != null) {
+ return [arg];
+ }
+ else {
+ return [];
+ }
+}
+exports.arrayify = arrayify;
+/**
+ * @deprecated (no longer used)
+ * Enforces the invariant that the input is an object.
+ */
+function objectify(arg) {
+ if (typeof arg === "object" && arg != null) {
+ return arg;
+ }
+ else {
+ return {};
+ }
+}
+exports.objectify = objectify;
+function hasOwnProperty(arg, key) {
+ return Object.prototype.hasOwnProperty.call(arg, key);
+}
+exports.hasOwnProperty = hasOwnProperty;
+/**
+ * Replace hyphens in a rule name by upper-casing the letter after them.
+ * E.g. "foo-bar" -> "fooBar"
+ */
+function camelize(stringWithHyphens) {
+ return stringWithHyphens.replace(/-(.)/g, function (_, nextLetter) { return nextLetter.toUpperCase(); });
+}
+exports.camelize = camelize;
+function isUpperCase(str) {
+ return str === str.toUpperCase();
+}
+exports.isUpperCase = isUpperCase;
+function isLowerCase(str) {
+ return str === str.toLowerCase();
+}
+exports.isLowerCase = isLowerCase;
+/**
+ * Removes leading indents from a template string without removing all leading whitespace
+ */
+function dedent(strings) {
+ var values = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ values[_i - 1] = arguments[_i];
+ }
+ var fullString = strings.reduce(function (accumulator, str, i) {
+ return "" + accumulator + values[i - 1] + str;
+ });
+ // match all leading spaces/tabs at the start of each line
+ var match = fullString.match(/^[ \t]*(?=\S)/gm);
+ if (match === null) {
+ // e.g. if the string is empty or all whitespace.
+ return fullString;
+ }
+ // find the smallest indent, we don't want to remove all leading whitespace
+ var indent = Math.min.apply(Math, match.map(function (el) { return el.length; }));
+ var regexp = new RegExp("^[ \\t]{" + indent + "}", "gm");
+ fullString = indent > 0 ? fullString.replace(regexp, "") : fullString;
+ return fullString;
+}
+exports.dedent = dedent;
+/**
+ * Strip comments from file content.
+ */
+function stripComments(content) {
+ /**
+ * First capturing group matches double quoted string
+ * Second matches single quotes string
+ * Third matches block comments
+ * Fourth matches line comments
+ */
+ var regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
+ var result = content.replace(regexp, function (match, _m1, _m2, m3, m4) {
+ // Only one of m1, m2, m3, m4 matches
+ if (m3 !== undefined) {
+ // A block comment. Replace with nothing
+ return "";
+ }
+ else if (m4 !== undefined) {
+ // A line comment. If it ends in \r?\n then keep it.
+ var length = m4.length;
+ if (length > 2 && m4[length - 1] === "\n") {
+ return m4[length - 2] === "\r" ? "\r\n" : "\n";
+ }
+ else {
+ return "";
+ }
+ }
+ else {
+ // We match a string
+ return match;
+ }
+ });
+ return result;
+}
+exports.stripComments = stripComments;
+/**
+ * Escapes all special characters in RegExp pattern to avoid broken regular expressions and ensure proper matches
+ */
+function escapeRegExp(re) {
+ return re.replace(/[.+*?|^$[\]{}()\\]/g, "\\$&");
+}
+exports.escapeRegExp = escapeRegExp;
+function arraysAreEqual(a, b, eq) {
+ return a === b || a !== undefined && b !== undefined && a.length === b.length && a.every(function (x, idx) { return eq(x, b[idx]); });
+}
+exports.arraysAreEqual = arraysAreEqual;
+/** Returns the first non-`undefined` result. */
+function find(inputs, getResult) {
+ for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {
+ var element = inputs_1[_i];
+ var result = getResult(element);
+ if (result !== undefined) {
+ return result;
+ }
+ }
+ return undefined;
+}
+exports.find = find;
+/** Returns an array that is the concatenation of all output arrays. */
+function flatMap(inputs, getOutputs) {
+ var out = [];
+ for (var _i = 0, inputs_2 = inputs; _i < inputs_2.length; _i++) {
+ var input = inputs_2[_i];
+ out.push.apply(out, getOutputs(input));
+ }
+ return out;
+}
+exports.flatMap = flatMap;
+/** Returns an array of all outputs that are not `undefined`. */
+function mapDefined(inputs, getOutput) {
+ var out = [];
+ for (var _i = 0, inputs_3 = inputs; _i < inputs_3.length; _i++) {
+ var input = inputs_3[_i];
+ var output = getOutput(input);
+ if (output !== undefined) {
+ out.push(output);
+ }
+ }
+ return out;
+}
+exports.mapDefined = mapDefined;
+function readBufferWithDetectedEncoding(buffer) {
+ switch (detectBufferEncoding(buffer)) {
+ case "utf8":
+ return buffer.toString();
+ case "utf8-bom":
+ return buffer.toString("utf-8", 2);
+ case "utf16le":
+ return buffer.toString("utf16le", 2);
+ case "utf16be":
+ // Round down to nearest multiple of 2.
+ var len = buffer.length & ~1; // tslint:disable-line no-bitwise
+ // Flip all byte pairs, then read as little-endian.
+ for (var i = 0; i < len; i += 2) {
+ var temp = buffer[i];
+ buffer[i] = buffer[i + 1];
+ buffer[i + 1] = temp;
+ }
+ return buffer.toString("utf16le", 2);
+ }
+}
+exports.readBufferWithDetectedEncoding = readBufferWithDetectedEncoding;
+function detectBufferEncoding(buffer, length) {
+ if (length === void 0) { length = buffer.length; }
+ if (length < 2) {
+ return "utf8";
+ }
+ switch (buffer[0]) {
+ case 0xEF:
+ if (buffer[1] === 0xBB && length >= 3 && buffer[2] === 0xBF) {
+ return "utf8-bom";
+ }
+ break;
+ case 0xFE:
+ if (buffer[1] === 0xFF) {
+ return "utf16be";
+ }
+ break;
+ case 0xFF:
+ if (buffer[1] === 0xFE) {
+ return "utf16le";
+ }
+ }
+ return "utf8";
+}
+exports.detectBufferEncoding = detectBufferEncoding;