aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint/lib/rules
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules')
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/alignRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/alignRule.js7
-rw-r--r--node_modules/tslint/lib/rules/arrayTypeRule.js4
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.js8
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.js15
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.js14
-rw-r--r--node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/banCommaOperatorRule.js21
-rw-r--r--node_modules/tslint/lib/rules/banRule.js4
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js5
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.js1
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.js8
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.js7
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/blockExclusion.js4
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts4
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/classExclusion.js8
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts23
-rw-r--r--node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts4
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.d.ts50
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.js259
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.js18
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.js8
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.js10
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.js2
-rw-r--r--node_modules/tslint/lib/rules/eoflineRule.js2
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.d.ts1
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.js44
-rw-r--r--node_modules/tslint/lib/rules/forinRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/forinRule.js4
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.js8
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.js2
-rw-r--r--node_modules/tslint/lib/rules/indentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/indentRule.js8
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.js4
-rw-r--r--node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.js6
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.js4
-rw-r--r--node_modules/tslint/lib/rules/linebreakStyleRule.js4
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.js6
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.js8
-rw-r--r--node_modules/tslint/lib/rules/maxFileLineCountRule.js4
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.js63
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.js12
-rw-r--r--node_modules/tslint/lib/rules/memberOrderingRule.js204
-rw-r--r--node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noAnyRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noBitwiseRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.js11
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noDefaultExportRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateImportsRule.js30
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.js13
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.js12
-rw-r--r--node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.js35
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noForInArrayRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noImplicitDependenciesRule.js69
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noInternalModuleRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noMagicNumbersRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noNonNullAssertionRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noRedundantJsdocRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noReferenceImportRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReferenceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noRequireImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noReturnAwaitRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.js84
-rw-r--r--node_modules/tslint/lib/rules/noSparseArraysRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noSubmoduleImportsRule.js9
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts20
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noThisAssignmentRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.js7
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryClassRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js55
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.js50
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.js112
-rw-r--r--node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js17
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noVarRequiresRule.js5
-rw-r--r--node_modules/tslint/lib/rules/noVoidExpressionRule.js9
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.js2
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.js4
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts17
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js36
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.js9
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js4
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js6
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.js8
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.js62
-rw-r--r--node_modules/tslint/lib/rules/preferConstRule.js20
-rw-r--r--node_modules/tslint/lib/rules/preferForOfRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js4
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.js4
-rw-r--r--node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.js13
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.js4
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js76
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.js4
-rw-r--r--node_modules/tslint/lib/rules/radixRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/radixRule.js33
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.js8
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.js8
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.js4
-rw-r--r--node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js9
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.js14
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts2
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js21
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.js28
-rw-r--r--node_modules/tslint/lib/rules/switchDefaultRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/switchFinalBreakRule.js47
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.js6
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.js6
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.js2
-rw-r--r--node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts18
-rw-r--r--node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js12
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.js4
-rw-r--r--node_modules/tslint/lib/rules/variableNameRule.js7
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.js7
244 files changed, 3187 insertions, 713 deletions
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
index 18d5df0d9..967655d2d 100644
--- a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
index da1303ba3..7bba51a80 100644
--- a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
@@ -111,7 +111,7 @@ function getOverloadKey(node) {
return undefined;
}
var _a = typeof info === "string" ? [false, info] : [info.computed, info.name], computed = _a[0], name = _a[1];
- var isStatic = Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword);
+ var isStatic = utils.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword);
return (computed ? "0" : "1") + (isStatic ? "0" : "1") + name;
}
exports.getOverloadKey = getOverloadKey;
diff --git a/node_modules/tslint/lib/rules/alignRule.d.ts b/node_modules/tslint/lib/rules/alignRule.d.ts
index 051a5bb15..78cc017cf 100644
--- a/node_modules/tslint/lib/rules/alignRule.d.ts
+++ b/node_modules/tslint/lib/rules/alignRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/alignRule.js b/node_modules/tslint/lib/rules/alignRule.js
index f2fbc169e..702711ffe 100644
--- a/node_modules/tslint/lib/rules/alignRule.js
+++ b/node_modules/tslint/lib/rules/alignRule.js
@@ -44,8 +44,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "align",
description: "Enforces vertical alignment.",
hasFix: true,
- rationale: "Helps maintain a readable, consistent style in your codebase.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks alignment of function parameters.\n * `\"", "\"` checks alignment of function call arguments.\n * `\"", "\"` checks alignment of statements.\n * `\"", "\"` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * `\"", "\"` checks alignment of elements of array iterals, array destructuring and tuple types."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks alignment of function parameters.\n * \\`\"", "\"\\` checks alignment of function call arguments.\n * \\`\"", "\"\\` checks alignment of statements.\n * \\`\"", "\"\\` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * \\`\"", "\"\\` checks alignment of elements of array iterals, array destructuring and tuple types."], Lint.Utils.dedent(_a, OPTION_PARAMETERS, OPTION_ARGUMENTS, OPTION_STATEMENTS, OPTION_MEMBERS, OPTION_ELEMENTS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps maintain a readable, consistent style in your codebase.\n\n Consistent alignment for code statements helps keep code readable and clear.\n Statements misaligned from the standard can be harder to read and understand."], ["\n Helps maintain a readable, consistent style in your codebase.\n\n Consistent alignment for code statements helps keep code readable and clear.\n Statements misaligned from the standard can be harder to read and understand."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks alignment of function parameters.\n * `\"", "\"` checks alignment of function call arguments.\n * `\"", "\"` checks alignment of statements.\n * `\"", "\"` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * `\"", "\"` checks alignment of elements of array iterals, array destructuring and tuple types."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks alignment of function parameters.\n * \\`\"", "\"\\` checks alignment of function call arguments.\n * \\`\"", "\"\\` checks alignment of statements.\n * \\`\"", "\"\\` checks alignment of members of classes, interfaces, type literal, object literals and\n object destructuring.\n * \\`\"", "\"\\` checks alignment of elements of array iterals, array destructuring and tuple types."])), OPTION_PARAMETERS, OPTION_ARGUMENTS, OPTION_STATEMENTS, OPTION_MEMBERS, OPTION_ELEMENTS),
options: {
type: "array",
items: {
@@ -170,6 +170,7 @@ var AlignWalker = /** @class */ (function (_super) {
AlignWalker.prototype.getStart = function (node) {
return node.kind !== ts.SyntaxKind.OmittedExpression
? node.getStart(this.sourceFile)
+ // find the comma token following the OmmitedExpression
: tsutils_1.getNextToken(node, this.sourceFile).getStart(this.sourceFile);
};
return AlignWalker;
@@ -181,4 +182,4 @@ function getLineAndCharacterWithoutBom(sourceFile, pos) {
}
return result;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/arrayTypeRule.js b/node_modules/tslint/lib/rules/arrayTypeRule.js
index af92a8084..f04126edf 100644
--- a/node_modules/tslint/lib/rules/arrayTypeRule.js
+++ b/node_modules/tslint/lib/rules/arrayTypeRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "array-type",
description: "Requires using either 'T[]' or 'Array<T>' for arrays.",
hasFix: true,
- optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces use of `T[]` for all types T.\n * `\"", "\"` enforces use of `Array<T>` for all types T.\n * `\"", "\"` enforces use of `T[]` if `T` is a simple type (primitive or type reference)."], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces use of \\`T[]\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`Array<T>\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`T[]\\` if \\`T\\` is a simple type (primitive or type reference)."], Lint.Utils.dedent(_a, OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces use of `T[]` for all types T.\n * `\"", "\"` enforces use of `Array<T>` for all types T.\n * `\"", "\"` enforces use of `T[]` if `T` is a simple type (primitive or type reference)."], ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces use of \\`T[]\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`Array<T>\\` for all types T.\n * \\`\"", "\"\\` enforces use of \\`T[]\\` if \\`T\\` is a simple type (primitive or type reference)."])), OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE),
options: {
type: "string",
enum: [OPTION_ARRAY, OPTION_GENERIC, OPTION_ARRAY_SIMPLE],
@@ -151,4 +151,4 @@ function isSimpleType(nodeType) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.d.ts b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
index 32149f7ed..ebb24e383 100644
--- a/node_modules/tslint/lib/rules/arrowParensRule.d.ts
+++ b/node_modules/tslint/lib/rules/arrowParensRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.js b/node_modules/tslint/lib/rules/arrowParensRule.js
index 5af83227d..49f869560 100644
--- a/node_modules/tslint/lib/rules/arrowParensRule.js
+++ b/node_modules/tslint/lib/rules/arrowParensRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
description: "Requires parentheses around the parameters of arrow function definitions.",
hasFix: true,
rationale: "Maintains stylistic consistency with other arrow function definitions.",
- optionsDescription: (_a = ["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], _a.raw = ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], Lint.Utils.dedent(_a, BAN_SINGLE_ARG_PARENS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."], ["\n If \\`", "\\` is specified, then arrow functions with one parameter\n must not have parentheses if removing them is allowed by TypeScript."])), BAN_SINGLE_ARG_PARENS),
options: {
type: "string",
enum: [BAN_SINGLE_ARG_PARENS],
@@ -69,8 +69,10 @@ function walk(ctx) {
}
else if (ctx.options.banSingleArgParens) {
var closeParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.CloseParenToken);
+ var charBeforeOpenParen = ctx.sourceFile.text.substring(openParen.pos - 1, openParen.pos);
+ var replaceValue = charBeforeOpenParen.match(/[a-z]/i) !== null ? " " : "";
ctx.addFailureAtNode(node.parameters[0], Rule.FAILURE_STRING_EXISTS, [
- Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), " "),
+ Lint.Replacement.replaceFromTo(openParen.pos, node.parameters[0].getStart(ctx.sourceFile), replaceValue),
Lint.Replacement.deleteFromTo(node.parameters[0].end, closeParen.end),
]);
}
@@ -92,4 +94,4 @@ function isSimpleParameter(parameter) {
&& parameter.questionToken === undefined
&& parameter.type === undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
index 221a0b522..3cd37b60a 100644
--- a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
index 41ccb332e..3f869f765 100644
--- a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
@@ -40,7 +40,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "arrow-return-shorthand",
description: "Suggests to convert `() => { return x; }` to `() => x`.",
hasFix: true,
- optionsDescription: (_a = ["\n If `", "` is specified, then this will warn even if the function spans multiple lines."], _a.raw = ["\n If \\`", "\\` is specified, then this will warn even if the function spans multiple lines."], Lint.Utils.dedent(_a, OPTION_MULTILINE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then this will warn even if the function spans multiple lines."], ["\n If \\`", "\\` is specified, then this will warn even if the function spans multiple lines."])), OPTION_MULTILINE),
options: {
type: "string",
enum: [OPTION_MULTILINE],
@@ -49,6 +49,7 @@ var Rule = /** @class */ (function (_super) {
true,
[true, OPTION_MULTILINE],
],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It's unnecessary to include `return` and `{}` brackets in arrow lambdas.\n Leaving them out results in simpler and easier to read code.\n "], ["\n It's unnecessary to include \\`return\\` and \\`{}\\` brackets in arrow lambdas.\n Leaving them out results in simpler and easier to read code.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -70,11 +71,11 @@ function walk(ctx) {
}
function createFix(arrowFunction, body, expr, text) {
var statement = expr.parent;
- var returnKeyword = Lint.childOfKind(statement, ts.SyntaxKind.ReturnKeyword);
- var arrow = Lint.childOfKind(arrowFunction, ts.SyntaxKind.EqualsGreaterThanToken);
- var openBrace = Lint.childOfKind(body, ts.SyntaxKind.OpenBraceToken);
- var closeBrace = Lint.childOfKind(body, ts.SyntaxKind.CloseBraceToken);
- var semicolon = Lint.childOfKind(statement, ts.SyntaxKind.SemicolonToken);
+ var returnKeyword = utils.getChildOfKind(statement, ts.SyntaxKind.ReturnKeyword);
+ var arrow = utils.getChildOfKind(arrowFunction, ts.SyntaxKind.EqualsGreaterThanToken);
+ var openBrace = utils.getChildOfKind(body, ts.SyntaxKind.OpenBraceToken);
+ var closeBrace = utils.getChildOfKind(body, ts.SyntaxKind.CloseBraceToken);
+ var semicolon = utils.getChildOfKind(statement, ts.SyntaxKind.SemicolonToken);
var anyComments = hasComments(arrow) || hasComments(openBrace) || hasComments(statement) || hasComments(returnKeyword) ||
hasComments(expr) || (semicolon !== undefined && hasComments(semicolon)) || hasComments(closeBrace);
return anyComments ? undefined : (expr.kind === ts.SyntaxKind.ObjectLiteralExpression ? [
@@ -98,4 +99,4 @@ function getSimpleReturnExpression(block) {
? block.statements[0].expression
: undefined;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
index b5a31ed7b..e54ae8844 100644
--- a/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.js b/node_modules/tslint/lib/rules/awaitPromiseRule.js
index cb1c35b08..c6eef346f 100644
--- a/node_modules/tslint/lib/rules/awaitPromiseRule.js
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "await-promise",
description: "Warns for an awaited value that is not a Promise.",
- optionsDescription: (_a = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], _a.raw = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "], ["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "]))),
options: {
type: "list",
listType: {
@@ -42,6 +42,7 @@ var Rule = /** @class */ (function (_super) {
},
},
optionExamples: [true, [true, "Thenable"]],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "], ["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -70,8 +71,13 @@ function walk(ctx, tc) {
}
}
function containsType(type, predicate) {
- if (Lint.isTypeFlagSet(type, ts.TypeFlags.Any) ||
- tsutils_1.isTypeReference(type) && type.target.symbol !== undefined && predicate(type.target.symbol.name)) {
+ if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any)) {
+ return true;
+ }
+ if (tsutils_1.isTypeReference(type)) {
+ type = type.target;
+ }
+ if (type.symbol !== undefined && predicate(type.symbol.name)) {
return true;
}
if (tsutils_1.isUnionOrIntersectionType(type)) {
@@ -83,4 +89,4 @@ function containsType(type, predicate) {
function isAsyncIterable(name) {
return name === "AsyncIterable" || name === "AsyncIterableIterator";
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts b/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
+++ b/node_modules/tslint/lib/rules/banCommaOperatorRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/banCommaOperatorRule.js b/node_modules/tslint/lib/rules/banCommaOperatorRule.js
index 2a5bcede0..e81084295 100644
--- a/node_modules/tslint/lib/rules/banCommaOperatorRule.js
+++ b/node_modules/tslint/lib/rules/banCommaOperatorRule.js
@@ -28,26 +28,33 @@ var Rule = /** @class */ (function (_super) {
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk);
};
- /* tslint:disable:object-literal-sort-keys */
+ /* tslint:disable:object-literal-sort-keys max-line-length */
Rule.metadata = {
ruleName: "ban-comma-operator",
- description: "Bans the comma operator.",
+ description: "Disallows the comma operator to be used.",
+ descriptionDetails: "[Read more about the comma operator here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator).",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.\n\n ### Examples\n ```\n foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious\n ```\n\n ```\n switch (foo) {\n case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'\n return true;\n case 3:\n return false;\n }\n ```\n\n ```\n let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.\n ```\n "], ["\n Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.\n\n ### Examples\n \\`\\`\\`\n foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious\n \\`\\`\\`\n\n \\`\\`\\`\n switch (foo) {\n case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'\n return true;\n case 3:\n return false;\n }\n \\`\\`\\`\n\n \\`\\`\\`\n let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.\n \\`\\`\\`\n "]))),
options: null,
optionsDescription: "",
optionExamples: [true],
- type: "typescript",
- typescriptOnly: true,
+ type: "functionality",
+ typescriptOnly: false,
};
- /* tslint:enable:object-literal-sort-keys */
- Rule.FAILURE_STRING = "Don't use the comma operator.";
+ /* tslint:enable:object-literal-sort-keys max-line-length */
+ Rule.FAILURE_STRING = "Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs.";
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
- if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.CommaToken) {
+ if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.CommaToken && !isForLoopIncrementor(node)) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
+function isForLoopIncrementor(node) {
+ var parent = node.parent;
+ return parent.kind === ts.SyntaxKind.ForStatement && parent.incrementor === node;
+}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/banRule.js b/node_modules/tslint/lib/rules/banRule.js
index ab4e8b096..a87a1f3a7 100644
--- a/node_modules/tslint/lib/rules/banRule.js
+++ b/node_modules/tslint/lib/rules/banRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "ban",
description: "Bans the use of specific functions or global methods.",
- optionsDescription: (_a = ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: `\"functionName\"`\n * the name of the function in an array with one element: `[\"functionName\"]`\n * an object in the following format: `{\"name\": \"functionName\", \"message\": \"optional explanation message\"}`\n * banning methods:\n * an array with the object name, method name and optional message: `[\"functionName\", \"methodName\", \"optional message\"]`\n * an object in the following format: `{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}`\n * you can also ban deeply nested methods: `{\"name\": [\"foo\", \"bar\", \"baz\"]}` bans `foo.bar.baz()`\n * the first element can contain a wildcard (`*`) that matches everything. `{\"name\": [\"*\", \"forEach\"]}` bans `[].forEach(...)`, `$(...).forEach(...)`, `arr.forEach(...)`, etc.\n "], _a.raw = ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: \\`\"functionName\"\\`\n * the name of the function in an array with one element: \\`[\"functionName\"]\\`\n * an object in the following format: \\`{\"name\": \"functionName\", \"message\": \"optional explanation message\"}\\`\n * banning methods:\n * an array with the object name, method name and optional message: \\`[\"functionName\", \"methodName\", \"optional message\"]\\`\n * an object in the following format: \\`{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}\\`\n * you can also ban deeply nested methods: \\`{\"name\": [\"foo\", \"bar\", \"baz\"]}\\` bans \\`foo.bar.baz()\\`\n * the first element can contain a wildcard (\\`*\\`) that matches everything. \\`{\"name\": [\"*\", \"forEach\"]}\\` bans\\\n \\`[].forEach(...)\\`, \\`$(...).forEach(...)\\`, \\`arr.forEach(...)\\`, etc.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: `\"functionName\"`\n * the name of the function in an array with one element: `[\"functionName\"]`\n * an object in the following format: `{\"name\": \"functionName\", \"message\": \"optional explanation message\"}`\n * banning methods:\n * an array with the object name, method name and optional message: `[\"functionName\", \"methodName\", \"optional message\"]`\n * an object in the following format: `{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}`\n * you can also ban deeply nested methods: `{\"name\": [\"foo\", \"bar\", \"baz\"]}` bans `foo.bar.baz()`\n * the first element can contain a wildcard (`*`) that matches everything. `{\"name\": [\"*\", \"forEach\"]}` bans `[].forEach(...)`, `$(...).forEach(...)`, `arr.forEach(...)`, etc.\n "], ["\n A list of banned functions or methods in the following format:\n\n * banning functions:\n * just the name of the function: \\`\"functionName\"\\`\n * the name of the function in an array with one element: \\`[\"functionName\"]\\`\n * an object in the following format: \\`{\"name\": \"functionName\", \"message\": \"optional explanation message\"}\\`\n * banning methods:\n * an array with the object name, method name and optional message: \\`[\"functionName\", \"methodName\", \"optional message\"]\\`\n * an object in the following format: \\`{\"name\": [\"objectName\", \"methodName\"], \"message\": \"optional message\"}\\`\n * you can also ban deeply nested methods: \\`{\"name\": [\"foo\", \"bar\", \"baz\"]}\\` bans \\`foo.bar.baz()\\`\n * the first element can contain a wildcard (\\`*\\`) that matches everything. \\`{\"name\": [\"*\", \"forEach\"]}\\` bans\\\n \\`[].forEach(...)\\`, \\`$(...).forEach(...)\\`, \\`arr.forEach(...)\\`, etc.\n "]))),
options: {
type: "list",
listType: {
@@ -171,4 +171,4 @@ var BanFunctionWalker = /** @class */ (function (_super) {
};
return BanFunctionWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/banTypesRule.d.ts b/node_modules/tslint/lib/rules/banTypesRule.d.ts
index 35b876994..931ef3657 100644
--- a/node_modules/tslint/lib/rules/banTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/banTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/banTypesRule.js b/node_modules/tslint/lib/rules/banTypesRule.js
index 0e8fe73f1..bcb971f80 100644
--- a/node_modules/tslint/lib/rules/banTypesRule.js
+++ b/node_modules/tslint/lib/rules/banTypesRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "ban-types",
- description: (_a = ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], _a.raw = ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."], ["\n Bans specific types from being used. Does not ban the\n corresponding runtime objects from being used."]))),
options: {
type: "list",
listType: {
@@ -45,7 +45,7 @@ var Rule = /** @class */ (function (_super) {
maxLength: 2,
},
},
- optionsDescription: (_b = ["\n A list of `[\"regex\", \"optional explanation here\"]`, which bans\n types that match `regex`"], _b.raw = ["\n A list of \\`[\"regex\", \"optional explanation here\"]\\`, which bans\n types that match \\`regex\\`"], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A list of `[\"regex\", \"optional explanation here\"]`, which bans\n types that match `regex`"], ["\n A list of \\`[\"regex\", \"optional explanation here\"]\\`, which bans\n types that match \\`regex\\`"]))),
optionExamples: [[true, ["Object", "Use {} instead."], ["String"]]],
type: "typescript",
typescriptOnly: true,
@@ -72,4 +72,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
+++ b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
index b11273d40..87a6f2bed 100644
--- a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
+++ b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
@@ -32,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "binary-expression-operand-order",
- description: (_a = ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], _a.raw = ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."], ["\n In a binary expression, a literal should always be on the right-hand side if possible.\n For example, prefer 'x + 1' over '1 + x'."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Expressions like `1 + x` are sometimes referred to as \"Yoda\" expressions because they read\n opposite to how we would normally speak the expression.\n\n Sticking to a consistent grammar for conditions helps keep code readable and understandable.\n "], ["\n Expressions like \\`1 + x\\` are sometimes referred to as \"Yoda\" expressions because they read\n opposite to how we would normally speak the expression.\n\n Sticking to a consistent grammar for conditions helps keep code readable and understandable.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -90,4 +91,4 @@ function isLiteral(node) {
return false;
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.d.ts b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
index 46cb6b262..a731d581d 100644
--- a/node_modules/tslint/lib/rules/callableTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/callableTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.js b/node_modules/tslint/lib/rules/callableTypesRule.js
index 8c4813225..3e569fe1c 100644
--- a/node_modules/tslint/lib/rules/callableTypesRule.js
+++ b/node_modules/tslint/lib/rules/callableTypesRule.js
@@ -97,6 +97,7 @@ function shouldWrapSuggestion(parent) {
switch (parent.kind) {
case ts.SyntaxKind.UnionType:
case ts.SyntaxKind.IntersectionType:
+ case ts.SyntaxKind.ArrayType:
return true;
default:
return false;
diff --git a/node_modules/tslint/lib/rules/classNameRule.d.ts b/node_modules/tslint/lib/rules/classNameRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/classNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/classNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/classNameRule.js b/node_modules/tslint/lib/rules/classNameRule.js
index cf9acbe33..3d72541e2 100644
--- a/node_modules/tslint/lib/rules/classNameRule.js
+++ b/node_modules/tslint/lib/rules/classNameRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "class-name",
description: "Enforces PascalCased class and interface names.",
- rationale: "Makes it easy to differentiate classes from regular variables at a glance.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Makes it easy to differentiate classes from regular variables at a glance.\n\n JavaScript and general programming convention is to refer to classes in PascalCase.\n It's confusing to use camelCase or other conventions for class names.\n "], ["\n Makes it easy to differentiate classes from regular variables at a glance.\n\n JavaScript and general programming convention is to refer to classes in PascalCase.\n It's confusing to use camelCase or other conventions for class names.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -49,13 +49,11 @@ function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isClassLikeDeclaration(node) && node.name !== undefined ||
tsutils_1.isInterfaceDeclaration(node)) {
- if (!isPascalCased(node.name.text)) {
+ if (!utils_1.isPascalCased(node.name.text)) {
ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING);
}
}
return ts.forEachChild(node, cb);
});
}
-function isPascalCased(name) {
- return utils_1.isUpperCase(name[0]) && !name.includes("_");
-}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.d.ts b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
index 5de68b5db..3f9d070dd 100644
--- a/node_modules/tslint/lib/rules/commentFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/commentFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.js b/node_modules/tslint/lib/rules/commentFormatRule.js
index ca4027362..050a251dd 100644
--- a/node_modules/tslint/lib/rules/commentFormatRule.js
+++ b/node_modules/tslint/lib/rules/commentFormatRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "comment-format",
description: "Enforces formatting rules for single-line comments.",
rationale: "Helps maintain a consistent, readable style in your codebase.",
- optionsDescription: (_a = ["\n Three arguments may be optionally provided:\n\n * `\"check-space\"` requires that all single-line comments must begin with a space, as in `// comment`\n * note that for comments starting with multiple slashes, e.g. `///`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * `\"check-lowercase\"` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * `\"check-uppercase\"` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to `\"check-lowercase\"` or `\"check-uppercase\"` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * `\"ignore-words\"` - array of strings - words that will be ignored at the beginning of the comment.\n * `\"ignore-pattern\"` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], _a.raw = ["\n Three arguments may be optionally provided:\n\n * \\`\"check-space\"\\` requires that all single-line comments must begin with a space, as in \\`// comment\\`\n * note that for comments starting with multiple slashes, e.g. \\`///\\`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * \\`\"check-lowercase\"\\` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * \\`\"check-uppercase\"\\` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to \\`\"check-lowercase\"\\` or \\`\"check-uppercase\"\\` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * \\`\"ignore-words\"\\` - array of strings - words that will be ignored at the beginning of the comment.\n * \\`\"ignore-pattern\"\\` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Three arguments may be optionally provided:\n\n * `\"check-space\"` requires that all single-line comments must begin with a space, as in `// comment`\n * note that for comments starting with multiple slashes, e.g. `///`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * `\"check-lowercase\"` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * `\"check-uppercase\"` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to `\"check-lowercase\"` or `\"check-uppercase\"` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * `\"ignore-words\"` - array of strings - words that will be ignored at the beginning of the comment.\n * `\"ignore-pattern\"` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "], ["\n Three arguments may be optionally provided:\n\n * \\`\"check-space\"\\` requires that all single-line comments must begin with a space, as in \\`// comment\\`\n * note that for comments starting with multiple slashes, e.g. \\`///\\`, leading slashes are ignored\n * TypeScript reference comments are ignored completely\n * \\`\"check-lowercase\"\\` requires that the first non-whitespace character of a comment must be lowercase, if applicable.\n * \\`\"check-uppercase\"\\` requires that the first non-whitespace character of a comment must be uppercase, if applicable.\n\n Exceptions to \\`\"check-lowercase\"\\` or \\`\"check-uppercase\"\\` can be managed with object that may be passed as last argument.\n\n One of two options can be provided in this object:\n\n * \\`\"ignore-words\"\\` - array of strings - words that will be ignored at the beginning of the comment.\n * \\`\"ignore-pattern\"\\` - string - RegExp pattern that will be ignored at the beginning of the comment.\n "]))),
options: {
type: "array",
items: {
@@ -79,6 +79,7 @@ var Rule = /** @class */ (function (_super) {
],
type: "style",
typescriptOnly: false,
+ hasFix: true,
};
/* tslint:enable:object-literal-sort-keys */
Rule.LOWERCASE_FAILURE = "comment must start with lowercase letter";
@@ -140,7 +141,7 @@ function walk(ctx) {
return;
}
if (ctx.options.space && commentText[0] !== " ") {
- ctx.addFailure(start, end, Rule.LEADING_SPACE_FAILURE);
+ ctx.addFailure(start, end, Rule.LEADING_SPACE_FAILURE, [Lint.Replacement.appendText(start, " ")]);
}
if (ctx.options.case === 0 /* None */ ||
ctx.options.exceptions !== undefined && ctx.options.exceptions.test(commentText) ||
@@ -162,4 +163,4 @@ function walk(ctx) {
}
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js b/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
index fdc7dabd0..99621fa18 100644
--- a/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
+++ b/node_modules/tslint/lib/rules/completed-docs/blockExclusion.js
@@ -17,8 +17,8 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
-var Lint = require("../../index");
var completedDocsRule_1 = require("../completedDocsRule");
var exclusion_1 = require("./exclusion");
var BlockExclusion = /** @class */ (function (_super) {
@@ -32,7 +32,7 @@ var BlockExclusion = /** @class */ (function (_super) {
if (this.visibilities.has(completedDocsRule_1.ALL)) {
return false;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
return !this.visibilities.has(completedDocsRule_1.VISIBILITY_EXPORTED);
}
return !this.visibilities.has(completedDocsRule_1.VISIBILITY_INTERNAL);
diff --git a/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts b/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
index a6f24bbe7..c2661a18d 100644
--- a/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/classExclusion.d.ts
@@ -25,6 +25,6 @@ export declare class ClassExclusion extends Exclusion<IClassExclusionDescriptor>
readonly locations: Set<Location>;
readonly privacies: Set<Privacy>;
excludes(node: ts.Node): boolean;
- private shouldLocationBeDocumented(node);
- private shouldPrivacyBeDocumented(node);
+ private shouldLocationBeDocumented;
+ private shouldPrivacyBeDocumented;
}
diff --git a/node_modules/tslint/lib/rules/completed-docs/classExclusion.js b/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
index 4c8c8ec57..5fffc2e62 100644
--- a/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
+++ b/node_modules/tslint/lib/rules/completed-docs/classExclusion.js
@@ -17,8 +17,8 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
-var Lint = require("../../index");
var completedDocsRule_1 = require("../completedDocsRule");
var exclusion_1 = require("./exclusion");
var ClassExclusion = /** @class */ (function (_super) {
@@ -37,7 +37,7 @@ var ClassExclusion = /** @class */ (function (_super) {
if (this.locations.has(completedDocsRule_1.ALL)) {
return true;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword)) {
return this.locations.has(completedDocsRule_1.LOCATION_STATIC);
}
return this.locations.has(completedDocsRule_1.LOCATION_INSTANCE);
@@ -46,10 +46,10 @@ var ClassExclusion = /** @class */ (function (_super) {
if (this.privacies.has(completedDocsRule_1.ALL)) {
return true;
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword)) {
return this.privacies.has(completedDocsRule_1.PRIVACY_PRIVATE);
}
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword)) {
return this.privacies.has(completedDocsRule_1.PRIVACY_PROTECTED);
}
return this.privacies.has(completedDocsRule_1.PRIVACY_PUBLIC);
diff --git a/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts b/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
index aacf39d73..3148a1ee6 100644
--- a/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/exclusionFactory.d.ts
@@ -1,8 +1,25 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import { DocType } from "../completedDocsRule";
import { Exclusion } from "./exclusion";
import { IInputExclusionDescriptors } from "./exclusionDescriptors";
+export declare type ExclusionsMap = Map<DocType, Array<Exclusion<any>>>;
export declare class ExclusionFactory {
- constructExclusionsMap(ruleArguments: IInputExclusionDescriptors[]): Map<DocType, Array<Exclusion<any>>>;
- private addRequirements(exclusionsMap, descriptors);
- private createRequirementsForDocType(docType, descriptor);
+ constructExclusionsMap(ruleArguments: IInputExclusionDescriptors[]): ExclusionsMap;
+ private addRequirements;
+ private createRequirementsForDocType;
}
diff --git a/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts b/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
index d13121323..57fd0cf8d 100644
--- a/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
+++ b/node_modules/tslint/lib/rules/completed-docs/tagExclusion.d.ts
@@ -29,6 +29,6 @@ export declare class TagExclusion extends Exclusion<ITagExclusionDescriptor> {
private readonly contentTags;
private readonly existenceTags;
excludes(node: ts.Node): boolean;
- private getDocumentationNode(node);
- private parseTagsWithContents(nodeText);
+ private getDocumentationNode;
+ private parseTagsWithContents;
}
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.d.ts b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
index 67c76d562..d876d8c64 100644
--- a/node_modules/tslint/lib/rules/completedDocsRule.d.ts
+++ b/node_modules/tslint/lib/rules/completedDocsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
import { IInputExclusionDescriptors } from "./completed-docs/exclusionDescriptors";
@@ -22,7 +38,7 @@ export declare const PRIVACY_PRIVATE = "private";
export declare const PRIVACY_PROTECTED = "protected";
export declare const PRIVACY_PUBLIC = "public";
export declare const TAGS_FOR_CONTENT = "content";
-export declare const TAGS_FOR_EXISTENCE = "exists";
+export declare const TAGS_FOR_EXISTENCE = "existence";
export declare const VISIBILITY_EXPORTED = "exported";
export declare const VISIBILITY_INTERNAL = "internal";
export declare type All = typeof ALL;
@@ -35,16 +51,23 @@ export declare class Rule extends Lint.Rules.TypedRule {
static defaultArguments: IInputExclusionDescriptors;
static ARGUMENT_DESCRIPTOR_BLOCK: {
properties: {
- [x: string]: {
+ [DESCRIPTOR_TAGS]: {
properties: {
- [x: string]: {
+ [TAGS_FOR_CONTENT]: {
+ items: {
+ type: string;
+ };
+ type: string;
+ };
+ [TAGS_FOR_EXISTENCE]: {
items: {
type: string;
};
type: string;
};
};
- } | {
+ };
+ [DESCRIPTOR_VISIBILITIES]: {
enum: string[];
type: string;
};
@@ -53,16 +76,27 @@ export declare class Rule extends Lint.Rules.TypedRule {
};
static ARGUMENT_DESCRIPTOR_CLASS: {
properties: {
- [x: string]: {
+ [DESCRIPTOR_TAGS]: {
properties: {
- [x: string]: {
+ [TAGS_FOR_CONTENT]: {
+ items: {
+ type: string;
+ };
+ type: string;
+ };
+ [TAGS_FOR_EXISTENCE]: {
items: {
type: string;
};
type: string;
};
};
- } | {
+ };
+ [DESCRIPTOR_LOCATIONS]: {
+ enum: string[];
+ type: string;
+ };
+ [DESCRIPTOR_PRIVACIES]: {
enum: string[];
type: string;
};
@@ -72,5 +106,5 @@ export declare class Rule extends Lint.Rules.TypedRule {
static metadata: Lint.IRuleMetadata;
private readonly exclusionFactory;
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
- private getExclusionsMap(ruleArguments);
+ private getExclusionsMap;
}
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.js b/node_modules/tslint/lib/rules/completedDocsRule.js
index d64315563..9333c44ac 100644
--- a/node_modules/tslint/lib/rules/completedDocsRule.js
+++ b/node_modules/tslint/lib/rules/completedDocsRule.js
@@ -17,7 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
-var tsutils_1 = require("tsutils");
+var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
var ts = require("typescript");
var Lint = require("../index");
var exclusionFactory_1 = require("./completed-docs/exclusionFactory");
@@ -42,7 +42,7 @@ exports.PRIVACY_PRIVATE = "private";
exports.PRIVACY_PROTECTED = "protected";
exports.PRIVACY_PUBLIC = "public";
exports.TAGS_FOR_CONTENT = "content";
-exports.TAGS_FOR_EXISTENCE = "exists";
+exports.TAGS_FOR_EXISTENCE = "existence";
exports.VISIBILITY_EXPORTED = "exported";
exports.VISIBILITY_INTERNAL = "internal";
var Rule = /** @class */ (function (_super) {
@@ -55,9 +55,8 @@ var Rule = /** @class */ (function (_super) {
}
Rule.prototype.applyWithProgram = function (sourceFile, program) {
var options = this.getOptions();
- var completedDocsWalker = new CompletedDocsWalker(sourceFile, options, program);
- completedDocsWalker.setExclusionsMap(this.getExclusionsMap(options.ruleArguments));
- return this.applyWithWalker(completedDocsWalker);
+ var exclusionsMap = this.getExclusionsMap(options.ruleArguments);
+ return this.applyWithFunction(sourceFile, walk, exclusionsMap, program.getTypeChecker());
};
Rule.prototype.getExclusionsMap = function (ruleArguments) {
if (ruleArguments.length === 0) {
@@ -162,8 +161,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "completed-docs",
- description: "Enforces documentation for important items be filled out.",
- optionsDescription: (_k = ["\n `true` to enable for [", "]],\n or an array with each item in one of two formats:\n\n * `string` to enable for that type\n * `object` keying types to when their documentation is required:\n * `\"", "\"` and `\"", "\"` may specify:\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * Other types may specify `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * All types may also provide `\"", "\"`\n with members specifying tags that allow the docs to not have a body.\n * `\"", "\"`: Object mapping tags to `RegExp` bodies content allowed to count as complete docs.\n * `\"", "\"`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`"], _k.raw = ["\n \\`true\\` to enable for [", "]],\n or an array with each item in one of two formats:\n\n * \\`string\\` to enable for that type\n * \\`object\\` keying types to when their documentation is required:\n * \\`\"", "\"\\` and \\`\"", "\"\\` may specify:\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * Other types may specify \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * All types may also provide \\`\"", "\"\\`\n with members specifying tags that allow the docs to not have a body.\n * \\`\"", "\"\\`: Object mapping tags to \\`RegExp\\` bodies content allowed to count as complete docs.\n * \\`\"", "\"\\`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`"], Lint.Utils.dedent(_k, Object.keys(Rule.defaultArguments).join(", "), exports.ARGUMENT_METHODS, exports.ARGUMENT_PROPERTIES, exports.DESCRIPTOR_PRIVACIES, exports.ALL, exports.PRIVACY_PRIVATE, exports.PRIVACY_PROTECTED, exports.PRIVACY_PUBLIC, exports.DESCRIPTOR_LOCATIONS, exports.ALL, exports.LOCATION_INSTANCE, exports.LOCATION_STATIC, exports.DESCRIPTOR_VISIBILITIES, exports.ALL, exports.VISIBILITY_EXPORTED, exports.VISIBILITY_INTERNAL, exports.DESCRIPTOR_TAGS, exports.TAGS_FOR_CONTENT, exports.TAGS_FOR_EXISTENCE, exports.ARGUMENT_CLASSES, exports.ARGUMENT_ENUMS, exports.ARGUMENT_ENUM_MEMBERS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_INTERFACES, exports.ARGUMENT_METHODS, exports.ARGUMENT_NAMESPACES, exports.ARGUMENT_PROPERTIES, exports.ARGUMENT_TYPES, exports.ARGUMENT_VARIABLES)),
+ description: "Enforces JSDoc comments for important items be filled out.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n `true` to enable for `[", "]`,\n or an array with each item in one of two formats:\n\n * `string` to enable for that type\n * `object` keying types to when their documentation is required:\n * `\"", "\"` and `\"", "\"` may specify:\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * Other types may specify `\"", "\"`:\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * All types may also provide `\"", "\"`\n with members specifying tags that allow the docs to not have a body.\n * `\"", "\"`: Object mapping tags to `RegExp` bodies content allowed to count as complete docs.\n * `\"", "\"`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`\n * `\"", "\"`"], ["\n \\`true\\` to enable for \\`[", "]\\`,\n or an array with each item in one of two formats:\n\n * \\`string\\` to enable for that type\n * \\`object\\` keying types to when their documentation is required:\n * \\`\"", "\"\\` and \\`\"", "\"\\` may specify:\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * Other types may specify \\`\"", "\"\\`:\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * All types may also provide \\`\"", "\"\\`\n with members specifying tags that allow the docs to not have a body.\n * \\`\"", "\"\\`: Object mapping tags to \\`RegExp\\` bodies content allowed to count as complete docs.\n * \\`\"", "\"\\`: Array of tags that must only exist to count as complete docs.\n\n Types that may be enabled are:\n\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`\n * \\`\"", "\"\\`"])), Object.keys(Rule.defaultArguments).join(", "), exports.ARGUMENT_METHODS, exports.ARGUMENT_PROPERTIES, exports.DESCRIPTOR_PRIVACIES, exports.ALL, exports.PRIVACY_PRIVATE, exports.PRIVACY_PROTECTED, exports.PRIVACY_PUBLIC, exports.DESCRIPTOR_LOCATIONS, exports.ALL, exports.LOCATION_INSTANCE, exports.LOCATION_STATIC, exports.DESCRIPTOR_VISIBILITIES, exports.ALL, exports.VISIBILITY_EXPORTED, exports.VISIBILITY_INTERNAL, exports.DESCRIPTOR_TAGS, exports.TAGS_FOR_CONTENT, exports.TAGS_FOR_EXISTENCE, exports.ARGUMENT_CLASSES, exports.ARGUMENT_ENUMS, exports.ARGUMENT_ENUM_MEMBERS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_INTERFACES, exports.ARGUMENT_METHODS, exports.ARGUMENT_NAMESPACES, exports.ARGUMENT_PROPERTIES, exports.ARGUMENT_TYPES, exports.ARGUMENT_VARIABLES),
options: {
type: "array",
items: {
@@ -184,18 +183,18 @@ var Rule = /** @class */ (function (_super) {
},
{
type: "object",
- properties: (_l = {},
- _l[exports.ARGUMENT_CLASSES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_ENUMS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_ENUM_MEMBERS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_FUNCTIONS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_INTERFACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_METHODS] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
- _l[exports.ARGUMENT_NAMESPACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_PROPERTIES] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
- _l[exports.ARGUMENT_TYPES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l[exports.ARGUMENT_VARIABLES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
- _l),
+ properties: (_k = {},
+ _k[exports.ARGUMENT_CLASSES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_ENUMS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_ENUM_MEMBERS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_FUNCTIONS] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_INTERFACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_METHODS] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _k[exports.ARGUMENT_NAMESPACES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_PROPERTIES] = Rule.ARGUMENT_DESCRIPTOR_CLASS,
+ _k[exports.ARGUMENT_TYPES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k[exports.ARGUMENT_VARIABLES] = Rule.ARGUMENT_DESCRIPTOR_BLOCK,
+ _k),
},
],
},
@@ -205,24 +204,27 @@ var Rule = /** @class */ (function (_super) {
[true, exports.ARGUMENT_ENUMS, exports.ARGUMENT_FUNCTIONS, exports.ARGUMENT_METHODS],
[
true,
- (_m = {},
- _m[exports.ARGUMENT_ENUMS] = true,
- _m[exports.ARGUMENT_FUNCTIONS] = (_o = {},
- _o[exports.DESCRIPTOR_VISIBILITIES] = [exports.VISIBILITY_EXPORTED],
+ (_l = {},
+ _l[exports.ARGUMENT_ENUMS] = true,
+ _l[exports.ARGUMENT_FUNCTIONS] = (_m = {},
+ _m[exports.DESCRIPTOR_VISIBILITIES] = [exports.VISIBILITY_EXPORTED],
+ _m),
+ _l[exports.ARGUMENT_METHODS] = (_o = {},
+ _o[exports.DESCRIPTOR_LOCATIONS] = exports.LOCATION_INSTANCE,
+ _o[exports.DESCRIPTOR_PRIVACIES] = [exports.PRIVACY_PUBLIC, exports.PRIVACY_PROTECTED],
_o),
- _m[exports.ARGUMENT_METHODS] = (_p = {},
- _p[exports.DESCRIPTOR_LOCATIONS] = exports.LOCATION_INSTANCE,
- _p[exports.DESCRIPTOR_PRIVACIES] = [exports.PRIVACY_PUBLIC, exports.PRIVACY_PROTECTED],
+ _l[exports.ARGUMENT_PROPERTIES] = (_p = {},
+ _p[exports.DESCRIPTOR_TAGS] = (_q = {},
+ _q[exports.TAGS_FOR_CONTENT] = {
+ see: ["#.*"],
+ },
+ _q[exports.TAGS_FOR_EXISTENCE] = ["inheritdoc"],
+ _q),
_p),
- _m[exports.DESCRIPTOR_TAGS] = (_q = {},
- _q[exports.TAGS_FOR_CONTENT] = {
- see: ["#.*"],
- },
- _q[exports.TAGS_FOR_EXISTENCE] = ["inheritdoc"],
- _q),
- _m),
+ _l),
],
],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Helps ensure important components are documented.\n\n Note: use this rule sparingly. It's better to have self-documenting names on components with single, consice responsibilities.\n Comments that only restate the names of variables add nothing to code, and can easily become outdated.\n "], ["\n Helps ensure important components are documented.\n\n Note: use this rule sparingly. It's better to have self-documenting names on components with single, consice responsibilities.\n Comments that only restate the names of variables add nothing to code, and can easily become outdated.\n "]))),
type: "style",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -230,63 +232,72 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-var CompletedDocsWalker = /** @class */ (function (_super) {
- tslib_1.__extends(CompletedDocsWalker, _super);
- function CompletedDocsWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+var modifierAliases = {
+ export: "exported",
+};
+function walk(context, typeChecker) {
+ return ts.forEachChild(context.sourceFile, cb);
+ function cb(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.ClassDeclaration:
+ checkNode(node, exports.ARGUMENT_CLASSES);
+ break;
+ case ts.SyntaxKind.EnumDeclaration:
+ checkNode(node, exports.ARGUMENT_ENUMS);
+ for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
+ var member = _a[_i];
+ // Enum members don't have modifiers, so use the parent
+ // enum declaration when checking the requirements.
+ checkNode(member, exports.ARGUMENT_ENUM_MEMBERS, node);
+ }
+ break;
+ case ts.SyntaxKind.FunctionDeclaration:
+ checkNode(node, exports.ARGUMENT_FUNCTIONS);
+ break;
+ case ts.SyntaxKind.InterfaceDeclaration:
+ checkNode(node, exports.ARGUMENT_INTERFACES);
+ break;
+ case ts.SyntaxKind.MethodDeclaration:
+ if (node.parent.kind !== ts.SyntaxKind.ObjectLiteralExpression) {
+ checkNode(node, exports.ARGUMENT_METHODS);
+ }
+ break;
+ case ts.SyntaxKind.ModuleDeclaration:
+ checkNode(node, exports.ARGUMENT_NAMESPACES);
+ break;
+ case ts.SyntaxKind.PropertyDeclaration:
+ checkNode(node, exports.ARGUMENT_PROPERTIES);
+ break;
+ case ts.SyntaxKind.TypeAliasDeclaration:
+ checkNode(node, exports.ARGUMENT_TYPES);
+ break;
+ case ts.SyntaxKind.VariableStatement:
+ // Only check variables at the namespace/module-level or file-level
+ // and not variables declared inside functions and other things.
+ switch (node.parent.kind) {
+ case ts.SyntaxKind.SourceFile:
+ case ts.SyntaxKind.ModuleBlock:
+ for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) {
+ var declaration = _c[_b];
+ checkNode(declaration, exports.ARGUMENT_VARIABLES, node);
+ }
+ }
+ break;
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ if (node.parent.kind !== ts.SyntaxKind.ObjectLiteralExpression) {
+ checkNode(node, exports.ARGUMENT_PROPERTIES);
+ }
+ }
+ return ts.forEachChild(node, cb);
}
- CompletedDocsWalker.prototype.setExclusionsMap = function (exclusionsMap) {
- this.exclusionsMap = exclusionsMap;
- };
- CompletedDocsWalker.prototype.visitClassDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_CLASSES);
- _super.prototype.visitClassDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitEnumDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_ENUMS);
- _super.prototype.visitEnumDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitEnumMember = function (node) {
- // Enum members don't have modifiers, so use the parent
- // enum declaration when checking the requirements.
- this.checkNode(node, exports.ARGUMENT_ENUM_MEMBERS, node.parent);
- _super.prototype.visitEnumMember.call(this, node);
- };
- CompletedDocsWalker.prototype.visitFunctionDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_FUNCTIONS);
- _super.prototype.visitFunctionDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitInterfaceDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_INTERFACES);
- _super.prototype.visitInterfaceDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitMethodDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_METHODS);
- _super.prototype.visitMethodDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitModuleDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_NAMESPACES);
- _super.prototype.visitModuleDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitPropertyDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_PROPERTIES);
- _super.prototype.visitPropertyDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitTypeAliasDeclaration = function (node) {
- this.checkNode(node, exports.ARGUMENT_TYPES);
- _super.prototype.visitTypeAliasDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.visitVariableDeclaration = function (node) {
- this.checkVariable(node);
- _super.prototype.visitVariableDeclaration.call(this, node);
- };
- CompletedDocsWalker.prototype.checkNode = function (node, nodeType, requirementNode) {
+ function checkNode(node, nodeType, requirementNode) {
if (requirementNode === void 0) { requirementNode = node; }
var name = node.name;
if (name === undefined) {
return;
}
- var exclusions = this.exclusionsMap.get(nodeType);
+ var exclusions = context.options.get(nodeType);
if (exclusions === undefined) {
return;
}
@@ -296,62 +307,38 @@ var CompletedDocsWalker = /** @class */ (function (_super) {
return;
}
}
- var symbol = this.getTypeChecker().getSymbolAtLocation(name);
+ var symbol = typeChecker.getSymbolAtLocation(name);
if (symbol === undefined) {
return;
}
- var comments = symbol.getDocumentationComment();
- this.checkComments(node, this.describeNode(nodeType), comments, requirementNode);
- };
- CompletedDocsWalker.prototype.checkVariable = function (node) {
- // Only check variables in variable declaration lists
- // and not variables in catch clauses and for loops.
- var list = node.parent;
- if (!tsutils_1.isVariableDeclarationList(list)) {
- return;
- }
- var statement = list.parent;
- if (!tsutils_1.isVariableStatement(statement)) {
- return;
- }
- // Only check variables at the namespace/module-level or file-level
- // and not variables declared inside functions and other things.
- switch (statement.parent.kind) {
- case ts.SyntaxKind.SourceFile:
- case ts.SyntaxKind.ModuleBlock:
- this.checkNode(node, exports.ARGUMENT_VARIABLES, statement);
- }
- };
- CompletedDocsWalker.prototype.checkComments = function (node, nodeDescriptor, comments, requirementNode) {
+ var comments = symbol.getDocumentationComment(typeChecker);
+ checkComments(node, describeNode(nodeType), comments, requirementNode);
+ }
+ function checkComments(node, nodeDescriptor, comments, requirementNode) {
if (comments.map(function (comment) { return comment.text; }).join("").trim() === "") {
- this.addDocumentationFailure(node, nodeDescriptor, requirementNode);
+ addDocumentationFailure(node, nodeDescriptor, requirementNode);
}
- };
- CompletedDocsWalker.prototype.addDocumentationFailure = function (node, nodeType, requirementNode) {
+ }
+ function addDocumentationFailure(node, nodeType, requirementNode) {
var start = node.getStart();
var width = node.getText().split(/\r|\n/g)[0].length;
- var description = this.describeDocumentationFailure(requirementNode, nodeType);
- this.addFailureAt(start, width, description);
- };
- CompletedDocsWalker.prototype.describeDocumentationFailure = function (node, nodeType) {
- var _this = this;
- var description = Rule.FAILURE_STRING_EXIST;
- if (node.modifiers !== undefined) {
- description += node.modifiers.map(function (modifier) { return _this.describeModifier(modifier.kind); }).join(",") + " ";
- }
- return "" + description + nodeType + ".";
- };
- CompletedDocsWalker.prototype.describeModifier = function (kind) {
- var description = ts.SyntaxKind[kind].toLowerCase().split("keyword")[0];
- var alias = CompletedDocsWalker.modifierAliases[description];
- return alias !== undefined ? alias : description;
- };
- CompletedDocsWalker.prototype.describeNode = function (nodeType) {
- return nodeType.replace("-", " ");
- };
- CompletedDocsWalker.modifierAliases = {
- export: "exported",
- };
- return CompletedDocsWalker;
-}(Lint.ProgramAwareRuleWalker));
-var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
+ var description = describeDocumentationFailure(requirementNode, nodeType);
+ context.addFailureAt(start, width, description);
+ }
+}
+function describeDocumentationFailure(node, nodeType) {
+ var description = Rule.FAILURE_STRING_EXIST;
+ if (node.modifiers !== undefined) {
+ description += node.modifiers.map(function (modifier) { return describeModifier(modifier.kind); }).join(" ") + " ";
+ }
+ return "" + description + nodeType + ".";
+}
+function describeModifier(kind) {
+ var description = ts.SyntaxKind[kind].toLowerCase().split("keyword")[0];
+ var alias = modifierAliases[description];
+ return alias !== undefined ? alias : description;
+}
+function describeNode(nodeType) {
+ return nodeType.replace("-", " ");
+}
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/curlyRule.d.ts b/node_modules/tslint/lib/rules/curlyRule.d.ts
index 929f3f551..13fc07684 100644
--- a/node_modules/tslint/lib/rules/curlyRule.d.ts
+++ b/node_modules/tslint/lib/rules/curlyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/curlyRule.js b/node_modules/tslint/lib/rules/curlyRule.js
index 906201a12..c6421dd83 100644
--- a/node_modules/tslint/lib/rules/curlyRule.js
+++ b/node_modules/tslint/lib/rules/curlyRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var curly_examples_1 = require("./code-examples/curly.examples");
var OPTION_AS_NEEDED = "as-needed";
var OPTION_IGNORE_SAME_LINE = "ignore-same-line";
var Rule = /** @class */ (function (_super) {
@@ -42,8 +43,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "curly",
description: "Enforces braces for `if`/`for`/`do`/`while` statements.",
- rationale: (_a = ["\n ```ts\n if (foo === bar)\n foo++;\n bar++;\n ```\n\n In the code above, the author almost certainly meant for both `foo++` and `bar++`\n to be executed only if `foo === bar`. However, he forgot braces and `bar++` will be executed\n no matter what. This rule could prevent such a mistake."], _a.raw = ["\n \\`\\`\\`ts\n if (foo === bar)\n foo++;\n bar++;\n \\`\\`\\`\n\n In the code above, the author almost certainly meant for both \\`foo++\\` and \\`bar++\\`\n to be executed only if \\`foo === bar\\`. However, he forgot braces and \\`bar++\\` will be executed\n no matter what. This rule could prevent such a mistake."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One of the following options may be provided:\n\n * `\"", "\"` forbids any unnecessary curly braces.\n * `\"", "\"` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], _b.raw = ["\n One of the following options may be provided:\n\n * \\`\"", "\"\\` forbids any unnecessary curly braces.\n * \\`\"", "\"\\` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], Lint.Utils.dedent(_b, OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ```ts\n if (foo === bar)\n foo++;\n bar++;\n ```\n\n In the code above, the author almost certainly meant for both `foo++` and `bar++`\n to be executed only if `foo === bar`. However, they forgot braces and `bar++` will be executed\n no matter what. This rule could prevent such a mistake."], ["\n \\`\\`\\`ts\n if (foo === bar)\n foo++;\n bar++;\n \\`\\`\\`\n\n In the code above, the author almost certainly meant for both \\`foo++\\` and \\`bar++\\`\n to be executed only if \\`foo === bar\\`. However, they forgot braces and \\`bar++\\` will be executed\n no matter what. This rule could prevent such a mistake."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One of the following options may be provided:\n\n * `\"", "\"` forbids any unnecessary curly braces.\n * `\"", "\"` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "], ["\n One of the following options may be provided:\n\n * \\`\"", "\"\\` forbids any unnecessary curly braces.\n * \\`\"", "\"\\` skips checking braces for control-flow statements\n that are on one line and start on the same line as their control-flow keyword\n "])), OPTION_AS_NEEDED, OPTION_IGNORE_SAME_LINE),
options: {
type: "array",
items: {
@@ -62,6 +63,7 @@ var Rule = /** @class */ (function (_super) {
type: "functionality",
typescriptOnly: false,
hasFix: true,
+ codeExamples: curly_examples_1.codeExamples,
};
/* tslint:enable:object-literal-sort-keys */
Rule.FAILURE_STRING_AS_NEEDED = "Block contains only one statement; remove the curly braces.";
@@ -71,7 +73,7 @@ exports.Rule = Rule;
function walkAsNeeded(ctx) {
ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isBlock(node) && isBlockUnnecessary(node)) {
- ctx.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.OpenBraceToken), Rule.FAILURE_STRING_AS_NEEDED);
+ ctx.addFailureAt(node.statements.pos - 1, 1, Rule.FAILURE_STRING_AS_NEEDED);
}
ts.forEachChild(node, cb);
});
@@ -133,8 +135,8 @@ var CurlyWalker = /** @class */ (function (_super) {
CurlyWalker.prototype.createMissingBraceFix = function (statement, node, sameLine) {
if (sameLine) {
return [
- Lint.Replacement.appendText(statement.getStart(), "{ "),
- Lint.Replacement.appendText(statement.getEnd(), " }"),
+ Lint.Replacement.appendText(statement.pos, " {"),
+ Lint.Replacement.appendText(statement.end, " }"),
];
}
else {
@@ -145,11 +147,11 @@ var CurlyWalker = /** @class */ (function (_super) {
match[1].repeat(ts.getLineAndCharacterOfPosition(this.sourceFile, node.getStart(this.sourceFile)).character);
var maybeCarriageReturn = this.sourceFile.text[this.sourceFile.getLineEndOfPosition(node.pos) - 1] === "\r" ? "\r" : "";
return [
- Lint.Replacement.appendText(this.sourceFile.getLineEndOfPosition(statement.pos), " {"),
- Lint.Replacement.appendText(statement.getEnd(), maybeCarriageReturn + "\n" + indentation + "}"),
+ Lint.Replacement.appendText(statement.pos, " {"),
+ Lint.Replacement.appendText(statement.end, maybeCarriageReturn + "\n" + indentation + "}"),
];
}
};
return CurlyWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
index 25f7d9696..9ca72563a 100644
--- a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
index 91d6f9ead..80a665f47 100644
--- a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
@@ -54,9 +54,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "cyclomatic-complexity",
description: "Enforces a threshold of cyclomatic complexity.",
- descriptionDetails: (_a = ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * `catch`\n * `if` and `? :`\n * `||` and `&&` due to short-circuit evaluation\n * `for`, `for in` and `for of` loops\n * `while` and `do while` loops\n * `case` clauses that contain statements"], _a.raw = ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * \\`catch\\`\n * \\`if\\` and \\`? :\\`\n * \\`||\\` and \\`&&\\` due to short-circuit evaluation\n * \\`for\\`, \\`for in\\` and \\`for of\\` loops\n * \\`while\\` and \\`do while\\` loops\n * \\`case\\` clauses that contain statements"], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify."], _b.raw = ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], _c.raw = ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], Lint.Utils.dedent(_c, Rule.DEFAULT_THRESHOLD)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * `catch`\n * `if` and `? :`\n * `||` and `&&` due to short-circuit evaluation\n * `for`, `for in` and `for of` loops\n * `while` and `do while` loops\n * `case` clauses that contain statements"], ["\n Cyclomatic complexity is assessed for each function of any type. A starting value of 0\n is assigned and this value is then incremented for every statement which can branch the\n control flow within the function. The following statements and expressions contribute\n to cyclomatic complexity:\n * \\`catch\\`\n * \\`if\\` and \\`? :\\`\n * \\`||\\` and \\`&&\\` due to short-circuit evaluation\n * \\`for\\`, \\`for in\\` and \\`for of\\` loops\n * \\`while\\` and \\`do while\\` loops\n * \\`case\\` clauses that contain statements"]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify.\n\n It's better to have smaller, single-purpose functions with self-documenting names."], ["\n Cyclomatic complexity is a code metric which indicates the level of complexity in a\n function. High cyclomatic complexity indicates confusing code which may be prone to\n errors or difficult to modify.\n\n It's better to have smaller, single-purpose functions with self-documenting names."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."], ["\n An optional upper limit for cyclomatic complexity can be specified. If no limit option\n is provided a default value of ", " will be used."])), Rule.DEFAULT_THRESHOLD),
options: {
type: "number",
minimum: Rule.MINIMUM_THRESHOLD,
@@ -116,4 +116,4 @@ function increasesComplexity(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/deprecationRule.d.ts b/node_modules/tslint/lib/rules/deprecationRule.d.ts
index 790b1c9e9..cf627b138 100644
--- a/node_modules/tslint/lib/rules/deprecationRule.d.ts
+++ b/node_modules/tslint/lib/rules/deprecationRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/deprecationRule.js b/node_modules/tslint/lib/rules/deprecationRule.js
index bcd8a7da4..619783700 100644
--- a/node_modules/tslint/lib/rules/deprecationRule.js
+++ b/node_modules/tslint/lib/rules/deprecationRule.js
@@ -36,11 +36,11 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "deprecation",
description: "Warns when deprecated APIs are used.",
- descriptionDetails: (_a = ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], _a.raw = ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"], ["Any usage of an identifier\n with the @deprecated JSDoc annotation will trigger a warning.\n See http://usejsdoc.org/tags-deprecated.html"]))),
rationale: "Deprecated APIs should be avoided, and usage updated.",
optionsDescription: "",
options: null,
- optionExamples: [],
+ optionExamples: [true],
type: "maintainability",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -137,7 +137,7 @@ function getDeprecation(node, tc) {
else {
symbol = tc.getSymbolAtLocation(node);
}
- if (symbol !== undefined && Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ if (symbol !== undefined && tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
symbol = tc.getAliasedSymbol(symbol);
}
if (symbol === undefined ||
@@ -152,7 +152,7 @@ function findDeprecationTag(tags) {
for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) {
var tag = tags_1[_i];
if (tag.name === "deprecated") {
- return tag.text;
+ return tag.text === undefined ? "" : tag.text;
}
}
return undefined;
@@ -226,4 +226,4 @@ function isFunctionOrMethod(declarations) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/encodingRule.d.ts b/node_modules/tslint/lib/rules/encodingRule.d.ts
index ad81e932d..e45243ff0 100644
--- a/node_modules/tslint/lib/rules/encodingRule.d.ts
+++ b/node_modules/tslint/lib/rules/encodingRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
import { Encoding } from "../utils";
diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js
index 156d157a0..3fcd46590 100644
--- a/node_modules/tslint/lib/rules/encodingRule.js
+++ b/node_modules/tslint/lib/rules/encodingRule.js
@@ -66,7 +66,7 @@ function showEncoding(encoding) {
function detectEncoding(fileName) {
var fd = fs.openSync(fileName, "r");
var maxBytesRead = 3; // Only need 3 bytes to detect the encoding.
- var buffer = new Buffer(maxBytesRead);
+ var buffer = Buffer.allocUnsafe(maxBytesRead);
var bytesRead = fs.readSync(fd, buffer, /*offset*/ 0, /*length*/ maxBytesRead, /*position*/ 0);
fs.closeSync(fd);
return utils_1.detectBufferEncoding(buffer, bytesRead);
diff --git a/node_modules/tslint/lib/rules/eoflineRule.js b/node_modules/tslint/lib/rules/eoflineRule.js
index 631b5fc28..a235ef7f2 100644
--- a/node_modules/tslint/lib/rules/eoflineRule.js
+++ b/node_modules/tslint/lib/rules/eoflineRule.js
@@ -41,7 +41,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "eofline",
description: "Ensures the file ends with a newline.",
descriptionDetails: "Fix for single-line files is not supported.",
- rationale: "It is a [standard convention](http://stackoverflow.com/q/729692/3124288) to end files with a newline.",
+ rationale: "It is a [standard convention](https://stackoverflow.com/q/729692/3124288) to end files with a newline.",
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.d.ts b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
index bd1fcddd6..e4cf6ec2c 100644
--- a/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.d.ts
@@ -20,4 +20,5 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING: string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ private createComment;
}
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.js b/node_modules/tslint/lib/rules/fileHeaderRule.js
index 91d505d53..eca48adc5 100644
--- a/node_modules/tslint/lib/rules/fileHeaderRule.js
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.js
@@ -26,27 +26,58 @@ var Rule = /** @class */ (function (_super) {
}
Rule.prototype.apply = function (sourceFile) {
var text = sourceFile.text;
+ var headerFormat = new RegExp(this.ruleArguments[0]);
+ var textToInsert = this.ruleArguments[1];
// ignore shebang if it exists
var offset = text.startsWith("#!") ? text.indexOf("\n") : 0;
// returns the text of the first comment or undefined
var commentText = ts.forEachLeadingCommentRange(text, offset, function (pos, end, kind) { return text.substring(pos + 2, kind === ts.SyntaxKind.SingleLineCommentTrivia ? end : end - 2); });
- if (commentText === undefined || !new RegExp(this.ruleArguments[0]).test(commentText)) {
- if (offset !== 0) {
+ if (commentText === undefined || !headerFormat.test(commentText)) {
+ var isErrorAtStart = offset === 0;
+ if (!isErrorAtStart) {
++offset; // show warning in next line after shebang
}
- return [new Lint.RuleFailure(sourceFile, offset, offset, Rule.FAILURE_STRING, this.ruleName)];
+ var leadingNewlines = isErrorAtStart ? 0 : 1;
+ var trailingNewlines = isErrorAtStart ? 2 : 1;
+ var fix = textToInsert !== undefined
+ ? Lint.Replacement.appendText(offset, this.createComment(sourceFile, textToInsert, leadingNewlines, trailingNewlines))
+ : undefined;
+ return [new Lint.RuleFailure(sourceFile, offset, offset, Rule.FAILURE_STRING, this.ruleName, fix)];
}
return [];
};
+ Rule.prototype.createComment = function (sourceFile, commentText, leadingNewlines, trailingNewlines) {
+ if (leadingNewlines === void 0) { leadingNewlines = 1; }
+ if (trailingNewlines === void 0) { trailingNewlines = 1; }
+ var maybeCarriageReturn = sourceFile.text[sourceFile.getLineEndOfPosition(0)] === "\r" ? "\r" : "";
+ var lineEnding = maybeCarriageReturn + "\n";
+ return lineEnding.repeat(leadingNewlines) + [
+ "/*!"
+ ].concat(commentText.split(/\r?\n/g).map(function (line) { return (" * " + line).replace(/\s+$/, ""); }), [
+ " */",
+ ]).join(lineEnding) + lineEnding.repeat(trailingNewlines);
+ };
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "file-header",
description: "Enforces a certain header comment for all files, matched by a regular expression.",
- optionsDescription: "Regular expression to match the header.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The first option, which is mandatory, is a regular expression that all headers should match.\n The second argument, which is optional, is a string that should be inserted as a header comment\n if fixing is enabled and no header that matches the first argument is found."], ["\n The first option, which is mandatory, is a regular expression that all headers should match.\n The second argument, which is optional, is a string that should be inserted as a header comment\n if fixing is enabled and no header that matches the first argument is found."]))),
options: {
- type: "string",
+ type: "array",
+ items: [
+ {
+ type: "string",
+ },
+ {
+ type: "string",
+ },
+ ],
+ additionalItems: false,
+ minLength: 1,
+ maxLength: 2,
},
- optionExamples: [[true, "Copyright \\d{4}"]],
+ optionExamples: [[true, "Copyright \\d{4}", "Copyright 2017"]],
+ hasFix: true,
type: "style",
typescriptOnly: false,
};
@@ -55,3 +86,4 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/forinRule.d.ts b/node_modules/tslint/lib/rules/forinRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/forinRule.d.ts
+++ b/node_modules/tslint/lib/rules/forinRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/forinRule.js b/node_modules/tslint/lib/rules/forinRule.js
index 23cbddc86..dfeab4b10 100644
--- a/node_modules/tslint/lib/rules/forinRule.js
+++ b/node_modules/tslint/lib/rules/forinRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "forin",
description: "Requires a `for ... in` statement to be filtered with an `if` statement.",
- rationale: (_a = ["\n ```ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n ```\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's `for...in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about `for...in` loops."], _a.raw = ["\n \\`\\`\\`ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n \\`\\`\\`\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's \\`for...in\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about \\`for...in\\` loops."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ```ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n ```\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's `for...in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about `for...in` loops.\n\n Also consider using a [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n or [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\n if you're storing collections of objects.\n Using `Object`s can cause occasional edge case bugs, such as if a key is named \"hasOwnProperty\".\n "], ["\n \\`\\`\\`ts\n for (let key in someObject) {\n if (someObject.hasOwnProperty(key)) {\n // code here\n }\n }\n \\`\\`\\`\n Prevents accidental iteration over properties inherited from an object's prototype.\n See [MDN's \\`for...in\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)\n documentation for more information about \\`for...in\\` loops.\n\n Also consider using a [\\`Map\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n or [\\`Set\\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\n if you're storing collections of objects.\n Using \\`Object\\`s can cause occasional edge case bugs, such as if a key is named \"hasOwnProperty\".\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -65,4 +65,4 @@ function nodeIsContinue(node) {
return node.kind === ts.SyntaxKind.ContinueStatement ||
tsutils_1.isBlock(node) && node.statements.length === 1 && node.statements[0].kind === ts.SyntaxKind.ContinueStatement;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.d.ts b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
index 93cc48a7d..5c64ffe7a 100644
--- a/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.js b/node_modules/tslint/lib/rules/importBlacklistRule.js
index c79242cfa..eb1dce21f 100644
--- a/node_modules/tslint/lib/rules/importBlacklistRule.js
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.js
@@ -33,8 +33,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "import-blacklist",
- description: (_a = ["\n Disallows importing the specified modules directly via `import` and `require`.\n Instead only sub modules may be imported from that module."], _a.raw = ["\n Disallows importing the specified modules directly via \\`import\\` and \\`require\\`.\n Instead only sub modules may be imported from that module."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], _b.raw = ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing the specified modules directly via `import` and `require`.\n Instead only sub modules may be imported from that module."], ["\n Disallows importing the specified modules directly via \\`import\\` and \\`require\\`.\n Instead only sub modules may be imported from that module."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."], ["\n Some libraries allow importing their submodules instead of the entire module.\n This is good practise as it avoids loading unused modules."]))),
optionsDescription: "A list of blacklisted modules.",
options: {
type: "array",
@@ -52,11 +52,11 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
if (ctx.options.indexOf(name.text) !== -1) {
ctx.addFailure(name.getStart(ctx.sourceFile) + 1, name.end - 1, Rule.FAILURE_STRING);
}
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.d.ts b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
index ffc41c23b..b1e1f6d7b 100644
--- a/node_modules/tslint/lib/rules/importSpacingRule.d.ts
+++ b/node_modules/tslint/lib/rules/importSpacingRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.js b/node_modules/tslint/lib/rules/importSpacingRule.js
index 14ed83607..51304ba3a 100644
--- a/node_modules/tslint/lib/rules/importSpacingRule.js
+++ b/node_modules/tslint/lib/rules/importSpacingRule.js
@@ -130,7 +130,7 @@ var Walker = /** @class */ (function (_super) {
this.addFailure(nodeStart, moduleSpecifierStart, Rule.TOO_MANY_SPACES_AFTER_IMPORT);
}
else if (nodeStart + "import".length === moduleSpecifierStart) {
- this.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.ImportKeyword), Rule.ADD_SPACE_AFTER_IMPORT);
+ this.addFailureAtNode(tsutils_1.getChildOfKind(node, ts.SyntaxKind.ImportKeyword, this.sourceFile), Rule.ADD_SPACE_AFTER_IMPORT);
}
if (LINE_BREAK_REGEX.test(node.getText())) {
this.addFailureAtNode(node, Rule.NO_LINE_BREAKS);
diff --git a/node_modules/tslint/lib/rules/indentRule.d.ts b/node_modules/tslint/lib/rules/indentRule.d.ts
index 49096c1b4..1355845f9 100644
--- a/node_modules/tslint/lib/rules/indentRule.d.ts
+++ b/node_modules/tslint/lib/rules/indentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/indentRule.js b/node_modules/tslint/lib/rules/indentRule.js
index 599ec98c3..13ebe62ad 100644
--- a/node_modules/tslint/lib/rules/indentRule.js
+++ b/node_modules/tslint/lib/rules/indentRule.js
@@ -41,8 +41,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "indent",
description: "Enforces indentation with tabs or spaces.",
- rationale: (_a = ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], _a.raw = ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One of the following arguments must be provided:\n\n * `", "` enforces consistent spaces.\n * `", "` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * `", "` enforces 2 space indentation.\n * `", "` enforces 4 space indentation.\n\n Indentation size is required for auto-fixing, but not for rule checking.\n "], _b.raw = ["\n One of the following arguments must be provided:\n\n * \\`", "\\` enforces consistent spaces.\n * \\`", "\\` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * \\`", "\\` enforces 2 space indentation.\n * \\`", "\\` enforces 4 space indentation.\n\n Indentation size is required for auto-fixing, but not for rule checking.\n "], Lint.Utils.dedent(_b, OPTION_USE_SPACES, OPTION_USE_TABS, OPTION_INDENT_SIZE_2.toString(), OPTION_INDENT_SIZE_4.toString())),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `", "` enforces consistent spaces.\n * `", "` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * `", "` enforces 2 space indentation.\n * `", "` enforces 4 space indentation.\n\n Indentation size is **required** for auto-fixing, but not for rule checking.\n\n **NOTE**: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.\n "], ["\n One of the following arguments must be provided:\n\n * \\`", "\\` enforces consistent spaces.\n * \\`", "\\` enforces consistent tabs.\n\n A second optional argument specifies indentation size:\n\n * \\`", "\\` enforces 2 space indentation.\n * \\`", "\\` enforces 4 space indentation.\n\n Indentation size is **required** for auto-fixing, but not for rule checking.\n\n **NOTE**: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.\n "])), OPTION_USE_SPACES, OPTION_USE_TABS, OPTION_INDENT_SIZE_2.toString(), OPTION_INDENT_SIZE_4.toString()),
options: {
type: "array",
items: [
@@ -63,6 +63,7 @@ var Rule = /** @class */ (function (_super) {
[true, OPTION_USE_SPACES, OPTION_INDENT_SIZE_4],
[true, OPTION_USE_TABS, OPTION_INDENT_SIZE_2],
],
+ hasFix: true,
type: "maintainability",
typescriptOnly: false,
};
@@ -114,6 +115,7 @@ function createFix(lineStart, fullLeadingWhitespace, tabs, size) {
return undefined;
}
var replaceRegExp = tabs
+ // we want to find every group of `size` spaces, plus up to one 'incomplete' group
? new RegExp("^( {" + size + "})+( {1," + (size - 1) + "})?", "g")
: /\t/g;
var replacement = fullLeadingWhitespace.replace(replaceRegExp, function (match) {
@@ -121,4 +123,4 @@ function createFix(lineStart, fullLeadingWhitespace, tabs, size) {
});
return new Lint.Replacement(lineStart, fullLeadingWhitespace.length, replacement);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.d.ts b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
index 4e719997a..382e0ae01 100644
--- a/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.js b/node_modules/tslint/lib/rules/interfaceNameRule.js
index fe9958d0f..2255d3bf5 100644
--- a/node_modules/tslint/lib/rules/interfaceNameRule.js
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "interface-name",
description: "Requires interface names to begin with a capital 'I'",
rationale: "Makes it easy to differentiate interfaces from regular classes at a glance.",
- optionsDescription: (_a = ["\n One of the following two options must be provided:\n\n * `\"", "\"` requires interface names to start with an \"I\"\n * `\"", "\"` requires interface names to not have an \"I\" prefix"], _a.raw = ["\n One of the following two options must be provided:\n\n * \\`\"", "\"\\` requires interface names to start with an \"I\"\n * \\`\"", "\"\\` requires interface names to not have an \"I\" prefix"], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following two options must be provided:\n\n * `\"", "\"` requires interface names to start with an \"I\"\n * `\"", "\"` requires interface names to not have an \"I\" prefix"], ["\n One of the following two options must be provided:\n\n * \\`\"", "\"\\` requires interface names to start with an \"I\"\n * \\`\"", "\"\\` requires interface names to not have an \"I\" prefix"])), OPTION_ALWAYS, OPTION_NEVER),
options: {
type: "string",
enum: [OPTION_ALWAYS, OPTION_NEVER],
@@ -72,4 +72,4 @@ function hasPrefixI(name) {
// Allow IndexedDB interfaces
return name.length >= 2 && name[0] === "I" && utils_1.isUpperCase(name[1]) && !name.startsWith("IDB");
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
+++ b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
index 3bc191dae..e7f2a30fd 100644
--- a/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.js b/node_modules/tslint/lib/rules/jsdocFormatRule.js
index b75550a6d..e484d4d81 100644
--- a/node_modules/tslint/lib/rules/jsdocFormatRule.js
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.js
@@ -35,9 +35,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "jsdoc-format",
description: "Enforces basic format rules for JSDoc comments.",
- descriptionDetails: (_a = ["\n The following rules are enforced for JSDoc comments (comments starting with `/**`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with `/** ` and end with `*/`\n * multiline comments don't allow text after `/** ` in the first line (with option `\"", "\"`)\n "], _a.raw = ["\n The following rules are enforced for JSDoc comments (comments starting with \\`/**\\`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with \\`/** \\` and end with \\`*/\\`\n * multiline comments don't allow text after \\`/** \\` in the first line (with option \\`\"", "\"\\`)\n "], Lint.Utils.dedent(_a, OPTION_CHECK_MULTILINE_START)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The following rules are enforced for JSDoc comments (comments starting with `/**`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with `/** ` and end with `*/`\n * multiline comments don't allow text after `/** ` in the first line (with option `\"", "\"`)\n "], ["\n The following rules are enforced for JSDoc comments (comments starting with \\`/**\\`):\n\n * each line contains an asterisk and asterisks must be aligned\n * each asterisk must be followed by either a space or a newline (except for the first and the last)\n * the only characters before the asterisk on each line must be whitespace characters\n * one line comments must start with \\`/** \\` and end with \\`*/\\`\n * multiline comments don't allow text after \\`/** \\` in the first line (with option \\`\"", "\"\\`)\n "])), OPTION_CHECK_MULTILINE_START),
rationale: "Helps maintain a consistent, readable style for JSDoc comments.",
- optionsDescription: (_b = ["\n You can optionally specify the option `\"", "\"` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], _b.raw = ["\n You can optionally specify the option \\`\"", "\"\\` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], Lint.Utils.dedent(_b, OPTION_CHECK_MULTILINE_START)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You can optionally specify the option `\"", "\"` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "], ["\n You can optionally specify the option \\`\"", "\"\\` to enforce the first line of a\n multiline JSDoc comment to be empty.\n "])), OPTION_CHECK_MULTILINE_START),
options: {
type: "array",
minItems: 0,
@@ -108,4 +108,4 @@ function getAlignColumn(sourceFile, pos) {
? result.character - 1
: result.character;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.d.ts b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/labelPositionRule.d.ts
+++ b/node_modules/tslint/lib/rules/labelPositionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.js b/node_modules/tslint/lib/rules/labelPositionRule.js
index 165e6efd8..ae8fdb6b6 100644
--- a/node_modules/tslint/lib/rules/labelPositionRule.js
+++ b/node_modules/tslint/lib/rules/labelPositionRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "label-position",
description: "Only allows labels in sensible locations.",
descriptionDetails: "This rule only allows labels to be on `do/for/while/switch` statements.",
- rationale: (_a = ["\n Labels in JavaScript only can be used in conjunction with `break` or `continue`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], _a.raw = ["\n Labels in JavaScript only can be used in conjunction with \\`break\\` or \\`continue\\`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Labels in JavaScript only can be used in conjunction with `break` or `continue`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."], ["\n Labels in JavaScript only can be used in conjunction with \\`break\\` or \\`continue\\`,\n constructs meant to be used for loop flow control. While you can theoretically use\n labels on any block statement in JS, it is considered poor code structure to do so."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -66,4 +66,4 @@ function isLabelable(node) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/linebreakStyleRule.js b/node_modules/tslint/lib/rules/linebreakStyleRule.js
index bbbfb24aa..c32179dc8 100644
--- a/node_modules/tslint/lib/rules/linebreakStyleRule.js
+++ b/node_modules/tslint/lib/rules/linebreakStyleRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "linebreak-style",
description: "Enforces a consistent linebreak style.",
- optionsDescription: (_a = ["\n One of the following options must be provided:\n\n * `\"", "\"` requires LF (`\\n`) linebreaks\n * `\"", "\"` requires CRLF (`\\r\\n`) linebreaks"], _a.raw = ["\n One of the following options must be provided:\n\n * \\`\"", "\"\\` requires LF (\\`\\\\n\\`) linebreaks\n * \\`\"", "\"\\` requires CRLF (\\`\\\\r\\\\n\\`) linebreaks"], Lint.Utils.dedent(_a, OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following options must be provided:\n\n * `\"", "\"` requires LF (`\\n`) linebreaks\n * `\"", "\"` requires CRLF (`\\r\\n`) linebreaks"], ["\n One of the following options must be provided:\n\n * \\`\"", "\"\\` requires LF (\\`\\\\n\\`) linebreaks\n * \\`\"", "\"\\` requires CRLF (\\`\\\\r\\\\n\\`) linebreaks"])), OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF),
options: {
type: "string",
enum: [OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF],
@@ -64,4 +64,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
index b4f5e6391..d1a2e58b3 100644
--- a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
index f7df853f4..050a512b3 100644
--- a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "match-default-export-name",
- description: (_a = ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], _a.raw = ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."], ["\n Requires that a default import have the same name as the declaration it imports.\n Does nothing for anonymous default exports."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -55,7 +55,7 @@ function walk(ctx, tc) {
}
var defaultImport = statement.importClause.name;
var symbol = tc.getSymbolAtLocation(defaultImport);
- if (symbol === undefined || !Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ if (symbol === undefined || !tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
continue;
}
var declarations = tc.getAliasedSymbol(symbol).declarations;
@@ -67,4 +67,4 @@ function walk(ctx, tc) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
index 18e914536..c698645cf 100644
--- a/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
index 74092147c..36963d30c 100644
--- a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
@@ -42,9 +42,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "max-classes-per-file",
- description: (_a = ["\n A file may not contain more than the specified number of classes"], _a.raw = ["\n A file may not contain more than the specified number of classes"], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], _b.raw = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument `\"exclude-class-expressions\"` can be provided to exclude class expressions\n from the overall class count."], _c.raw = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument \\`\"exclude-class-expressions\"\\` can be provided to exclude class expressions\n from the overall class count."], Lint.Utils.dedent(_c)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A file may not contain more than the specified number of classes"], ["\n A file may not contain more than the specified number of classes"]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument `\"exclude-class-expressions\"` can be provided to exclude class expressions\n from the overall class count."], ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a\n file. An optional argument \\`\"exclude-class-expressions\"\\` can be provided to exclude class expressions\n from the overall class count."]))),
options: {
type: "array",
items: [
@@ -81,4 +81,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/maxFileLineCountRule.js b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
index 98a98cbb0..6bd801d8c 100644
--- a/node_modules/tslint/lib/rules/maxFileLineCountRule.js
+++ b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
@@ -44,7 +44,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "max-file-line-count",
description: "Requires files to remain under a certain number of lines",
- rationale: (_a = ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], _a.raw = ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."], ["\n Limiting the number of lines allowed in a file allows files to remain small,\n single purpose, and maintainable."]))),
optionsDescription: "An integer indicating the maximum number of lines.",
options: {
type: "number",
@@ -57,4 +57,4 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
index 476a48d7f..15227fef4 100644
--- a/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -5,4 +21,5 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING_FACTORY(lineLimit: number): string;
isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+ private getRuleOptions;
}
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.js b/node_modules/tslint/lib/rules/maxLineLengthRule.js
index b6b1ebfca..465efcbed 100644
--- a/node_modules/tslint/lib/rules/maxLineLengthRule.js
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.js
@@ -29,22 +29,57 @@ var Rule = /** @class */ (function (_super) {
return "Exceeds maximum line length of " + lineLimit;
};
Rule.prototype.isEnabled = function () {
- return _super.prototype.isEnabled.call(this) && this.ruleArguments[0] > 0;
+ var limit = this.getRuleOptions().limit;
+ return _super.prototype.isEnabled.call(this) && (limit > 0);
};
Rule.prototype.apply = function (sourceFile) {
- return this.applyWithFunction(sourceFile, walk, this.ruleArguments[0]);
+ return this.applyWithFunction(sourceFile, walk, this.getRuleOptions());
+ };
+ Rule.prototype.getRuleOptions = function () {
+ var argument = this.ruleArguments[0];
+ var options = { limit: 0 };
+ if (typeof argument === "number") {
+ options.limit = argument;
+ }
+ else {
+ options = argument;
+ var ignorePattern = argument["ignore-pattern"];
+ options.ignorePattern = (typeof ignorePattern === "string") ?
+ new RegExp((ignorePattern)) : undefined;
+ }
+ options.limit = Number(options.limit); // user can pass a string instead of number
+ return options;
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "max-line-length",
description: "Requires lines to be under a certain max length.",
- rationale: (_a = ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], _a.raw = ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], Lint.Utils.dedent(_a)),
- optionsDescription: "An integer indicating the max length of lines.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."], ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It can take one argument, which can be any of the following:\n * integer indicating maximum length of lines.\n * object with keys:\n * `limit` - number < 0 defining max line length\n * `ignore-pattern` - string defining ignore pattern for this rule, being parsed by `new RegExp()`.\n For example:\n * `// ` pattern will ignore all in-line comments.\n * `^import ` pattern will ignore all import statements.\n * `^export {(.*?)}` pattern will ignore all multiple export statements.\n * `class [a-zA-Z]+ implements ` pattern will ignore all class declarations implementing interfaces.\n * `^import |^export {(.*?)}|class [a-zA-Z]+ implements |// ` pattern will ignore all the cases listed above.\n "], ["\n It can take one argument, which can be any of the following:\n * integer indicating maximum length of lines.\n * object with keys:\n * \\`limit\\` - number < 0 defining max line length\n * \\`ignore-pattern\\` - string defining ignore pattern for this rule, being parsed by \\`new RegExp()\\`.\n For example:\n * \\`\\/\\/ \\` pattern will ignore all in-line comments.\n * \\`^import \\` pattern will ignore all import statements.\n * \\`^export \\{(.*?)\\}\\` pattern will ignore all multiple export statements.\n * \\`class [a-zA-Z]+ implements \\` pattern will ignore all class declarations implementing interfaces.\n * \\`^import |^export \\{(.*?)\\}|class [a-zA-Z]+ implements |// \\` pattern will ignore all the cases listed above.\n "]))),
options: {
- type: "number",
- minimum: "1",
+ type: "array",
+ items: {
+ oneOf: [
+ {
+ type: "number",
+ },
+ {
+ type: "object",
+ properties: {
+ "limit": { type: "number" },
+ "ignore-pattern": { type: "string" },
+ },
+ additionalProperties: false,
+ },
+ ],
+ },
+ minLength: 1,
+ maxLength: 2,
},
- optionExamples: [[true, 120]],
+ optionExamples: [[true, 120], [true, {
+ "limit": 120,
+ "ignore-pattern": "^import |^export \{(.*?)\}"
+ }]],
type: "maintainability",
typescriptOnly: false,
};
@@ -52,12 +87,18 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- var limit = ctx.options;
+ var limit = ctx.options.limit;
+ var ignorePattern = ctx.options.ignorePattern;
for (var _i = 0, _a = tsutils_1.getLineRanges(ctx.sourceFile); _i < _a.length; _i++) {
var line = _a[_i];
- if (line.contentLength > limit) {
- ctx.addFailureAt(line.pos, line.contentLength, Rule.FAILURE_STRING_FACTORY(limit));
+ if (line.contentLength <= limit) {
+ continue;
+ }
+ var lineContent = ctx.sourceFile.text.substr(line.pos, line.contentLength);
+ if (ignorePattern !== undefined && ignorePattern.test(lineContent)) {
+ continue;
}
+ ctx.addFailureAt(line.pos, line.contentLength, Rule.FAILURE_STRING_FACTORY(limit));
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.d.ts b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
index 5aa42a707..74b4e23b6 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.d.ts
+++ b/node_modules/tslint/lib/rules/memberAccessRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.js b/node_modules/tslint/lib/rules/memberAccessRule.js
index abb843b04..80b90dcad 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.js
+++ b/node_modules/tslint/lib/rules/memberAccessRule.js
@@ -58,8 +58,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "member-access",
description: "Requires explicit visibility declarations for class members.",
- rationale: "Explicit visibility declarations can make code more readable and accessible for those new to TS.",
- optionsDescription: (_a = ["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], _a.raw = ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to `private`, unlike TypeScript's default of `public`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "], ["\n Explicit visibility declarations can make code more readable and accessible for those new to TS.\n\n Other languages such as C# default to \\`private\\`, unlike TypeScript's default of \\`public\\`.\n Members lacking a visibility declaration may be an indication of an accidental leak of class internals.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n These arguments may be optionally provided:\n\n * `\"no-public\"` forbids public accessibility to be specified, because this is the default.\n * `\"check-accessor\"` enforces explicit visibility on get/set accessors\n * `\"check-constructor\"` enforces explicit visibility on constructors\n * `\"check-parameter-property\"` enforces explicit visibility on parameter properties"], ["\n These arguments may be optionally provided:\n\n * \\`\"no-public\"\\` forbids public accessibility to be specified, because this is the default.\n * \\`\"check-accessor\"\\` enforces explicit visibility on get/set accessors\n * \\`\"check-constructor\"\\` enforces explicit visibility on constructors\n * \\`\"check-parameter-property\"\\` enforces explicit visibility on parameter properties"]))),
options: {
type: "array",
items: {
@@ -115,15 +115,13 @@ function walk(ctx) {
}
}
function check(node) {
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword)) {
return;
}
var publicKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.PublicKeyword);
if (noPublic && publicKeyword !== undefined) {
- var readonlyKeyword = tsutils_1.getModifier(node, ts.SyntaxKind.ReadonlyKeyword);
// public is not optional for parameter property without the readonly modifier
- var isPublicOptional = node.kind !== ts.SyntaxKind.Parameter || readonlyKeyword !== undefined;
- if (isPublicOptional) {
+ if (node.kind !== ts.SyntaxKind.Parameter || tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.ReadonlyKeyword)) {
var start = publicKeyword.end - "public".length;
ctx.addFailure(start, publicKeyword.end, Rule.FAILURE_STRING_NO_PUBLIC, Lint.Replacement.deleteFromTo(start, tsutils_1.getNextToken(publicKeyword, ctx.sourceFile).getStart(ctx.sourceFile)));
}
@@ -159,4 +157,4 @@ function typeToString(node) {
throw new Error("unhandled node type " + ts.SyntaxKind[node.kind]);
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/memberOrderingRule.js b/node_modules/tslint/lib/rules/memberOrderingRule.js
index e2e35a548..a9752e3a4 100644
--- a/node_modules/tslint/lib/rules/memberOrderingRule.js
+++ b/node_modules/tslint/lib/rules/memberOrderingRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var error_1 = require("../error");
var Lint = require("../index");
@@ -96,7 +97,7 @@ var allMemberKindNames = utils_1.mapDefined(Object.keys(MemberKind), function (k
function namesMarkdown(names) {
return names.map(function (name) { return "* `" + name + "`"; }).join("\n ");
}
-var optionsDescription = (_a = ["\n One argument, which is an object, must be provided. It should contain an `order` property.\n The `order` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for `order` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], _a.raw = ["\n One argument, which is an object, must be provided. It should contain an \\`order\\` property.\n The \\`order\\` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for \\`order\\` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], Lint.Utils.dedent(_a, namesMarkdown(PRESET_NAMES), namesMarkdown(allMemberKindNames), OPTION_ALPHABETIZE));
+var optionsDescription = Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument, which is an object, must be provided. It should contain an `order` property.\n The `order` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for `order` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], ["\n One argument, which is an object, must be provided. It should contain an \\`order\\` property.\n The \\`order\\` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for \\`order\\` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."])), namesMarkdown(PRESET_NAMES), namesMarkdown(allMemberKindNames), OPTION_ALPHABETIZE);
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -124,7 +125,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "member-ordering",
description: "Enforces member ordering.",
- rationale: "A consistent ordering for class members can make classes easier to read, navigate, and edit.",
+ hasFix: true,
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A consistent ordering for class members can make classes easier to read, navigate, and edit.\n\n A common opposite practice to `member-ordering` is to keep related groups of classes together.\n Instead of creating classes with multiple separate groups, consider splitting class responsibilities\n apart across multiple single-responsibility classes.\n "], ["\n A consistent ordering for class members can make classes easier to read, navigate, and edit.\n\n A common opposite practice to \\`member-ordering\\` is to keep related groups of classes together.\n Instead of creating classes with multiple separate groups, consider splitting class responsibilities\n apart across multiple single-responsibility classes.\n "]))),
optionsDescription: optionsDescription,
options: {
type: "object",
@@ -187,11 +189,15 @@ exports.Rule = Rule;
var MemberOrderingWalker = /** @class */ (function (_super) {
tslib_1.__extends(MemberOrderingWalker, _super);
function MemberOrderingWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.fixes = [];
+ return _this;
}
MemberOrderingWalker.prototype.walk = function (sourceFile) {
var _this = this;
var cb = function (node) {
+ // NB: iterate through children first!
+ ts.forEachChild(node, cb);
switch (node.kind) {
case ts.SyntaxKind.ClassDeclaration:
case ts.SyntaxKind.ClassExpression:
@@ -199,13 +205,27 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.TypeLiteral:
_this.checkMembers(node.members);
}
- return ts.forEachChild(node, cb);
};
- return ts.forEachChild(sourceFile, cb);
+ ts.forEachChild(sourceFile, cb);
+ // assign Replacements which have not been merged into surrounding ones to their RuleFailures.
+ this.fixes.forEach(function (_a) {
+ var failure = _a[0], replacement = _a[1];
+ failure.getFix().push(replacement);
+ });
};
+ /**
+ * Check wether the passed members adhere to the configured order. If not, RuleFailures are generated and a single
+ * Lint.Replacement is generated, which replaces the entire NodeArray with a correctly sorted one. The Replacement
+ * is not immediately added to a RuleFailure, as incorrectly sorted nodes can be nested (e.g. a class declaration
+ * in a method implementation), but instead temporarily stored in `this.fixes`. Nested Replacements are manually
+ * merged, as TSLint doesn't handle overlapping ones. For this reason it is important that the recursion happens
+ * before the checkMembers call in this.walk().
+ */
MemberOrderingWalker.prototype.checkMembers = function (members) {
+ var _this = this;
var prevRank = -1;
var prevName;
+ var failureExists = false;
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var member = members_1[_i];
var rank = this.memberRank(member);
@@ -222,7 +242,9 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
: "at the beginning of the class/interface";
var errorLine1 = "Declaration of " + nodeType + " not allowed after declaration of " + prevNodeType + ". " +
("Instead, this should come " + locationHint + ".");
- this.addFailureAtNode(member, errorLine1);
+ // add empty array as fix so we can add a replacement later. (fix itself is readonly)
+ this.addFailureAtNode(member, errorLine1, []);
+ failureExists = true;
}
else {
if (this.options.alphabetize && member.name !== undefined) {
@@ -232,7 +254,8 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
}
var curName = nameString(member.name);
if (prevName !== undefined && caseInsensitiveLess(curName, prevName)) {
- this.addFailureAtNode(member.name, Rule.FAILURE_STRING_ALPHABETIZE(this.findLowerName(members, rank, curName), curName));
+ this.addFailureAtNode(member.name, Rule.FAILURE_STRING_ALPHABETIZE(this.findLowerName(members, rank, curName), curName), []);
+ failureExists = true;
}
else {
prevName = curName;
@@ -242,6 +265,56 @@ var MemberOrderingWalker = /** @class */ (function (_super) {
prevRank = rank;
}
}
+ if (failureExists) {
+ var sortedMemberIndexes = members.map(function (_, i) { return i; }).sort(function (ai, bi) {
+ var a = members[ai];
+ var b = members[bi];
+ // first, sort by member rank
+ var rankDiff = _this.memberRank(a) - _this.memberRank(b);
+ if (rankDiff !== 0) {
+ return rankDiff;
+ }
+ // then lexicographically if alphabetize == true
+ if (_this.options.alphabetize && a.name !== undefined && b.name !== undefined) {
+ var aName = nameString(a.name);
+ var bName = nameString(b.name);
+ var nameDiff = aName.localeCompare(bName);
+ if (nameDiff !== 0) {
+ return nameDiff;
+ }
+ }
+ // finally, sort by position in original NodeArray so the sort remains stable.
+ return ai - bi;
+ });
+ var splits_1 = getSplitIndexes(members, this.sourceFile.text);
+ var sortedMembersText = sortedMemberIndexes.map(function (i) {
+ var start = splits_1[i];
+ var end = splits_1[i + 1];
+ var nodeText = _this.sourceFile.text.substring(start, end);
+ while (true) {
+ // check if there are previous fixes which we need to merge into this one
+ // if yes, remove it from the list so that we do not return overlapping Replacements
+ var fixIndex = arrayFindLastIndex(_this.fixes, function (_a) {
+ var r = _a[1];
+ return r.start >= start && r.start + r.length <= end;
+ });
+ if (fixIndex === -1) {
+ break;
+ }
+ var fix = _this.fixes.splice(fixIndex, 1)[0];
+ var replacement = fix[1];
+ nodeText = applyReplacementOffset(nodeText, replacement, start);
+ }
+ return nodeText;
+ });
+ // instead of assigning the fix immediately to the last failure, we temporarily store it in `this.fixes`,
+ // in case a containing node needs to be fixed too. We only "add" the fix to the last failure, although
+ // it fixes all failures in this NodeArray, as TSLint doesn't handle duplicate Replacements.
+ this.fixes.push([
+ arrayLast(this.failures),
+ Lint.Replacement.replaceFromTo(splits_1[0], arrayLast(splits_1), sortedMembersText.join("")),
+ ]);
+ }
};
/** Finds the lowest name higher than 'targetName'. */
MemberOrderingWalker.prototype.findLowerName = function (members, targetRank, targetName) {
@@ -303,8 +376,8 @@ function memberKindFromName(name) {
}
}
function getMemberKind(member) {
- var accessLevel = hasModifier(ts.SyntaxKind.PrivateKeyword) ? "private"
- : hasModifier(ts.SyntaxKind.ProtectedKeyword) ? "protected"
+ var accessLevel = tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.PrivateKeyword) ? "private"
+ : tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.ProtectedKeyword) ? "protected"
: "public";
switch (member.kind) {
case ts.SyntaxKind.Constructor:
@@ -320,12 +393,9 @@ function getMemberKind(member) {
return undefined;
}
function methodOrField(isMethod) {
- var membership = hasModifier(ts.SyntaxKind.StaticKeyword) ? "Static" : "Instance";
+ var membership = tsutils_1.hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword) ? "Static" : "Instance";
return memberKindForMethodOrField(accessLevel, membership, isMethod ? "Method" : "Field");
}
- function hasModifier(kind) {
- return Lint.hasModifier(member.modifiers, kind);
- }
}
var MemberCategory = /** @class */ (function () {
function MemberCategory(name, kinds) {
@@ -436,4 +506,110 @@ function nameString(name) {
return "";
}
}
-var _a;
+/**
+ * Returns the last element of an array. (Or undefined).
+ */
+function arrayLast(array) {
+ return array[array.length - 1];
+}
+/**
+ * Array.prototype.findIndex, but the last index.
+ */
+function arrayFindLastIndex(array, predicate) {
+ for (var i = array.length; i-- > 0;) {
+ if (predicate(array[i], i, array)) {
+ return i;
+ }
+ }
+ return -1;
+}
+/**
+ * Applies a Replacement to a part of the text which starts at offset.
+ * See also Replacement.apply
+ */
+function applyReplacementOffset(content, replacement, offset) {
+ return content.substring(0, replacement.start - offset)
+ + replacement.text
+ + content.substring(replacement.start - offset + replacement.length);
+}
+/**
+ * Get the indexes of the boundaries between nodes in the node array. The following points must be taken into account:
+ * - Trivia should stay with its corresponding node (comments on the same line following the token belong to the
+ * previous token, the rest to the next).
+ * - Reordering the subtexts should not result in code being commented out due to being moved between a "//" and
+ * the following newline.
+ * - The end of one node must be the start of the next, otherwise the intravening whitespace will be lost when
+ * reordering.
+ *
+ * Hence, the boundaries are chosen to be _after_ the newline following the node, or the beginning of the next token,
+ * if that comes first.
+ */
+function getSplitIndexes(members, text) {
+ var result = members.map(function (member) { return getNextSplitIndex(text, member.getFullStart()); });
+ result.push(getNextSplitIndex(text, arrayLast(members).getEnd()));
+ return result;
+}
+/**
+ * Calculates the index after the newline following pos, or the beginning of the next token, whichever comes first.
+ * See also getSplitIndexes.
+ * This method is a modified version of TypeScript's internal iterateCommentRanges function.
+ */
+function getNextSplitIndex(text, pos) {
+ scan: while (pos >= 0 && pos < text.length) {
+ var ch = text.charCodeAt(pos);
+ switch (ch) {
+ case 13 /* carriageReturn */:
+ if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
+ pos++;
+ }
+ // falls through
+ case 10 /* lineFeed */:
+ pos++;
+ // split is after new line
+ return pos;
+ case 9 /* tab */:
+ case 11 /* verticalTab */:
+ case 12 /* formFeed */:
+ case 32 /* space */:
+ // skip whitespace
+ pos++;
+ continue;
+ case 47 /* slash */:
+ var nextChar = text.charCodeAt(pos + 1);
+ if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) {
+ var isSingleLineComment = nextChar === 47 /* slash */;
+ pos += 2;
+ if (isSingleLineComment) {
+ while (pos < text.length) {
+ if (ts.isLineBreak(text.charCodeAt(pos))) {
+ // the comment ends here, go back to default logic to handle parsing new line and result
+ continue scan;
+ }
+ pos++;
+ }
+ }
+ else {
+ while (pos < text.length) {
+ if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
+ pos += 2;
+ continue scan;
+ }
+ pos++;
+ }
+ }
+ // if we arrive here, it's because pos == text.length
+ return pos;
+ }
+ break scan;
+ default:
+ // skip whitespace:
+ if (ch > 127 /* maxAsciiCharacter */ && (ts.isWhiteSpaceLike(ch))) {
+ pos++;
+ continue;
+ }
+ break scan;
+ }
+ }
+ return pos;
+}
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
+++ b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
index 2634398da..2cb4f24b6 100644
--- a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-angle-bracket-type-assertion",
description: "Requires the use of `as Type` for type assertions instead of `<Type>`.",
hasFix: true,
- rationale: (_a = ["\n Both formats of type assertions have the same effect, but only `as` type assertions\n work in `.tsx` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], _a.raw = ["\n Both formats of type assertions have the same effect, but only \\`as\\` type assertions\n work in \\`.tsx\\` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Both formats of type assertions have the same effect, but only `as` type assertions\n work in `.tsx` files. This rule ensures that you have a consistent type assertion style\n across your codebase."], ["\n Both formats of type assertions have the same effect, but only \\`as\\` type assertions\n work in \\`.tsx\\` files. This rule ensures that you have a consistent type assertion style\n across your codebase."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -70,4 +70,4 @@ function needsParens(node) {
return tsutils_1.isBinaryExpression(parent) &&
(parent.operatorToken.kind === ts.SyntaxKind.AmpersandToken || parent.operatorToken.kind === ts.SyntaxKind.BarToken);
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noAnyRule.js b/node_modules/tslint/lib/rules/noAnyRule.js
index d438dabca..bd424bf9f 100644
--- a/node_modules/tslint/lib/rules/noAnyRule.js
+++ b/node_modules/tslint/lib/rules/noAnyRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-any",
description: "Disallows usages of `any` as a type declaration.",
hasFix: false,
- rationale: "Using `any` as a type declaration nullifies the compile-time benefits of the type system.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `any` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use `<T>` template types for generic type handling.\n\n Also see the `no-unsafe-any` rule.\n "], ["\n Using \\`any\\` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use \\`<T>\\` template types for generic type handling.\n\n Also see the \\`no-unsafe-any\\` rule.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -40,9 +40,7 @@ var Rule = /** @class */ (function (_super) {
typescriptOnly: true,
};
/* tslint:enable:object-literal-sort-keys */
- Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. " +
- "Consider replacing it with a more precise type, the empty type ('{}'), " +
- "or suppress this occurrence.";
+ Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.";
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
@@ -50,8 +48,9 @@ function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (node.kind === ts.SyntaxKind.AnyKeyword) {
var start = node.end - 3;
- return ctx.addFailure(start, node.end, Rule.FAILURE_STRING, new Lint.Replacement(start, 3, "{}"));
+ return ctx.addFailure(start, node.end, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noArgRule.d.ts b/node_modules/tslint/lib/rules/noArgRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noArgRule.d.ts
+++ b/node_modules/tslint/lib/rules/noArgRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noArgRule.js b/node_modules/tslint/lib/rules/noArgRule.js
index e5fe14932..6036f84dc 100644
--- a/node_modules/tslint/lib/rules/noArgRule.js
+++ b/node_modules/tslint/lib/rules/noArgRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-arg",
description: "Disallows use of `arguments.callee`.",
- rationale: (_a = ["\n Using `arguments.callee` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid `arguments.callee`."], _a.raw = ["\n Using \\`arguments.callee\\` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid \\`arguments.callee\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `arguments.callee` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid `arguments.callee`."], ["\n Using \\`arguments.callee\\` makes various performance optimizations impossible.\n See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee)\n for more details on why to avoid \\`arguments.callee\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -54,4 +54,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noBitwiseRule.js b/node_modules/tslint/lib/rules/noBitwiseRule.js
index 4a3d413a6..edd086133 100644
--- a/node_modules/tslint/lib/rules/noBitwiseRule.js
+++ b/node_modules/tslint/lib/rules/noBitwiseRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-bitwise",
description: "Disallows bitwise operators.",
- descriptionDetails: (_a = ["\n Specifically, the following bitwise operators are banned:\n `&`, `&=`, `|`, `|=`,\n `^`, `^=`, `<<`, `<<=`,\n `>>`, `>>=`, `>>>`, `>>>=`, and `~`.\n This rule does not ban the use of `&` and `|` for intersection and union types."], _a.raw = ["\n Specifically, the following bitwise operators are banned:\n \\`&\\`, \\`&=\\`, \\`|\\`, \\`|=\\`,\n \\`^\\`, \\`^=\\`, \\`<<\\`, \\`<<=\\`,\n \\`>>\\`, \\`>>=\\`, \\`>>>\\`, \\`>>>=\\`, and \\`~\\`.\n This rule does not ban the use of \\`&\\` and \\`|\\` for intersection and union types."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Bitwise operators are often typos - for example `bool1 & bool2` instead of `bool1 && bool2`.\n They also can be an indicator of overly clever code which decreases maintainability."], _b.raw = ["\n Bitwise operators are often typos - for example \\`bool1 & bool2\\` instead of \\`bool1 && bool2\\`.\n They also can be an indicator of overly clever code which decreases maintainability."], Lint.Utils.dedent(_b)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Specifically, the following bitwise operators are banned:\n `&`, `&=`, `|`, `|=`,\n `^`, `^=`, `<<`, `<<=`,\n `>>`, `>>=`, `>>>`, `>>>=`, and `~`.\n This rule does not ban the use of `&` and `|` for intersection and union types."], ["\n Specifically, the following bitwise operators are banned:\n \\`&\\`, \\`&=\\`, \\`|\\`, \\`|=\\`,\n \\`^\\`, \\`^=\\`, \\`<<\\`, \\`<<=\\`,\n \\`>>\\`, \\`>>=\\`, \\`>>>\\`, \\`>>>=\\`, and \\`~\\`.\n This rule does not ban the use of \\`&\\` and \\`|\\` for intersection and union types."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Bitwise operators are often typos - for example `bool1 & bool2` instead of `bool1 && bool2`.\n They also can be an indicator of overly clever code which decreases maintainability."], ["\n Bitwise operators are often typos - for example \\`bool1 & bool2\\` instead of \\`bool1 && bool2\\`.\n They also can be an indicator of overly clever code which decreases maintainability."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -70,4 +70,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
index 979552d6f..5f2dd1ccd 100644
--- a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
index cefd393ec..efe5027c1 100644
--- a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
@@ -40,6 +40,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Comparing boolean values to boolean literals is unnecessary, as those expressions will result in booleans too.\n Just use the boolean values directly or negate them.\n "], ["\n Comparing boolean values to boolean literals is unnecessary, as those expressions will result in booleans too.\n Just use the boolean values directly or negate them.\n "]))),
type: "style",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -60,7 +61,7 @@ function walk(ctx, checker) {
}
function getBooleanComparison(node, checker) {
var cmp = deconstructComparison(node);
- return cmp === undefined || !Lint.isTypeFlagSet(checker.getTypeAtLocation(cmp.expression), ts.TypeFlags.Boolean) ? undefined : cmp;
+ return cmp === undefined || !utils.isTypeFlagSet(checker.getTypeAtLocation(cmp.expression), ts.TypeFlags.Boolean) ? undefined : cmp;
}
function fix(node, _a) {
var negate = _a.negate, expression = _a.expression;
@@ -119,3 +120,4 @@ function booleanFromExpression(node) {
return undefined;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
index 30e77aa84..7e004cb58 100644
--- a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-conditional-assignment",
description: "Disallows any type of assignment in conditionals.",
descriptionDetails: "This applies to `do-while`, `for`, `if`, and `while` statements and conditional (ternary) expressions.",
- rationale: (_a = ["\n Assignments in conditionals are often typos:\n for example `if (var1 = var2)` instead of `if (var1 == var2)`.\n They also can be an indicator of overly clever code which decreases maintainability."], _a.raw = ["\n Assignments in conditionals are often typos:\n for example \\`if (var1 = var2)\\` instead of \\`if (var1 == var2)\\`.\n They also can be an indicator of overly clever code which decreases maintainability."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Assignments in conditionals are often typos:\n for example `if (var1 = var2)` instead of `if (var1 == var2)`.\n They also can be an indicator of overly clever code which decreases maintainability."], ["\n Assignments in conditionals are often typos:\n for example \\`if (var1 = var2)\\` instead of \\`if (var1 == var2)\\`.\n They also can be an indicator of overly clever code which decreases maintainability."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -115,4 +115,4 @@ function maybeCallback(cb, node) {
cb(node);
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
index 36668bc3f..9a2716053 100644
--- a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
index 8e6253ba5..a52a03d15 100644
--- a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
@@ -48,8 +48,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-consecutive-blank-lines",
description: "Disallows one or more blank lines in a row.",
hasFix: true,
- rationale: "Helps maintain a readable style in your codebase.",
- optionsDescription: (_a = ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], _a.raw = ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], Lint.Utils.dedent(_a, Rule.DEFAULT_ALLOWED_BLANKS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps maintain a readable style in your codebase.\n\n Extra blank lines take up extra space and add little to a semantic understanding of the code.\n It can be harder to read through files when fewer components can fit into the screen.\n If you find a file is so large you feel a need to split them up with extra blank lines or comments,\n consider splitting your file into smaller files.\n "], ["\n Helps maintain a readable style in your codebase.\n\n Extra blank lines take up extra space and add little to a semantic understanding of the code.\n It can be harder to read through files when fewer components can fit into the screen.\n If you find a file is so large you feel a need to split them up with extra blank lines or comments,\n consider splitting your file into smaller files.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."], ["\n An optional number of maximum allowed sequential blanks can be specified. If no value\n is provided, a default of ", " will be used."])), Rule.DEFAULT_ALLOWED_BLANKS),
options: {
type: "number",
minimum: "1",
@@ -125,4 +125,4 @@ function getTemplateRanges(sourceFile) {
return intervals;
}
exports.getTemplateRanges = getTemplateRanges;
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.d.ts b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
index 0e867ca96..44d692363 100644
--- a/node_modules/tslint/lib/rules/noConsoleRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConsoleRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.js b/node_modules/tslint/lib/rules/noConsoleRule.js
index 384154d12..0a2eeb42e 100644
--- a/node_modules/tslint/lib/rules/noConsoleRule.js
+++ b/node_modules/tslint/lib/rules/noConsoleRule.js
@@ -51,12 +51,11 @@ var Rule = /** @class */ (function (_super) {
exports.Rule = Rule;
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
- if (tsutils_1.isCallExpression(node) &&
- tsutils_1.isPropertyAccessExpression(node.expression) &&
- tsutils_1.isIdentifier(node.expression.expression) &&
- node.expression.expression.text === "console" &&
- (ctx.options.length === 0 || ctx.options.indexOf(node.expression.name.text) !== -1)) {
- ctx.addFailureAtNode(node.expression, Rule.FAILURE_STRING_FACTORY(node.expression.name.text));
+ if (tsutils_1.isPropertyAccessExpression(node) &&
+ tsutils_1.isIdentifier(node.expression) &&
+ node.expression.text === "console" &&
+ (ctx.options.length === 0 || ctx.options.indexOf(node.name.text) !== -1)) {
+ ctx.addFailureAtNode(node, Rule.FAILURE_STRING_FACTORY(node.name.text));
}
return ts.forEachChild(node, cb);
});
diff --git a/node_modules/tslint/lib/rules/noConstructRule.d.ts b/node_modules/tslint/lib/rules/noConstructRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noConstructRule.d.ts
+++ b/node_modules/tslint/lib/rules/noConstructRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noConstructRule.js b/node_modules/tslint/lib/rules/noConstructRule.js
index bc6130b24..9d7391b3a 100644
--- a/node_modules/tslint/lib/rules/noConstructRule.js
+++ b/node_modules/tslint/lib/rules/noConstructRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-construct",
description: "Disallows access to the constructors of `String`, `Number`, and `Boolean`.",
descriptionDetails: "Disallows constructor use such as `new Number(foo)` but does not disallow `Number(foo)`.",
- rationale: (_a = ["\n There is little reason to use `String`, `Number`, or `Boolean` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], _a.raw = ["\n There is little reason to use \\`String\\`, \\`Number\\`, or \\`Boolean\\` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n There is little reason to use `String`, `Number`, or `Boolean` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."], ["\n There is little reason to use \\`String\\`, \\`Number\\`, or \\`Boolean\\` as constructors.\n In almost all cases, the regular function-call version is more appropriate.\n [More details](http://stackoverflow.com/q/4719320/3124288) are available on StackOverflow."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -58,4 +58,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noDefaultExportRule.js b/node_modules/tslint/lib/rules/noDefaultExportRule.js
index da53773d5..099290b2d 100644
--- a/node_modules/tslint/lib/rules/noDefaultExportRule.js
+++ b/node_modules/tslint/lib/rules/noDefaultExportRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-default-export",
description: "Disallows default exports in ES6-style modules.",
descriptionDetails: "Use named exports instead.",
- rationale: (_a = ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], _a.raw = ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."], ["\n Named imports/exports [promote clarity](https://github.com/palantir/tslint/issues/1182#issue-151780453).\n In addition, current tooling differs on the correct way to handle default imports/exports.\n Avoiding them all together can help avoid tooling bugs and conflicts."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -62,4 +62,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
index 419acce16..37804b2d0 100644
--- a/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
index af7c741f8..d30d74b4c 100644
--- a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
+var ts = require("typescript");
var Lint = require("../index");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
@@ -33,8 +34,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-duplicate-imports",
- description: (_a = ["\n Disallows multiple import statements from the same module."], _a.raw = ["\n Disallows multiple import statements from the same module."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], _b.raw = ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows multiple import statements from the same module."], ["\n Disallows multiple import statements from the same module."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."], ["\n Using a single import statement per module will make the code clearer because you can see everything being imported\n from that module on one line."]))),
optionsDescription: "Not configurable",
options: null,
optionExamples: [true],
@@ -45,15 +46,24 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- var seen = new Set();
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 1 /* ImportDeclaration */); _i < _a.length; _i++) {
- var _b = _a[_i], text = _b.text, parent = _b.parent;
- if (seen.has(text)) {
- ctx.addFailureAtNode(parent, Rule.FAILURE_STRING(text));
- }
- else {
+ walkWorker(ctx, ctx.sourceFile.statements, new Set());
+}
+function walkWorker(ctx, statements, seen) {
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
+ if (tsutils_1.isImportDeclaration(statement) && tsutils_1.isLiteralExpression(statement.moduleSpecifier)) {
+ var text = statement.moduleSpecifier.text;
+ if (seen.has(text)) {
+ ctx.addFailureAtNode(statement, Rule.FAILURE_STRING(text));
+ }
seen.add(text);
}
+ if (tsutils_1.isModuleDeclaration(statement) && statement.body !== undefined && statement.name.kind === ts.SyntaxKind.StringLiteral) {
+ // If this is a module augmentation, re-use `seen` since those imports could be moved outside.
+ // If this is an ambient module, create a fresh `seen`
+ // because they should have separate imports to avoid becoming augmentations.
+ walkWorker(ctx, statement.body.statements, ts.isExternalModule(ctx.sourceFile) ? seen : new Set());
+ }
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
index 33c7edd14..eb78370a5 100644
--- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
index 39e07d472..b1e545f48 100644
--- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
@@ -53,7 +53,7 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
function getSuperForNode(node) {
- if (Lint.isLoop(node)) {
+ if (tsutils_1.isIterationStatement(node)) {
var bodySuper = combineSequentialChildren(node);
if (typeof bodySuper === "number") {
return 0 /* NoSuper */;
@@ -77,8 +77,17 @@ function walk(ctx) {
return node.parent.kind === ts.SyntaxKind.CallExpression && node.parent.expression === node
? { node: node.parent, break: false }
: 0 /* NoSuper */;
+ case ts.SyntaxKind.ConditionalExpression: {
+ var _a = node, condition = _a.condition, whenTrue = _a.whenTrue, whenFalse = _a.whenFalse;
+ var inCondition = getSuperForNode(condition);
+ var inBranches = worse(getSuperForNode(whenTrue), getSuperForNode(whenFalse));
+ if (typeof inCondition !== "number" && typeof inBranches !== "number") {
+ addDuplicateFailure(inCondition.node, inBranches.node);
+ }
+ return worse(inCondition, inBranches);
+ }
case ts.SyntaxKind.IfStatement: {
- var _a = node, thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
+ var _b = node, thenStatement = _b.thenStatement, elseStatement = _b.elseStatement;
return worse(getSuperForNode(thenStatement), elseStatement !== undefined ? getSuperForNode(elseStatement) : 0 /* NoSuper */);
}
case ts.SyntaxKind.SwitchStatement:
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
index 117f46536..699da0464 100644
--- a/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
index f546ddfc4..54a053387 100644
--- a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
@@ -39,9 +39,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-duplicate-variable",
description: "Disallows duplicate variable declarations in the same block scope.",
- descriptionDetails: (_a = ["\n This rule is only useful when using the `var` keyword -\n the compiler will detect redeclarations of `let` and `const` variables."], _a.raw = ["\n This rule is only useful when using the \\`var\\` keyword -\n the compiler will detect redeclarations of \\`let\\` and \\`const\\` variables."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], _b.raw = ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], Lint.Utils.dedent(_b)),
- optionsDescription: "You can specify `\"" + OPTION_CHECK_PARAMETERS + "\"` to check for variables with the same name as a paramter.",
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule is only useful when using the `var` keyword -\n the compiler will detect redeclarations of `let` and `const` variables."], ["\n This rule is only useful when using the \\`var\\` keyword -\n the compiler will detect redeclarations of \\`let\\` and \\`const\\` variables."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."], ["\n A variable can be reassigned if necessary -\n there's no good reason to have a duplicate variable declaration."]))),
+ optionsDescription: "You can specify `\"" + OPTION_CHECK_PARAMETERS + "\"` to check for variables with the same name as a parameter.",
options: {
type: "string",
enum: [OPTION_CHECK_PARAMETERS],
@@ -59,7 +59,9 @@ exports.Rule = Rule;
var NoDuplicateVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoDuplicateVariableWalker, _super);
function NoDuplicateVariableWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Set();
+ return _this;
}
NoDuplicateVariableWalker.prototype.walk = function (sourceFile) {
var _this = this;
@@ -105,4 +107,4 @@ var NoDuplicateVariableWalker = /** @class */ (function (_super) {
};
return NoDuplicateVariableWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
index 0a098d7f6..99a5b06b6 100644
--- a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.d.ts b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noEmptyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEmptyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.js b/node_modules/tslint/lib/rules/noEmptyRule.js
index 115875816..ee79f5f8b 100644
--- a/node_modules/tslint/lib/rules/noEmptyRule.js
+++ b/node_modules/tslint/lib/rules/noEmptyRule.js
@@ -21,6 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var ALLOW_EMPTY_CATCH = "allow-empty-catch";
+var ALLOW_EMPTY_FUNCTIONS = "allow-empty-functions";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -29,6 +30,7 @@ var Rule = /** @class */ (function (_super) {
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk, {
allowEmptyCatch: this.ruleArguments.indexOf(ALLOW_EMPTY_CATCH) !== -1,
+ allowEmptyFunctions: this.ruleArguments.indexOf(ALLOW_EMPTY_FUNCTIONS) !== -1,
});
};
/* tslint:disable:object-literal-sort-keys */
@@ -37,12 +39,28 @@ var Rule = /** @class */ (function (_super) {
description: "Disallows empty blocks.",
descriptionDetails: "Blocks with a comment inside are not considered empty.",
rationale: "Empty blocks are often indicators of missing code.",
- optionsDescription: (_a = ["\n If `", "` is specified, then catch blocks are allowed to be empty."], _a.raw = ["\n If \\`", "\\` is specified, then catch blocks are allowed to be empty."], Lint.Utils.dedent(_a, ALLOW_EMPTY_CATCH)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then catch blocks are allowed to be empty.\n If `", "` is specified, then function definitions are allowed to be empty."], ["\n If \\`", "\\` is specified, then catch blocks are allowed to be empty.\n If \\`", "\\` is specified, then function definitions are allowed to be empty."])), ALLOW_EMPTY_CATCH, ALLOW_EMPTY_FUNCTIONS),
options: {
- type: "string",
- enum: [ALLOW_EMPTY_CATCH],
+ type: "array",
+ items: {
+ anyOf: [
+ {
+ type: "string",
+ enum: [ALLOW_EMPTY_CATCH],
+ },
+ {
+ type: "string",
+ enum: [ALLOW_EMPTY_FUNCTIONS],
+ },
+ ],
+ },
},
- optionExamples: [true, [true, ALLOW_EMPTY_CATCH]],
+ optionExamples: [
+ true,
+ [true, ALLOW_EMPTY_CATCH],
+ [true, ALLOW_EMPTY_FUNCTIONS],
+ [true, ALLOW_EMPTY_CATCH, ALLOW_EMPTY_FUNCTIONS],
+ ],
type: "functionality",
typescriptOnly: false,
};
@@ -71,6 +89,13 @@ function isExcluded(node, options) {
if (options.allowEmptyCatch && node.kind === ts.SyntaxKind.CatchClause) {
return true;
}
+ if (options.allowEmptyFunctions &&
+ (node.kind === ts.SyntaxKind.MethodDeclaration ||
+ node.kind === ts.SyntaxKind.FunctionDeclaration ||
+ node.kind === ts.SyntaxKind.FunctionExpression ||
+ node.kind === ts.SyntaxKind.ArrowFunction)) {
+ return true;
+ }
return tsutils_1.isConstructorDeclaration(node) &&
(
/* If constructor is private or protected, the block is allowed to be empty.
@@ -80,4 +105,4 @@ function isExcluded(node, options) {
tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ProtectedKeyword) ||
node.parameters.some(tsutils_1.isParameterProperty));
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noEvalRule.d.ts b/node_modules/tslint/lib/rules/noEvalRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noEvalRule.d.ts
+++ b/node_modules/tslint/lib/rules/noEvalRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noEvalRule.js b/node_modules/tslint/lib/rules/noEvalRule.js
index 9067a3fd8..386914433 100644
--- a/node_modules/tslint/lib/rules/noEvalRule.js
+++ b/node_modules/tslint/lib/rules/noEvalRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-eval",
description: "Disallows `eval` function invocations.",
- rationale: (_a = ["\n `eval()` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for `eval()`."], _a.raw = ["\n \\`eval()\\` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for \\`eval()\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n `eval()` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for `eval()`."], ["\n \\`eval()\\` is dangerous as it allows arbitrary code execution with full privileges. There are\n [alternatives](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)\n for most of the use cases for \\`eval()\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -53,4 +53,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
index 152a03eab..f6d8c1e0d 100644
--- a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
@@ -32,8 +32,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-floating-promises",
description: "Promises returned by functions must be handled appropriately.",
- descriptionDetails: "Use `no-unused-expression` in addition to this rule to reveal even more floating promises.",
- optionsDescription: (_a = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], _a.raw = ["\n A list of \\'string\\' names of any additional classes that should also be handled as Promises.\n "], Lint.Utils.dedent(_a)),
+ descriptionDetails: "Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], ["\n A list of \\'string\\' names of any additional classes that should also be handled as Promises.\n "]))),
options: {
type: "list",
listType: {
@@ -42,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
},
},
optionExamples: [true, [true, "JQueryPromise"]],
- rationale: "Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.",
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Creating a Promise and not storing or returning it may let other code run independently of its result.\n This can cause unexpected and/or non-deterministic behavior depending on external timing factors.\n\n It's typically better to return Promises from functions that start them, then handle them in calling code.\n\n Use `no-unused-expression` in addition to this rule to reveal even more floating promises.\n "], ["\n Creating a Promise and not storing or returning it may let other code run independently of its result.\n This can cause unexpected and/or non-deterministic behavior depending on external timing factors.\n\n It's typically better to return Promises from functions that start them, then handle them in calling code.\n\n Use \\`no-unused-expression\\` in addition to this rule to reveal even more floating promises.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -76,4 +76,4 @@ function isPromiseThenCallWithRejectionHandler(expression) {
expression.expression.name.text === "then" &&
expression.arguments.length >= 2;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noForInArrayRule.js b/node_modules/tslint/lib/rules/noForInArrayRule.js
index a5a2ad6b8..726001716 100644
--- a/node_modules/tslint/lib/rules/noForInArrayRule.js
+++ b/node_modules/tslint/lib/rules/noForInArrayRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-for-in-array",
description: "Disallows iterating over an array with a for-in loop.",
- descriptionDetails: (_a = ["\n A for-in loop (`for (var k in o)`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], _a.raw = ["\n A for-in loop (\\`for (var k in o)\\`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A for-in loop (`for (var k in o)`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "], ["\n A for-in loop (\\`for (var k in o)\\`) iterates over the properties of an Object.\n\n While it is legal to use for-in loops with array types, it is not common.\n for-in will iterate over the indices of the array as strings, omitting any \"holes\" in\n the array.\n\n More common is to use for-of, which iterates over the values of an array.\n If you want to iterate over the indices, alternatives include:\n\n array.forEach((value, index) => { ... });\n for (const [index, value] of array.entries()) { ... }\n for (let i = 0; i < array.length; i++) { ... }\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -57,4 +57,4 @@ function walk(ctx, checker) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
index ac0e6994f..41a47d70a 100644
--- a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
index 212baf8ae..6aa697a33 100644
--- a/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
+++ b/node_modules/tslint/lib/rules/noImplicitDependenciesRule.js
@@ -35,27 +35,42 @@ var Rule = /** @class */ (function (_super) {
return "Module '" + module + "' is not listed as dependency in package.json";
};
Rule.prototype.apply = function (sourceFile) {
+ var whitelist = this.ruleArguments.find(function (arg) { return Array.isArray(arg); });
+ if (whitelist === null || whitelist === undefined) {
+ whitelist = [];
+ }
return this.applyWithFunction(sourceFile, walk, {
dev: this.ruleArguments.indexOf(OPTION_DEV) !== -1,
optional: this.ruleArguments.indexOf(OPTION_OPTIONAL) !== -1,
+ whitelist: whitelist,
});
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-implicit-dependencies",
description: "Disallows importing modules that are not listed as dependency in the project's package.json",
- descriptionDetails: (_a = ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], _a.raw = ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n By default the rule looks at `\"dependencies\"` and `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule looks at `\"devDependencies\"` instead of `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"optionalDependencies\"`.\n "], _b.raw = ["\n By default the rule looks at \\`\"dependencies\"\\` and \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule looks at \\`\"devDependencies\"\\` instead of \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"optionalDependencies\"\\`.\n "], Lint.Utils.dedent(_b, OPTION_DEV, OPTION_OPTIONAL)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "], ["\n Disallows importing transient dependencies and modules installed above your package's root directory.\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n By default the rule looks at `\"dependencies\"` and `\"peerDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"devDependencies\"`.\n By adding the `\"", "\"` option the rule also looks at `\"optionalDependencies\"`.\n An array of whitelisted modules can be added to skip checking their existence in package.json.\n "], ["\n By default the rule looks at \\`\"dependencies\"\\` and \\`\"peerDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"devDependencies\"\\`.\n By adding the \\`\"", "\"\\` option the rule also looks at \\`\"optionalDependencies\"\\`.\n An array of whitelisted modules can be added to skip checking their existence in package.json.\n "])), OPTION_DEV, OPTION_OPTIONAL),
options: {
type: "array",
- items: {
- type: "string",
- enum: [OPTION_DEV, OPTION_OPTIONAL],
- },
+ items: [
+ {
+ type: "string",
+ enum: [OPTION_DEV, OPTION_OPTIONAL],
+ },
+ {
+ type: "array",
+ },
+ ],
minItems: 0,
- maxItems: 2,
+ maxItems: 3,
},
- optionExamples: [true, [true, OPTION_DEV], [true, OPTION_OPTIONAL]],
+ optionExamples: [
+ true,
+ [true, OPTION_DEV],
+ [true, OPTION_OPTIONAL],
+ [true, ["src", "app"]],
+ ],
type: "functionality",
typescriptOnly: false,
};
@@ -65,11 +80,12 @@ exports.Rule = Rule;
function walk(ctx) {
var options = ctx.options;
var dependencies;
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ var whitelist = new Set(options.whitelist);
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
if (!ts.isExternalModuleNameRelative(name.text)) {
var packageName = getPackageName(name.text);
- if (builtins.indexOf(packageName) === -1 && !hasDependency(packageName)) {
+ if (!whitelist.has(packageName) && builtins.indexOf(packageName) === -1 && !hasDependency(packageName)) {
ctx.addFailureAtNode(name, Rule.FAILURE_STRING_FACTORY(packageName));
}
}
@@ -92,20 +108,25 @@ function getDependencies(fileName, options) {
var result = new Set();
var packageJsonPath = findPackageJson(path.resolve(path.dirname(fileName)));
if (packageJsonPath !== undefined) {
- // don't use require here to avoid caching
- // remove BOM from file content before parsing
- var content = JSON.parse(fs.readFileSync(packageJsonPath, "utf8").replace(/^\uFEFF/, ""));
- if (content.dependencies !== undefined) {
- addDependencies(result, content.dependencies);
- }
- if (!options.dev && content.peerDependencies !== undefined) {
- addDependencies(result, content.peerDependencies);
- }
- if (options.dev && content.devDependencies !== undefined) {
- addDependencies(result, content.devDependencies);
+ try {
+ // don't use require here to avoid caching
+ // remove BOM from file content before parsing
+ var content = JSON.parse(fs.readFileSync(packageJsonPath, "utf8").replace(/^\uFEFF/, ""));
+ if (content.dependencies !== undefined) {
+ addDependencies(result, content.dependencies);
+ }
+ if (content.peerDependencies !== undefined) {
+ addDependencies(result, content.peerDependencies);
+ }
+ if (options.dev && content.devDependencies !== undefined) {
+ addDependencies(result, content.devDependencies);
+ }
+ if (options.optional && content.optionalDependencies !== undefined) {
+ addDependencies(result, content.optionalDependencies);
+ }
}
- if (options.optional && content.optionalDependencies !== undefined) {
- addDependencies(result, content.optionalDependencies);
+ catch (_a) {
+ // treat malformed package.json files as empty
}
}
return result;
@@ -129,4 +150,4 @@ function findPackageJson(current) {
} while (prev !== current);
return undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.js b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
index a2b6afb0a..104a8f0e2 100644
--- a/node_modules/tslint/lib/rules/noImportSideEffectRule.js
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a;
var utils = require("tsutils");
var Lint = require("../index");
var OPTION_IGNORE_MODULE = "ignore-module";
@@ -46,7 +47,7 @@ var Rule = /** @class */ (function (_super) {
minLength: 0,
type: "array",
},
- optionsDescription: (_b = ["\n One argument may be optionally provided:\n\n * `", "` allows to specify a regex and ignore modules which it matches."], _b.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows to specify a regex and ignore modules which it matches."], Lint.Utils.dedent(_b, OPTION_IGNORE_MODULE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows to specify a regex and ignore modules which it matches."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows to specify a regex and ignore modules which it matches."])), OPTION_IGNORE_MODULE),
rationale: "Imports with side effects may have behavior which is hard for static verification.",
ruleName: "no-import-side-effect",
type: "typescript",
@@ -72,4 +73,4 @@ function walk(ctx) {
}
}
}
-var _a, _b;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
index 38e1bc3a5..c8caca0f9 100644
--- a/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.js b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
index a9da20d83..dc87eb9ff 100644
--- a/node_modules/tslint/lib/rules/noInferrableTypesRule.js
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
@@ -42,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-inferrable-types",
description: "Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.",
rationale: "Explicit types where they can be easily inferred by the compiler make code more verbose.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `", "` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the `typedef` rule.\n * `", "` allows specifying an inferrable type annotation for class properties."], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the \\`typedef\\` rule.\n * \\`", "\\` allows specifying an inferrable type annotation for class properties."], Lint.Utils.dedent(_a, OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `", "` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the `typedef` rule.\n * `", "` allows specifying an inferrable type annotation for class properties."], ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows specifying an inferrable type annotation for function params.\n This can be useful when combining with the \\`typedef\\` rule.\n * \\`", "\\` allows specifying an inferrable type annotation for class properties."])), OPTION_IGNORE_PARMS, OPTION_IGNORE_PROPERTIES),
options: {
type: "array",
items: {
@@ -121,4 +121,4 @@ function typeIsInferrable(type, initializer) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
index 1e9b27cc8..6103d1624 100644
--- a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
index df4b9304c..0d8bd858a 100644
--- a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
@@ -35,6 +35,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n When function or constructor may be called with a type parameter but one isn't supplied or inferrable,\n TypeScript defaults to `{}`.\n This is often undesirable as the call is meant to be of a more specific type.\n "], ["\n When function or constructor may be called with a type parameter but one isn't supplied or inferrable,\n TypeScript defaults to \\`{}\\`.\n This is often undesirable as the call is meant to be of a more specific type.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -101,3 +102,4 @@ var NoInferredEmptyObjectTypeRule = /** @class */ (function (_super) {
};
return NoInferredEmptyObjectTypeRule;
}(Lint.AbstractWalker));
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noInternalModuleRule.js b/node_modules/tslint/lib/rules/noInternalModuleRule.js
index 06ed07e24..965b8c259 100644
--- a/node_modules/tslint/lib/rules/noInternalModuleRule.js
+++ b/node_modules/tslint/lib/rules/noInternalModuleRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var Rule = /** @class */ (function (_super) {
@@ -63,10 +64,10 @@ var NoInternalModuleWalker = /** @class */ (function (_super) {
NoInternalModuleWalker.prototype.checkModuleDeclaration = function (node, nested) {
if (!nested &&
node.name.kind === ts.SyntaxKind.Identifier &&
- !Lint.isNodeFlagSet(node, ts.NodeFlags.Namespace) &&
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.Namespace) &&
// augmenting global uses a special syntax that is allowed
// see https://github.com/Microsoft/TypeScript/pull/6213
- !Lint.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
var end = node.name.pos;
var start = end - "module".length;
this.addFailure(start, end, Rule.FAILURE_STRING, Lint.Replacement.replaceFromTo(start, end, "namespace"));
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
index 3fe553081..5dd00a4d3 100644
--- a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
@@ -31,11 +31,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-invalid-template-strings",
- // tslint:disable-next-line no-invalid-template-strings
- description: "Warns on use of `${` in non-template strings.",
+ description: "Warns on use of `\${` in non-template strings.",
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: "Interpolation will only work for template strings.",
type: "functionality",
typescriptOnly: false,
};
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
index a664f16a5..f3c779344 100644
--- a/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "..";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.js b/node_modules/tslint/lib/rules/noInvalidThisRule.js
index 49333d54f..1a427d9c2 100644
--- a/node_modules/tslint/lib/rules/noInvalidThisRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-invalid-this",
description: "Disallows using the `this` keyword outside of classes.",
rationale: "See [the rule's author's rationale here.](https://github.com/palantir/tslint/pull/1105#issue-147549402)",
- optionsDescription: (_a = ["\n One argument may be optionally provided:\n\n * `", "` disallows using the `this` keyword in functions within class methods."], _a.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` disallows using the \\`this\\` keyword in functions within class methods."], Lint.Utils.dedent(_a, OPTION_FUNCTION_IN_METHOD)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` disallows using the `this` keyword in functions within class methods."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` disallows using the \\`this\\` keyword in functions within class methods."])), OPTION_FUNCTION_IN_METHOD),
options: {
type: "array",
items: {
@@ -98,4 +98,4 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
index 4c0baeb89..d041cf4b4 100644
--- a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
@@ -29,7 +29,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-irregular-whitespace",
- description: "Disallow irregular whitespace outside of strings and comments",
+ description: "Disallow irregular whitespace within a file, including strings and comments.",
hasFix: true,
optionsDescription: "Not configurable.",
options: null,
diff --git a/node_modules/tslint/lib/rules/noMagicNumbersRule.js b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
index 483130dfe..4678c4f73 100644
--- a/node_modules/tslint/lib/rules/noMagicNumbersRule.js
+++ b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
+var tsutils_1 = require("tsutils");
var Lint = require("../index");
var utils_1 = require("../language/utils");
var Rule = /** @class */ (function (_super) {
@@ -26,14 +27,13 @@ var Rule = /** @class */ (function (_super) {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
- var allowedNumbers = this.ruleArguments.length > 0 ? this.ruleArguments : Rule.DEFAULT_ALLOWED;
- return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, new Set(allowedNumbers.map(String))));
+ return this.applyWithWalker(new NoMagicNumbersWalker(sourceFile, this.ruleName, this.ruleArguments.length > 0 ? this.ruleArguments : Rule.DEFAULT_ALLOWED));
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-magic-numbers",
- description: (_a = ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], _a.raw = ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Magic numbers should be avoided as they often lack documentation, forcing\n them to be stored in variables gives them implicit documentation."], _b.raw = ["\n Magic numbers should be avoided as they often lack documentation, forcing\n them to be stored in variables gives them implicit documentation."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."], ["\n Disallows the use constant number values outside of variable assignments.\n When no list of allowed values is specified, -1, 0 and 1 are allowed by default."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Magic numbers should be avoided as they often lack documentation.\n Forcing them to be stored in variables gives them implicit documentation.\n "], ["\n Magic numbers should be avoided as they often lack documentation.\n Forcing them to be stored in variables gives them implicit documentation.\n "]))),
optionsDescription: "A list of allowed numbers.",
options: {
type: "array",
@@ -72,6 +72,9 @@ var NoMagicNumbersWalker = /** @class */ (function (_super) {
NoMagicNumbersWalker.prototype.walk = function (sourceFile) {
var _this = this;
var cb = function (node) {
+ if (tsutils_1.isCallExpression(node) && tsutils_1.isIdentifier(node.expression) && node.expression.text === "parseInt") {
+ return node.arguments.length === 0 ? undefined : cb(node.arguments[0]);
+ }
if (node.kind === ts.SyntaxKind.NumericLiteral) {
return _this.checkNumericLiteral(node, node.text);
}
@@ -83,10 +86,12 @@ var NoMagicNumbersWalker = /** @class */ (function (_super) {
return ts.forEachChild(sourceFile, cb);
};
NoMagicNumbersWalker.prototype.checkNumericLiteral = function (node, num) {
- if (!Rule.ALLOWED_NODES.has(node.parent.kind) && !this.options.has(num)) {
+ /* Using Object.is() to differentiate between pos/neg zero */
+ if (!Rule.ALLOWED_NODES.has(node.parent.kind) &&
+ !this.options.some(function (allowedNum) { return Object.is(allowedNum, parseFloat(num)); })) {
this.addFailureAtNode(node, Rule.FAILURE_STRING);
}
};
return NoMagicNumbersWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
index ddc81e37c..9d47972ab 100644
--- a/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.js b/node_modules/tslint/lib/rules/noMisusedNewRule.js
index 4f166eb36..8a26af86c 100644
--- a/node_modules/tslint/lib/rules/noMisusedNewRule.js
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.js
@@ -35,6 +35,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Interfaces in TypeScript aren't meant to describe constructors on their implementations.\n The `new` descriptor is primarily for describing JavaScript libraries.\n If you're trying to describe a function known to be a class, it's typically better to `declare class`.\n "], ["\n Interfaces in TypeScript aren't meant to describe constructors on their implementations.\n The \\`new\\` descriptor is primarily for describing JavaScript libraries.\n If you're trying to describe a function known to be a class, it's typically better to \\`declare class\\`.\n "]))),
type: "functionality",
typescriptOnly: true,
};
@@ -72,3 +73,4 @@ function returnTypeMatchesParent(parent, decl) {
}
return decl.type.typeName.kind === ts.SyntaxKind.Identifier && decl.type.typeName.text === parent.name.text;
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.d.ts b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.js b/node_modules/tslint/lib/rules/noNamespaceRule.js
index 4afdb2ee4..602e49c91 100644
--- a/node_modules/tslint/lib/rules/noNamespaceRule.js
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.js
@@ -36,8 +36,8 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-namespace",
description: "Disallows use of internal \`module\`s and \`namespace\`s.",
descriptionDetails: "This rule still allows the use of `declare module ... {}`",
- rationale: (_a = ["\n ES6-style external modules are the standard way to modularize code.\n Using `module {}` and `namespace {}` are outdated ways to organize TypeScript code."], _a.raw = ["\n ES6-style external modules are the standard way to modularize code.\n Using \\`module {}\\` and \\`namespace {}\\` are outdated ways to organize TypeScript code."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n One argument may be optionally provided:\n\n * `", "` allows `declare namespace ... {}` to describe external APIs."], _b.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows \\`declare namespace ... {}\\` to describe external APIs."], Lint.Utils.dedent(_b, OPTION_ALLOW_DECLARATIONS)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ES6-style external modules are the standard way to modularize code.\n Using `module {}` and `namespace {}` are outdated ways to organize TypeScript code."], ["\n ES6-style external modules are the standard way to modularize code.\n Using \\`module {}\\` and \\`namespace {}\\` are outdated ways to organize TypeScript code."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows `declare namespace ... {}` to describe external APIs."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows \\`declare namespace ... {}\\` to describe external APIs."])), OPTION_ALLOW_DECLARATIONS),
options: {
type: "array",
items: {
@@ -73,4 +73,4 @@ function walk(ctx) {
}
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
index dc657fc53..f9b2b7857 100644
--- a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-non-null-assertion",
description: "Disallows non-null assertions using the `!` postfix operator.",
- rationale: "Using non-null assertion cancels the benefits of the strict null checking mode.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n ```\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n ```\n\n Either inform the strict type system that the object must exist:\n\n ```\n function foo(instance: MyClass) {\n instance.doWork();\n }\n ```\n\n Or verify that the instance exists, which will inform the type checker:\n\n ```\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n ```\n "], ["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n \\`\\`\\`\n\n Either inform the strict type system that the object must exist:\n\n \\`\\`\\`\n function foo(instance: MyClass) {\n instance.doWork();\n }\n \\`\\`\\`\n\n Or verify that the instance exists, which will inform the type checker:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n \\`\\`\\`\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -51,3 +51,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.js b/node_modules/tslint/lib/rules/noNullKeywordRule.js
index b54f9170c..5967586d1 100644
--- a/node_modules/tslint/lib/rules/noNullKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-null-keyword",
description: "Disallows use of the `null` keyword literal.",
- rationale: (_a = ["\n Instead of having the dual concepts of `null` and`undefined` in a codebase,\n this rule ensures that only `undefined` is used."], _a.raw = ["\n Instead of having the dual concepts of \\`null\\` and\\`undefined\\` in a codebase,\n this rule ensures that only \\`undefined\\` is used."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Instead of having the dual concepts of `null` and`undefined` in a codebase,\n this rule ensures that only `undefined` is used.\n\n JavaScript originally intended `undefined` to refer to a value that doesn't yet exist,\n while `null` was meant to refer to a value that does exist but points to nothing.\n That's confusing.\n `undefined` is the default value when object members don't exist, and is the return value\n for newer native collection APIs such as `Map.get` when collection values don't exist.\n\n ```\n const myObject = {};\n myObject.doesNotExist; // undefined\n ```\n\n ```\n const myMap = new Map<string, number>();\n myMap.get(\"doesNotExist\"); // undefined\n ```\n\n To remove confusion over the two similar values, it's better to stick with just `undefined`.\n "], ["\n Instead of having the dual concepts of \\`null\\` and\\`undefined\\` in a codebase,\n this rule ensures that only \\`undefined\\` is used.\n\n JavaScript originally intended \\`undefined\\` to refer to a value that doesn't yet exist,\n while \\`null\\` was meant to refer to a value that does exist but points to nothing.\n That's confusing.\n \\`undefined\\` is the default value when object members don't exist, and is the return value\n for newer native collection APIs such as \\`Map.get\\` when collection values don't exist.\n\n \\`\\`\\`\n const myObject = {};\n myObject.doesNotExist; // undefined\n \\`\\`\\`\n\n \\`\\`\\`\n const myMap = new Map<string, number>();\n myMap.get(\"doesNotExist\"); // undefined\n \\`\\`\\`\n\n To remove confusion over the two similar values, it's better to stick with just \\`undefined\\`.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -68,4 +68,4 @@ function walk(ctx) {
}
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
index 1690165bd..1cad0a6d3 100644
--- a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-object-literal-type-assertion",
- description: (_a = ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to `any` is still allowed."], _a.raw = ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to \\`any\\` is still allowed."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Always prefer `const x: T = { ... };` to `const x = { ... } as T;`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: `const x: { foo: number } = {}` will fail to compile, but\n `const x = {} as { foo: number }` will succeed."], _b.raw = ["\n Always prefer \\`const x: T = { ... };\\` to \\`const x = { ... } as T;\\`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: \\`const x: { foo: number } = {}\\` will fail to compile, but\n \\`const x = {} as { foo: number }\\` will succeed."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Forbids an object literal to appear in a type assertion expression.\n Casting to `any` is still allowed."], ["\n Forbids an object literal to appear in a type assertion expression.\n Casting to \\`any\\` is still allowed."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Always prefer `const x: T = { ... };` to `const x = { ... } as T;`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: `const x: { foo: number } = {}` will fail to compile, but\n `const x = {} as { foo: number }` will succeed."], ["\n Always prefer \\`const x: T = { ... };\\` to \\`const x = { ... } as T;\\`.\n The type assertion in the latter case is either unnecessary or hides an error.\n The compiler will warn for excess properties with this syntax, but not missing required fields.\n For example: \\`const x: { foo: number } = {}\\` will fail to compile, but\n \\`const x = {} as { foo: number }\\` will succeed."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -53,4 +53,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
index c7e07066c..5fc47f394 100644
--- a/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
index c852cee9c..193a7f4d6 100644
--- a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-parameter-properties",
description: "Disallows parameter properties in class constructors.",
- rationale: (_a = ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members."], _a.raw = ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members.\n\n It can be cleaner to keep member variable declarations in one list directly only the class\n (instead of mixed between direct class members and constructor parameter properties).\n "], ["\n Parameter properties can be confusing to those new to TS as they are less explicit\n than other ways of declaring and initializing class members.\n\n It can be cleaner to keep member variable declarations in one list directly only the class\n (instead of mixed between direct class members and constructor parameter properties).\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -59,4 +59,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
index 117f46536..db71bc3dc 100644
--- a/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts b/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
index 5d51fdd37..70451bcfa 100644
--- a/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
+++ b/node_modules/tslint/lib/rules/noRedundantJsdocRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noRedundantJsdocRule.js b/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
index 398162132..3d6eaae71 100644
--- a/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
+++ b/node_modules/tslint/lib/rules/noRedundantJsdocRule.js
@@ -76,20 +76,25 @@ function walk(ctx) {
case ts.SyntaxKind.JSDocAugmentsTag:
// OK
break;
- case ts.SyntaxKind.JSDocTemplateTag:
+ case ts.SyntaxKind.JSDocClassTag:
case ts.SyntaxKind.JSDocTypeTag:
case ts.SyntaxKind.JSDocTypedefTag:
case ts.SyntaxKind.JSDocPropertyTag:
// Always redundant
ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_REDUNDANT_TAG(tag.tagName.text));
break;
+ case ts.SyntaxKind.JSDocTemplateTag:
+ if (tag.comment === undefined || tag.comment === "") {
+ ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_NO_COMMENT(tag.tagName.text));
+ }
+ break;
case ts.SyntaxKind.JSDocReturnTag:
case ts.SyntaxKind.JSDocParameterTag: {
var _a = tag, typeExpression = _a.typeExpression, comment = _a.comment;
if (typeExpression !== undefined) {
ctx.addFailureAtNode(typeExpression, Rule.FAILURE_STRING_REDUNDANT_TYPE);
}
- if (comment === "") {
+ if (comment === undefined || comment === "") {
// Redundant if no documentation
ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_NO_COMMENT(tag.tagName.text));
}
diff --git a/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
index 65d573ba8..eeda34db8 100644
--- a/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
+++ b/node_modules/tslint/lib/rules/noReferenceImportRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReferenceRule.js b/node_modules/tslint/lib/rules/noReferenceRule.js
index e3325e20a..5fec96c3b 100644
--- a/node_modules/tslint/lib/rules/noReferenceRule.js
+++ b/node_modules/tslint/lib/rules/noReferenceRule.js
@@ -30,7 +30,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-reference",
description: "Disallows `/// <reference path=>` imports (use ES6-style imports instead).",
- rationale: (_a = ["\n Using `/// <reference path=>` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], _a.raw = ["\n Using \\`/// <reference path=>\\` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `/// <reference path=>` comments to load other files is outdated.\n Use ES6-style imports to reference other files."], ["\n Using \\`/// <reference path=>\\` comments to load other files is outdated.\n Use ES6-style imports to reference other files."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -48,4 +48,4 @@ function walk(ctx) {
ctx.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING);
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noRequireImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts b/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
+++ b/node_modules/tslint/lib/rules/noReturnAwaitRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noReturnAwaitRule.js b/node_modules/tslint/lib/rules/noReturnAwaitRule.js
index 67cc188ad..4e354dca6 100644
--- a/node_modules/tslint/lib/rules/noReturnAwaitRule.js
+++ b/node_modules/tslint/lib/rules/noReturnAwaitRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-return-await",
description: "Disallows unnecessary `return await`.",
- rationale: (_a = ["\n An async function always wraps the return value in a Promise.\n Using `return await` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], _a.raw = ["\n An async function always wraps the return value in a Promise.\n Using \\`return await\\` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n An async function always wraps the return value in a Promise.\n Using `return await` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "], ["\n An async function always wraps the return value in a Promise.\n Using \\`return await\\` just adds extra time before the overreaching promise is resolved without changing the semantics.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -107,4 +107,4 @@ function isInsideTryBlock(node) {
}
return false;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
index 1cd1b8c5c..759d5fafb 100644
--- a/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.js b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
index c2db583c6..7ada497cc 100644
--- a/node_modules/tslint/lib/rules/noShadowedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
@@ -36,8 +36,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-shadowed-variable",
description: "Disallows shadowing variable declarations.",
- rationale: "Shadowing a variable masks access to it and obscures to what value an identifier actually refers.",
- optionsDescription: (_a = ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are `\"class\"`, `\"enum\"`, `\"function\"`, `\"import\"`, `\"interface\"`, `\"namespace\"`, `\"typeAlias\"`\n and `\"typeParameter\"`. Just set the value to `false` for the check you want to disable.\n All checks default to `true`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n "], _a.raw = ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are \\`\"class\"\\`, \\`\"enum\"\\`, \\`\"function\"\\`, \\`\"import\"\\`, \\`\"interface\"\\`, \\`\"namespace\"\\`, \\`\"typeAlias\"\\`\n and \\`\"typeParameter\"\\`. Just set the value to \\`false\\` for the check you want to disable.\n All checks default to \\`true\\`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Shadowing a variable masks access to it and obscures to what value an identifier actually refers.\n For example, in the following code, it can be confusing why the filter is likely never true:\n\n ```\n const findNeighborsWithin = (instance: MyClass, instances: MyClass[]): MyClass[] => {\n return instances.filter((instance) => instance.neighbors.includes(instance));\n };\n ```\n "], ["\n Shadowing a variable masks access to it and obscures to what value an identifier actually refers.\n For example, in the following code, it can be confusing why the filter is likely never true:\n\n \\`\\`\\`\n const findNeighborsWithin = (instance: MyClass, instances: MyClass[]): MyClass[] => {\n return instances.filter((instance) => instance.neighbors.includes(instance));\n };\n \\`\\`\\`\n "]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are `\"class\"`, `\"enum\"`, `\"function\"`, `\"import\"`, `\"interface\"`, `\"namespace\"`, `\"typeAlias\"`\n and `\"typeParameter\"`. Just set the value to `false` for the check you want to disable.\n All checks default to `true`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n\n The option `\"temporalDeadZone\"` defaults to `true` which shows errors when shadowing block scoped declarations in their\n temporal dead zone. When set to `false` parameters, classes, enums and variables declared\n with `let` or `const` are not considered shadowed if the shadowing occurs within their\n [temporal dead zone](http://jsrocks.org/2015/01/temporal-dead-zone-tdz-demystified).\n\n The following example shows how the `\"temporalDeadZone\"` option changes the linting result:\n\n ```ts\n function fn(value) {\n if (value) {\n const tmp = value; // no error on this line if \"temporalDeadZone\" is false\n return tmp;\n }\n let tmp = undefined;\n if (!value) {\n const tmp = value; // this line always contains an error\n return tmp;\n }\n }\n ```\n "], ["\n You can optionally pass an object to disable checking for certain kinds of declarations.\n Possible keys are \\`\"class\"\\`, \\`\"enum\"\\`, \\`\"function\"\\`, \\`\"import\"\\`, \\`\"interface\"\\`, \\`\"namespace\"\\`, \\`\"typeAlias\"\\`\n and \\`\"typeParameter\"\\`. Just set the value to \\`false\\` for the check you want to disable.\n All checks default to \\`true\\`, i.e. are enabled by default.\n Note that you cannot disable variables and parameters.\n\n The option \\`\"temporalDeadZone\"\\` defaults to \\`true\\` which shows errors when shadowing block scoped declarations in their\n temporal dead zone. When set to \\`false\\` parameters, classes, enums and variables declared\n with \\`let\\` or \\`const\\` are not considered shadowed if the shadowing occurs within their\n [temporal dead zone](http://jsrocks.org/2015/01/temporal-dead-zone-tdz-demystified).\n\n The following example shows how the \\`\"temporalDeadZone\"\\` option changes the linting result:\n\n \\`\\`\\`ts\n function fn(value) {\n if (value) {\n const tmp = value; // no error on this line if \"temporalDeadZone\" is false\n return tmp;\n }\n let tmp = undefined;\n if (!value) {\n const tmp = value; // this line always contains an error\n return tmp;\n }\n }\n \\`\\`\\`\n "]))),
options: {
type: "object",
properties: {
@@ -49,6 +49,7 @@ var Rule = /** @class */ (function (_super) {
namespace: { type: "boolean" },
typeAlias: { type: "boolean" },
typeParameter: { type: "boolean" },
+ temporalDeadZone: { type: "boolean" },
},
},
optionExamples: [
@@ -62,7 +63,7 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function parseOptions(option) {
- return tslib_1.__assign({ class: true, enum: true, function: true, import: true, interface: true, namespace: true, typeAlias: true, typeParameter: true }, option);
+ return tslib_1.__assign({ class: true, enum: true, function: true, import: true, interface: true, namespace: true, temporalDeadZone: true, typeAlias: true, typeParameter: true }, option);
}
var Scope = /** @class */ (function () {
function Scope(functionScope) {
@@ -72,16 +73,21 @@ var Scope = /** @class */ (function () {
// if no functionScope is provided we are in the process of creating a new function scope, which for consistency links to itself
this.functionScope = functionScope !== undefined ? functionScope : this;
}
- Scope.prototype.addVariable = function (identifier, blockScoped) {
+ Scope.prototype.addVariable = function (identifier, blockScoped, tdz) {
if (blockScoped === void 0) { blockScoped = true; }
+ if (tdz === void 0) { tdz = false; }
// block scoped variables go to the block scope, function scoped variables to the containing function scope
var scope = blockScoped ? this : this.functionScope;
var list = scope.variables.get(identifier.text);
+ var variableInfo = {
+ identifier: identifier,
+ tdz: tdz,
+ };
if (list === undefined) {
- scope.variables.set(identifier.text, [identifier]);
+ scope.variables.set(identifier.text, [variableInfo]);
}
else {
- list.push(identifier);
+ list.push(variableInfo);
}
};
return Scope;
@@ -89,10 +95,15 @@ var Scope = /** @class */ (function () {
var NoShadowedVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoShadowedVariableWalker, _super);
function NoShadowedVariableWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Scope();
+ return _this;
}
NoShadowedVariableWalker.prototype.walk = function (sourceFile) {
var _this = this;
+ if (sourceFile.isDeclarationFile) {
+ return;
+ }
this.scope = new Scope();
var cb = function (node) {
var parentScope = _this.scope;
@@ -153,7 +164,7 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
break;
case ts.SyntaxKind.ClassDeclaration:
if (_this.options.class && node.name !== undefined) {
- parentScope.addVariable(node.name);
+ parentScope.addVariable(node.name, true, true);
}
// falls through
case ts.SyntaxKind.ClassExpression:
@@ -168,7 +179,7 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
break;
case ts.SyntaxKind.EnumDeclaration:
if (_this.options.enum) {
- parentScope.addVariable(node.name);
+ parentScope.addVariable(node.name, true, true);
}
break;
case ts.SyntaxKind.InterfaceDeclaration:
@@ -180,15 +191,21 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
if (node.parent.kind !== ts.SyntaxKind.IndexSignature &&
!tsutils_1.isThisParameter(node) &&
tsutils_1.isFunctionWithBody(node.parent)) {
- _this.handleBindingName(node.name, false);
+ _this.handleBindingName(node.name, false, true);
}
break;
case ts.SyntaxKind.ModuleDeclaration:
if (_this.options.namespace &&
node.parent.kind !== ts.SyntaxKind.ModuleDeclaration &&
- node.name.kind === ts.SyntaxKind.Identifier) {
+ node.name.kind === ts.SyntaxKind.Identifier &&
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation)) {
parentScope.addVariable(node.name, false);
}
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ _this.onScopeEnd(parentScope);
+ _this.scope = parentScope;
+ return; // don't check any ambient declaration blocks
+ }
break;
case ts.SyntaxKind.ImportClause:
if (_this.options.import && node.name !== undefined) {
@@ -238,15 +255,16 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
this.handleBindingName(variable.name, blockScoped);
}
};
- NoShadowedVariableWalker.prototype.handleBindingName = function (node, blockScoped) {
+ NoShadowedVariableWalker.prototype.handleBindingName = function (node, blockScoped, tdz) {
+ if (tdz === void 0) { tdz = blockScoped; }
if (node.kind === ts.SyntaxKind.Identifier) {
- this.scope.addVariable(node, blockScoped);
+ this.scope.addVariable(node, blockScoped, tdz);
}
else {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (element.kind !== ts.SyntaxKind.OmittedExpression) {
- this.handleBindingName(element.name, blockScoped);
+ this.handleBindingName(element.name, blockScoped, tdz);
}
}
}
@@ -255,14 +273,21 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
var _this = this;
var _a = this.scope, variables = _a.variables, variablesSeen = _a.variablesSeen;
variablesSeen.forEach(function (identifiers, name) {
- if (variables.has(name)) {
- for (var _i = 0, identifiers_1 = identifiers; _i < identifiers_1.length; _i++) {
- var identifier = identifiers_1[_i];
+ var declarationsInScope = variables.get(name);
+ var _loop_1 = function (identifier) {
+ if (declarationsInScope !== undefined &&
+ (_this.options.temporalDeadZone ||
+ // check if any of the declaration either has no temporal dead zone or is declared before the identifier
+ declarationsInScope.some(function (declaration) { return !declaration.tdz || declaration.identifier.pos < identifier.pos; }))) {
_this.addFailureAtNode(identifier, Rule.FAILURE_STRING_FACTORY(name));
}
- }
- else if (parent !== undefined) {
- addToList(parent.variablesSeen, name, identifiers);
+ else if (parent !== undefined) {
+ addOneToList(parent.variablesSeen, name, identifier);
+ }
+ };
+ for (var _i = 0, identifiers_1 = identifiers; _i < identifiers_1.length; _i++) {
+ var identifier = identifiers_1[_i];
+ _loop_1(identifier);
}
});
if (parent !== undefined) {
@@ -273,13 +298,24 @@ var NoShadowedVariableWalker = /** @class */ (function (_super) {
};
return NoShadowedVariableWalker;
}(Lint.AbstractWalker));
-function addToList(map, name, identifiers) {
+function addToList(map, name, variables) {
+ var list = map.get(name);
+ if (list === undefined) {
+ list = [];
+ map.set(name, list);
+ }
+ for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) {
+ var variable = variables_1[_i];
+ list.push(variable.identifier);
+ }
+}
+function addOneToList(map, name, identifier) {
var list = map.get(name);
if (list === undefined) {
- map.set(name, identifiers);
+ map.set(name, [identifier]);
}
else {
- list.push.apply(list, identifiers);
+ list.push(identifier);
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSparseArraysRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
index cce59d100..06cb02d5e 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.d.ts
@@ -1,7 +1,24 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING: string;
+ static id(input: string): string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.js b/node_modules/tslint/lib/rules/noStringLiteralRule.js
index c543aa4d8..c0669cf83 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.js
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.js
@@ -25,14 +25,17 @@ var Rule = /** @class */ (function (_super) {
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
+ Rule.id = function (input) {
+ return input;
+ };
Rule.prototype.apply = function (sourceFile) {
return this.applyWithFunction(sourceFile, walk);
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-string-literal",
- description: (_a = ["\n Forbids unnecessary string literal property access.\n Allows `obj[\"prop-erty\"]` (can't be a regular property access).\n Disallows `obj[\"property\"]` (should be `obj.property`)."], _a.raw = ["\n Forbids unnecessary string literal property access.\n Allows \\`obj[\"prop-erty\"]\\` (can't be a regular property access).\n Disallows \\`obj[\"property\"]\\` (should be \\`obj.property\\`)."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n If `--noImplicitAny` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], _b.raw = ["\n If \\`--noImplicitAny\\` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Forbids unnecessary string literal property access.\n Allows `obj[\"prop-erty\"]` (can't be a regular property access).\n Disallows `obj[\"property\"]` (should be `obj.property`)."], ["\n Forbids unnecessary string literal property access.\n Allows \\`obj[\"prop-erty\"]\\` (can't be a regular property access).\n Disallows \\`obj[\"property\"]\\` (should be \\`obj.property\\`)."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n If `--noImplicitAny` is turned off,\n property access via a string literal will be 'any' if the property does not exist."], ["\n If \\`--noImplicitAny\\` is turned off,\n property access via a string literal will be 'any' if the property does not exist."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -50,8 +53,12 @@ function walk(ctx) {
if (tsutils_1.isElementAccessExpression(node)) {
var argument = node.argumentExpression;
if (argument !== undefined && tsutils_1.isStringLiteral(argument) && tsutils_1.isValidPropertyAccess(argument.text)) {
- // for compatibility with typescript@<2.5.0 to avoid fixing expr['__foo'] to expr.___foo
- var propertyName = ts.unescapeIdentifier(argument.text); // tslint:disable-line:deprecation
+ // typescript@<2.5.0 has an extra underscore in escaped identifier text content,
+ // to avoid fixing issue `expr['__foo'] → expr.___foo`, unescapeIdentifier() is to be used
+ // As of typescript@3, unescapeIdentifier() removed, thus check in runtime, if the method exists
+ // tslint:disable-next-line no-unsafe-any strict-boolean-expressions
+ var unescapeIdentifier = ts.unescapeIdentifier || Rule.id;
+ var propertyName = unescapeIdentifier(argument.text);
ctx.addFailureAtNode(argument, Rule.FAILURE_STRING,
// expr['foo'] -> expr.foo
Lint.Replacement.replaceFromTo(node.expression.end, node.end, "." + propertyName));
@@ -60,4 +67,4 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.d.ts b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.js b/node_modules/tslint/lib/rules/noStringThrowRule.js
index 1640b91cf..84c314db1 100644
--- a/node_modules/tslint/lib/rules/noStringThrowRule.js
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var noStringThrowRule_examples_1 = require("./code-examples/noStringThrowRule.examples");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -31,11 +32,13 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-string-throw",
- description: "Flags throwing plain strings or concatenations of strings " +
- "because only Errors produce proper stack traces.",
+ description: "Flags throwing plain strings or concatenations of strings.",
hasFix: true,
options: null,
+ optionExamples: [true],
optionsDescription: "Not configurable.",
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Example \u2013 Doing it right\n\n ```ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n ```\n\n Example \u2013 Anti Pattern\n\n ```ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n ```\n\n Only Error objects contain a `.stack` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "], ["\n Example \u2013 Doing it right\n\n \\`\\`\\`ts\n // throwing an Error from typical function, whether sync or async\n if (!productToAdd) {\n throw new Error(\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Example \u2013 Anti Pattern\n\n \\`\\`\\`ts\n // throwing a string lacks any stack trace information and other important data properties\n if (!productToAdd) {\n throw (\"How can I add new product when no value provided?\");\n }\n \\`\\`\\`\n\n Only Error objects contain a \\`.stack\\` member equivalent to the current stack trace.\n Primitives such as strings do not.\n "]))),
+ codeExamples: noStringThrowRule_examples_1.codeExamples,
type: "functionality",
typescriptOnly: false,
};
@@ -75,3 +78,4 @@ function isString(node) {
return false;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
index d0ae3c619..1e053483a 100644
--- a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
+++ b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
@@ -31,8 +31,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-submodule-imports",
- description: (_a = ["\n Disallows importing any submodule."], _a.raw = ["\n Disallows importing any submodule."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], _b.raw = ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows importing any submodule."], ["\n Disallows importing any submodule."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."], ["\n Submodules of some packages are treated as private APIs and the import\n paths may change without deprecation periods. It's best to stick with\n top-level package exports."]))),
optionsDescription: "A list of whitelisted package or submodule names.",
options: {
type: "array",
@@ -49,9 +49,8 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
- for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 31 /* All */); _i < _a.length; _i++) {
+ for (var _i = 0, _a = tsutils_1.findImports(ctx.sourceFile, 63 /* All */); _i < _a.length; _i++) {
var name = _a[_i];
- // TODO remove assertion on upgrade to typescript@2.5.2
if (!ts.isExternalModuleNameRelative(name.text) &&
isSubmodulePath(name.text) &&
!isWhitelisted(name.text, ctx.options)) {
@@ -71,4 +70,4 @@ function isWhitelisted(path, whitelist) {
function isSubmodulePath(path) {
return path.split("/").length > (path[0] === "@" ? 2 : 1);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
index ff699286d..46b8a7ad1 100644
--- a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -7,6 +23,6 @@ export declare class Rule extends Lint.Rules.AbstractRule {
}
export declare class NoSwitchCaseFallThroughWalker extends Lint.AbstractWalker<void> {
walk(sourceFile: ts.SourceFile): void | undefined;
- private visitSwitchStatement({caseBlock: {clauses}});
- private isFallThroughAllowed(clause);
+ private visitSwitchStatement;
+ private isFallThroughAllowed;
}
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
index 713e91fae..428da3e3f 100644
--- a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-switch-case-fall-through",
description: "Disallows falling through case statements.",
- descriptionDetails: (_a = ["\n For example, the following is not allowed:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n ```\n\n However, fall through is allowed when case statements are consecutive or\n a magic `/* falls through */` comment is present. The following is valid:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n ```"], _a.raw = ["\n For example, the following is not allowed:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n \\`\\`\\`\n\n However, fall through is allowed when case statements are consecutive or\n a magic \\`/* falls through */\\` comment is present. The following is valid:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n \\`\\`\\`"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n For example, the following is not allowed:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n ```\n\n However, fall through is allowed when case statements are consecutive or\n a magic `/* falls through */` comment is present. The following is valid:\n\n ```ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n ```"], ["\n For example, the following is not allowed:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n case 2:\n someOtherFunc(foo);\n }\n \\`\\`\\`\n\n However, fall through is allowed when case statements are consecutive or\n a magic \\`/* falls through */\\` comment is present. The following is valid:\n\n \\`\\`\\`ts\n switch(foo) {\n case 1:\n someFunc(foo);\n /* falls through */\n case 2:\n case 3:\n someOtherFunc(foo);\n }\n \\`\\`\\`"]))),
rationale: "Fall though in switch statements is often unintentional and a bug.",
optionsDescription: "Not configurable.",
options: null,
@@ -84,4 +84,4 @@ var NoSwitchCaseFallThroughWalker = /** @class */ (function (_super) {
return NoSwitchCaseFallThroughWalker;
}(Lint.AbstractWalker));
exports.NoSwitchCaseFallThroughWalker = NoSwitchCaseFallThroughWalker;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts b/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
index 2eaf0e03c..da606e4b6 100644
--- a/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
+++ b/node_modules/tslint/lib/rules/noThisAssignmentRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noThisAssignmentRule.js b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
index 5d509faa8..df581bdb8 100644
--- a/node_modules/tslint/lib/rules/noThisAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a, _b;
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -71,9 +72,8 @@ var Rule = /** @class */ (function (_super) {
_b),
type: "object",
},
- optionsDescription: (_c = ["\n Two options may be provided on an object:\n\n * `", "` allows using destructuring to access members of `this` (e.g. `{ foo, bar } = this;`).\n * `", "` may be specified as a list of regular expressions to match allowed variable names."], _c.raw = ["\n Two options may be provided on an object:\n\n * \\`", "\\` allows using destructuring to access members of \\`this\\` (e.g. \\`{ foo, bar } = this;\\`).\n * \\`", "\\` may be specified as a list of regular expressions to match allowed variable names."], Lint.Utils.dedent(_c, ALLOW_THIS_DESTRUCTURING, ALLOWED_THIS_NAMES)),
- rationale: "Assigning a variable to `this` instead of properly using arrow lambdas "
- + "may be a symptom of pre-ES6 practices or not manging scope well.",
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two options may be provided on an object:\n\n * `", "` allows using destructuring to access members of `this` (e.g. `{ foo, bar } = this;`).\n * `", "` may be specified as a list of regular expressions to match allowed variable names."], ["\n Two options may be provided on an object:\n\n * \\`", "\\` allows using destructuring to access members of \\`this\\` (e.g. \\`{ foo, bar } = this;\\`).\n * \\`", "\\` may be specified as a list of regular expressions to match allowed variable names."])), ALLOW_THIS_DESTRUCTURING, ALLOWED_THIS_NAMES),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Assigning a variable to `this` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices\n or not managing scope well.\n\n Instead of storing a reference to `this` and using it inside a `function () {`:\n\n ```\n const self = this;\n\n setTimeout(function () {\n self.doWork();\n });\n ```\n\n Use `() =>` arrow lambdas, as they preserve `this` scope for you:\n\n ```\n setTimeout(() => {\n this.doWork();\n });\n ```\n "], ["\n Assigning a variable to \\`this\\` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices\n or not managing scope well.\n\n Instead of storing a reference to \\`this\\` and using it inside a \\`function () {\\`:\n\n \\`\\`\\`\n const self = this;\n\n setTimeout(function () {\n self.doWork();\n });\n \\`\\`\\`\n\n Use \\`() =>\\` arrow lambdas, as they preserve \\`this\\` scope for you:\n\n \\`\\`\\`\n setTimeout(() => {\n this.doWork();\n });\n \\`\\`\\`\n "]))),
ruleName: "no-this-assignment",
type: "functionality",
typescriptOnly: false,
@@ -125,4 +125,4 @@ var NoThisAssignmentWalker = /** @class */ (function (_super) {
};
return NoThisAssignmentWalker;
}(Lint.AbstractWalker));
-var _a, _b, _c;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
index 5ad6cbe8a..44041143b 100644
--- a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
@@ -44,7 +44,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "no-trailing-whitespace",
description: "Disallows trailing whitespace at the end of a line.",
rationale: "Keeps version control diffs clean as it prevents accidental whitespace from being committed.",
- optionsDescription: (_a = ["\n Possible settings are:\n\n * `\"", "\"`: Allows trailing whitespace in template strings.\n * `\"", "\"`: Allows trailing whitespace in comments.\n * `\"", "\"`: Allows trailing whitespace only in JSDoc comments.\n * `\"", "\"`: Allows trailing whitespace on empty lines."], _a.raw = ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Allows trailing whitespace in template strings.\n * \\`\"", "\"\\`: Allows trailing whitespace in comments.\n * \\`\"", "\"\\`: Allows trailing whitespace only in JSDoc comments.\n * \\`\"", "\"\\`: Allows trailing whitespace on empty lines."], Lint.Utils.dedent(_a, OPTION_IGNORE_TEMPLATE_STRINGS, OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC, OPTION_IGNORE_BLANK_LINES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Possible settings are:\n\n * `\"", "\"`: Allows trailing whitespace in template strings.\n * `\"", "\"`: Allows trailing whitespace in comments.\n * `\"", "\"`: Allows trailing whitespace only in JSDoc comments.\n * `\"", "\"`: Allows trailing whitespace on empty lines."], ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Allows trailing whitespace in template strings.\n * \\`\"", "\"\\`: Allows trailing whitespace in comments.\n * \\`\"", "\"\\`: Allows trailing whitespace only in JSDoc comments.\n * \\`\"", "\"\\`: Allows trailing whitespace on empty lines."])), OPTION_IGNORE_TEMPLATE_STRINGS, OPTION_IGNORE_COMMENTS, OPTION_IGNORE_JSDOC, OPTION_IGNORE_BLANK_LINES),
hasFix: true,
options: {
type: "array",
@@ -129,4 +129,4 @@ function getExcludedComments(sourceFile, options) {
function isJsDoc(sourceText, kind, range) {
return kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceText[range.pos + 2] === "*" && sourceText[range.pos + 3] !== "*";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.js b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
index 153550c57..d8085193a 100644
--- a/node_modules/tslint/lib/rules/noUnboundMethodRule.js
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
@@ -34,13 +34,14 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unbound-method",
- description: "Warns when a method is used as outside of a method call.",
+ description: "Warns when a method is used outside of a method call.",
optionsDescription: "You may optionally pass \"" + OPTION_IGNORE_STATIC + "\" to ignore static methods.",
options: {
type: "string",
enum: [OPTION_IGNORE_STATIC],
},
optionExamples: [true, [true, OPTION_IGNORE_STATIC]],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Class functions don't preserve the class scope when passed as standalone variables.\n For example, this code will log the global scope (`window`/`global`), not the class instance:\n\n ```\n class MyClass {\n public log(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const log = instance.log;\n\n log();\n ```\n\n You need to either use an arrow lambda (`() => {...}`) or call the function with the correct scope.\n\n ```\n class MyClass {\n public logArrowBound = (): void => {\n console.log(bound);\n };\n\n public logManualBind(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const logArrowBound = instance.logArrowBound;\n const logManualBind = instance.logManualBind.bind(instance);\n\n logArrowBound();\n logManualBind();\n ```\n "], ["\n Class functions don't preserve the class scope when passed as standalone variables.\n For example, this code will log the global scope (\\`window\\`/\\`global\\`), not the class instance:\n\n \\`\\`\\`\n class MyClass {\n public log(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const log = instance.log;\n\n log();\n \\`\\`\\`\n\n You need to either use an arrow lambda (\\`() => {...}\\`) or call the function with the correct scope.\n\n \\`\\`\\`\n class MyClass {\n public logArrowBound = (): void => {\n console.log(bound);\n };\n\n public logManualBind(): void {\n console.log(this);\n }\n }\n\n const instance = new MyClass();\n const logArrowBound = instance.logArrowBound;\n const logManualBind = instance.logManualBind.bind(instance);\n\n logArrowBound();\n logManualBind();\n \\`\\`\\`\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -78,8 +79,9 @@ function isSafeUse(node) {
return parent.expression === node;
case ts.SyntaxKind.TaggedTemplateExpression:
return parent.tag === node;
- // E.g. `obj.method.bind(obj)`.
+ // E.g. `obj.method.bind(obj) or obj.method["prop"]`.
case ts.SyntaxKind.PropertyAccessExpression:
+ case ts.SyntaxKind.ElementAccessExpression:
return true;
// Allow most binary operators, but don't allow e.g. `myArray.forEach(obj.method || otherObj.otherMethod)`.
case ts.SyntaxKind.BinaryExpression:
@@ -102,3 +104,4 @@ function isSafeUse(node) {
return false;
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
index 218e9218e..00469f0ca 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
index 25c7f9173..ecc2337ed 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
@@ -35,10 +35,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unnecessary-callback-wrapper",
- description: (_a = ["\n Replaces `x => f(x)` with just `f`.\n To catch more cases, enable `only-arrow-functions` and `arrow-return-shorthand` too."], _a.raw = ["\n Replaces \\`x => f(x)\\` with just \\`f\\`.\n To catch more cases, enable \\`only-arrow-functions\\` and \\`arrow-return-shorthand\\` too."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Replaces `x => f(x)` with just `f`.\n To catch more cases, enable `only-arrow-functions` and `arrow-return-shorthand` too."], ["\n Replaces \\`x => f(x)\\` with just \\`f\\`.\n To catch more cases, enable \\`only-arrow-functions\\` and \\`arrow-return-shorthand\\` too."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n There's generally no reason to wrap a function with a callback wrapper if it's directly called anyway.\n Doing so creates extra inline lambdas that slow the runtime down.\n "], ["\n There's generally no reason to wrap a function with a callback wrapper if it's directly called anyway.\n Doing so creates extra inline lambdas that slow the runtime down.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -83,4 +84,4 @@ function isRedundantCallback(parameters, args, expression) {
}
return true;
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js b/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
index fff8b5ed1..950dbda43 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryClassRule.js
@@ -41,9 +41,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unnecessary-class",
- description: (_a = ["\n Disallows classes that are not strictly necessary."], _a.raw = ["\n Disallows classes that are not strictly necessary."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], _b.raw = ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n Three arguments may be optionally provided:\n\n * `\"allow-constructor-only\"` ignores classes whose members are constructors.\n * `\"allow-empty-class\"` ignores `class DemoClass {}`.\n * `\"allow-static-only\"` ignores classes whose members are static."], _c.raw = ["\n Three arguments may be optionally provided:\n\n * \\`\"allow-constructor-only\"\\` ignores classes whose members are constructors.\n * \\`\"allow-empty-class\"\\` ignores \\`class DemoClass {}\\`.\n * \\`\"allow-static-only\"\\` ignores classes whose members are static."], Lint.Utils.dedent(_c)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows classes that are not strictly necessary."], ["\n Disallows classes that are not strictly necessary."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."], ["\n Users who come from a Java-style OO language may wrap\n their utility functions in an extra class, instead of\n putting them at the top level."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Three arguments may be optionally provided:\n\n * `\"allow-constructor-only\"` ignores classes whose members are constructors.\n * `\"allow-empty-class\"` ignores `class DemoClass {}`.\n * `\"allow-static-only\"` ignores classes whose members are static."], ["\n Three arguments may be optionally provided:\n\n * \\`\"allow-constructor-only\"\\` ignores classes whose members are constructors.\n * \\`\"allow-empty-class\"\\` ignores \\`class DemoClass {}\\`.\n * \\`\"allow-static-only\"\\` ignores classes whose members are static."]))),
options: {
type: "array",
items: {
@@ -110,4 +110,4 @@ function hasExtendsClause(declaration) {
function isConstructorWithShorthandProps(member) {
return tsutils_1.isConstructorDeclaration(member) && member.parameters.some(tsutils_1.isParameterProperty);
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
index 37c1931a4..05f0e2842 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
index 794c668fb..110938857 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
@@ -36,6 +36,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Values in JavaScript default to `undefined`.\n There's no need to do so manually.\n "], ["\n Values in JavaScript default to \\`undefined\\`.\n There's no need to do so manually.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -53,7 +54,7 @@ function walk(ctx) {
checkInitializer(node);
break;
case ts.SyntaxKind.VariableDeclaration:
- if (!tsutils_1.isBindingPattern(node.name) && !Lint.isNodeFlagSet(node.parent, ts.NodeFlags.Const)) {
+ if (!tsutils_1.isBindingPattern(node.name) && !tsutils_1.isNodeFlagSet(node.parent, ts.NodeFlags.Const)) {
checkInitializer(node);
}
break;
@@ -82,7 +83,7 @@ function walk(ctx) {
}
}
function failWithFix(node) {
- var fix = Lint.Replacement.deleteFromTo(Lint.childOfKind(node, ts.SyntaxKind.EqualsToken).pos, node.end);
+ var fix = Lint.Replacement.deleteFromTo(tsutils_1.getChildOfKind(node, ts.SyntaxKind.EqualsToken).pos, node.end);
ctx.addFailureAtNode(node, Rule.FAILURE_STRING, fix);
}
}
@@ -102,3 +103,4 @@ function isUndefined(node) {
node.kind === ts.SyntaxKind.Identifier &&
node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
index af476a3f9..a6143341f 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
index a9a32b362..2c89620b7 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
@@ -113,7 +113,6 @@ function walk(ctx, checker) {
return alias !== undefined && symbolIsNamespaceInScope(alias);
}
function symbolsAreEqual(accessed, inScope) {
- // TODO remove type assertion on update to typescript@2.6.0
if (checker.getExportSymbolOfSymbol !== undefined) {
inScope = checker.getExportSymbolOfSymbol(inScope);
return accessed === inScope;
@@ -124,5 +123,5 @@ function walk(ctx, checker) {
}
}
function tryGetAliasedSymbol(symbol, checker) {
- return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
+ return utils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
index 6af6a0d60..ca3a278e0 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
@@ -61,8 +61,10 @@ var Walker = /** @class */ (function (_super) {
var _this = this;
var cb = function (node) {
switch (node.kind) {
- case ts.SyntaxKind.TypeAssertionExpression:
case ts.SyntaxKind.NonNullExpression:
+ _this.checkNonNullAssertion(node);
+ break;
+ case ts.SyntaxKind.TypeAssertionExpression:
case ts.SyntaxKind.AsExpression:
_this.verifyCast(node);
}
@@ -70,23 +72,19 @@ var Walker = /** @class */ (function (_super) {
};
return ts.forEachChild(sourceFile, cb);
};
+ Walker.prototype.checkNonNullAssertion = function (node) {
+ var type = this.checker.getTypeAtLocation(node.expression);
+ if (type === this.checker.getNonNullableType(type)) {
+ this.addFailureAtNode(node, Rule.FAILURE_STRING, Lint.Replacement.deleteFromTo(node.expression.end, node.end));
+ }
+ };
Walker.prototype.verifyCast = function (node) {
- if (tsutils_1.isAssertionExpression(node) && this.options.indexOf(node.type.getText(this.sourceFile)) !== -1) {
+ if (this.options.indexOf(node.type.getText(this.sourceFile)) !== -1) {
return;
}
var castType = this.checker.getTypeAtLocation(node);
- if (castType === undefined) {
- return;
- }
- if (node.kind !== ts.SyntaxKind.NonNullExpression &&
- (tsutils_1.isTypeFlagSet(castType, ts.TypeFlags.Literal) ||
- tsutils_1.isObjectType(castType) &&
- tsutils_1.isObjectFlagSet(castType, ts.ObjectFlags.Tuple)) ||
- // Sometimes tuple types don't have ObjectFlags.Tuple set, like when
- // they're being matched against an inferred type. So, in addition,
- // check if any properties are numbers, which implies that this is
- // likely a tuple type.
- (castType.getProperties().some(function (symbol) { return !isNaN(Number(symbol.name)); }))) {
+ if (tsutils_1.isTypeFlagSet(castType, ts.TypeFlags.Literal) ||
+ tsutils_1.isObjectType(castType) && (tsutils_1.isObjectFlagSet(castType, ts.ObjectFlags.Tuple) || couldBeTupleType(castType))) {
// It's not always safe to remove a cast to a literal type or tuple
// type, as those types are sometimes widened without the cast.
return;
@@ -95,8 +93,35 @@ var Walker = /** @class */ (function (_super) {
if (uncastType === castType) {
this.addFailureAtNode(node, Rule.FAILURE_STRING, node.kind === ts.SyntaxKind.TypeAssertionExpression
? Lint.Replacement.deleteFromTo(node.getStart(), node.expression.getStart())
- : Lint.Replacement.deleteFromTo(node.expression.getEnd(), node.getEnd()));
+ : Lint.Replacement.deleteFromTo(node.expression.end, node.end));
}
};
return Walker;
}(Lint.AbstractWalker));
+/**
+ * Sometimes tuple types don't have ObjectFlags.Tuple set, like when they're being matched against an inferred type.
+ * So, in addition, check if there are integer properties 0..n and no other numeric keys
+ */
+function couldBeTupleType(type) {
+ var properties = type.getProperties();
+ if (properties.length === 0) {
+ return false;
+ }
+ var i = 0;
+ for (; i < properties.length; ++i) {
+ var name = properties[i].name;
+ if (String(i) !== name) {
+ if (i === 0) {
+ // if there are no integer properties, this is not a tuple
+ return false;
+ }
+ break;
+ }
+ }
+ for (; i < properties.length; ++i) {
+ if (String(+properties[i].name) === properties[i].name) {
+ return false; // if there are any other numeric properties, this is not a tuple
+ }
+ }
+ return true;
+}
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
index c0a36360a..301b55b48 100644
--- a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
@@ -20,6 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var utils_1 = require("../utils");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -31,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unsafe-any",
- description: (_a = ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for `{} | null | undefined`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as `\"\" + x`) are allowed."], _a.raw = ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for \\`{} | null | undefined\\`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as \\`\"\" + x\\`) are allowed."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for `{} | null | undefined`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as `\"\" + x`) are allowed."], ["\n Warns when using an expression of type 'any' in a dynamic way.\n Uses are only allowed if they would work for \\`{} | null | undefined\\`.\n Type casts and tests are allowed.\n Expressions that work on all values (such as \\`\"\" + x\\`) are allowed."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use `<T>` template types for generic type handling.\n\n Also see the `no-any` rule.\n "], ["\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use \\`<T>\\` template types for generic type handling.\n\n Also see the \\`no-any\\` rule.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
@@ -115,6 +117,10 @@ var NoUnsafeAnyWalker = /** @class */ (function (_super) {
return initializer !== undefined &&
this.visitNode(initializer, isPropertyAny(node, this.checker));
}
+ case ts.SyntaxKind.SpreadAssignment:
+ return this.visitNode(node.expression,
+ // allow any in object spread, but not in object rest
+ !tsutils_1.isReassignmentTarget(node.parent));
case ts.SyntaxKind.ComputedPropertyName:
return this.visitNode(node.expression, true);
case ts.SyntaxKind.TaggedTemplateExpression: {
@@ -284,10 +290,10 @@ var NoUnsafeAnyWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.EqualsEqualsToken:
case ts.SyntaxKind.CommaToken: // Allow `any, any`
case ts.SyntaxKind.BarBarToken: // Allow `any || any`
- case ts.SyntaxKind.AmpersandAmpersandToken:// Allow `any && any`
+ case ts.SyntaxKind.AmpersandAmpersandToken: // Allow `any && any`
allowAnyLeft = allowAnyRight = true;
break;
- case ts.SyntaxKind.InstanceOfKeyword:// Allow test
+ case ts.SyntaxKind.InstanceOfKeyword: // Allow test
allowAnyLeft = true;
break;
case ts.SyntaxKind.EqualsToken:
@@ -359,12 +365,44 @@ function isPropertyAny(node, checker) {
return true;
}
function isNodeAny(node, checker) {
+ var symbol = checker.getSymbolAtLocation(node);
+ if (symbol !== undefined && tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
+ symbol = checker.getAliasedSymbol(symbol);
+ }
+ if (symbol !== undefined) {
+ // NamespaceModule is a type-only namespace without runtime value, its type is 'any' when used as 'ns.Type' -> avoid error
+ if (tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.NamespaceModule)) {
+ return false;
+ }
+ if (tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
+ return isAny(checker.getDeclaredTypeOfSymbol(symbol));
+ }
+ }
+ // Lowercase JSX elements are assumed to be allowed by design
+ if (isJsxNativeElement(node)) {
+ return false;
+ }
return isAny(checker.getTypeAtLocation(node));
}
+var jsxElementTypes = new Set([
+ ts.SyntaxKind.JsxClosingElement,
+ ts.SyntaxKind.JsxOpeningElement,
+ ts.SyntaxKind.JsxSelfClosingElement,
+]);
+function isJsxNativeElement(node) {
+ if (!tsutils_1.isIdentifier(node) || node.parent === undefined) {
+ return false;
+ }
+ // TypeScript <=2.1 incorrectly parses JSX fragments
+ if (node.text === "") {
+ return true;
+ }
+ return jsxElementTypes.has(node.parent.kind) && utils_1.isLowerCase(node.text[0]);
+}
function isStringLike(expr, checker) {
- return Lint.isTypeFlagSet(checker.getTypeAtLocation(expr), ts.TypeFlags.StringLike);
+ return tsutils_1.isTypeFlagSet(checker.getTypeAtLocation(expr), ts.TypeFlags.StringLike);
}
function isAny(type) {
- return type !== undefined && Lint.isTypeFlagSet(type, ts.TypeFlags.Any);
+ return type !== undefined && tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any);
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
index 117f46536..760aa26c0 100644
--- a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
index ea28c23f4..7fae6d742 100644
--- a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
@@ -35,9 +35,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unsafe-finally",
- description: (_a = ["\n Disallows control flow statements, such as `return`, `continue`,\n `break` and `throws` in finally blocks."], _a.raw = ["\n Disallows control flow statements, such as \\`return\\`, \\`continue\\`,\n \\`break\\` and \\`throws\\` in finally blocks."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows control flow statements, such as `return`, `continue`,\n `break` and `throws` in finally blocks."], ["\n Disallows control flow statements, such as \\`return\\`, \\`continue\\`,\n \\`break\\` and \\`throws\\` in finally blocks."]))),
descriptionDetails: "",
- rationale: (_b = ["\n When used inside `finally` blocks, control flow statements,\n such as `return`, `continue`, `break` and `throws`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], _b.raw = ["\n When used inside \\`finally\\` blocks, control flow statements,\n such as \\`return\\`, \\`continue\\`, \\`break\\` and \\`throws\\`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], Lint.Utils.dedent(_b)),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n When used inside `finally` blocks, control flow statements,\n such as `return`, `continue`, `break` and `throws`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."], ["\n When used inside \\`finally\\` blocks, control flow statements,\n such as \\`return\\`, \\`continue\\`, \\`break\\` and \\`throws\\`\n override any other control flow statements in the same try/catch scope.\n This is confusing and unexpected behavior."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -133,4 +133,4 @@ function printJumpKind(node) {
return "return";
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
index cce59d100..cb4dfbb50 100644
--- a/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2014 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
index 7390a6984..6e3794a53 100644
--- a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
@@ -39,9 +39,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-unused-expression",
description: "Disallows unused expression statements.",
- descriptionDetails: (_a = ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], _a.raw = ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n Detects potential errors where an assignment or function call was intended."], _b.raw = ["\n Detects potential errors where an assignment or function call was intended."], Lint.Utils.dedent(_b)),
- optionsDescription: (_c = ["\n Two arguments may be optionally provided:\n\n * `", "` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. `e && e.preventDefault()`).\n * `", "` allows 'new' expressions for side effects (e.g. `new ModifyGlobalState();`.\n * `", "` allows tagged templates for side effects (e.g. `this.add\\`foo\\`;`."], _c.raw = ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. \\`e && e.preventDefault()\\`).\n * \\`", "\\` allows 'new' expressions for side effects (e.g. \\`new ModifyGlobalState();\\`.\n * \\`", "\\` allows tagged templates for side effects (e.g. \\`this.add\\\\\\`foo\\\\\\`;\\`."], Lint.Utils.dedent(_c, ALLOW_FAST_NULL_CHECKS, ALLOW_NEW, ALLOW_TAGGED_TEMPLATE)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."], ["\n Unused expressions are expression statements which are not assignments or function calls\n (and thus usually no-ops)."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Detects potential errors where an assignment or function call was intended."], ["\n Detects potential errors where an assignment or function call was intended."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `", "` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. `e && e.preventDefault()`).\n * `", "` allows 'new' expressions for side effects (e.g. `new ModifyGlobalState();`.\n * `", "` allows tagged templates for side effects (e.g. `this.add\\`foo\\`;`."], ["\n Two arguments may be optionally provided:\n\n * \\`", "\\` allows to use logical operators to perform fast null checks and perform\n method or function calls for side effects (e.g. \\`e && e.preventDefault()\\`).\n * \\`", "\\` allows 'new' expressions for side effects (e.g. \\`new ModifyGlobalState();\\`.\n * \\`", "\\` allows tagged templates for side effects (e.g. \\`this.add\\\\\\`foo\\\\\\`;\\`."])), ALLOW_FAST_NULL_CHECKS, ALLOW_NEW, ALLOW_TAGGED_TEMPLATE),
options: {
type: "array",
items: {
@@ -211,4 +211,4 @@ function canContainDirective(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3;
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
index 60ae7f538..566348792 100644
--- a/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2014 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.js b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
index b7b9f6fe4..8a7d7b5af 100644
--- a/node_modules/tslint/lib/rules/noUnusedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var semver = require("semver");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -34,10 +35,10 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unused-variable",
- description: (_a = ["Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], _a.raw = ["Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], Lint.Utils.dedent(_a)),
- descriptionDetails: (_b = ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have `tslint` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's `--fix` option."], _b.raw = ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have \\`tslint\\` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's \\`--fix\\` option."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."], ["\n Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation."]))),
+ descriptionDetails: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have `tslint` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's `--fix` option."], ["\n In addition to avoiding compilation errors, this rule may still be useful if you\n wish to have \\`tslint\\` automatically remove unused imports, variables, functions,\n and private class members, when using TSLint's \\`--fix\\` option."]))),
hasFix: true,
- optionsDescription: (_c = ["\n Three optional arguments may be optionally provided:\n\n * `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], _c.raw = ["\n Three optional arguments may be optionally provided:\n\n * \\`\"check-parameters\"\\` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * \\`{\"ignore-pattern\": \"pattern\"}\\` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], Lint.Utils.dedent(_c)),
+ optionsDescription: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n Three optional arguments may be optionally provided:\n\n * `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."], ["\n Three optional arguments may be optionally provided:\n\n * \\`\"check-parameters\"\\` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * \\`{\"ignore-pattern\": \"pattern\"}\\` where pattern is a case-sensitive regexp.\n Variable names and imports that match the pattern will be ignored."]))),
options: {
type: "array",
items: {
@@ -59,9 +60,13 @@ var Rule = /** @class */ (function (_super) {
maxLength: 3,
},
optionExamples: [true, [true, { "ignore-pattern": "^_" }]],
+ rationale: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n Variables that are declared and not used anywhere in code are likely an error due to incomplete refactoring.\n Such variables take up space in the code, are mild performance pains, and can lead to confusion by readers.\n "], ["\n Variables that are declared and not used anywhere in code are likely an error due to incomplete refactoring.\n Such variables take up space in the code, are mild performance pains, and can lead to confusion by readers.\n "]))),
type: "functionality",
typescriptOnly: true,
requiresTypeInfo: true,
+ deprecationMessage: semver.gte(ts.version, "2.9.0-dev.0")
+ ? "Since TypeScript 2.9. Please use the built-in compiler checks instead."
+ : undefined,
};
return Rule;
}(Lint.Rules.TypedRule));
@@ -100,22 +105,26 @@ function walk(ctx, program) {
continue;
}
var failure = ts.flattenDiagnosticMessageText(diag.messageText, "\n");
- if (ignorePattern !== undefined) {
+ // BUG: this means imports / destructures with all (2+) unused variables don't respect ignore pattern
+ if (ignorePattern !== undefined && kind !== 2 /* DECLARATION */ && kind !== 3 /* ALL_DESTRUCTURES */) {
var varName = /'(.*)'/.exec(failure)[1];
if (ignorePattern.test(varName)) {
continue;
}
}
- if (kind === 0 /* VARIABLE_OR_PARAMETER */) {
- var importName = findImport(diag.start, sourceFile);
- if (importName !== undefined) {
- if (declaration && isImportUsed(importName, sourceFile, checker)) {
- continue;
- }
- if (importSpecifierFailures.has(importName)) {
- throw new Error("Should not get 2 errors for the same import.");
+ if (kind === 0 /* VARIABLE_OR_PARAMETER */ || kind === 2 /* DECLARATION */) {
+ var importNames = findImports(diag.start, sourceFile, kind);
+ if (importNames.length > 0) {
+ for (var _b = 0, importNames_1 = importNames; _b < importNames_1.length; _b++) {
+ var importName = importNames_1[_b];
+ if (declaration && isImportUsed(importName, sourceFile, checker)) {
+ continue;
+ }
+ if (importSpecifierFailures.has(importName)) {
+ throw new Error("Should not get 2 errors for the same import.");
+ }
+ importSpecifierFailures.set(importName, failure);
}
- importSpecifierFailures.set(importName, failure);
continue;
}
}
@@ -156,7 +165,7 @@ function addImportSpecifierFailures(ctx, failures, sourceFile) {
if (defaultName !== undefined) {
failures.delete(defaultName);
}
- removeAll(importNode, "All imports are unused.");
+ removeAll(importNode, "All imports on this line are unused.");
return;
}
if (defaultName !== undefined) {
@@ -249,7 +258,7 @@ function isImportUsed(importSpecifier, sourceFile, checker) {
return false;
}
var symbol = checker.getAliasedSymbol(importedSymbol);
- if (!Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
+ if (!utils.isSymbolFlagSet(symbol, ts.SymbolFlags.Type)) {
return false;
}
return ts.forEachChild(sourceFile, function cb(child) {
@@ -292,12 +301,13 @@ function forEachImport(sourceFile, f) {
return undefined;
});
}
-function findImport(pos, sourceFile) {
- return forEachImport(sourceFile, function (i) {
+function findImports(pos, sourceFile, kind) {
+ var imports = forEachImport(sourceFile, function (i) {
+ if (!isInRange(i, pos)) {
+ return undefined;
+ }
if (i.kind === ts.SyntaxKind.ImportEqualsDeclaration) {
- if (i.name.getStart() === pos) {
- return i.name;
- }
+ return [i.name];
}
else {
if (i.importClause === undefined) {
@@ -306,33 +316,69 @@ function findImport(pos, sourceFile) {
}
var _a = i.importClause, defaultName = _a.name, namedBindings = _a.namedBindings;
if (namedBindings !== undefined && namedBindings.kind === ts.SyntaxKind.NamespaceImport) {
- var name = namedBindings.name;
- if (name.getStart() === pos) {
- return name;
+ return [namedBindings.name];
+ }
+ // Starting from TS2.8, when all imports in an import node are not used,
+ // TS emits only 1 diagnostic object for the whole line as opposed
+ // to the previous behavior of outputting a diagnostic with kind == 6192
+ // (UnusedKind.VARIABLE_OR_PARAMETER) for every unused import.
+ // From TS2.8, in the case of none of the imports in a line being used,
+ // the single diagnostic TS outputs are different between the 1 import
+ // and 2+ imports cases:
+ // - 1 import in node:
+ // - diagnostic has kind == 6133 (UnusedKind.VARIABLE_OR_PARAMETER)
+ // - the text range is the whole node (`import { ... } from "..."`)
+ // whereas pre-TS2.8, the text range was for the import node. so
+ // `name.getStart()` won't equal `pos` like in pre-TS2.8
+ // - 2+ imports in node:
+ // - diagnostic has kind == 6192 (UnusedKind.DECLARATION)
+ // - we know that all of these are unused
+ if (kind === 2 /* DECLARATION */) {
+ var imp = [];
+ if (defaultName !== undefined) {
+ imp.push(defaultName);
}
- return undefined;
+ if (namedBindings !== undefined) {
+ imp.push.apply(imp, namedBindings.elements.map(function (el) { return el.name; }));
+ }
+ return imp.length > 0 ? imp : undefined;
}
- if (defaultName !== undefined && defaultName.getStart() === pos) {
- return defaultName;
+ else if (defaultName !== undefined && (isInRange(defaultName, pos) || namedBindings === undefined // defaultName is the only option
+ )) {
+ return [defaultName];
}
else if (namedBindings !== undefined) {
+ if (namedBindings.elements.length === 1) {
+ return [namedBindings.elements[0].name];
+ }
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
- var name = _b[_i].name;
- if (name.getStart() === pos) {
- return name;
+ var element = _b[_i];
+ if (isInRange(element, pos)) {
+ return [element.name];
}
}
}
}
return undefined;
});
+ return imports !== undefined ? imports : [];
+}
+function isInRange(range, pos) {
+ return range.pos <= pos && range.end >= pos;
}
function getUnusedDiagnostic(diag) {
+ // https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
switch (diag.code) {
- case 6133:
- return 0 /* VARIABLE_OR_PARAMETER */; // "'{0}' is declared but never used.
+ case 6133: // Pre TS 2.9 "'{0}' is declared but never used.
+ // TS 2.9+ "'{0}' is declared but its value is never read."
+ case 6196: // TS 2.9+ "'{0}' is declared but never used."
+ return 0 /* VARIABLE_OR_PARAMETER */;
case 6138:
return 1 /* PROPERTY */; // "Property '{0}' is declared but never used."
+ case 6192:
+ return 2 /* DECLARATION */; // "All imports in import declaration are unused."
+ case 6198:
+ return 3 /* ALL_DESTRUCTURES */; // "All destructured elements are unused."
default:
return undefined;
}
@@ -358,7 +404,7 @@ function makeUnusedCheckedProgram(program, checkParameters) {
readFile: function (f) { return sourceFilesByName.get(getCanonicalFileName(f)).text; },
getSourceFile: function (f) { return sourceFilesByName.get(getCanonicalFileName(f)); },
getDefaultLibFileName: function () { return ts.getDefaultLibFileName(options); },
- writeFile: function () { },
+ writeFile: function () { return undefined; },
getCurrentDirectory: function () { return ""; },
getDirectories: function () { return []; },
getCanonicalFileName: getCanonicalFileName,
@@ -371,4 +417,4 @@ function makeUnusedCheckedProgram(program, checkParameters) {
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
}
}
-var _a, _b, _c;
+var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
diff --git a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
index 5c742bfbd..a9a849483 100644
--- a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
+++ b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
@@ -18,7 +18,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
+var tsutils_1 = require("tsutils");
var Lint = require("../index");
+var noUseBeforeDeclare_examples_1 = require("./code-examples/noUseBeforeDeclare.examples");
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -35,13 +37,14 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-use-before-declare",
description: "Disallows usage of variables before their declaration.",
- descriptionDetails: (_a = ["\n This rule is primarily useful when using the `var` keyword -\n the compiler will detect if a `let` and `const` variable is used before it is declared."], _a.raw = ["\n This rule is primarily useful when using the \\`var\\` keyword -\n the compiler will detect if a \\`let\\` and \\`const\\` variable is used before it is declared."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule is primarily useful when using the `var` keyword since the compiler will\n automatically detect if a block-scoped `let` and `const` variable is used before\n declaration. Since most modern TypeScript doesn't use `var`, this rule is generally\n discouraged and is kept around for legacy purposes. It is slow to compute, is not\n enabled in the built-in configuration presets, and should not be used to inform TSLint\n design decisions.\n "], ["\n This rule is primarily useful when using the \\`var\\` keyword since the compiler will\n automatically detect if a block-scoped \\`let\\` and \\`const\\` variable is used before\n declaration. Since most modern TypeScript doesn't use \\`var\\`, this rule is generally\n discouraged and is kept around for legacy purposes. It is slow to compute, is not\n enabled in the built-in configuration presets, and should not be used to inform TSLint\n design decisions.\n "]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
type: "functionality",
typescriptOnly: false,
requiresTypeInfo: true,
+ codeExamples: noUseBeforeDeclare_examples_1.codeExamples,
};
return Rule;
}(Lint.Rules.TypedRule));
@@ -56,6 +59,9 @@ function walk(ctx, checker) {
// Ignore `y` in `x.y`, but recurse to `x`.
return recur(node.expression);
case ts.SyntaxKind.Identifier:
+ if (isPropNameInBinding(node)) {
+ return;
+ }
return checkIdentifier(node, checker.getSymbolAtLocation(node));
case ts.SyntaxKind.ExportSpecifier:
return checkIdentifier(node.name, checker.getExportSpecifierLocalTargetSymbol(node));
@@ -83,5 +89,12 @@ function walk(ctx, checker) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING(node.text));
}
}
+ /**
+ * Destructured vars/args w/ rename are declared later in the source.
+ * var { x: y } = { x: 43 };
+ */
+ function isPropNameInBinding(node) {
+ return node.parent !== undefined && tsutils_1.isBindingElement(node.parent) && node.parent.propertyName === node;
+ }
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.js b/node_modules/tslint/lib/rules/noVarKeywordRule.js
index e79d9c65f..73a2964a5 100644
--- a/node_modules/tslint/lib/rules/noVarKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.js
@@ -37,6 +37,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Declaring variables using `var` has several edge case behaviors that make `var` unsuitable for modern code.\n Variables declared by `var` have their parent function block as their scope, ignoring other control flow statements.\n `var`s have declaration \"hoisting\" (similar to `function`s) and can appear to be used before declaration.\n\n Variables declared by `const` and `let` instead have as their scope the block in which they are defined,\n and are not allowed to used before declaration or be re-declared with another `const` or `let`.\n "], ["\n Declaring variables using \\`var\\` has several edge case behaviors that make \\`var\\` unsuitable for modern code.\n Variables declared by \\`var\\` have their parent function block as their scope, ignoring other control flow statements.\n \\`var\\`s have declaration \"hoisting\" (similar to \\`function\\`s) and can appear to be used before declaration.\n\n Variables declared by \\`const\\` and \\`let\\` instead have as their scope the block in which they are defined,\n and are not allowed to used before declaration or be re-declared with another \\`const\\` or \\`let\\`.\n "]))),
type: "functionality",
typescriptOnly: false,
};
@@ -65,6 +66,7 @@ function walk(ctx) {
// Allow `declare var x: number;` or `declare global { var x: number; }`
function isGlobalVarDeclaration(node) {
var parent = node.parent;
- return Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)
- || parent.kind === ts.SyntaxKind.ModuleBlock && Lint.isNodeFlagSet(parent.parent, ts.NodeFlags.GlobalAugmentation);
+ return tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)
+ || parent.kind === ts.SyntaxKind.ModuleBlock && tsutils_1.isNodeFlagSet(parent.parent, ts.NodeFlags.GlobalAugmentation);
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/noVarRequiresRule.js b/node_modules/tslint/lib/rules/noVarRequiresRule.js
index 9a8dfb694..567235b1c 100644
--- a/node_modules/tslint/lib/rules/noVarRequiresRule.js
+++ b/node_modules/tslint/lib/rules/noVarRequiresRule.js
@@ -32,10 +32,11 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-var-requires",
description: "Disallows the use of require statements except in import statements.",
- descriptionDetails: (_a = ["\n In other words, the use of forms such as `var module = require(\"module\")` are banned.\n Instead use ES6 style imports or `import foo = require('foo')` imports."], _a.raw = ["\n In other words, the use of forms such as \\`var module = require(\"module\")\\` are banned.\n Instead use ES6 style imports or \\`import foo = require('foo')\\` imports."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n In other words, the use of forms such as `var module = require(\"module\")` are banned.\n Instead use ES2015-style imports or `import foo = require('foo')` imports."], ["\n In other words, the use of forms such as \\`var module = require(\"module\")\\` are banned.\n Instead use ES2015-style imports or \\`import foo = require('foo')\\` imports."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n AMD-style `require([])` and CommonJS-style `require(\"\")` statements are environment-specific\n and more difficult to statically analyze.\n\n ES2015-style `import`s are part of the JavaScript language specfication and recommended as the path going forward.\n TypeScript will compile them to environment-specific forms as needed.\n "], ["\n AMD-style \\`require([])\\` and CommonJS-style \\`require(\"\")\\` statements are environment-specific\n and more difficult to statically analyze.\n\n ES2015-style \\`import\\`s are part of the JavaScript language specfication and recommended as the path going forward.\n TypeScript will compile them to environment-specific forms as needed.\n "]))),
type: "typescript",
typescriptOnly: true,
};
@@ -66,4 +67,4 @@ var NoVarRequiresWalker = /** @class */ (function (_super) {
};
return NoVarRequiresWalker;
}(Lint.ScopeAwareRuleWalker));
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/noVoidExpressionRule.js b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
index daaded82d..96742a87d 100644
--- a/node_modules/tslint/lib/rules/noVoidExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
@@ -17,9 +17,9 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var utils_1 = require("../language/utils");
var OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND = "ignore-arrow-function-shorthand";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
@@ -34,7 +34,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "no-void-expression",
description: "Requires expressions of type `void` to appear in statement position.",
- optionsDescription: (_a = ["\n If `", "` is provided, `() => returnsVoid()` will be allowed.\n Otherwise, it must be written as `() => { returnsVoid(); }`."], _a.raw = ["\n If \\`", "\\` is provided, \\`() => returnsVoid()\\` will be allowed.\n Otherwise, it must be written as \\`() => { returnsVoid(); }\\`."], Lint.Utils.dedent(_a, OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is provided, `() => returnsVoid()` will be allowed.\n Otherwise, it must be written as `() => { returnsVoid(); }`."], ["\n If \\`", "\\` is provided, \\`() => returnsVoid()\\` will be allowed.\n Otherwise, it must be written as \\`() => { returnsVoid(); }\\`."])), OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND),
options: {
type: "array",
items: {
@@ -44,6 +44,7 @@ var Rule = /** @class */ (function (_super) {
minLength: 0,
maxLength: 1,
},
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n It's misleading returning the results of an expression whose type is `void`.\n Attempting to do so is likely a symptom of expecting a different return type from a function.\n For example, the following code will log `undefined` but looks like it logs a value:\n\n ```\n const performWork = (): void => {\n workFirst();\n workSecond();\n };\n\n console.log(performWork());\n ```\n "], ["\n It's misleading returning the results of an expression whose type is \\`void\\`.\n Attempting to do so is likely a symptom of expecting a different return type from a function.\n For example, the following code will log \\`undefined\\` but looks like it logs a value:\n\n \\`\\`\\`\n const performWork = (): void => {\n workFirst();\n workSecond();\n };\n\n console.log(performWork());\n \\`\\`\\`\n "]))),
requiresTypeInfo: true,
type: "functionality",
typescriptOnly: false,
@@ -58,7 +59,7 @@ function walk(ctx, checker) {
return ts.forEachChild(sourceFile, function cb(node) {
if (isPossiblyVoidExpression(node)
&& !isParentAllowedVoid(node)
- && utils_1.isTypeFlagSet(checker.getTypeAtLocation(node), ts.TypeFlags.Void)) {
+ && tsutils_1.isTypeFlagSet(checker.getTypeAtLocation(node), ts.TypeFlags.Void)) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
@@ -84,4 +85,4 @@ function isPossiblyVoidExpression(node) {
return false;
}
}
-var _a;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
index 352592b23..a83b51361 100644
--- a/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
index bdcb5c699..3b313b693 100644
--- a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
@@ -36,6 +36,7 @@ var Rule = /** @class */ (function (_super) {
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Helps keep a consistent style with numeric literals.\n Non-standard literals are more difficult to scan through and can be a symptom of typos.\n "], ["\n Helps keep a consistent style with numeric literals.\n Non-standard literals are more difficult to scan through and can be a symptom of typos.\n "]))),
type: "style",
typescriptOnly: false,
};
@@ -102,3 +103,4 @@ function walk(ctx) {
}
}
}
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
index 41a6e7c56..c6c00d0d7 100644
--- a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
index d216bdfc6..2462c06d0 100644
--- a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
@@ -44,9 +44,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "object-literal-key-quotes",
description: "Enforces consistent object literal property quote style.",
- descriptionDetails: (_a = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], _a.raw = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."]))),
hasFix: true,
- optionsDescription: (_b = ["\n Possible settings are:\n\n * `\"", "\"`: Property names should always be quoted. (This is the default.)\n * `\"", "\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * `\"", "\"`: Property names should either all be quoted or unquoted.\n * `\"", "\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], _b.raw = ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"", "\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * \\`\"", "\"\\`: Property names should either all be quoted or unquoted.\n * \\`\"", "\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."], Lint.Utils.dedent(_b, OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n Possible settings are:\n\n * `\"", "\"`: Property names should always be quoted. (This is the default.)\n * `\"", "\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * `\"", "\"`: Property names should either all be quoted or unquoted.\n * `\"", "\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], ["\n Possible settings are:\n\n * \\`\"", "\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"", "\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * \\`\"", "\"\\`: Property names should either all be quoted or unquoted.\n * \\`\"", "\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no\n property names may be quoted.\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."])), OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED),
options: {
type: "string",
enum: [OPTION_ALWAYS, OPTION_AS_NEEDED, OPTION_CONSISTENT, OPTION_CONSISTENT_AS_NEEDED],
@@ -147,4 +147,4 @@ function hasInconsistentQuotes(properties) {
}
return false;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
index 94e0c80a5..368e5eb99 100644
--- a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "..";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
index 59ac30d76..e770d72e6 100644
--- a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
@@ -36,7 +36,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "object-literal-shorthand",
description: "Enforces/disallows use of ES6 object literal shorthand.",
hasFix: true,
- optionsDescription: (_a = ["\n If the 'never' option is provided, any shorthand object literal syntax will cause a failure."], _a.raw = ["\n If the \\'never\\' option is provided, any shorthand object literal syntax will cause a failure."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If the 'never' option is provided, any shorthand object literal syntax will cause a failure."], ["\n If the \\'never\\' option is provided, any shorthand object literal syntax will cause a failure."]))),
options: {
type: "string",
enum: [OPTION_NEVER],
@@ -101,4 +101,4 @@ function handleLonghandMethod(name, initializer, sourceFile) {
}
return [prefix + sourceFile.text.substring(nameStart, name.end), fix];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
index 7ea64b163..9d03fd582 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
@@ -1,9 +1,26 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.OptionallyTypedRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING_ALPHABETICAL(name: string): string;
static FAILURE_STRING_USE_DECLARATION_ORDER(propName: string, typeName: string | undefined): string;
+ static FAILURE_STRING_SHORTHAND_FIRST(name: string): string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
index 70d7c5e49..88bdd7cc9 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
@@ -22,6 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_CASE = "ignore-case";
var OPTION_MATCH_DECLARATION_ORDER = "match-declaration-order";
+var OPTION_SHORTHAND_FIRST = "shorthand-first";
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
@@ -35,6 +36,9 @@ var Rule = /** @class */ (function (_super) {
var type = typeName === undefined ? "its type declaration" : "'" + typeName + "'";
return "The key '" + propName + "' is not in the same order as it is in " + type + ".";
};
+ Rule.FAILURE_STRING_SHORTHAND_FIRST = function (name) {
+ return "The shorthand property '" + name + "' should appear before normal properties";
+ };
Rule.prototype.apply = function (sourceFile) {
var options = parseOptions(this.ruleArguments);
if (options.matchDeclarationOrder) {
@@ -48,16 +52,16 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "object-literal-sort-keys",
- description: (_a = ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], _a.raw = ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "], ["\n Checks ordering of keys in object literals.\n\n When using the default alphabetical ordering, additional blank lines may be used to group\n object properties together while keeping the elements within each group in alphabetical order.\n "]))),
rationale: "Useful in preventing merge conflicts",
- optionsDescription: (_b = ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will to compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n "], _b.raw = ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will to compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n "], Lint.Utils.dedent(_b, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n * \"", "\" will enforce shorthand properties to appear first, as in:\n\n const obj = { a, c, b: true };\n "], ["\n By default, this rule checks that keys are in alphabetical order.\n The following may optionally be passed:\n\n * \"", "\" will compare keys in a case insensitive way.\n * \"", "\" will prefer to use the key ordering of the contextual type of the object literal, as in:\n\n interface I { foo: number; bar: number; }\n const obj: I = { foo: 1, bar: 2 };\n\n If a contextual type is not found, alphabetical ordering will be used instead.\n * \"", "\" will enforce shorthand properties to appear first, as in:\n\n const obj = { a, c, b: true };\n "])), OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST),
options: {
type: "string",
- enum: [OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
+ enum: [OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST],
},
optionExamples: [
true,
- [true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
+ [true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST],
],
type: "maintainability",
typescriptOnly: false,
@@ -69,13 +73,14 @@ function parseOptions(ruleArguments) {
return {
ignoreCase: has(OPTION_IGNORE_CASE),
matchDeclarationOrder: has(OPTION_MATCH_DECLARATION_ORDER),
+ shorthandFirst: has(OPTION_SHORTHAND_FIRST),
};
function has(name) {
return ruleArguments.indexOf(name) !== -1;
}
}
function walk(ctx, checker) {
- var sourceFile = ctx.sourceFile, _a = ctx.options, ignoreCase = _a.ignoreCase, matchDeclarationOrder = _a.matchDeclarationOrder;
+ var sourceFile = ctx.sourceFile, _a = ctx.options, ignoreCase = _a.ignoreCase, matchDeclarationOrder = _a.matchDeclarationOrder, shorthandFirst = _a.shorthandFirst;
ts.forEachChild(sourceFile, function cb(node) {
if (tsutils_1.isObjectLiteralExpression(node) && node.properties.length > 1) {
check(node);
@@ -100,14 +105,31 @@ function walk(ctx, checker) {
return;
}
var lastKey;
+ var lastPropertyWasShorthand;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var property = _a[_i];
switch (property.kind) {
case ts.SyntaxKind.SpreadAssignment:
lastKey = undefined; // reset at spread
+ lastPropertyWasShorthand = undefined; // reset at spread
break;
case ts.SyntaxKind.ShorthandPropertyAssignment:
case ts.SyntaxKind.PropertyAssignment:
+ if (shorthandFirst) {
+ if (property.kind === ts.SyntaxKind.ShorthandPropertyAssignment) {
+ if (lastPropertyWasShorthand === false) {
+ ctx.addFailureAtNode(property.name, Rule.FAILURE_STRING_SHORTHAND_FIRST(property.name.text));
+ return; // only show warning on first out-of-order property
+ }
+ lastPropertyWasShorthand = true;
+ }
+ else {
+ if (lastPropertyWasShorthand === true) {
+ lastKey = undefined; // reset on change from shorthand to normal
+ }
+ lastPropertyWasShorthand = false;
+ }
+ }
if (property.name.kind === ts.SyntaxKind.Identifier ||
property.name.kind === ts.SyntaxKind.StringLiteral) {
var key = ignoreCase ? property.name.text.toLowerCase() : property.name.text;
@@ -162,7 +184,7 @@ function hasBlankLineBefore(sourceFile, element) {
});
}
function hasDoubleNewLine(sourceFile, position) {
- return /(\r\n|\r|\n){2}/.test(sourceFile.text.slice(position, position + 4));
+ return /(\r?\n){2}/.test(sourceFile.text.slice(position, position + 4));
}
function getTypeName(t) {
var parent = t.parent;
@@ -184,4 +206,4 @@ function getContextualType(node, checker) {
var decl = declarations[0];
return tsutils_1.isInterfaceDeclaration(decl) || tsutils_1.isTypeLiteralNode(decl) ? decl : undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/oneLineRule.d.ts b/node_modules/tslint/lib/rules/oneLineRule.d.ts
index 73a63c253..cb45e35bb 100644
--- a/node_modules/tslint/lib/rules/oneLineRule.d.ts
+++ b/node_modules/tslint/lib/rules/oneLineRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/oneLineRule.js b/node_modules/tslint/lib/rules/oneLineRule.js
index 5d271ae91..1d0dccf92 100644
--- a/node_modules/tslint/lib/rules/oneLineRule.js
+++ b/node_modules/tslint/lib/rules/oneLineRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "one-line",
description: "Requires the specified tokens to be on the same line as the expression preceding them.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks that `catch` is on the same line as the closing brace for `try`.\n * `\"", "\"` checks that `finally` is on the same line as the closing brace for `catch`.\n * `\"", "\"` checks that `else` is on the same line as the closing brace for `if`.\n * `\"", "\"` checks that an open brace falls on the same line as its preceding expression.\n * `\"", "\"` checks preceding whitespace for the specified tokens."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks that \\`catch\\` is on the same line as the closing brace for \\`try\\`.\n * \\`\"", "\"\\` checks that \\`finally\\` is on the same line as the closing brace for \\`catch\\`.\n * \\`\"", "\"\\` checks that \\`else\\` is on the same line as the closing brace for \\`if\\`.\n * \\`\"", "\"\\` checks that an open brace falls on the same line as its preceding expression.\n * \\`\"", "\"\\` checks preceding whitespace for the specified tokens."], Lint.Utils.dedent(_a, OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE, OPTION_BRACE, OPTION_WHITESPACE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` checks that `catch` is on the same line as the closing brace for `try`.\n * `\"", "\"` checks that `finally` is on the same line as the closing brace for `catch`.\n * `\"", "\"` checks that `else` is on the same line as the closing brace for `if`.\n * `\"", "\"` checks that an open brace falls on the same line as its preceding expression.\n * `\"", "\"` checks preceding whitespace for the specified tokens."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks that \\`catch\\` is on the same line as the closing brace for \\`try\\`.\n * \\`\"", "\"\\` checks that \\`finally\\` is on the same line as the closing brace for \\`catch\\`.\n * \\`\"", "\"\\` checks that \\`else\\` is on the same line as the closing brace for \\`if\\`.\n * \\`\"", "\"\\` checks that an open brace falls on the same line as its preceding expression.\n * \\`\"", "\"\\` checks preceding whitespace for the specified tokens."])), OPTION_CATCH, OPTION_FINALLY, OPTION_ELSE, OPTION_BRACE, OPTION_WHITESPACE),
options: {
type: "array",
items: {
@@ -89,7 +89,10 @@ var OneLineWalker = /** @class */ (function (_super) {
case ts.SyntaxKind.InterfaceDeclaration:
case ts.SyntaxKind.ClassDeclaration:
case ts.SyntaxKind.ClassExpression: {
- _this.check(tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenBraceToken, sourceFile));
+ var openBrace = tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenBraceToken, sourceFile);
+ if (openBrace !== undefined) {
+ _this.check(openBrace);
+ }
break;
}
case ts.SyntaxKind.IfStatement: {
@@ -148,4 +151,4 @@ var OneLineWalker = /** @class */ (function (_super) {
};
return OneLineWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
index 42ee49cac..502f282e0 100644
--- a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
@@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "one-variable-per-declaration",
description: "Disallows multiple variable definitions in the same declaration statement.",
- optionsDescription: (_a = ["\n One argument may be optionally provided:\n\n * `", "` allows multiple variable definitions in a for loop declaration."], _a.raw = ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows multiple variable definitions in a for loop declaration."], Lint.Utils.dedent(_a, OPTION_IGNORE_FOR_LOOP)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument may be optionally provided:\n\n * `", "` allows multiple variable definitions in a for loop declaration."], ["\n One argument may be optionally provided:\n\n * \\`", "\\` allows multiple variable definitions in a for loop declaration."])), OPTION_IGNORE_FOR_LOOP),
options: {
type: "array",
items: {
@@ -68,4 +68,4 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
index 7af04a45b..672c59bb8 100644
--- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
@@ -35,7 +35,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "only-arrow-functions",
description: "Disallows traditional (non-arrow) function expressions.",
rationale: "Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `\"", "\"` allows standalone function declarations.\n * `\"", "\"` allows the expression `function foo() {}` but not `function() {}`.\n "], ["\n Two arguments may be optionally provided:\n\n * \\`\"", "\"\\` allows standalone function declarations.\n * \\`\"", "\"\\` allows the expression \\`function foo() {}\\` but not \\`function() {}\\`.\n "])), OPTION_ALLOW_DECLARATIONS, OPTION_ALLOW_NAMED_FUNCTIONS),
options: {
type: "array",
items: {
@@ -75,7 +75,7 @@ function walk(ctx) {
case ts.SyntaxKind.FunctionExpression: {
var f = node;
if (!(allowNamedFunctions && f.name !== undefined) && !functionIsExempt(f)) {
- ctx.addFailureAtNode(Lint.childOfKind(node, ts.SyntaxKind.FunctionKeyword), Rule.FAILURE_STRING);
+ ctx.addFailureAtNode(utils.getChildOfKind(node, ts.SyntaxKind.FunctionKeyword, ctx.sourceFile), Rule.FAILURE_STRING);
}
}
}
@@ -91,4 +91,4 @@ function functionIsExempt(node) {
function usesThis(node) {
return node.kind === ts.SyntaxKind.ThisKeyword || !utils.hasOwnThisReference(node) && ts.forEachChild(node, usesThis);
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.d.ts b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
index ab1329ea4..5b624b3e0 100644
--- a/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.js b/node_modules/tslint/lib/rules/orderedImportsRule.js
index 4f7c5f0da..51a5ea82d 100644
--- a/node_modules/tslint/lib/rules/orderedImportsRule.js
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.js
@@ -32,9 +32,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "ordered-imports",
description: "Requires that import statements be alphabetized and grouped.",
- descriptionDetails: (_a = ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], _a.raw = ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."], ["\n Enforce a consistent ordering for ES6 imports:\n - Named imports must be alphabetized (i.e. \"import {A, B, C} from \"foo\";\")\n - The exact ordering can be controlled by the named-imports-order option.\n - \"longName as name\" imports are ordered by \"longName\".\n - Import sources must be alphabetized within groups, i.e.:\n import * as foo from \"a\";\n import * as bar from \"b\";\n - Groups of imports are delineated by blank lines. You can use these to group imports\n however you like, e.g. by first- vs. third-party or thematically or can you can\n enforce a grouping of third-party, parent directories and the current directory."]))),
hasFix: true,
- optionsDescription: (_b = ["\n You may set the `\"import-sources-order\"` option to control the ordering of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"import-sources-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `\"Bar\"`, `\"baz\"`, `\"Foo\"`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `\"baz\"`, `\"Bar\"`, `\"Foo\"`.\n * `\"lowercase-last\"`: Correct order is `\"Bar\"`, `\"Foo\"`, `\"baz\"`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"grouped-imports\"` option to control the grouping of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"grouped-imports\"` are:\n\n * `false`: Do not enforce grouping. (This is the default.)\n * `true`: Group source imports by `\"bar\"`, `\"../baz\"`, `\"./foo\"`.\n\n You may set the `\"named-imports-order\"` option to control the ordering of named\n imports (the `{A, B, C}` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"named-imports-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `{A, b, C}`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `{b, A, C}`.\n * `\"lowercase-last\"`: Correct order is `{A, C, b}`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"module-source-path\"` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for `\"module-source-path\"` are:\n\n * `\"full'`: Correct order is `\"./a/Foo\"`, `\"./b/baz\"`, `\"./c/Bar\"`. (This is the default.)\n * `\"basename\"`: Correct order is `\"./c/Bar\"`, `\"./b/baz\"`, `\"./a/Foo\"`.\n\n "], _b.raw = ["\n You may set the \\`\"import-sources-order\"\\` option to control the ordering of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"import-sources-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`\"Bar\"\\`, \\`\"baz\"\\`, \\`\"Foo\"\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`\"baz\"\\`, \\`\"Bar\"\\`, \\`\"Foo\"\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`\"Bar\"\\`, \\`\"Foo\"\\`, \\`\"baz\"\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"grouped-imports\"\\` option to control the grouping of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"grouped-imports\"\\` are:\n\n * \\`false\\`: Do not enforce grouping. (This is the default.)\n * \\`true\\`: Group source imports by \\`\"bar\"\\`, \\`\"../baz\"\\`, \\`\"./foo\"\\`.\n\n You may set the \\`\"named-imports-order\"\\` option to control the ordering of named\n imports (the \\`{A, B, C}\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"named-imports-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`{A, b, C}\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`{b, A, C}\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`{A, C, b}\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"module-source-path\"\\` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for \\`\"module-source-path\"\\` are:\n\n * \\`\"full'\\`: Correct order is \\`\"./a/Foo\"\\`, \\`\"./b/baz\"\\`, \\`\"./c/Bar\"\\`. (This is the default.)\n * \\`\"basename\"\\`: Correct order is \\`\"./c/Bar\"\\`, \\`\"./b/baz\"\\`, \\`\"./a/Foo\"\\`.\n\n "], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n You may set the `\"import-sources-order\"` option to control the ordering of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"import-sources-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `\"Bar\"`, `\"baz\"`, `\"Foo\"`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `\"baz\"`, `\"Bar\"`, `\"Foo\"`.\n * `\"lowercase-last\"`: Correct order is `\"Bar\"`, `\"Foo\"`, `\"baz\"`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"grouped-imports\"` option to control the grouping of source\n imports (the `\"foo\"` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"grouped-imports\"` are:\n\n * `false`: Do not enforce grouping. (This is the default.)\n * `true`: Group source imports by `\"bar\"`, `\"../baz\"`, `\"./foo\"`.\n\n You may set the `\"named-imports-order\"` option to control the ordering of named\n imports (the `{A, B, C}` in `import {A, B, C} from \"foo\"`).\n\n Possible values for `\"named-imports-order\"` are:\n\n * `\"case-insensitive'`: Correct order is `{A, b, C}`. (This is the default.)\n * `\"lowercase-first\"`: Correct order is `{b, A, C}`.\n * `\"lowercase-last\"`: Correct order is `{A, C, b}`.\n * `\"any\"`: Allow any order.\n\n You may set the `\"module-source-path\"` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for `\"module-source-path\"` are:\n\n * `\"full'`: Correct order is `\"./a/Foo\"`, `\"./b/baz\"`, `\"./c/Bar\"`. (This is the default.)\n * `\"basename\"`: Correct order is `\"./c/Bar\"`, `\"./b/baz\"`, `\"./a/Foo\"`.\n\n "], ["\n You may set the \\`\"import-sources-order\"\\` option to control the ordering of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"import-sources-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`\"Bar\"\\`, \\`\"baz\"\\`, \\`\"Foo\"\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`\"baz\"\\`, \\`\"Bar\"\\`, \\`\"Foo\"\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`\"Bar\"\\`, \\`\"Foo\"\\`, \\`\"baz\"\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"grouped-imports\"\\` option to control the grouping of source\n imports (the \\`\"foo\"\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"grouped-imports\"\\` are:\n\n * \\`false\\`: Do not enforce grouping. (This is the default.)\n * \\`true\\`: Group source imports by \\`\"bar\"\\`, \\`\"../baz\"\\`, \\`\"./foo\"\\`.\n\n You may set the \\`\"named-imports-order\"\\` option to control the ordering of named\n imports (the \\`{A, B, C}\\` in \\`import {A, B, C} from \"foo\"\\`).\n\n Possible values for \\`\"named-imports-order\"\\` are:\n\n * \\`\"case-insensitive'\\`: Correct order is \\`{A, b, C}\\`. (This is the default.)\n * \\`\"lowercase-first\"\\`: Correct order is \\`{b, A, C}\\`.\n * \\`\"lowercase-last\"\\`: Correct order is \\`{A, C, b}\\`.\n * \\`\"any\"\\`: Allow any order.\n\n You may set the \\`\"module-source-path\"\\` option to control the ordering of imports based full path\n or just the module name\n\n Possible values for \\`\"module-source-path\"\\` are:\n\n * \\`\"full'\\`: Correct order is \\`\"./a/Foo\"\\`, \\`\"./b/baz\"\\`, \\`\"./c/Bar\"\\`. (This is the default.)\n * \\`\"basename\"\\`: Correct order is \\`\"./c/Bar\"\\`, \\`\"./b/baz\"\\`, \\`\"./a/Foo\"\\`.\n\n "]))),
options: {
type: "object",
properties: {
@@ -240,6 +240,7 @@ var Walker = /** @class */ (function (_super) {
}
};
Walker.prototype.getReplacements = function () {
+ var _a;
var importDeclarationsList = this.importsBlocks
.map(function (block) { return block.getImportDeclarations(); })
.filter(function (imports) { return imports.length > 0; });
@@ -248,7 +249,6 @@ var Walker = /** @class */ (function (_super) {
var startOffset = allImportDeclarations.length === 0 ? 0 : allImportDeclarations[0].nodeStartOffset;
replacements.push(Lint.Replacement.appendText(startOffset, this.getGroupedImports(allImportDeclarations)));
return replacements;
- var _a;
};
Walker.prototype.getReplacementsForExistingImports = function (importDeclarationsList) {
var _this = this;
@@ -435,4 +435,4 @@ function moduleDeclarationBody(node) {
}
return body !== undefined && body.kind === ts.SyntaxKind.ModuleBlock ? body : undefined;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
index 6054ed924..bf0307d56 100644
--- a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
index a6f7f173c..cd7a5ea33 100644
--- a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
@@ -38,8 +38,8 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "prefer-conditional-expression",
- description: (_a = ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], _a.raw = ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], Lint.Utils.dedent(_a)),
- rationale: (_b = ["\n This reduces duplication and can eliminate an unnecessary variable declaration."], _b.raw = ["\n This reduces duplication and can eliminate an unnecessary variable declaration."], Lint.Utils.dedent(_b)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."], ["\n Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement."]))),
+ rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This reduces duplication and can eliminate an unnecessary variable declaration."], ["\n This reduces duplication and can eliminate an unnecessary variable declaration."]))),
optionsDescription: "If `" + OPTION_CHECK_ELSE_IF + "` is specified, the rule also checks nested if-else-if statements.",
options: {
type: "string",
@@ -56,42 +56,50 @@ function walk(ctx) {
var sourceFile = ctx.sourceFile, checkElseIf = ctx.options.checkElseIf;
return ts.forEachChild(sourceFile, function cb(node) {
if (tsutils_1.isIfStatement(node)) {
- var assigned = detect(node, sourceFile, checkElseIf);
+ var assigned = detectAssignment(node, sourceFile, checkElseIf);
if (assigned !== undefined) {
ctx.addFailureAtNode(node.getChildAt(0, sourceFile), Rule.FAILURE_STRING(assigned.getText(sourceFile)));
}
if (assigned !== undefined || !checkElseIf) {
// Be careful not to fail again for the "else if"
- ts.forEachChild(node.expression, cb);
- ts.forEachChild(node.thenStatement, cb);
- if (node.elseStatement !== undefined) {
- ts.forEachChild(node.elseStatement, cb);
- }
- return;
+ do {
+ ts.forEachChild(node.expression, cb);
+ ts.forEachChild(node.thenStatement, cb);
+ if (node.elseStatement === undefined) {
+ return;
+ }
+ node = node.elseStatement;
+ while (tsutils_1.isBlock(node) && node.statements.length === 1) {
+ node = node.statements[0];
+ }
+ } while (tsutils_1.isIfStatement(node));
}
}
return ts.forEachChild(node, cb);
});
}
-function detect(_a, sourceFile, elseIf) {
- var thenStatement = _a.thenStatement, elseStatement = _a.elseStatement;
- if (elseStatement === undefined || !elseIf && elseStatement.kind === ts.SyntaxKind.IfStatement) {
- return undefined;
- }
- var elze = tsutils_1.isIfStatement(elseStatement) ? detect(elseStatement, sourceFile, elseIf) : getAssigned(elseStatement, sourceFile);
- if (elze === undefined) {
- return undefined;
+/**
+ * @param inElse `undefined` when this is the top level if statement, `false` when inside the then branch, `true` when inside else
+ */
+function detectAssignment(statement, sourceFile, checkElseIf, inElse) {
+ if (tsutils_1.isIfStatement(statement)) {
+ if (inElse === false || !checkElseIf && inElse || statement.elseStatement === undefined) {
+ return undefined;
+ }
+ var then = detectAssignment(statement.thenStatement, sourceFile, checkElseIf, false);
+ if (then === undefined) {
+ return undefined;
+ }
+ var elze = detectAssignment(statement.elseStatement, sourceFile, checkElseIf, true);
+ return elze !== undefined && nodeEquals(then, elze, sourceFile) ? then : undefined;
}
- var then = getAssigned(thenStatement, sourceFile);
- return then !== undefined && nodeEquals(elze, then, sourceFile) ? then : undefined;
-}
-/** Returns the left side of an assignment. */
-function getAssigned(node, sourceFile) {
- if (tsutils_1.isBlock(node)) {
- return node.statements.length === 1 ? getAssigned(node.statements[0], sourceFile) : undefined;
+ else if (tsutils_1.isBlock(statement)) {
+ return statement.statements.length === 1
+ ? detectAssignment(statement.statements[0], sourceFile, checkElseIf, inElse)
+ : undefined;
}
- else if (tsutils_1.isExpressionStatement(node) && tsutils_1.isBinaryExpression(node.expression)) {
- var _a = node.expression, kind = _a.operatorToken.kind, left = _a.left, right = _a.right;
+ else if (tsutils_1.isExpressionStatement(statement) && tsutils_1.isBinaryExpression(statement.expression)) {
+ var _a = statement.expression, kind = _a.operatorToken.kind, left = _a.left, right = _a.right;
return kind === ts.SyntaxKind.EqualsToken && tsutils_1.isSameLine(sourceFile, right.getStart(sourceFile), right.end) ? left : undefined;
}
else {
@@ -101,4 +109,4 @@ function getAssigned(node, sourceFile) {
function nodeEquals(a, b, sourceFile) {
return a.getText(sourceFile) === b.getText(sourceFile);
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferConstRule.js b/node_modules/tslint/lib/rules/preferConstRule.js
index 42f1e6ce4..5d88718de 100644
--- a/node_modules/tslint/lib/rules/preferConstRule.js
+++ b/node_modules/tslint/lib/rules/preferConstRule.js
@@ -43,9 +43,9 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-const",
description: "Requires that variable declarations use `const` instead of `let` and `var` if possible.",
- descriptionDetails: (_a = ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], _a.raw = ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], Lint.Utils.dedent(_a)),
+ descriptionDetails: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"], ["\n If a variable is only assigned to once when it is declared, it should be declared using 'const'"]))),
hasFix: true,
- optionsDescription: (_b = ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], _b.raw = ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], Lint.Utils.dedent(_b, OPTION_DESTRUCTURING_ANY, OPTION_DESTRUCTURING_ALL)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."], ["\n An optional object containing the property \"destructuring\" with two possible values:\n\n * \"", "\" (default) - If any variable in destructuring can be const, this rule warns for those variables.\n * \"", "\" - Only warns if all variables in destructuring can be const."])), OPTION_DESTRUCTURING_ANY, OPTION_DESTRUCTURING_ALL),
options: {
type: "object",
properties: {
@@ -87,7 +87,9 @@ var Scope = /** @class */ (function () {
var PreferConstWalker = /** @class */ (function (_super) {
tslib_1.__extends(PreferConstWalker, _super);
function PreferConstWalker() {
- return _super !== null && _super.apply(this, arguments) || this;
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.scope = new Scope();
+ return _this;
}
PreferConstWalker.prototype.walk = function (sourceFile) {
var _this = this;
@@ -146,10 +148,12 @@ var PreferConstWalker = /** @class */ (function (_super) {
}
}
else if (node.kind === ts.SyntaxKind.Parameter) {
- _this.handleBindingName(node.name, {
- canBeConst: false,
- isBlockScoped: true,
- });
+ if (node.parent.kind !== ts.SyntaxKind.IndexSignature) {
+ _this.handleBindingName(node.name, {
+ canBeConst: false,
+ isBlockScoped: true,
+ });
+ }
}
else if (utils.isPostfixUnaryExpression(node) ||
utils.isPrefixUnaryExpression(node) &&
@@ -309,4 +313,4 @@ var PreferConstWalker = /** @class */ (function (_super) {
};
return PreferConstWalker;
}(Lint.AbstractWalker));
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/preferForOfRule.d.ts b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
index cce59d100..bd1fcddd6 100644
--- a/node_modules/tslint/lib/rules/preferForOfRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferForOfRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
index 9f145cef6..c18d09317 100644
--- a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-function-over-method",
description: "Warns for class methods that do not use 'this'.",
- optionsDescription: (_a = ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], _a.raw = ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], Lint.Utils.dedent(_a, OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."], ["\n \"", "\" excludes checking of public methods.\n \"", "\" excludes checking of protected methods."])), OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED),
options: {
type: "string",
enum: [OPTION_ALLOW_PUBLIC, OPTION_ALLOW_PROTECTED],
@@ -108,4 +108,4 @@ function isRecursiveCall(node, name) {
node.parent.kind === ts.SyntaxKind.PropertyAccessExpression &&
node.parent.name.text === name;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
index a3fe1e9be..4a22ff3ed 100644
--- a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
@@ -50,8 +50,8 @@ function walk(ctx) {
var type = node.type;
if (type !== undefined && tsutils_1.isFunctionTypeNode(type)) {
ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING, type.type === undefined ? undefined : [
- Lint.Replacement.deleteFromTo(Lint.childOfKind(node, ts.SyntaxKind.ColonToken).getStart(), type.getStart()),
- Lint.Replacement.replaceFromTo(Lint.childOfKind(type, ts.SyntaxKind.EqualsGreaterThanToken).pos, type.type.pos, ":"),
+ Lint.Replacement.deleteFromTo(type.pos - 1, type.getStart()),
+ Lint.Replacement.replaceFromTo(type.parameters.end + 1, type.type.pos, ":"),
]);
}
}
diff --git a/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
index 34aff8cc4..7b6f9ea32 100644
--- a/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferObjectSpreadRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.d.ts b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
index cce59d100..65ed5c49f 100644
--- a/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.js b/node_modules/tslint/lib/rules/preferSwitchRule.js
index f9afd3650..6291ac4cc 100644
--- a/node_modules/tslint/lib/rules/preferSwitchRule.js
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a, _b;
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
@@ -38,14 +39,14 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-switch",
description: "Prefer a `switch` statement to an `if` statement with simple `===` comparisons.",
- optionsDescription: (_a = ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], _a.raw = ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], Lint.Utils.dedent(_a, OPTION_MIN_CASES)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."], ["\n An optional object with the property '", "'.\n This is the number cases needed before a switch statement is recommended.\n Defaults to 3."])), OPTION_MIN_CASES),
options: {
type: "object",
- properties: (_b = {},
- _b[OPTION_MIN_CASES] = { type: "number" },
- _b),
+ properties: (_a = {},
+ _a[OPTION_MIN_CASES] = { type: "number" },
+ _a),
},
- optionExamples: [true, [true, (_c = {}, _c[OPTION_MIN_CASES] = 2, _c)]],
+ optionExamples: [true, [true, (_b = {}, _b[OPTION_MIN_CASES] = 2, _b)]],
type: "style",
typescriptOnly: false,
};
@@ -136,4 +137,4 @@ function isSimple(node) {
return false;
}
}
-var _a, _b, _c;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.d.ts b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
index 0b4ebc00c..e6719dbf7 100644
--- a/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.js b/node_modules/tslint/lib/rules/preferTemplateRule.js
index 5255a5f37..6b065d719 100644
--- a/node_modules/tslint/lib/rules/preferTemplateRule.js
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "prefer-template",
description: "Prefer a template expression over string literal concatenation.",
- optionsDescription: (_a = ["\n If `", "` is specified, then a single concatenation (`x + y`) is allowed, but not more (`x + y + z`)."], _a.raw = ["\n If \\`", "\\` is specified, then a single concatenation (\\`x + y\\`) is allowed, but not more (\\`x + y + z\\`)."], Lint.Utils.dedent(_a, OPTION_SINGLE_CONCAT)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If `", "` is specified, then a single concatenation (`x + y`) is allowed, but not more (`x + y + z`)."], ["\n If \\`", "\\` is specified, then a single concatenation (\\`x + y\\`) is allowed, but not more (\\`x + y + z\\`)."])), OPTION_SINGLE_CONCAT),
options: {
type: "string",
enum: [OPTION_SINGLE_CONCAT],
@@ -121,4 +121,4 @@ function isStringLike(node) {
return false;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
index d2d51d1d1..8b31e4da7 100644
--- a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
index aa6f8163e..61a97fde0 100644
--- a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
@@ -17,25 +17,61 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var _a;
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
+var OPTION_FUNCTION_DECLARATION = "check-function-declaration";
+var OPTION_FUNCTION_EXPRESSION = "check-function-expression";
+var OPTION_ARROW_FUNCTION = "check-arrow-function";
+var OPTION_METHOD_DECLARATION = "check-method-declaration";
+var KIND_FOR_OPTION = (_a = {},
+ _a[OPTION_FUNCTION_DECLARATION] = ts.SyntaxKind.FunctionDeclaration,
+ _a[OPTION_FUNCTION_EXPRESSION] = ts.SyntaxKind.FunctionExpression,
+ _a[OPTION_ARROW_FUNCTION] = ts.SyntaxKind.ArrowFunction,
+ _a[OPTION_METHOD_DECLARATION] = ts.SyntaxKind.MethodDeclaration,
+ _a);
+function parseOptions(ruleArguments) {
+ if (ruleArguments.length === 0) {
+ ruleArguments = Object.keys(KIND_FOR_OPTION);
+ }
+ var enabledKinds = new Set();
+ for (var _i = 0, ruleArguments_1 = ruleArguments; _i < ruleArguments_1.length; _i++) {
+ var arg = ruleArguments_1[_i];
+ enabledKinds.add(KIND_FOR_OPTION[arg]);
+ }
+ return enabledKinds;
+}
var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments), program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "promise-function-async",
description: "Requires any function or method that returns a promise to be marked async.",
- rationale: (_a = ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-`async` `Promise`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n "], _a.raw = ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-\\`async\\` \\`Promise\\`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n "], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-`async` `Promise`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n\n If no optional arguments are provided then all function types are checked,\n otherwise the specific function types are checked:\n\n * `\"", "\"` check function declarations.\n * `\"", "\"` check function expressions.\n * `\"", "\"` check arrow functions.\n * `\"", "\"` check method declarations.\n "], ["\n Ensures that each function is only capable of 1) returning a rejected promise, or 2)\n throwing an Error object. In contrast, non-\\`async\\` \\`Promise\\`-returning functions\n are technically capable of either. This practice removes a requirement for consuming\n code to handle both cases.\n\n If no optional arguments are provided then all function types are checked,\n otherwise the specific function types are checked:\n\n * \\`\"", "\"\\` check function declarations.\n * \\`\"", "\"\\` check function expressions.\n * \\`\"", "\"\\` check arrow functions.\n * \\`\"", "\"\\` check method declarations.\n "])), OPTION_FUNCTION_DECLARATION, OPTION_FUNCTION_EXPRESSION, OPTION_ARROW_FUNCTION, OPTION_METHOD_DECLARATION),
optionsDescription: "Not configurable.",
- options: null,
- optionExamples: [true],
+ options: {
+ type: "array",
+ items: {
+ type: "string",
+ enum: [
+ OPTION_FUNCTION_DECLARATION,
+ OPTION_FUNCTION_EXPRESSION,
+ OPTION_ARROW_FUNCTION,
+ OPTION_METHOD_DECLARATION,
+ ],
+ },
+ minLength: 0,
+ maxLength: 4,
+ },
+ optionExamples: [true,
+ [true, OPTION_FUNCTION_DECLARATION, OPTION_METHOD_DECLARATION]],
type: "typescript",
typescriptOnly: false,
requiresTypeInfo: true,
@@ -46,19 +82,23 @@ var Rule = /** @class */ (function (_super) {
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
function walk(ctx, tc) {
- return ts.forEachChild(ctx.sourceFile, function cb(node) {
- switch (node.kind) {
- case ts.SyntaxKind.MethodDeclaration:
- case ts.SyntaxKind.FunctionDeclaration:
- if (node.body === undefined) {
- break;
- }
- // falls through
- case ts.SyntaxKind.FunctionExpression:
- case ts.SyntaxKind.ArrowFunction:
- if (!tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) && returnsPromise(node, tc)) {
- ctx.addFailure(node.getStart(ctx.sourceFile), node.body.pos, Rule.FAILURE_STRING);
- }
+ var sourceFile = ctx.sourceFile, options = ctx.options;
+ return ts.forEachChild(sourceFile, function cb(node) {
+ if (options.has(node.kind)) {
+ switch (node.kind) {
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.FunctionDeclaration:
+ if (node.body === undefined) {
+ break;
+ }
+ // falls through
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.ArrowFunction:
+ if (!tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
+ && returnsPromise(node, tc)) {
+ ctx.addFailure(node.getStart(sourceFile), node.body.pos, Rule.FAILURE_STRING);
+ }
+ }
}
return ts.forEachChild(node, cb);
});
@@ -67,4 +107,4 @@ function returnsPromise(node, tc) {
var type = tc.getReturnTypeOfSignature(tc.getTypeAtLocation(node).getCallSignatures()[0]);
return type.symbol !== undefined && type.symbol.name === "Promise";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.d.ts b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
index a79a13730..c4f5cdecb 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.d.ts
+++ b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.js b/node_modules/tslint/lib/rules/quotemarkRule.js
index 19586069a..e4ab69552 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.js
+++ b/node_modules/tslint/lib/rules/quotemarkRule.js
@@ -53,7 +53,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "quotemark",
description: "Requires single or double quotes for string literals.",
hasFix: true,
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"` enforces single quotes.\n * `\"", "\"` enforces double quotes.\n * `\"", "\"` enforces single quotes for JSX attributes.\n * `\"", "\"` enforces double quotes for JSX attributes.\n * `\"", "\"` forbids single-line untagged template strings that do not contain string interpolations.\n * `\"", "\"` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, `[true, \"", "\", \"", "\"]` would not report a failure on the string literal\n `'Hello \"World\"'`."], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` enforces single quotes.\n * \\`\"", "\"\\` enforces double quotes.\n * \\`\"", "\"\\` enforces single quotes for JSX attributes.\n * \\`\"", "\"\\` enforces double quotes for JSX attributes.\n * \\`\"", "\"\\` forbids single-line untagged template strings that do not contain string interpolations.\n * \\`\"", "\"\\` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, \\`[true, \"", "\", \"", "\"]\\` would not report a failure on the string literal\n \\`'Hello \"World\"'\\`."], Lint.Utils.dedent(_a, OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_TEMPLATE, OPTION_AVOID_ESCAPE, OPTION_DOUBLE, OPTION_AVOID_ESCAPE)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"` enforces single quotes.\n * `\"", "\"` enforces double quotes.\n * `\"", "\"` enforces single quotes for JSX attributes.\n * `\"", "\"` enforces double quotes for JSX attributes.\n * `\"", "\"` forbids single-line untagged template strings that do not contain string interpolations.\n * `\"", "\"` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, `[true, \"", "\", \"", "\"]` would not report a failure on the string literal\n `'Hello \"World\"'`."], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\` enforces single quotes.\n * \\`\"", "\"\\` enforces double quotes.\n * \\`\"", "\"\\` enforces single quotes for JSX attributes.\n * \\`\"", "\"\\` enforces double quotes for JSX attributes.\n * \\`\"", "\"\\` forbids single-line untagged template strings that do not contain string interpolations.\n * \\`\"", "\"\\` allows you to use the \"other\" quotemark in cases where escaping would normally be required.\n For example, \\`[true, \"", "\", \"", "\"]\\` would not report a failure on the string literal\n \\`'Hello \"World\"'\\`."])), OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_TEMPLATE, OPTION_AVOID_ESCAPE, OPTION_DOUBLE, OPTION_AVOID_ESCAPE),
options: {
type: "array",
items: {
@@ -118,4 +118,4 @@ function getQuotemarkPreference(args) {
}
return undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/radixRule.d.ts b/node_modules/tslint/lib/rules/radixRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/radixRule.d.ts
+++ b/node_modules/tslint/lib/rules/radixRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/radixRule.js b/node_modules/tslint/lib/rules/radixRule.js
index 3d1f695de..e5548c558 100644
--- a/node_modules/tslint/lib/rules/radixRule.js
+++ b/node_modules/tslint/lib/rules/radixRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "radix",
description: "Requires the radix parameter to be specified when calling `parseInt`.",
- rationale: (_a = ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], _a.raw = ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."], ["\n From [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt):\n > Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.\n > Different implementations produce different results when a radix is not specified, usually defaulting the value to 10."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -44,21 +44,36 @@ var Rule = /** @class */ (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
+function isParseInt(expression) {
+ return tsutils_1.isIdentifier(expression) && expression.text === "parseInt";
+}
+function isPropertyAccessParseInt(expression) {
+ return tsutils_1.isPropertyAccessExpression(expression) && expression.name.text === "parseInt";
+}
+function isPropertyAccessOfIdentifier(expression, identifers) {
+ return tsutils_1.isPropertyAccessExpression(expression) && tsutils_1.isIdentifier(expression.expression) &&
+ identifers.some(function (identifer) { return expression.expression.text === identifer; });
+}
+function isPropertyAccessOfProperty(expression, identifers) {
+ return tsutils_1.isPropertyAccessExpression(expression) && tsutils_1.isPropertyAccessExpression(expression.expression) &&
+ identifers.some(function (identifer) { return expression.expression.name.text === identifer; });
+}
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isCallExpression(node) && node.arguments.length === 1 &&
(
// parseInt("123")
- tsutils_1.isIdentifier(node.expression) && node.expression.text === "parseInt" ||
- // window.parseInt("123") || global.parseInt("123")
- tsutils_1.isPropertyAccessExpression(node.expression) &&
- node.expression.name.text === "parseInt" &&
- tsutils_1.isIdentifier(node.expression.expression) &&
- (node.expression.expression.text === "global" ||
- node.expression.expression.text === "window"))) {
+ isParseInt(node.expression) ||
+ // window.parseInt("123") || global.parseInt("123") || Number.parseInt("123")
+ isPropertyAccessParseInt(node.expression) &&
+ isPropertyAccessOfIdentifier(node.expression, ["global", "window", "Number"]) ||
+ // window.Number.parseInt("123") || global.Number.parseInt("123")
+ isPropertyAccessParseInt(node.expression) &&
+ isPropertyAccessOfProperty(node.expression, ["Number"]) &&
+ isPropertyAccessOfIdentifier(node.expression.expression, ["global", "window"]))) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
index 222faaa7f..5867be53a 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2016 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
index c2b8bdb96..e05bd3fff 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
@@ -63,17 +63,17 @@ function walk(ctx, tc) {
});
}
function getBaseTypeOfLiteralType(type) {
- if (Lint.isTypeFlagSet(type, ts.TypeFlags.StringLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.String)) {
+ if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.StringLiteral) || tsutils_1.isTypeFlagSet(type, ts.TypeFlags.String)) {
return "string";
}
- else if (Lint.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) || Lint.isTypeFlagSet(type, ts.TypeFlags.Number)) {
+ else if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) || tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Number)) {
return "number";
}
- else if (tsutils_1.isUnionType(type) && !Lint.isTypeFlagSet(type, ts.TypeFlags.Enum)) {
+ else if (tsutils_1.isUnionType(type) && !tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Enum)) {
var types = type.types.map(getBaseTypeOfLiteralType);
return allSame(types) ? types[0] : "invalid";
}
- else if (Lint.isTypeFlagSet(type, ts.TypeFlags.EnumLiteral)) {
+ else if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.EnumLiteral)) {
// Compatibility for TypeScript pre-2.4, which used EnumLiteralType instead of LiteralType
getBaseTypeOfLiteralType(type.baseType);
}
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
index e2bae0d7c..4d6862114 100644
--- a/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.js b/node_modules/tslint/lib/rules/returnUndefinedRule.js
index e117a1b3d..ab3da43ce 100644
--- a/node_modules/tslint/lib/rules/returnUndefinedRule.js
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.js
@@ -98,10 +98,10 @@ function getReturnKind(node, checker) {
? tryGetReturnType(checker.getContextualType(node), checker)
: undefined;
var returnType = contextual !== undefined ? contextual : tryGetReturnType(checker.getTypeAtLocation(node), checker);
- if (returnType === undefined || Lint.isTypeFlagSet(returnType, ts.TypeFlags.Any)) {
+ if (returnType === undefined || tsutils_1.isTypeFlagSet(returnType, ts.TypeFlags.Any)) {
return undefined;
}
- if ((Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? isEffectivelyVoidPromise : isEffectivelyVoid)(returnType)) {
+ if ((tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? isEffectivelyVoidPromise : isEffectivelyVoid)(returnType)) {
return ReturnKind.Void;
}
return ReturnKind.Value;
@@ -111,7 +111,7 @@ function isEffectivelyVoidPromise(type) {
// Would need access to `checker.getPromisedTypeOfPromise` to do this properly.
// Assume that the return type is the global Promise (since this is an async function) and get its type argument.
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
tsutils_1.isUnionType(type) && type.types.every(isEffectivelyVoidPromise) ||
tsutils_1.isTypeReference(type) && type.typeArguments !== undefined && type.typeArguments.length === 1 &&
isEffectivelyVoidPromise(type.typeArguments[0]);
@@ -119,7 +119,7 @@ function isEffectivelyVoidPromise(type) {
/** True for `void`, `undefined`, or `void | undefined`. */
function isEffectivelyVoid(type) {
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Void | ts.TypeFlags.Undefined) ||
tsutils_1.isUnionType(type) && type.types.every(isEffectivelyVoid);
}
function tryGetReturnType(fnType, checker) {
diff --git a/node_modules/tslint/lib/rules/semicolonRule.d.ts b/node_modules/tslint/lib/rules/semicolonRule.d.ts
index 1e32e4a09..2f56b6ba7 100644
--- a/node_modules/tslint/lib/rules/semicolonRule.d.ts
+++ b/node_modules/tslint/lib/rules/semicolonRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/semicolonRule.js b/node_modules/tslint/lib/rules/semicolonRule.js
index 6901842f4..9e20e960a 100644
--- a/node_modules/tslint/lib/rules/semicolonRule.js
+++ b/node_modules/tslint/lib/rules/semicolonRule.js
@@ -47,7 +47,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "semicolon",
description: "Enforces consistent semicolon usage at the end of every statement.",
hasFix: true,
- optionsDescription: (_a = ["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods.\n * `\"", "\"` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides `\"", "\"`.\n "], _a.raw = ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods.\n * \\`\"", "\"\\` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides \\`\"", "\"\\`.\n "], Lint.Utils.dedent(_a, OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS, OPTION_STRICT_BOUND_CLASS_METHODS, OPTION_IGNORE_BOUND_CLASS_METHODS)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One of the following arguments must be provided:\n\n * `\"", "\"` enforces semicolons at the end of every statement.\n * `\"", "\"` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * `\"", "\"` skips checking semicolons at the end of interface members.\n * `\"", "\"` skips checking semicolons at the end of bound class methods.\n * `\"", "\"` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides `\"", "\"`.\n "], ["\n One of the following arguments must be provided:\n\n * \\`\"", "\"\\` enforces semicolons at the end of every statement.\n * \\`\"", "\"\\` disallows semicolons at the end of every statement except for when they are necessary.\n\n The following arguments may be optionally provided:\n\n * \\`\"", "\"\\` skips checking semicolons at the end of interface members.\n * \\`\"", "\"\\` skips checking semicolons at the end of bound class methods.\n * \\`\"", "\"\\` disables any special handling of bound class methods and treats them as any\n other assignment. This option overrides \\`\"", "\"\\`.\n "])), OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE_INTERFACES, OPTION_IGNORE_BOUND_CLASS_METHODS, OPTION_STRICT_BOUND_CLASS_METHODS, OPTION_IGNORE_BOUND_CLASS_METHODS),
options: {
type: "array",
items: [
@@ -326,4 +326,4 @@ var SemicolonNeverWalker = /** @class */ (function (_super) {
};
return SemicolonNeverWalker;
}(SemicolonWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
index 7e3282b8c..2d7e934fa 100644
--- a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
+++ b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var ALWAYS_OR_NEVER = {
@@ -50,7 +51,7 @@ var Rule = /** @class */ (function (_super) {
},
type: "object",
},
- optionsDescription: (_a = ["\n One argument which is an object which may contain the keys `anonymous`, `named`, and `asyncArrow`\n These should be set to either `\"always\"` or `\"never\"`.\n\n * `\"anonymous\"` checks before the opening paren in anonymous functions\n * `\"named\"` checks before the opening paren in named functions\n * `\"asyncArrow\"` checks before the opening paren in async arrow functions\n * `\"method\"` checks before the opening paren in class methods\n * `\"constructor\"` checks before the opening paren in class constructors\n "], _a.raw = ["\n One argument which is an object which may contain the keys \\`anonymous\\`, \\`named\\`, and \\`asyncArrow\\`\n These should be set to either \\`\"always\"\\` or \\`\"never\"\\`.\n\n * \\`\"anonymous\"\\` checks before the opening paren in anonymous functions\n * \\`\"named\"\\` checks before the opening paren in named functions\n * \\`\"asyncArrow\"\\` checks before the opening paren in async arrow functions\n * \\`\"method\"\\` checks before the opening paren in class methods\n * \\`\"constructor\"\\` checks before the opening paren in class constructors\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n One argument which is an object which may contain the keys `anonymous`, `named`, and `asyncArrow`\n These should be set to either `\"always\"` or `\"never\"`.\n\n * `\"anonymous\"` checks before the opening paren in anonymous functions\n * `\"named\"` checks before the opening paren in named functions\n * `\"asyncArrow\"` checks before the opening paren in async arrow functions\n * `\"method\"` checks before the opening paren in class methods\n * `\"constructor\"` checks before the opening paren in class constructors\n "], ["\n One argument which is an object which may contain the keys \\`anonymous\\`, \\`named\\`, and \\`asyncArrow\\`\n These should be set to either \\`\"always\"\\` or \\`\"never\"\\`.\n\n * \\`\"anonymous\"\\` checks before the opening paren in anonymous functions\n * \\`\"named\"\\` checks before the opening paren in named functions\n * \\`\"asyncArrow\"\\` checks before the opening paren in async arrow functions\n * \\`\"method\"\\` checks before the opening paren in class methods\n * \\`\"constructor\"\\` checks before the opening paren in class constructors\n "]))),
ruleName: "space-before-function-paren",
type: "style",
typescriptOnly: false,
@@ -80,7 +81,7 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
function check(node, option) {
- var openParen = Lint.childOfKind(node, ts.SyntaxKind.OpenParenToken);
+ var openParen = tsutils_1.getChildOfKind(node, ts.SyntaxKind.OpenParenToken, sourceFile);
// openParen may be missing for an async arrow function `async x => ...`.
if (openParen === undefined) {
return;
@@ -99,7 +100,7 @@ function walk(ctx) {
function getOption(node, options) {
switch (node.kind) {
case ts.SyntaxKind.ArrowFunction:
- return !hasTypeParameters(node) && Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
+ return !hasTypeParameters(node) && tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword)
? options.asyncArrow : undefined;
case ts.SyntaxKind.Constructor:
return options.constructor;
@@ -123,4 +124,4 @@ function getOption(node, options) {
function hasTypeParameters(node) {
return node.typeParameters !== undefined;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts b/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
index 4ed2047ee..37eb73ffd 100644
--- a/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
+++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.js b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
index 55e7de0a9..c53cc75ce 100644
--- a/node_modules/tslint/lib/rules/spaceWithinParensRule.js
+++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
@@ -37,9 +37,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "space-within-parens",
- description: "Enforces spaces within parentheses or disallow them.",
+ description: "Enforces spaces within parentheses or disallow them. Empty parentheses () are always allowed.",
hasFix: true,
- optionsDescription: (_a = ["\n You may enforce the amount of whitespace within parentheses.\n "], _a.raw = ["\n You may enforce the amount of whitespace within parentheses.\n "], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n You may enforce the amount of whitespace within parentheses.\n "], ["\n You may enforce the amount of whitespace within parentheses.\n "]))),
options: { type: "number", min: 0 },
type: "style",
typescriptOnly: false,
@@ -75,10 +75,14 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) {
var _this = this;
tsutils_1.forEachToken(sourceFile, function (token) {
if (token.kind === ts.SyntaxKind.OpenParenToken) {
- _this.checkOpenParenToken(token);
+ if (sourceFile.text.charAt(token.end) !== ")") {
+ _this.checkOpenParenToken(token);
+ }
}
else if (token.kind === ts.SyntaxKind.CloseParenToken) {
- _this.checkCloseParenToken(token);
+ if (sourceFile.text.charAt(token.end - 2) !== "(") {
+ _this.checkCloseParenToken(token);
+ }
}
});
};
@@ -151,4 +155,4 @@ var SpaceWithinParensWalker = /** @class */ (function (_super) {
};
return SpaceWithinParensWalker;
}(Lint.AbstractWalker));
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
index 8a360c959..10d7c24dc 100644
--- a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.d.ts
@@ -29,7 +29,7 @@ export declare const enum TypeFailure {
Null = 4,
Undefined = 5,
Enum = 6,
- Mixes = 7,
+ Mixes = 7
}
declare module "typescript" {
interface IntrinsicType extends ts.Type {
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
index 605d85929..dc3dd9227 100644
--- a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
@@ -17,6 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_NULL_UNION = "allow-null-union";
@@ -37,8 +38,8 @@ var Rule = /** @class */ (function (_super) {
};
Rule.metadata = {
ruleName: "strict-boolean-expressions",
- description: (_a = ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the `!`, `&&`, and `||` operators\n * The condition in a conditional expression (`cond ? x : y`)\n * Conditions for `if`, `for`, `while`, and `do-while` statements."], _a.raw = ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the \\`!\\`, \\`&&\\`, and \\`||\\` operators\n * The condition in a conditional expression (\\`cond ? x : y\\`)\n * Conditions for \\`if\\`, \\`for\\`, \\`while\\`, and \\`do-while\\` statements."], Lint.Utils.dedent(_a)),
- optionsDescription: (_b = ["\n These options may be provided:\n\n * `", "` allows union types containing `null`.\n - It does *not* allow `null` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows union types containing `undefined`.\n - It does *not* allow `undefined` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows strings.\n - It does *not* allow unions containing `string`.\n - It does *not* allow string literal types.\n * `", "` allows numbers.\n - It does *not* allow unions containing `number`.\n - It does *not* allow enums or number literal types.\n * `", "` allows multiple of the above to appear together.\n - For example, `string | number` or `RegExp | null | undefined` would normally not be allowed.\n - A type like `\"foo\" | \"bar\" | undefined` is always allowed, because it has only one way to be false.\n * `", "` allows `boolean | undefined`.\n - Also allows `true | false | undefined`.\n - Does not allow `false | undefined`.\n - This option is a subset of `", "`, so you don't need to enable both options at the same time.\n "], _b.raw = ["\n These options may be provided:\n\n * \\`", "\\` allows union types containing \\`null\\`.\n - It does *not* allow \\`null\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows union types containing \\`undefined\\`.\n - It does *not* allow \\`undefined\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows strings.\n - It does *not* allow unions containing \\`string\\`.\n - It does *not* allow string literal types.\n * \\`", "\\` allows numbers.\n - It does *not* allow unions containing \\`number\\`.\n - It does *not* allow enums or number literal types.\n * \\`", "\\` allows multiple of the above to appear together.\n - For example, \\`string | number\\` or \\`RegExp | null | undefined\\` would normally not be allowed.\n - A type like \\`\"foo\" | \"bar\" | undefined\\` is always allowed, because it has only one way to be false.\n * \\`", "\\` allows \\`boolean | undefined\\`.\n - Also allows \\`true | false | undefined\\`.\n - Does not allow \\`false | undefined\\`.\n - This option is a subset of \\`", "\\`, so you don't need to enable both options at the same time.\n "], Lint.Utils.dedent(_b, OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER, OPTION_ALLOW_MIX, OPTION_ALLOW_BOOLEAN_OR_UNDEFINED, OPTION_ALLOW_UNDEFINED_UNION)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the `!`, `&&`, and `||` operators\n * The condition in a conditional expression (`cond ? x : y`)\n * Conditions for `if`, `for`, `while`, and `do-while` statements."], ["\n Restricts the types allowed in boolean expressions. By default only booleans are allowed.\n\n The following nodes are checked:\n\n * Arguments to the \\`!\\`, \\`&&\\`, and \\`||\\` operators\n * The condition in a conditional expression (\\`cond ? x : y\\`)\n * Conditions for \\`if\\`, \\`for\\`, \\`while\\`, and \\`do-while\\` statements."]))),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n These options may be provided:\n\n * `", "` allows union types containing `null`.\n - It does *not* allow `null` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows union types containing `undefined`.\n - It does *not* allow `undefined` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * `", "` allows strings.\n - It does *not* allow unions containing `string`.\n - It does *not* allow string literal types.\n * `", "` allows numbers.\n - It does *not* allow unions containing `number`.\n - It does *not* allow enums or number literal types.\n * `", "` allows multiple of the above to appear together.\n - For example, `string | number` or `RegExp | null | undefined` would normally not be allowed.\n - A type like `\"foo\" | \"bar\" | undefined` is always allowed, because it has only one way to be false.\n * `", "` allows `boolean | undefined`.\n - Also allows `true | false | undefined`.\n - Does not allow `false | undefined`.\n - This option is a subset of `", "`, so you don't need to enable both options at the same time.\n "], ["\n These options may be provided:\n\n * \\`", "\\` allows union types containing \\`null\\`.\n - It does *not* allow \\`null\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows union types containing \\`undefined\\`.\n - It does *not* allow \\`undefined\\` itself.\n - Without the '--strictNullChecks' compiler option, this will allow anything other than a string, number, or enum.\n * \\`", "\\` allows strings.\n - It does *not* allow unions containing \\`string\\`.\n - It does *not* allow string literal types.\n * \\`", "\\` allows numbers.\n - It does *not* allow unions containing \\`number\\`.\n - It does *not* allow enums or number literal types.\n * \\`", "\\` allows multiple of the above to appear together.\n - For example, \\`string | number\\` or \\`RegExp | null | undefined\\` would normally not be allowed.\n - A type like \\`\"foo\" | \"bar\" | undefined\\` is always allowed, because it has only one way to be false.\n * \\`", "\\` allows \\`boolean | undefined\\`.\n - Also allows \\`true | false | undefined\\`.\n - Does not allow \\`false | undefined\\`.\n - This option is a subset of \\`", "\\`, so you don't need to enable both options at the same time.\n "])), OPTION_ALLOW_NULL_UNION, OPTION_ALLOW_UNDEFINED_UNION, OPTION_ALLOW_STRING, OPTION_ALLOW_NUMBER, OPTION_ALLOW_MIX, OPTION_ALLOW_BOOLEAN_OR_UNDEFINED, OPTION_ALLOW_UNDEFINED_UNION),
options: {
type: "array",
items: {
@@ -155,10 +156,10 @@ function getTypeFailure(type, options) {
case true:
// Allow 'any'. Allow 'true' itself, but not any other always-truthy type.
// tslint:disable-next-line no-bitwise
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.BooleanLiteral) ? undefined : 0 /* AlwaysTruthy */;
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.BooleanLiteral) ? undefined : 0 /* AlwaysTruthy */;
case false:
// Allow 'false' itself, but not any other always-falsy type
- return Lint.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) ? undefined : 1 /* AlwaysFalsy */;
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) ? undefined : 1 /* AlwaysFalsy */;
case undefined:
return undefined;
}
@@ -167,13 +168,13 @@ function isBooleanUndefined(type) {
var isTruthy = false;
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var ty = _a[_i];
- if (Lint.isTypeFlagSet(ty, ts.TypeFlags.Boolean)) {
+ if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Boolean)) {
isTruthy = true;
}
- else if (Lint.isTypeFlagSet(ty, ts.TypeFlags.BooleanLiteral)) {
+ else if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.BooleanLiteral)) {
isTruthy = isTruthy || ty.intrinsicName === "true";
}
- else if (!Lint.isTypeFlagSet(ty, ts.TypeFlags.Void | ts.TypeFlags.Undefined)) {
+ else if (!tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Void | ts.TypeFlags.Undefined)) { // tslint:disable-line:no-bitwise
return undefined;
}
}
@@ -267,7 +268,7 @@ function getKind(type) {
(type.intrinsicName === "true" ? 9 /* AlwaysTruthy */ : 5 /* FalseBooleanLiteral */)
: 9 /* AlwaysTruthy */;
function is(flags) {
- return Lint.isTypeFlagSet(type, flags);
+ return tsutils_1.isTypeFlagSet(type, flags);
}
}
function numberLiteralIsZero(type) {
@@ -307,7 +308,7 @@ function stringOr(parts) {
}
}
function isUnionType(type) {
- return Lint.isTypeFlagSet(type, ts.TypeFlags.Union) && !Lint.isTypeFlagSet(type, ts.TypeFlags.Enum);
+ return tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Union) && !tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Enum);
}
function showLocation(n) {
switch (n.kind) {
@@ -371,4 +372,4 @@ function showTypeFailure(ty, unionType, strictNullChecks) {
case 7 /* Mixes */: return "unions more than one truthy/falsy type";
}
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
index 85b7194c3..1ad0fb902 100644
--- a/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
index 526116dd3..0a4c1a41e 100644
--- a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "strict-type-predicates",
- description: (_a = ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires `strictNullChecks` to work properly."], _a.raw = ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires \\`strictNullChecks\\` to work properly."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires `strictNullChecks` to work properly."], ["\n Warns for type predicates that are always true or always false.\n Works for 'typeof' comparisons to constants (e.g. 'typeof foo === \"string\"'), and equality comparison to 'null'/'undefined'.\n (TypeScript won't let you compare '1 === 2', but it has an exception for '1 === undefined'.)\n Does not yet work for 'instanceof'.\n Does *not* warn for 'if (x.y)' where 'x.y' is always truthy. For that, see strict-boolean-expressions.\n\n This rule requires \\`strictNullChecks\\` to work properly."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -78,7 +78,7 @@ function walk(ctx, checker) {
}
var exprType = checker.getTypeAtLocation(exprPred.expression);
// TODO: could use checker.getBaseConstraintOfType to help with type parameters, but it's not publicly exposed.
- if (Lint.isTypeFlagSet(exprType, ts.TypeFlags.Any | ts.TypeFlags.TypeParameter)) {
+ if (tsutils_1.isTypeFlagSet(exprType, ts.TypeFlags.Any | ts.TypeFlags.TypeParameter)) {
return;
}
switch (exprPred.kind) {
@@ -116,11 +116,19 @@ function getTypePredicateOneWay(left, right, isStrictEquals) {
switch (right.kind) {
case ts.SyntaxKind.TypeOfExpression:
var expression = right.expression;
- var kind = left.kind === ts.SyntaxKind.StringLiteral ? left.text : "";
- var predicate = getTypePredicateForKind(kind);
+ if (!tsutils_1.isLiteralExpression(left)) {
+ if (tsutils_1.isIdentifier(left) && left.text === "undefined" ||
+ left.kind === ts.SyntaxKind.NullKeyword ||
+ left.kind === ts.SyntaxKind.TrueKeyword ||
+ left.kind === ts.SyntaxKind.FalseKeyword) {
+ return { kind: 2 /* TypeofTypo */ };
+ }
+ return undefined;
+ }
+ var predicate = getTypePredicateForKind(left.text);
return predicate === undefined
? { kind: 2 /* TypeofTypo */ }
- : { kind: 0 /* Plain */, expression: expression, predicate: predicate, isNullOrUndefined: kind === "undefined" };
+ : { kind: 0 /* Plain */, expression: expression, predicate: predicate, isNullOrUndefined: left.text === "undefined" };
case ts.SyntaxKind.NullKeyword:
return nullOrUndefined(ts.TypeFlags.Null);
case ts.SyntaxKind.Identifier:
@@ -159,13 +167,13 @@ function getTypePredicateForKind(kind) {
// It's an object if it's not any of the above.
var allFlags_1 = ts.TypeFlags.Undefined | ts.TypeFlags.Void | ts.TypeFlags.BooleanLike |
ts.TypeFlags.NumberLike | ts.TypeFlags.StringLike | ts.TypeFlags.ESSymbol;
- return function (type) { return !Lint.isTypeFlagSet(type, allFlags_1) && !isFunction(type); };
+ return function (type) { return !tsutils_1.isTypeFlagSet(type, allFlags_1) && !isFunction(type); };
default:
return undefined;
}
}
function flagPredicate(testedFlag) {
- return function (type) { return Lint.isTypeFlagSet(type, testedFlag); };
+ return function (type) { return tsutils_1.isTypeFlagSet(type, testedFlag); };
}
function isFunction(t) {
if (t.getConstructSignatures().length !== 0 || t.getCallSignatures().length !== 0) {
@@ -199,10 +207,10 @@ function testNonStrictNullUndefined(type) {
var anyOther = false;
for (var _i = 0, _a = unionParts(type); _i < _a.length; _i++) {
var ty = _a[_i];
- if (Lint.isTypeFlagSet(ty, ts.TypeFlags.Null)) {
+ if (tsutils_1.isTypeFlagSet(ty, ts.TypeFlags.Null)) {
anyNull = true;
}
- else if (Lint.isTypeFlagSet(ty, undefinedFlags)) {
+ else if (tsutils_1.isTypeFlagSet(ty, undefinedFlags)) {
anyUndefined = true;
}
else {
@@ -218,4 +226,4 @@ function testNonStrictNullUndefined(type) {
function unionParts(type) {
return tsutils_1.isUnionType(type) ? type.types : [type];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/switchDefaultRule.d.ts b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
index cce59d100..06b7c4bbe 100644
--- a/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
+++ b/node_modules/tslint/lib/rules/switchDefaultRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2015 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts b/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
index 927ecfb9d..7c36ce7a5 100644
--- a/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
+++ b/node_modules/tslint/lib/rules/switchFinalBreakRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/switchFinalBreakRule.js b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
index d2477edab..bc6417eab 100644
--- a/node_modules/tslint/lib/rules/switchFinalBreakRule.js
+++ b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
@@ -33,7 +33,8 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "switch-final-break",
description: "Checks whether the final clause of a switch statement ends in \`break;\`.",
- optionsDescription: (_a = ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], _a.raw = ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], Lint.Utils.dedent(_a)),
+ hasFix: true,
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."], ["\n If no options are passed, a final 'break;' is forbidden.\n If the \"always\" option is passed this will require a 'break;' to always be present\n unless control flow is escaped in some other way."]))),
options: {
type: "string",
enum: [
@@ -65,29 +66,45 @@ function walk(ctx) {
}
if (always) {
if (!tsutils_1.endsControlFlow(clause)) {
- ctx.addFailureAtNode(clause.getChildAt(0), Rule.FAILURE_STRING_ALWAYS);
+ ctx.addFailureAtNode(clause.getChildAt(0), Rule.FAILURE_STRING_ALWAYS, createAddFix(clause));
}
return;
}
- if (clause.statements.length === 0) {
+ var lastStatement = getLastStatement(clause);
+ if (lastStatement === undefined || !tsutils_1.isBreakStatement(lastStatement)) {
return;
}
- var block = clause.statements[0];
- var statements = clause.statements.length === 1 && tsutils_1.isBlock(block) ? block.statements : clause.statements;
- var lastStatement = last(statements);
- if (lastStatement !== undefined && tsutils_1.isBreakStatement(lastStatement)) {
- if (lastStatement.label !== undefined) {
- var parent = node.parent;
- if (!tsutils_1.isLabeledStatement(parent) || parent.label === lastStatement.label) {
- // break jumps somewhere else, don't complain
- return;
- }
+ if (lastStatement.label !== undefined) {
+ var parent = node.parent;
+ if (!tsutils_1.isLabeledStatement(parent) || parent.label === lastStatement.label) {
+ // break jumps somewhere else, don't complain
+ return;
}
- ctx.addFailureAtNode(lastStatement, Rule.FAILURE_STRING_NEVER);
}
+ ctx.addFailureAtNode(lastStatement, Rule.FAILURE_STRING_NEVER, createRemoveFix(lastStatement));
}
+ function createAddFix(clause) {
+ var lastStatement = getLastStatement(clause);
+ if (lastStatement === undefined) {
+ return Lint.Replacement.appendText(clause.end, " break;");
+ }
+ var fullText = lastStatement.getFullText(ctx.sourceFile);
+ var indentation = fullText.slice(0, fullText.search(/\S+/));
+ return Lint.Replacement.appendText(lastStatement.end, indentation + "break;");
+ }
+ function createRemoveFix(lastStatement) {
+ return Lint.Replacement.replaceFromTo(lastStatement.getFullStart(), lastStatement.end, "");
+ }
+}
+function getLastStatement(clause) {
+ if (clause.statements.length === 0) {
+ return undefined;
+ }
+ var block = clause.statements[0];
+ var statements = clause.statements.length === 1 && tsutils_1.isBlock(block) ? block.statements : clause.statements;
+ return last(statements);
}
function last(arr) {
return arr[arr.length - 1];
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.d.ts b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
index ac23c5939..8b60fb6f7 100644
--- a/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.js b/node_modules/tslint/lib/rules/trailingCommaRule.js
index 784bc9a58..f6270e27c 100644
--- a/node_modules/tslint/lib/rules/trailingCommaRule.js
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.js
@@ -69,9 +69,9 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "trailing-comma",
- description: (_a = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], _a.raw = ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."], ["\n Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings,\n named imports and exports and function parameters."]))),
hasFix: true,
- optionsDescription: (_b = ["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option `esSpecCompliant`. Set this option to `true` to disallow trailing comma on\n object and array rest and rest parameters.\n "], _b.raw = ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option \\`esSpecCompliant\\`. Set this option to \\`true\\` to disallow trailing comma on\n object and array rest and rest parameters.\n "], Lint.Utils.dedent(_b)),
+ optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n One argument which is an object with the keys `multiline` and `singleline`.\n Both can be set to a string (`\"always\"` or `\"never\"`) or an object.\n\n The object can contain any of the following keys: `\"arrays\"`, `\"objects\"`, `\"functions\"`,\n `\"imports\"`, `\"exports\"`, and `\"typeLiterals\"`; each key can have one of the following\n values: `\"always\"`, `\"never\"`, and `\"ignore\"`. Any missing keys will default to `\"ignore\"`.\n\n * `\"multiline\"` checks multi-line object literals.\n * `\"singleline\"` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option `esSpecCompliant`. Set this option to `true` to disallow trailing comma on\n object and array rest and rest parameters.\n "], ["\n One argument which is an object with the keys \\`multiline\\` and \\`singleline\\`.\n Both can be set to a string (\\`\"always\"\\` or \\`\"never\"\\`) or an object.\n\n The object can contain any of the following keys: \\`\"arrays\"\\`, \\`\"objects\"\\`, \\`\"functions\"\\`,\n \\`\"imports\"\\`, \\`\"exports\"\\`, and \\`\"typeLiterals\"\\`; each key can have one of the following\n values: \\`\"always\"\\`, \\`\"never\"\\`, and \\`\"ignore\"\\`. Any missing keys will default to \\`\"ignore\"\\`.\n\n * \\`\"multiline\"\\` checks multi-line object literals.\n * \\`\"singleline\"\\` checks single-line object literals.\n\n An array is considered \"multiline\" if its closing bracket is on a line\n after the last array element. The same general logic is followed for\n object literals, function typings, named import statements\n and function parameters.\n\n To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs,\n there is a third option \\`esSpecCompliant\\`. Set this option to \\`true\\` to disallow trailing comma on\n object and array rest and rest parameters.\n "]))),
options: {
type: "object",
properties: {
@@ -231,4 +231,4 @@ function isArrayRest(node) {
function noRest() {
return false;
}
-var _a, _b;
+var templateObject_1, templateObject_2;
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
index 7a87690b6..1d2d9cb96 100644
--- a/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.js b/node_modules/tslint/lib/rules/tripleEqualsRule.js
index 7b4490807..a5b1fbbf7 100644
--- a/node_modules/tslint/lib/rules/tripleEqualsRule.js
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.js
@@ -37,7 +37,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "triple-equals",
description: "Requires `===` and `!==` in place of `==` and `!=`.",
- optionsDescription: (_a = ["\n Two arguments may be optionally provided:\n\n * `\"allow-null-check\"` allows `==` and `!=` when comparing to `null`.\n * `\"allow-undefined-check\"` allows `==` and `!=` when comparing to `undefined`."], _a.raw = ["\n Two arguments may be optionally provided:\n\n * \\`\"allow-null-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`null\\`.\n * \\`\"allow-undefined-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`undefined\\`."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments may be optionally provided:\n\n * `\"allow-null-check\"` allows `==` and `!=` when comparing to `null`.\n * `\"allow-undefined-check\"` allows `==` and `!=` when comparing to `undefined`."], ["\n Two arguments may be optionally provided:\n\n * \\`\"allow-null-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`null\\`.\n * \\`\"allow-undefined-check\"\\` allows \\`==\\` and \\`!=\\` when comparing to \\`undefined\\`."]))),
options: {
type: "array",
items: {
@@ -83,4 +83,4 @@ function isExpressionAllowed(node, options) {
node.kind === ts.SyntaxKind.Identifier &&
node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
index b8b6debd3..38389b0de 100644
--- a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
+++ b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
index 691ecffc5..cfbe088d9 100644
--- a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
+++ b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
@@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) {
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "type-literal-delimiter",
- description: (_a = ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], _a.raw = ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], Lint.Utils.dedent(_a)),
+ description: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."], ["\n Checks that type literal members are separated by semicolons.\n Enforces a trailing semicolon for multiline type literals."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -79,4 +79,4 @@ function walk(ctx) {
});
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typedefRule.d.ts b/node_modules/tslint/lib/rules/typedefRule.d.ts
index 6c60fe1ce..fc68d04af 100644
--- a/node_modules/tslint/lib/rules/typedefRule.d.ts
+++ b/node_modules/tslint/lib/rules/typedefRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typedefRule.js b/node_modules/tslint/lib/rules/typedefRule.js
index 76022abd9..1f1bfb51e 100644
--- a/node_modules/tslint/lib/rules/typedefRule.js
+++ b/node_modules/tslint/lib/rules/typedefRule.js
@@ -50,7 +50,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "typedef",
description: "Requires type definitions to exist.",
- optionsDescription: (_a = ["\n Several arguments may be optionally provided:\n\n * `\"", "\"` checks return type of functions.\n * `\"", "\"` checks return type of arrow functions.\n * `\"", "\"` checks type specifier of function parameters for non-arrow functions.\n * `\"", "\"` checks type specifier of function parameters for arrow functions.\n * `\"", "\"` checks return types of interface properties.\n * `\"", "\"` checks non-binding variable declarations.\n * `\"", "\"` checks member variable declarations.\n * `\"", "\"` checks object destructuring declarations.\n * `\"", "\"` checks array destructuring declarations."], _a.raw = ["\n Several arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks return type of functions.\n * \\`\"", "\"\\` checks return type of arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for non-arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for arrow functions.\n * \\`\"", "\"\\` checks return types of interface properties.\n * \\`\"", "\"\\` checks non-binding variable declarations.\n * \\`\"", "\"\\` checks member variable declarations.\n * \\`\"", "\"\\` checks object destructuring declarations.\n * \\`\"", "\"\\` checks array destructuring declarations."], Lint.Utils.dedent(_a, OPTION_CALL_SIGNATURE, OPTION_ARROW_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_ARROW_PARAMETER, OPTION_PROPERTY_DECLARATION, OPTION_VARIABLE_DECLARATION, OPTION_MEMBER_VARIABLE_DECLARATION, OPTION_OBJECT_DESTRUCTURING, OPTION_ARRAY_DESTRUCTURING)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Several arguments may be optionally provided:\n\n * `\"", "\"` checks return type of functions.\n * `\"", "\"` checks return type of arrow functions.\n * `\"", "\"` checks type specifier of function parameters for non-arrow functions.\n * `\"", "\"` checks type specifier of function parameters for arrow functions.\n * `\"", "\"` checks return types of interface properties.\n * `\"", "\"` checks non-binding variable declarations.\n * `\"", "\"` checks member variable declarations.\n * `\"", "\"` checks object destructuring declarations.\n * `\"", "\"` checks array destructuring declarations."], ["\n Several arguments may be optionally provided:\n\n * \\`\"", "\"\\` checks return type of functions.\n * \\`\"", "\"\\` checks return type of arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for non-arrow functions.\n * \\`\"", "\"\\` checks type specifier of function parameters for arrow functions.\n * \\`\"", "\"\\` checks return types of interface properties.\n * \\`\"", "\"\\` checks non-binding variable declarations.\n * \\`\"", "\"\\` checks member variable declarations.\n * \\`\"", "\"\\` checks object destructuring declarations.\n * \\`\"", "\"\\` checks array destructuring declarations."])), OPTION_CALL_SIGNATURE, OPTION_ARROW_CALL_SIGNATURE, OPTION_PARAMETER, OPTION_ARROW_PARAMETER, OPTION_PROPERTY_DECLARATION, OPTION_VARIABLE_DECLARATION, OPTION_MEMBER_VARIABLE_DECLARATION, OPTION_OBJECT_DESTRUCTURING, OPTION_ARRAY_DESTRUCTURING),
options: {
type: "array",
items: {
@@ -193,4 +193,4 @@ function isNodeArray(nodeOrArray) {
return Array.isArray(nodeOrArray);
}
exports.isNodeArray = isNodeArray;
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
index 1f72293ed..a62a0ba69 100644
--- a/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
index 04d58629e..be87083de 100644
--- a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
@@ -57,7 +57,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "typedef-whitespace",
description: "Requires or disallows whitespace for type definitions.",
descriptionDetails: "Determines if a space is required or not before the colon in a type specifier.",
- optionsDescription: (_a = ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of `\"onespace\"`, `\"space\"` or `\"nospace\"`.\n Possible keys are:\n\n * `\"call-signature\"` checks return type of functions.\n * `\"index-signature\"` checks index type specifier of indexers.\n * `\"parameter\"` checks function parameters.\n * `\"property-declaration\"` checks object property declarations.\n * `\"variable-declaration\"` checks variable declaration."], _a.raw = ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of \\`\"onespace\"\\`, \\`\"space\"\\` or \\`\"nospace\"\\`.\n Possible keys are:\n\n * \\`\"call-signature\"\\` checks return type of functions.\n * \\`\"index-signature\"\\` checks index type specifier of indexers.\n * \\`\"parameter\"\\` checks function parameters.\n * \\`\"property-declaration\"\\` checks object property declarations.\n * \\`\"variable-declaration\"\\` checks variable declaration."], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of `\"onespace\"`, `\"space\"` or `\"nospace\"`.\n Possible keys are:\n\n * `\"call-signature\"` checks return type of functions.\n * `\"index-signature\"` checks index type specifier of indexers.\n * `\"parameter\"` checks function parameters.\n * `\"property-declaration\"` checks object property declarations.\n * `\"variable-declaration\"` checks variable declaration."], ["\n Two arguments which are both objects.\n The first argument specifies how much space should be to the _left_ of a typedef colon.\n The second argument specifies how much space should be to the _right_ of a typedef colon.\n Each key should have a value of \\`\"onespace\"\\`, \\`\"space\"\\` or \\`\"nospace\"\\`.\n Possible keys are:\n\n * \\`\"call-signature\"\\` checks return type of functions.\n * \\`\"index-signature\"\\` checks index type specifier of indexers.\n * \\`\"parameter\"\\` checks function parameters.\n * \\`\"property-declaration\"\\` checks object property declarations.\n * \\`\"variable-declaration\"\\` checks variable declaration."]))),
options: {
type: "array",
items: [SPACE_OBJECT, SPACE_OBJECT],
@@ -106,7 +106,7 @@ var TypedefWhitespaceWalker = /** @class */ (function (_super) {
return ts.forEachChild(sourceFile, cb);
};
TypedefWhitespaceWalker.prototype.checkSpace = function (node, key) {
- if (node.type === undefined) {
+ if (!("type" in node) || node.type === undefined) {
return;
}
var _a = this.options, left = _a.left, right = _a.right;
@@ -195,4 +195,4 @@ function getOptionType(node) {
return undefined;
}
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.d.ts b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.js b/node_modules/tslint/lib/rules/typeofCompareRule.js
index 7668784df..9a6b5f2d9 100644
--- a/node_modules/tslint/lib/rules/typeofCompareRule.js
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.js
@@ -38,7 +38,7 @@ var Rule = /** @class */ (function (_super) {
optionExamples: [true],
type: "functionality",
typescriptOnly: false,
- deprecationMessage: ts.versionMajorMinor === "2.1"
+ deprecationMessage: !/^2\.1\./.test(ts.version)
? "Starting from TypeScript 2.2 the compiler includes this check which makes this rule redundant."
: "",
};
diff --git a/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
index 0a461d4d2..08c051e01 100644
--- a/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
+++ b/node_modules/tslint/lib/rules/unifiedSignaturesRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
@@ -5,6 +21,6 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING_OMITTING_SINGLE_PARAMETER(otherLine?: number): string;
static FAILURE_STRING_OMITTING_REST_PARAMETER(otherLine?: number): string;
static FAILURE_STRING_SINGLE_PARAMETER_DIFFERENCE(otherLine: number | undefined, type1: string, type2: string): string;
- private static FAILURE_STRING_START(otherLine?);
+ private static FAILURE_STRING_START;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
index d2d51d1d1..4df32174e 100644
--- a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
+++ b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.TypedRule {
diff --git a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
index 5036e75e2..d07faac42 100644
--- a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
+++ b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
@@ -49,11 +49,11 @@ function walk(ctx, checker) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
var argsAndParams = getArgsAndParameters(node, checker);
if (argsAndParams !== undefined) {
- checkArgsAndParameters(node, argsAndParams);
+ checkArgsAndParameters(argsAndParams);
}
return ts.forEachChild(node, cb);
});
- function checkArgsAndParameters(node, _a) {
+ function checkArgsAndParameters(_a) {
var typeArguments = _a.typeArguments, typeParameters = _a.typeParameters;
// Just check the last one. Must specify previous type parameters if the last one is specified.
var i = typeArguments.length - 1;
@@ -65,12 +65,10 @@ function walk(ctx, checker) {
}
function createFix() {
if (i === 0) {
- var lt = Lint.childOfKind(node, ts.SyntaxKind.LessThanToken);
- var gt = Lint.childOfKind(node, ts.SyntaxKind.GreaterThanToken);
- return Lint.Replacement.deleteFromTo(lt.getStart(), gt.getEnd());
+ return Lint.Replacement.deleteFromTo(typeArguments.pos - 1, typeArguments.end + 1);
}
else {
- return Lint.Replacement.deleteFromTo(typeArguments[i - 1].getEnd(), arg.getEnd());
+ return Lint.Replacement.deleteFromTo(typeArguments[i - 1].end, arg.end);
}
}
}
@@ -117,5 +115,5 @@ function getAliasedSymbol(symbol, checker) {
if (symbol === undefined) {
return undefined;
}
- return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : symbol;
+ return tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : symbol;
}
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.d.ts b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
index cce59d100..f4050b9de 100644
--- a/node_modules/tslint/lib/rules/useIsnanRule.d.ts
+++ b/node_modules/tslint/lib/rules/useIsnanRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.js b/node_modules/tslint/lib/rules/useIsnanRule.js
index bbb845580..cd5de673a 100644
--- a/node_modules/tslint/lib/rules/useIsnanRule.js
+++ b/node_modules/tslint/lib/rules/useIsnanRule.js
@@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "use-isnan",
description: "Enforces use of the `isNaN()` function to check for NaN references instead of a comparison to the `NaN` constant.",
- rationale: (_a = ["\n Since `NaN !== NaN`, comparisons with regular operators will produce unexpected results.\n So, instead of `if (myVar === NaN)`, do `if (isNaN(myVar))`."], _a.raw = ["\n Since \\`NaN !== NaN\\`, comparisons with regular operators will produce unexpected results.\n So, instead of \\`if (myVar === NaN)\\`, do \\`if (isNaN(myVar))\\`."], Lint.Utils.dedent(_a)),
+ rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Since `NaN !== NaN`, comparisons with regular operators will produce unexpected results.\n So, instead of `if (myVar === NaN)`, do `if (isNaN(myVar))`."], ["\n Since \\`NaN !== NaN\\`, comparisons with regular operators will produce unexpected results.\n So, instead of \\`if (myVar === NaN)\\`, do \\`if (isNaN(myVar))\\`."]))),
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
@@ -67,4 +67,4 @@ function walk(ctx) {
function isExpressionNaN(node) {
return node.kind === ts.SyntaxKind.Identifier && node.text === "NaN";
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/variableNameRule.js b/node_modules/tslint/lib/rules/variableNameRule.js
index ce17c71ea..d33afc53b 100644
--- a/node_modules/tslint/lib/rules/variableNameRule.js
+++ b/node_modules/tslint/lib/rules/variableNameRule.js
@@ -18,6 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// tslint:disable object-literal-sort-keys
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
@@ -41,7 +42,7 @@ var Rule = /** @class */ (function (_super) {
Rule.metadata = {
ruleName: "variable-name",
description: "Checks variable names for various errors.",
- optionsDescription: (_a = ["\n Five arguments may be optionally provided:\n\n * `\"", "\"`: allows only lowerCamelCased or UPPER_CASED variable names\n * `\"", "\"` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows PascalCase in addition to lowerCamelCase.\n * `\"", "\"` allows snake_case in addition to lowerCamelCase.\n * `\"", "\"`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], _a.raw = ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\`: allows only lowerCamelCased or UPPER_CASED variable names\n * \\`\"", "\"\\` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows PascalCase in addition to lowerCamelCase.\n * \\`\"", "\"\\` allows snake_case in addition to lowerCamelCase.\n * \\`\"", "\"\\`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], Lint.Utils.dedent(_a, OPTION_CHECK_FORMAT, OPTION_LEADING_UNDERSCORE, OPTION_TRAILING_UNDERSCORE, OPTION_ALLOW_PASCAL_CASE, OPTION_ALLOW_SNAKE_CASE, OPTION_BAN_KEYWORDS, bannedKeywordsStr)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Five arguments may be optionally provided:\n\n * `\"", "\"`: allows only lowerCamelCased or UPPER_CASED variable names\n * `\"", "\"` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * `\"", "\"` allows PascalCase in addition to lowerCamelCase.\n * `\"", "\"` allows snake_case in addition to lowerCamelCase.\n * `\"", "\"`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""], ["\n Five arguments may be optionally provided:\n\n * \\`\"", "\"\\`: allows only lowerCamelCased or UPPER_CASED variable names\n * \\`\"", "\"\\` allows underscores at the beginning (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows underscores at the end. (only has an effect if \"check-format\" specified)\n * \\`\"", "\"\\` allows PascalCase in addition to lowerCamelCase.\n * \\`\"", "\"\\` allows snake_case in addition to lowerCamelCase.\n * \\`\"", "\"\\`: disallows the use of certain TypeScript keywords as variable or parameter names.\n * These are: ", ""])), OPTION_CHECK_FORMAT, OPTION_LEADING_UNDERSCORE, OPTION_TRAILING_UNDERSCORE, OPTION_ALLOW_PASCAL_CASE, OPTION_ALLOW_SNAKE_CASE, OPTION_BAN_KEYWORDS, bannedKeywordsStr),
options: {
type: "array",
items: {
@@ -99,7 +100,7 @@ function walk(ctx) {
}
case ts.SyntaxKind.VariableStatement:
// skip 'declare' keywords
- if (Lint.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
+ if (tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
return;
}
break;
@@ -174,4 +175,4 @@ function isCamelCase(name, options) {
}
return true;
}
-var _a;
+var templateObject_1;
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.d.ts b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
index d35e1e5ad..6a6280637 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
@@ -1,3 +1,19 @@
+/**
+ * @license
+ * Copyright 2013 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.js b/node_modules/tslint/lib/rules/whitespaceRule.js
index baae7ec33..b39159eb3 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.js
+++ b/node_modules/tslint/lib/rules/whitespaceRule.js
@@ -43,7 +43,7 @@ var Rule = /** @class */ (function (_super) {
ruleName: "whitespace",
description: "Enforces whitespace style conventions.",
rationale: "Helps maintain a readable, consistent style in your codebase.",
- optionsDescription: (_a = ["\n Ten arguments may be optionally provided:\n\n * `\"check-branch\"` checks branching statements (`if`/`else`/`for`/`while`) are followed by whitespace.\n * `\"check-decl\"`checks that variable declarations have whitespace around the equals token.\n * `\"check-operator\"` checks for whitespace around operator tokens.\n * `\"check-module\"` checks for whitespace in import & export statements.\n * `\"check-separator\"` checks for whitespace after separator tokens (`,`/`;`).\n * `\"check-rest-spread\"` checks that there is no whitespace after rest/spread operator (`...`).\n * `\"check-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-type-operator\"` checks for whitespace between type operators `|` and `&`.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], _a.raw = ["\n Ten arguments may be optionally provided:\n\n * \\`\"check-branch\"\\` checks branching statements (\\`if\\`/\\`else\\`/\\`for\\`/\\`while\\`) are followed by whitespace.\n * \\`\"check-decl\"\\`checks that variable declarations have whitespace around the equals token.\n * \\`\"check-operator\"\\` checks for whitespace around operator tokens.\n * \\`\"check-module\"\\` checks for whitespace in import & export statements.\n * \\`\"check-separator\"\\` checks for whitespace after separator tokens (\\`,\\`/\\`;\\`).\n * \\`\"check-rest-spread\"\\` checks that there is no whitespace after rest/spread operator (\\`...\\`).\n * \\`\"check-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-type-operator\"\\` checks for whitespace between type operators \\`|\\` and \\`&\\`.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"], Lint.Utils.dedent(_a)),
+ optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Ten arguments may be optionally provided:\n\n * `\"check-branch\"` checks branching statements (`if`/`else`/`for`/`while`) are followed by whitespace.\n * `\"check-decl\"`checks that variable declarations have whitespace around the equals token.\n * `\"check-operator\"` checks for whitespace around operator tokens.\n * `\"check-module\"` checks for whitespace in import & export statements.\n * `\"check-separator\"` checks for whitespace after separator tokens (`,`/`;`).\n * `\"check-rest-spread\"` checks that there is no whitespace after rest/spread operator (`...`).\n * `\"check-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-type-operator\"` checks for whitespace between type operators `|` and `&`.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], ["\n Ten arguments may be optionally provided:\n\n * \\`\"check-branch\"\\` checks branching statements (\\`if\\`/\\`else\\`/\\`for\\`/\\`while\\`) are followed by whitespace.\n * \\`\"check-decl\"\\`checks that variable declarations have whitespace around the equals token.\n * \\`\"check-operator\"\\` checks for whitespace around operator tokens.\n * \\`\"check-module\"\\` checks for whitespace in import & export statements.\n * \\`\"check-separator\"\\` checks for whitespace after separator tokens (\\`,\\`/\\`;\\`).\n * \\`\"check-rest-spread\"\\` checks that there is no whitespace after rest/spread operator (\\`...\\`).\n * \\`\"check-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-type-operator\"\\` checks for whitespace between type operators \\`|\\` and \\`&\\`.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"]))),
options: {
type: "array",
items: {
@@ -173,6 +173,7 @@ function walk(ctx) {
}
break;
case ts.SyntaxKind.VariableDeclaration:
+ case ts.SyntaxKind.PropertyDeclaration:
var _c = node, name = _c.name, type = _c.type, initializer = _c.initializer;
if (options.decl && initializer !== undefined) {
checkForTrailingWhitespace((type !== undefined ? type : name).getEnd());
@@ -276,7 +277,7 @@ function walk(ctx) {
if (!options.operator) {
return;
}
- var equalsGreaterThanToken = Lint.childOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken);
+ var equalsGreaterThanToken = utils.getChildOfKind(node, ts.SyntaxKind.EqualsGreaterThanToken, sourceFile);
// condition so we don't crash if the arrow is somehow missing
if (equalsGreaterThanToken === undefined) {
return;
@@ -308,4 +309,4 @@ function walk(ctx) {
ctx.addFailureAt(position, 1, Rule.FAILURE_STRING_INVALID, fix);
}
}
-var _a;
+var templateObject_1;