aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-10-14 18:40:54 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-10-14 18:40:54 +0200
commit9df98e65f842cf3acae09cbdd969966f42d64469 (patch)
treef071d3e09a342c208fb8e1cd3f5241d64fbfbaf3 /node_modules/tslint
parent008926b18470e7f394cd640302957b29728a9803 (diff)
downloadwallet-core-9df98e65f842cf3acae09cbdd969966f42d64469.tar.xz
update dependencies
Diffstat (limited to 'node_modules/tslint')
-rw-r--r--node_modules/tslint/CHANGELOG.md44
-rw-r--r--node_modules/tslint/lib/configs/all.d.ts1
-rw-r--r--node_modules/tslint/lib/configs/all.js3
-rw-r--r--node_modules/tslint/lib/configs/latest.d.ts4
-rw-r--r--node_modules/tslint/lib/configs/latest.js14
-rw-r--r--node_modules/tslint/lib/error.js2
-rw-r--r--node_modules/tslint/lib/formatters/checkstyleFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/codeFrameFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/fileslistFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/jsonFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/msbuildFormatter.d.ts16
-rw-r--r--node_modules/tslint/lib/formatters/msbuildFormatter.js5
-rw-r--r--node_modules/tslint/lib/formatters/pmdFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/proseFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/stylishFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/tapFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/verboseFormatter.js2
-rw-r--r--node_modules/tslint/lib/formatters/vsoFormatter.js2
-rw-r--r--node_modules/tslint/lib/language/formatter/abstractFormatter.js2
-rw-r--r--node_modules/tslint/lib/language/rule/abstractRule.d.ts6
-rw-r--r--node_modules/tslint/lib/language/rule/abstractRule.js6
-rw-r--r--node_modules/tslint/lib/language/rule/optionallyTypedRule.js2
-rw-r--r--node_modules/tslint/lib/language/rule/rule.js6
-rw-r--r--node_modules/tslint/lib/language/rule/typedRule.js2
-rw-r--r--node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js2
-rw-r--r--node_modules/tslint/lib/language/walker/programAwareRuleWalker.js2
-rw-r--r--node_modules/tslint/lib/language/walker/ruleWalker.js2
-rw-r--r--node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js2
-rw-r--r--node_modules/tslint/lib/language/walker/syntaxWalker.js2
-rw-r--r--node_modules/tslint/lib/language/walker/walkContext.js2
-rw-r--r--node_modules/tslint/lib/language/walker/walker.js2
-rw-r--r--node_modules/tslint/lib/linter.js4
-rw-r--r--node_modules/tslint/lib/ruleLoader.js20
-rw-r--r--node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/alignRule.js4
-rw-r--r--node_modules/tslint/lib/rules/arrayTypeRule.js2
-rw-r--r--node_modules/tslint/lib/rules/arrowParensRule.js2
-rw-r--r--node_modules/tslint/lib/rules/arrowReturnShorthandRule.js2
-rw-r--r--node_modules/tslint/lib/rules/awaitPromiseRule.js8
-rw-r--r--node_modules/tslint/lib/rules/banRule.js4
-rw-r--r--node_modules/tslint/lib/rules/banTypesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js2
-rw-r--r--node_modules/tslint/lib/rules/callableTypesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/classNameRule.js2
-rw-r--r--node_modules/tslint/lib/rules/commentFormatRule.js2
-rw-r--r--node_modules/tslint/lib/rules/completedDocsRule.js10
-rw-r--r--node_modules/tslint/lib/rules/curlyRule.js4
-rw-r--r--node_modules/tslint/lib/rules/cyclomaticComplexityRule.js2
-rw-r--r--node_modules/tslint/lib/rules/deprecationRule.js114
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.js2
-rw-r--r--node_modules/tslint/lib/rules/eoflineRule.js4
-rw-r--r--node_modules/tslint/lib/rules/fileHeaderRule.js2
-rw-r--r--node_modules/tslint/lib/rules/forinRule.js2
-rw-r--r--node_modules/tslint/lib/rules/importBlacklistRule.js4
-rw-r--r--node_modules/tslint/lib/rules/importSpacingRule.js4
-rw-r--r--node_modules/tslint/lib/rules/indentRule.js2
-rw-r--r--node_modules/tslint/lib/rules/interfaceNameRule.js2
-rw-r--r--node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js2
-rw-r--r--node_modules/tslint/lib/rules/jsdocFormatRule.js2
-rw-r--r--node_modules/tslint/lib/rules/labelPositionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/linebreakStyleRule.js2
-rw-r--r--node_modules/tslint/lib/rules/matchDefaultExportNameRule.js4
-rw-r--r--node_modules/tslint/lib/rules/maxClassesPerFileRule.js2
-rw-r--r--node_modules/tslint/lib/rules/maxFileLineCountRule.js2
-rw-r--r--node_modules/tslint/lib/rules/maxLineLengthRule.js2
-rw-r--r--node_modules/tslint/lib/rules/memberAccessRule.js8
-rw-r--r--node_modules/tslint/lib/rules/memberOrderingRule.js6
-rw-r--r--node_modules/tslint/lib/rules/newParensRule.js2
-rw-r--r--node_modules/tslint/lib/rules/newlineBeforeReturnRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noAnyRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noArgRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noBitwiseRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConditionalAssignmentRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noConsoleRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noConstructRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noDebuggerRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noDefaultExportRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateImportsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateVariableRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noEmptyInterfaceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noEmptyRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noEvalRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noFloatingPromisesRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noForInArrayRule.js8
-rw-r--r--node_modules/tslint/lib/rules/noImportSideEffectRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noInferrableTypesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInternalModuleRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js18
-rw-r--r--node_modules/tslint/lib/rules/noInvalidThisRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noMagicNumbersRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noMergeableNamespaceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noMisusedNewRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noNamespaceRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noNonNullAssertionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noNullKeywordRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noParameterPropertiesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts7
-rw-r--r--node_modules/tslint/lib/rules/noParameterReassignmentRule.js70
-rw-r--r--node_modules/tslint/lib/rules/noReferenceImportRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noReferenceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noRequireImportsRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noShadowedVariableRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noSparseArraysRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noStringThrowRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noSubmoduleImportsRule.js24
-rw-r--r--node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noThisAssignmentRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noUnboundMethodRule.js6
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts16
-rw-r--r--node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js13
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeAnyRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noUnsafeFinallyRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noUnusedExpressionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/noUnusedVariableRule.js15
-rw-r--r--node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noVarKeywordRule.js3
-rw-r--r--node_modules/tslint/lib/rules/noVarRequiresRule.js4
-rw-r--r--node_modules/tslint/lib/rules/noVoidExpressionRule.js4
-rw-r--r--node_modules/tslint/lib/rules/numberLiteralFormatRule.js2
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralShorthandRule.js2
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts6
-rw-r--r--node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js154
-rw-r--r--node_modules/tslint/lib/rules/oneLineRule.js4
-rw-r--r--node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js2
-rw-r--r--node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js2
-rw-r--r--node_modules/tslint/lib/rules/orderedImportsRule.js6
-rw-r--r--node_modules/tslint/lib/rules/preferConditionalExpressionRule.js2
-rw-r--r--node_modules/tslint/lib/rules/preferConstRule.js16
-rw-r--r--node_modules/tslint/lib/rules/preferForOfRule.js8
-rw-r--r--node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js6
-rw-r--r--node_modules/tslint/lib/rules/preferMethodSignatureRule.js2
-rw-r--r--node_modules/tslint/lib/rules/preferObjectSpreadRule.js14
-rw-r--r--node_modules/tslint/lib/rules/preferSwitchRule.js2
-rw-r--r--node_modules/tslint/lib/rules/preferTemplateRule.js7
-rw-r--r--node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js4
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.d.ts1
-rw-r--r--node_modules/tslint/lib/rules/quotemarkRule.js25
-rw-r--r--node_modules/tslint/lib/rules/radixRule.js2
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.js7
-rw-r--r--node_modules/tslint/lib/rules/returnUndefinedRule.js4
-rw-r--r--node_modules/tslint/lib/rules/semicolonRule.js8
-rw-r--r--node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js2
-rw-r--r--node_modules/tslint/lib/rules/spaceWithinParensRule.js4
-rw-r--r--node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js4
-rw-r--r--node_modules/tslint/lib/rules/strictTypePredicatesRule.js4
-rw-r--r--node_modules/tslint/lib/rules/switchDefaultRule.js2
-rw-r--r--node_modules/tslint/lib/rules/switchFinalBreakRule.js2
-rw-r--r--node_modules/tslint/lib/rules/trailingCommaRule.js4
-rw-r--r--node_modules/tslint/lib/rules/tripleEqualsRule.js2
-rw-r--r--node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js2
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.d.ts1
-rw-r--r--node_modules/tslint/lib/rules/typedefRule.js10
-rw-r--r--node_modules/tslint/lib/rules/typedefWhitespaceRule.js4
-rw-r--r--node_modules/tslint/lib/rules/typeofCompareRule.js2
-rw-r--r--node_modules/tslint/lib/rules/unifiedSignaturesRule.js2
-rw-r--r--node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js4
-rw-r--r--node_modules/tslint/lib/rules/useIsnanRule.js2
-rw-r--r--node_modules/tslint/lib/rules/variableNameRule.js2
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.d.ts3
-rw-r--r--node_modules/tslint/lib/rules/whitespaceRule.js71
-rw-r--r--node_modules/tslint/lib/runner.js20
-rw-r--r--node_modules/tslint/lib/utils.d.ts2
-rw-r--r--node_modules/tslint/lib/verify/lines.js12
-rw-r--r--node_modules/tslint/package.json10
177 files changed, 789 insertions, 405 deletions
diff --git a/node_modules/tslint/CHANGELOG.md b/node_modules/tslint/CHANGELOG.md
index 4b96da396..9055970df 100644
--- a/node_modules/tslint/CHANGELOG.md
+++ b/node_modules/tslint/CHANGELOG.md
@@ -1,6 +1,50 @@
Change Log
===
+v5.7.0
+---
+
+## :tada: New rules, options, and fixers
+
+- [new-rule] [`no-parameter-reassignment`](https://palantir.github.io/tslint/rules/no-parameter-reassignment/) (#3045)
+- [new-rule-option]: [`object-literal-sort-keys`](https://palantir.github.io/tslint/rules/object-literal-sort-keys/): Add `match-declaration-order` option (#2829)
+- [new-rule-option] `check-type-operator` for [`whitespace`](https://palantir.github.io/tslint/rules/whitespace/) rule (#3083)
+- [new-rule-option] [`whitespace`](https://palantir.github.io/tslint/rules/whitespace/): Add `check-rest-spread` option (#3089)
+
+## :hammer_and_wrench: Bugfixes & enhancements
+
+- [api] `AbstractRule#applyWithFunction` allows additional parameter that is passed through to `walkFn` (#3140)
+- [api] `AbstractRule#applyWithFunction` has better type checking for its type parameter (#2660)
+- [bugfix] [`member-access`](https://palantir.github.io/tslint/rules/member-access/) autofix now correcly inserts `public` keyword after decorators (#3162)
+- [bugfix] [`prefer-const`](https://palantir.github.io/tslint/rules/prefer-const/) correctly handle `catch` without binding parameter introduced in `typescript@2.5.1` (#3151)
+- [bugfix] [`no-invalid-template-strings`](https://palantir.github.io/tslint/rules/no-invalid-template-strings/) allows backslash-prefixed template expressions (#3116)
+- [bugfix] [`deprecation`](https://palantir.github.io/tslint/rules/deprecation/) no longer shows errors on imports and exports (#3141)
+- [bugfix] [`deprecation`](https://palantir.github.io/tslint/rules/deprecation/): fix false positive when calling a function or method where another overload is deprecated (#2883)
+- [bugfix] [`whitespace`](https://palantir.github.io/tslint/rules/whitespace/): fixed `"check-separator"` for trivial `for` cases. (#3132)
+- [bugfix] [`prefer-object-spread`](https://palantir.github.io/tslint/rules/prefer-object-spread/) prevent spreading `this` as it is not allowed by the compiler (#3126)
+- [bugfix] `msbuild` formatter uses backslashes in paths on Windows (#3145)
+- [bugfix] [`no-namespace`](https://palantir.github.io/tslint/rules/no-namespace/) ignores global augmentation (#3161)
+- [enhancement] remove superfluous empty lines on tslint output. (#3121)
+- [enhancement] [`no-submodule-imports`](https://palantir.github.io/tslint/rules/no-submodule-imports/) allows whitelisting of submodules like `@angular/core/testing` (#3129)
+- [enhancement] custom lint rules will be resolved using node's path resolution to allow for loaders like `ts-node` (#3108)
+- [enhancement] [`quotemark`](https://palantir.github.io/tslint/rules/quotemark/) no longer requires `"single"` or `"double"` to be the first option. The rule defaults to `"double"` if none is specified. (#3114)
+- [enhancement] [`no-unused-variable`](https://palantir.github.io/tslint/rules/no-unused-variable/) autofix removes trailing comments of imports (#3156)
+- [enhancement] [`no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/) allows certain necessary assertions to prevent type widening (#3120)
+
+Thanks to our contributors!
+
+- Paul Gschwendtner
+- Andy Hanson
+- ksvitkovsky
+- Santi Albo
+- aervin
+- Junle Li
+- Joscha Feth
+- WiseBird
+- Caleb Eggensperger
+- WGroenestein
+- Bowen Ni
+
v5.6.0
---
diff --git a/node_modules/tslint/lib/configs/all.d.ts b/node_modules/tslint/lib/configs/all.d.ts
index 5a04decf4..cb04d518a 100644
--- a/node_modules/tslint/lib/configs/all.d.ts
+++ b/node_modules/tslint/lib/configs/all.d.ts
@@ -85,6 +85,7 @@ export declare const rules: {
"no-duplicate-imports": boolean;
"no-irregular-whitespace": boolean;
"no-mergeable-namespace": boolean;
+ "no-parameter-reassignment": boolean;
"no-require-imports": boolean;
"no-trailing-whitespace": boolean;
"object-literal-sort-keys": boolean;
diff --git a/node_modules/tslint/lib/configs/all.js b/node_modules/tslint/lib/configs/all.js
index 502c4a559..017ab5098 100644
--- a/node_modules/tslint/lib/configs/all.js
+++ b/node_modules/tslint/lib/configs/all.js
@@ -144,6 +144,7 @@ exports.rules = {
"no-duplicate-imports": true,
"no-irregular-whitespace": true,
"no-mergeable-namespace": true,
+ "no-parameter-reassignment": true,
"no-require-imports": true,
"no-trailing-whitespace": true,
"object-literal-sort-keys": true,
@@ -246,6 +247,8 @@ exports.rules = {
"check-type",
"check-typecast",
"check-preblock",
+ "check-type-operator",
+ "check-rest-spread",
],
};
exports.RULES_EXCLUDED_FROM_ALL_CONFIG = ["ban", "fileHeader", "importBlacklist", "noInvalidThis", "noSwitchCaseFallThrough", "typeofCompare"];
diff --git a/node_modules/tslint/lib/configs/latest.d.ts b/node_modules/tslint/lib/configs/latest.d.ts
index 37bd63881..79dc26d46 100644
--- a/node_modules/tslint/lib/configs/latest.d.ts
+++ b/node_modules/tslint/lib/configs/latest.d.ts
@@ -27,6 +27,10 @@ export declare const rules: {
"no-this-assignment": boolean;
"no-duplicate-imports": boolean;
"space-within-parens": (number | boolean)[];
+ "no-submodule-imports": boolean;
+ "whitespace": {
+ options: string[];
+ };
};
declare const xtends = "tslint:recommended";
export { xtends as extends };
diff --git a/node_modules/tslint/lib/configs/latest.js b/node_modules/tslint/lib/configs/latest.js
index c27200602..dcbb72b43 100644
--- a/node_modules/tslint/lib/configs/latest.js
+++ b/node_modules/tslint/lib/configs/latest.js
@@ -44,6 +44,20 @@ exports.rules = {
// added in v5.6
"no-duplicate-imports": true,
"space-within-parens": [true, 0],
+ "no-submodule-imports": true,
+ // added in v5.7
+ "whitespace": {
+ options: [
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type",
+ "check-typecast",
+ "check-type-operator",
+ "check-rest-spread",
+ ],
+ },
};
// tslint:enable object-literal-sort-keys
// work around "extends" being a keyword
diff --git a/node_modules/tslint/lib/error.js b/node_modules/tslint/lib/error.js
index beee3de3d..38fd4fce9 100644
--- a/node_modules/tslint/lib/error.js
+++ b/node_modules/tslint/lib/error.js
@@ -21,7 +21,7 @@ var shownWarnings = new Set();
/**
* Used to exit the program and display a friendly message without the callstack.
*/
-var FatalError = (function (_super) {
+var FatalError = /** @class */ (function (_super) {
tslib_1.__extends(FatalError, _super);
function FatalError(message, innerError) {
var _this = _super.call(this, message) || this;
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.js b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
index 8163a75a1..ab7400fb7 100644
--- a/node_modules/tslint/lib/formatters/checkstyleFormatter.js
+++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.js b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
index 0b46e244c..8a74160d1 100644
--- a/node_modules/tslint/lib/formatters/codeFrameFormatter.js
+++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.js
@@ -21,7 +21,7 @@ var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var codeFrame = require("babel-code-frame");
var colors = require("colors");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/fileslistFormatter.js b/node_modules/tslint/lib/formatters/fileslistFormatter.js
index 5585c4224..273edfdb0 100644
--- a/node_modules/tslint/lib/formatters/fileslistFormatter.js
+++ b/node_modules/tslint/lib/formatters/fileslistFormatter.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.js b/node_modules/tslint/lib/formatters/jsonFormatter.js
index 5dfc53263..0965b25f0 100644
--- a/node_modules/tslint/lib/formatters/jsonFormatter.js
+++ b/node_modules/tslint/lib/formatters/jsonFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
index 6227c2b8c..8f038f5ff 100644
--- a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
+++ b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
@@ -1,19 +1,3 @@
-/**
- * @license
- * Copyright 2016 Palantir Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";
diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.js b/node_modules/tslint/lib/formatters/msbuildFormatter.js
index f00960be4..b6335e02a 100644
--- a/node_modules/tslint/lib/formatters/msbuildFormatter.js
+++ b/node_modules/tslint/lib/formatters/msbuildFormatter.js
@@ -17,9 +17,10 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var path = require("path");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var utils_1 = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -27,7 +28,7 @@ var Formatter = (function (_super) {
/* tslint:enable:object-literal-sort-keys */
Formatter.prototype.format = function (failures) {
var outputLines = failures.map(function (failure) {
- var fileName = failure.getFileName();
+ var fileName = path.normalize(failure.getFileName());
var failureString = failure.getFailure();
var camelizedRule = utils_1.camelize(failure.getRuleName());
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.js b/node_modules/tslint/lib/formatters/pmdFormatter.js
index 04a1aa7d9..040e51af2 100644
--- a/node_modules/tslint/lib/formatters/pmdFormatter.js
+++ b/node_modules/tslint/lib/formatters/pmdFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/proseFormatter.js b/node_modules/tslint/lib/formatters/proseFormatter.js
index 43ecfefae..02b33e4cd 100644
--- a/node_modules/tslint/lib/formatters/proseFormatter.js
+++ b/node_modules/tslint/lib/formatters/proseFormatter.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.js b/node_modules/tslint/lib/formatters/stylishFormatter.js
index ded0ca567..7c142c9e7 100644
--- a/node_modules/tslint/lib/formatters/stylishFormatter.js
+++ b/node_modules/tslint/lib/formatters/stylishFormatter.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var colors = require("colors");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/tapFormatter.js b/node_modules/tslint/lib/formatters/tapFormatter.js
index f7743c173..65c1be6b2 100644
--- a/node_modules/tslint/lib/formatters/tapFormatter.js
+++ b/node_modules/tslint/lib/formatters/tapFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.js b/node_modules/tslint/lib/formatters/verboseFormatter.js
index 2b49e7e45..d681a7192 100644
--- a/node_modules/tslint/lib/formatters/verboseFormatter.js
+++ b/node_modules/tslint/lib/formatters/verboseFormatter.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.js b/node_modules/tslint/lib/formatters/vsoFormatter.js
index ac00d3de0..1e0b35659 100644
--- a/node_modules/tslint/lib/formatters/vsoFormatter.js
+++ b/node_modules/tslint/lib/formatters/vsoFormatter.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
var Utils = require("../utils");
-var Formatter = (function (_super) {
+var Formatter = /** @class */ (function (_super) {
tslib_1.__extends(Formatter, _super);
function Formatter() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/language/formatter/abstractFormatter.js b/node_modules/tslint/lib/language/formatter/abstractFormatter.js
index 63e037732..3306c7dc0 100644
--- a/node_modules/tslint/lib/language/formatter/abstractFormatter.js
+++ b/node_modules/tslint/lib/language/formatter/abstractFormatter.js
@@ -16,7 +16,7 @@
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
-var AbstractFormatter = (function () {
+var AbstractFormatter = /** @class */ (function () {
function AbstractFormatter() {
}
return AbstractFormatter;
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.d.ts b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
index 8a2362b5c..a5c2b82ac 100644
--- a/node_modules/tslint/lib/language/rule/abstractRule.d.ts
+++ b/node_modules/tslint/lib/language/rule/abstractRule.d.ts
@@ -17,6 +17,9 @@
import * as ts from "typescript";
import { IWalker, WalkContext } from "../walker";
import { IOptions, IRule, IRuleMetadata, RuleFailure, RuleSeverity } from "./rule";
+export declare type NoInfer<T> = T & {
+ [K in keyof T]: T[K];
+};
export declare abstract class AbstractRule implements IRule {
private options;
static metadata: IRuleMetadata;
@@ -29,7 +32,8 @@ export declare abstract class AbstractRule implements IRule {
applyWithWalker(walker: IWalker): RuleFailure[];
isEnabled(): boolean;
protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<void>) => void): RuleFailure[];
- protected applyWithFunction<T, U extends T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: U): RuleFailure[];
+ protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: NoInfer<T>): RuleFailure[];
+ protected applyWithFunction<T, U>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>, programOrChecker: U) => void, options: NoInfer<T>, checker: NoInfer<U>): RuleFailure[];
/**
* @deprecated
* Failures will be filtered based on `tslint:disable` comments by tslint.
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.js b/node_modules/tslint/lib/language/rule/abstractRule.js
index 52f4c8f55..879ac31b8 100644
--- a/node_modules/tslint/lib/language/rule/abstractRule.js
+++ b/node_modules/tslint/lib/language/rule/abstractRule.js
@@ -17,7 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var walker_1 = require("../walker");
-var AbstractRule = (function () {
+var AbstractRule = /** @class */ (function () {
function AbstractRule(options) {
this.options = options;
this.ruleName = options.ruleName;
@@ -34,9 +34,9 @@ var AbstractRule = (function () {
AbstractRule.prototype.isEnabled = function () {
return this.ruleSeverity !== "off";
};
- AbstractRule.prototype.applyWithFunction = function (sourceFile, walkFn, options) {
+ AbstractRule.prototype.applyWithFunction = function (sourceFile, walkFn, options, programOrChecker) {
var ctx = new walker_1.WalkContext(sourceFile, this.ruleName, options);
- walkFn(ctx);
+ walkFn(ctx, programOrChecker);
return ctx.failures;
};
/**
diff --git a/node_modules/tslint/lib/language/rule/optionallyTypedRule.js b/node_modules/tslint/lib/language/rule/optionallyTypedRule.js
index 1914eda40..1aefda55e 100644
--- a/node_modules/tslint/lib/language/rule/optionallyTypedRule.js
+++ b/node_modules/tslint/lib/language/rule/optionallyTypedRule.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var abstractRule_1 = require("./abstractRule");
-var OptionallyTypedRule = (function (_super) {
+var OptionallyTypedRule = /** @class */ (function (_super) {
tslib_1.__extends(OptionallyTypedRule, _super);
function OptionallyTypedRule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/language/rule/rule.js b/node_modules/tslint/lib/language/rule/rule.js
index 98291f25a..6feae5e96 100644
--- a/node_modules/tslint/lib/language/rule/rule.js
+++ b/node_modules/tslint/lib/language/rule/rule.js
@@ -21,7 +21,7 @@ function isTypedRule(rule) {
return "applyWithProgram" in rule;
}
exports.isTypedRule = isTypedRule;
-var Replacement = (function () {
+var Replacement = /** @class */ (function () {
function Replacement(start, length, text) {
this.start = start;
this.length = length;
@@ -72,7 +72,7 @@ var Replacement = (function () {
return Replacement;
}());
exports.Replacement = Replacement;
-var RuleFailurePosition = (function () {
+var RuleFailurePosition = /** @class */ (function () {
function RuleFailurePosition(position, lineAndCharacter) {
this.position = position;
this.lineAndCharacter = lineAndCharacter;
@@ -100,7 +100,7 @@ var RuleFailurePosition = (function () {
return RuleFailurePosition;
}());
exports.RuleFailurePosition = RuleFailurePosition;
-var RuleFailure = (function () {
+var RuleFailure = /** @class */ (function () {
function RuleFailure(sourceFile, start, end, failure, ruleName, fix) {
this.sourceFile = sourceFile;
this.failure = failure;
diff --git a/node_modules/tslint/lib/language/rule/typedRule.js b/node_modules/tslint/lib/language/rule/typedRule.js
index e713dcdbb..83873d49f 100644
--- a/node_modules/tslint/lib/language/rule/typedRule.js
+++ b/node_modules/tslint/lib/language/rule/typedRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var error_1 = require("../../error");
var abstractRule_1 = require("./abstractRule");
-var TypedRule = (function (_super) {
+var TypedRule = /** @class */ (function (_super) {
tslib_1.__extends(TypedRule, _super);
function TypedRule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
index 4dd311ddb..4adc42d04 100644
--- a/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
+++ b/node_modules/tslint/lib/language/walker/blockScopeAwareRuleWalker.js
@@ -27,7 +27,7 @@ var scopeAwareRuleWalker_1 = require("./scopeAwareRuleWalker");
* An AST walker that is aware of block scopes in addition to regular scopes. Block scopes
* are a superset of regular scopes (new block scopes are created more frequently in a program).
*/
-var BlockScopeAwareRuleWalker = (function (_super) {
+var BlockScopeAwareRuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(BlockScopeAwareRuleWalker, _super);
function BlockScopeAwareRuleWalker(sourceFile, options) {
var _this = _super.call(this, sourceFile, options) || this;
diff --git a/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js
index de68cb5a6..1a0702441 100644
--- a/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js
+++ b/node_modules/tslint/lib/language/walker/programAwareRuleWalker.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ruleWalker_1 = require("./ruleWalker");
-var ProgramAwareRuleWalker = (function (_super) {
+var ProgramAwareRuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(ProgramAwareRuleWalker, _super);
function ProgramAwareRuleWalker(sourceFile, options, program) {
var _this = _super.call(this, sourceFile, options) || this;
diff --git a/node_modules/tslint/lib/language/walker/ruleWalker.js b/node_modules/tslint/lib/language/walker/ruleWalker.js
index b5146825e..e0e77504e 100644
--- a/node_modules/tslint/lib/language/walker/ruleWalker.js
+++ b/node_modules/tslint/lib/language/walker/ruleWalker.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var rule_1 = require("../rule/rule");
var syntaxWalker_1 = require("./syntaxWalker");
-var RuleWalker = (function (_super) {
+var RuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(RuleWalker, _super);
function RuleWalker(sourceFile, options) {
var _this = _super.call(this) || this;
diff --git a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
index 081c29b6c..2c9cb93a1 100644
--- a/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
+++ b/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js
@@ -54,7 +54,7 @@ var ruleWalker_1 = require("./ruleWalker");
* });
* }
*/
-var ScopeAwareRuleWalker = (function (_super) {
+var ScopeAwareRuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(ScopeAwareRuleWalker, _super);
function ScopeAwareRuleWalker(sourceFile, options) {
var _this = _super.call(this, sourceFile, options) || this;
diff --git a/node_modules/tslint/lib/language/walker/syntaxWalker.js b/node_modules/tslint/lib/language/walker/syntaxWalker.js
index de69e4524..cdef4eaea 100644
--- a/node_modules/tslint/lib/language/walker/syntaxWalker.js
+++ b/node_modules/tslint/lib/language/walker/syntaxWalker.js
@@ -17,7 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
-var SyntaxWalker = (function () {
+var SyntaxWalker = /** @class */ (function () {
function SyntaxWalker() {
}
SyntaxWalker.prototype.walk = function (node) {
diff --git a/node_modules/tslint/lib/language/walker/walkContext.js b/node_modules/tslint/lib/language/walker/walkContext.js
index b6d8224d3..ad0c5e597 100644
--- a/node_modules/tslint/lib/language/walker/walkContext.js
+++ b/node_modules/tslint/lib/language/walker/walkContext.js
@@ -17,7 +17,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var rule_1 = require("../rule/rule");
-var WalkContext = (function () {
+var WalkContext = /** @class */ (function () {
function WalkContext(sourceFile, ruleName, options) {
this.sourceFile = sourceFile;
this.ruleName = ruleName;
diff --git a/node_modules/tslint/lib/language/walker/walker.js b/node_modules/tslint/lib/language/walker/walker.js
index ef0ff1828..9b78e7693 100644
--- a/node_modules/tslint/lib/language/walker/walker.js
+++ b/node_modules/tslint/lib/language/walker/walker.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var walkContext_1 = require("./walkContext");
-var AbstractWalker = (function (_super) {
+var AbstractWalker = /** @class */ (function (_super) {
tslib_1.__extends(AbstractWalker, _super);
function AbstractWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/linter.js b/node_modules/tslint/lib/linter.js
index 85ec5b0cd..f67c0198c 100644
--- a/node_modules/tslint/lib/linter.js
+++ b/node_modules/tslint/lib/linter.js
@@ -29,7 +29,7 @@ var utils_1 = require("./utils");
/**
* Linter that can lint multiple files in consecutive runs.
*/
-var Linter = (function () {
+var Linter = /** @class */ (function () {
function Linter(options, program) {
this.options = options;
this.program = program;
@@ -210,7 +210,7 @@ var Linter = (function () {
}
var _a;
};
- Linter.VERSION = "5.6.0";
+ Linter.VERSION = "5.7.0";
Linter.findConfiguration = configuration_1.findConfiguration;
Linter.findConfigurationPath = configuration_1.findConfigurationPath;
Linter.getRulesDirectories = configuration_1.getRulesDirectories;
diff --git a/node_modules/tslint/lib/ruleLoader.js b/node_modules/tslint/lib/ruleLoader.js
index acc7a3881..152f7b641 100644
--- a/node_modules/tslint/lib/ruleLoader.js
+++ b/node_modules/tslint/lib/ruleLoader.js
@@ -91,15 +91,29 @@ function transformName(name) {
* @param ruleName - A name of a rule in filename format. ex) "someLintRule"
*/
function loadRule(directory, ruleName) {
- var fullPath = path.join(directory, ruleName);
- if (fs.existsSync(fullPath + ".js")) {
- var ruleModule = require(fullPath);
+ var ruleFullPath = getRuleFullPath(directory, ruleName);
+ if (ruleFullPath !== undefined) {
+ var ruleModule = require(ruleFullPath);
if (ruleModule !== undefined) {
return ruleModule.Rule;
}
}
return "not-found";
}
+/**
+ * Returns the full path to a rule file. Path to rules are resolved using nodes path resolution.
+ * This allows developers to write custom rules in TypeScript, which then can be loaded by TS-Node.
+ * @param directory - An absolute path to a directory of rules
+ * @param ruleName - A name of a rule in filename format. ex) "someLintRule"
+ */
+function getRuleFullPath(directory, ruleName) {
+ try {
+ return require.resolve(path.join(directory, ruleName));
+ }
+ catch (e) {
+ return undefined;
+ }
+}
function loadCachedRule(directory, ruleName, isCustomPath) {
// use cached value if available
var fullPath = path.join(directory, ruleName);
diff --git a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
index 62a7bbcff..da1303ba3 100644
--- a/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
+++ b/node_modules/tslint/lib/rules/adjacentOverloadSignaturesRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/alignRule.js b/node_modules/tslint/lib/rules/alignRule.js
index 7d70b9229..f2fbc169e 100644
--- a/node_modules/tslint/lib/rules/alignRule.js
+++ b/node_modules/tslint/lib/rules/alignRule.js
@@ -25,7 +25,7 @@ var OPTION_MEMBERS = "members";
var OPTION_ELEMENTS = "elements";
var OPTION_PARAMETERS = "parameters";
var OPTION_ARGUMENTS = "arguments";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -64,7 +64,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var AlignWalker = (function (_super) {
+var AlignWalker = /** @class */ (function (_super) {
tslib_1.__extends(AlignWalker, _super);
function AlignWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/arrayTypeRule.js b/node_modules/tslint/lib/rules/arrayTypeRule.js
index 0253b8317..af92a8084 100644
--- a/node_modules/tslint/lib/rules/arrayTypeRule.js
+++ b/node_modules/tslint/lib/rules/arrayTypeRule.js
@@ -22,7 +22,7 @@ var Lint = require("../index");
var OPTION_ARRAY = "array";
var OPTION_GENERIC = "generic";
var OPTION_ARRAY_SIMPLE = "array-simple";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/arrowParensRule.js b/node_modules/tslint/lib/rules/arrowParensRule.js
index 116110560..6fa9f5537 100644
--- a/node_modules/tslint/lib/rules/arrowParensRule.js
+++ b/node_modules/tslint/lib/rules/arrowParensRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var BAN_SINGLE_ARG_PARENS = "ban-single-arg-parens";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
index 74010faa2..41ccb332e 100644
--- a/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
+++ b/node_modules/tslint/lib/rules/arrowReturnShorthandRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../language/utils");
var OPTION_MULTILINE = "multiline";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.js b/node_modules/tslint/lib/rules/awaitPromiseRule.js
index ba26774f6..69855f49f 100644
--- a/node_modules/tslint/lib/rules/awaitPromiseRule.js
+++ b/node_modules/tslint/lib/rules/awaitPromiseRule.js
@@ -20,15 +20,14 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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) {
var promiseTypes = new Set(["Promise"].concat(this.ruleArguments));
- var tc = program.getTypeChecker();
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, tc, promiseTypes); });
+ return this.applyWithFunction(sourceFile, walk, promiseTypes, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -52,7 +51,8 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-function walk(ctx, tc, promiseTypes) {
+function walk(ctx, tc) {
+ var promiseTypes = ctx.options;
return ts.forEachChild(ctx.sourceFile, cb);
function cb(node) {
if (tsutils_1.isAwaitExpression(node) && !couldBePromise(tc.getTypeAtLocation(node.expression))) {
diff --git a/node_modules/tslint/lib/rules/banRule.js b/node_modules/tslint/lib/rules/banRule.js
index 4b402160e..ab4e8b096 100644
--- a/node_modules/tslint/lib/rules/banRule.js
+++ b/node_modules/tslint/lib/rules/banRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -119,7 +119,7 @@ function parseOptions(args) {
}
return { functions: functions, methods: methods };
}
-var BanFunctionWalker = (function (_super) {
+var BanFunctionWalker = /** @class */ (function (_super) {
tslib_1.__extends(BanFunctionWalker, _super);
function BanFunctionWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/banTypesRule.js b/node_modules/tslint/lib/rules/banTypesRule.js
index 0f6fdc682..0e8fe73f1 100644
--- a/node_modules/tslint/lib/rules/banTypesRule.js
+++ b/node_modules/tslint/lib/rules/banTypesRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
index 03a50391c..b11273d40 100644
--- a/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
+++ b/node_modules/tslint/lib/rules/binaryExpressionOperandOrderRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../language/utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/callableTypesRule.js b/node_modules/tslint/lib/rules/callableTypesRule.js
index 42c26aac2..07bd7bd0f 100644
--- a/node_modules/tslint/lib/rules/callableTypesRule.js
+++ b/node_modules/tslint/lib/rules/callableTypesRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/classNameRule.js b/node_modules/tslint/lib/rules/classNameRule.js
index 6673fda84..cf9acbe33 100644
--- a/node_modules/tslint/lib/rules/classNameRule.js
+++ b/node_modules/tslint/lib/rules/classNameRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/commentFormatRule.js b/node_modules/tslint/lib/rules/commentFormatRule.js
index 067607139..ca4027362 100644
--- a/node_modules/tslint/lib/rules/commentFormatRule.js
+++ b/node_modules/tslint/lib/rules/commentFormatRule.js
@@ -25,7 +25,7 @@ var utils_1 = require("../utils");
var OPTION_SPACE = "check-space";
var OPTION_LOWERCASE = "check-lowercase";
var OPTION_UPPERCASE = "check-uppercase";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/completedDocsRule.js b/node_modules/tslint/lib/rules/completedDocsRule.js
index 515ca257d..5c3bf5cf2 100644
--- a/node_modules/tslint/lib/rules/completedDocsRule.js
+++ b/node_modules/tslint/lib/rules/completedDocsRule.js
@@ -42,7 +42,7 @@ exports.PRIVACY_PROTECTED = "protected";
exports.PRIVACY_PUBLIC = "public";
exports.VISIBILITY_EXPORTED = "exported";
exports.VISIBILITY_INTERNAL = "internal";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -156,7 +156,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-var Requirement = (function () {
+var Requirement = /** @class */ (function () {
// tslint:disable-next-line no-object-literal-type-assertion
function Requirement(descriptor) {
if (descriptor === void 0) { descriptor = {}; }
@@ -191,7 +191,7 @@ var Requirement = (function () {
};
return Requirement;
}());
-var BlockRequirement = (function (_super) {
+var BlockRequirement = /** @class */ (function (_super) {
tslib_1.__extends(BlockRequirement, _super);
function BlockRequirement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -209,7 +209,7 @@ var BlockRequirement = (function (_super) {
};
return BlockRequirement;
}(Requirement));
-var ClassRequirement = (function (_super) {
+var ClassRequirement = /** @class */ (function (_super) {
tslib_1.__extends(ClassRequirement, _super);
function ClassRequirement() {
var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -243,7 +243,7 @@ var ClassRequirement = (function (_super) {
};
return ClassRequirement;
}(Requirement));
-var CompletedDocsWalker = (function (_super) {
+var CompletedDocsWalker = /** @class */ (function (_super) {
tslib_1.__extends(CompletedDocsWalker, _super);
function CompletedDocsWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/curlyRule.js b/node_modules/tslint/lib/rules/curlyRule.js
index cd2bc205a..dbd14038d 100644
--- a/node_modules/tslint/lib/rules/curlyRule.js
+++ b/node_modules/tslint/lib/rules/curlyRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_AS_NEEDED = "as-needed";
var OPTION_IGNORE_SAME_LINE = "ignore-same-line";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -97,7 +97,7 @@ function isBlockUnnecessary(node) {
&& parent.thenStatement === node
&& parent.elseStatement !== undefined);
}
-var CurlyWalker = (function (_super) {
+var CurlyWalker = /** @class */ (function (_super) {
tslib_1.__extends(CurlyWalker, _super);
function CurlyWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
index e92eb1431..91d6f9ead 100644
--- a/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
+++ b/node_modules/tslint/lib/rules/cyclomaticComplexityRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/deprecationRule.js b/node_modules/tslint/lib/rules/deprecationRule.js
index 40b58e96b..ef6180125 100644
--- a/node_modules/tslint/lib/rules/deprecationRule.js
+++ b/node_modules/tslint/lib/rules/deprecationRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -30,7 +30,7 @@ var Rule = (function (_super) {
return name + " is deprecated" + (message === "" ? "." : ": " + message.trim());
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -59,6 +59,13 @@ function walk(ctx, tc) {
}
}
else {
+ switch (node.kind) {
+ case ts.SyntaxKind.ImportDeclaration:
+ case ts.SyntaxKind.ImportEqualsDeclaration:
+ case ts.SyntaxKind.ExportDeclaration:
+ case ts.SyntaxKind.ExportAssignment:
+ return;
+ }
return ts.forEachChild(node, cb);
}
});
@@ -89,40 +96,70 @@ function isDeclaration(identifier) {
case ts.SyntaxKind.PropertyDeclaration:
case ts.SyntaxKind.PropertyAssignment:
case ts.SyntaxKind.EnumMember:
+ case ts.SyntaxKind.ImportEqualsDeclaration:
return parent.name === identifier;
case ts.SyntaxKind.BindingElement:
- case ts.SyntaxKind.ExportSpecifier:
- case ts.SyntaxKind.ImportSpecifier:
- // return true for `b` in `import {a as b} from "foo"`
+ // return true for `b` in `const {a: b} = obj"`
return parent.name === identifier &&
parent.propertyName !== undefined;
default:
return false;
}
}
+function getCallExpresion(node) {
+ var parent = node.parent;
+ if (tsutils_1.isPropertyAccessExpression(parent) && parent.name === node) {
+ node = parent;
+ parent = node.parent;
+ }
+ return tsutils_1.isTaggedTemplateExpression(parent) || tsutils_1.isCallExpression(parent) && parent.expression === node ? parent : undefined;
+}
function getDeprecation(node, tc) {
+ var callExpression = getCallExpresion(node);
+ if (callExpression !== undefined) {
+ var result = getSignatureDeprecation(tc.getResolvedSignature(callExpression));
+ if (result !== undefined) {
+ return result;
+ }
+ }
var symbol = tc.getSymbolAtLocation(node);
if (symbol !== undefined && Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
symbol = tc.getAliasedSymbol(symbol);
}
- if (symbol !== undefined) {
- return getDeprecationValue(symbol);
+ if (symbol === undefined ||
+ // if this is a CallExpression and the declaration is a function or method,
+ // stop here to avoid collecting JsDoc of all overload signatures
+ callExpression !== undefined && isFunctionOrMethod(symbol.declarations)) {
+ return undefined;
+ }
+ return getSymbolDeprecation(symbol);
+}
+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 undefined;
}
-function getDeprecationValue(symbol) {
+function getSymbolDeprecation(symbol) {
if (symbol.getJsDocTags !== undefined) {
- for (var _i = 0, _a = symbol.getJsDocTags(); _i < _a.length; _i++) {
- var tag = _a[_i];
- if (tag.name === "deprecated") {
- return tag.text;
- }
- }
- return undefined;
+ return findDeprecationTag(symbol.getJsDocTags());
}
// for compatibility with typescript@<2.3.0
return getDeprecationFromDeclarations(symbol.declarations);
}
+function getSignatureDeprecation(signature) {
+ if (signature === undefined) {
+ return undefined;
+ }
+ if (signature.getJsDocTags !== undefined) {
+ return findDeprecationTag(signature.getJsDocTags());
+ }
+ // for compatibility with typescript@<2.3.0
+ return signature.declaration === undefined ? undefined : getDeprecationFromDeclaration(signature.declaration);
+}
function getDeprecationFromDeclarations(declarations) {
if (declarations === undefined) {
return undefined;
@@ -139,22 +176,43 @@ function getDeprecationFromDeclarations(declarations) {
if (tsutils_1.isVariableDeclarationList(declaration)) {
declaration = declaration.parent;
}
- for (var _a = 0, _b = declaration.getChildren(); _a < _b.length; _a++) {
- var child = _b[_a];
- if (!tsutils_1.isJsDoc(child)) {
- break;
- }
- if (child.tags === undefined) {
- continue;
- }
- for (var _c = 0, _d = child.tags; _c < _d.length; _c++) {
- var tag = _d[_c];
- if (tag.tagName.text === "deprecated") {
- return tag.comment === undefined ? "" : tag.comment;
- }
+ var result = getDeprecationFromDeclaration(declaration);
+ if (result !== undefined) {
+ return result;
+ }
+ }
+ return undefined;
+}
+function getDeprecationFromDeclaration(declaration) {
+ for (var _i = 0, _a = declaration.getChildren(); _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (!tsutils_1.isJsDoc(child)) {
+ break;
+ }
+ if (child.tags === undefined) {
+ continue;
+ }
+ for (var _b = 0, _c = child.tags; _b < _c.length; _b++) {
+ var tag = _c[_b];
+ if (tag.tagName.text === "deprecated") {
+ return tag.comment === undefined ? "" : tag.comment;
}
}
}
return undefined;
}
+function isFunctionOrMethod(declarations) {
+ if (declarations === undefined || declarations.length === 0) {
+ return false;
+ }
+ switch (declarations[0].kind) {
+ case ts.SyntaxKind.MethodDeclaration:
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.MethodSignature:
+ return true;
+ default:
+ return false;
+ }
+}
var _a;
diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js
index eda50bfa6..156d157a0 100644
--- a/node_modules/tslint/lib/rules/encodingRule.js
+++ b/node_modules/tslint/lib/rules/encodingRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var fs = require("fs");
var Lint = require("../index");
var utils_1 = require("../utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/eoflineRule.js b/node_modules/tslint/lib/rules/eoflineRule.js
index c41ad92b0..631b5fc28 100644
--- a/node_modules/tslint/lib/rules/eoflineRule.js
+++ b/node_modules/tslint/lib/rules/eoflineRule.js
@@ -18,14 +18,14 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
var length = sourceFile.text.length;
- if (length === 0 ||
+ if (length === 0 || // if the file is empty, it "ends with a newline", so don't return a failure
sourceFile.text[length - 1] === "\n") {
return [];
}
diff --git a/node_modules/tslint/lib/rules/fileHeaderRule.js b/node_modules/tslint/lib/rules/fileHeaderRule.js
index ff8a24b62..91d505d53 100644
--- a/node_modules/tslint/lib/rules/fileHeaderRule.js
+++ b/node_modules/tslint/lib/rules/fileHeaderRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/forinRule.js b/node_modules/tslint/lib/rules/forinRule.js
index f33bf3537..23cbddc86 100644
--- a/node_modules/tslint/lib/rules/forinRule.js
+++ b/node_modules/tslint/lib/rules/forinRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/importBlacklistRule.js b/node_modules/tslint/lib/rules/importBlacklistRule.js
index c4bbd7fac..c99110b96 100644
--- a/node_modules/tslint/lib/rules/importBlacklistRule.js
+++ b/node_modules/tslint/lib/rules/importBlacklistRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -52,7 +52,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var ImportBlacklistWalker = (function (_super) {
+var ImportBlacklistWalker = /** @class */ (function (_super) {
tslib_1.__extends(ImportBlacklistWalker, _super);
function ImportBlacklistWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/importSpacingRule.js b/node_modules/tslint/lib/rules/importSpacingRule.js
index ba3cf601e..14ed83607 100644
--- a/node_modules/tslint/lib/rules/importSpacingRule.js
+++ b/node_modules/tslint/lib/rules/importSpacingRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var LINE_BREAK_REGEX = /\r?\n/;
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -51,7 +51,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var Walker = (function (_super) {
+var Walker = /** @class */ (function (_super) {
tslib_1.__extends(Walker, _super);
function Walker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/indentRule.js b/node_modules/tslint/lib/rules/indentRule.js
index 7aa3459ba..599ec98c3 100644
--- a/node_modules/tslint/lib/rules/indentRule.js
+++ b/node_modules/tslint/lib/rules/indentRule.js
@@ -24,7 +24,7 @@ var OPTION_USE_TABS = "tabs";
var OPTION_USE_SPACES = "spaces";
var OPTION_INDENT_SIZE_2 = 2;
var OPTION_INDENT_SIZE_4 = 4;
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/interfaceNameRule.js b/node_modules/tslint/lib/rules/interfaceNameRule.js
index 050352bf9..fe9958d0f 100644
--- a/node_modules/tslint/lib/rules/interfaceNameRule.js
+++ b/node_modules/tslint/lib/rules/interfaceNameRule.js
@@ -23,7 +23,7 @@ var Lint = require("../index");
var utils_1 = require("../utils");
var OPTION_ALWAYS = "always-prefix";
var OPTION_NEVER = "never-prefix";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js
index e8da59c1b..fa4c0977b 100644
--- a/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js
+++ b/node_modules/tslint/lib/rules/interfaceOverTypeLiteralRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/jsdocFormatRule.js b/node_modules/tslint/lib/rules/jsdocFormatRule.js
index 1359ce867..329cf2538 100644
--- a/node_modules/tslint/lib/rules/jsdocFormatRule.js
+++ b/node_modules/tslint/lib/rules/jsdocFormatRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/labelPositionRule.js b/node_modules/tslint/lib/rules/labelPositionRule.js
index ef961ee4c..165e6efd8 100644
--- a/node_modules/tslint/lib/rules/labelPositionRule.js
+++ b/node_modules/tslint/lib/rules/labelPositionRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/linebreakStyleRule.js b/node_modules/tslint/lib/rules/linebreakStyleRule.js
index fed387732..bbbfb24aa 100644
--- a/node_modules/tslint/lib/rules/linebreakStyleRule.js
+++ b/node_modules/tslint/lib/rules/linebreakStyleRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var Lint = require("../index");
var OPTION_LINEBREAK_STYLE_CRLF = "CRLF";
var OPTION_LINEBREAK_STYLE_LF = "LF";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
index 06602d375..f7df853f4 100644
--- a/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
+++ b/node_modules/tslint/lib/rules/matchDefaultExportNameRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -30,7 +30,7 @@ var Rule = (function (_super) {
return "Expected import '" + importName + "' to match the default export '" + exportName + "'.";
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
index c70766a86..c5921368b 100644
--- a/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
+++ b/node_modules/tslint/lib/rules/maxClassesPerFileRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/maxFileLineCountRule.js b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
index c29761d19..98a98cbb0 100644
--- a/node_modules/tslint/lib/rules/maxFileLineCountRule.js
+++ b/node_modules/tslint/lib/rules/maxFileLineCountRule.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/maxLineLengthRule.js b/node_modules/tslint/lib/rules/maxLineLengthRule.js
index 5324c073c..b6b1ebfca 100644
--- a/node_modules/tslint/lib/rules/maxLineLengthRule.js
+++ b/node_modules/tslint/lib/rules/maxLineLengthRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/memberAccessRule.js b/node_modules/tslint/lib/rules/memberAccessRule.js
index 2143f15d4..599a0952e 100644
--- a/node_modules/tslint/lib/rules/memberAccessRule.js
+++ b/node_modules/tslint/lib/rules/memberAccessRule.js
@@ -24,7 +24,7 @@ var Lint = require("../index");
var OPTION_NO_PUBLIC = "no-public";
var OPTION_CHECK_ACCESSOR = "check-accessor";
var OPTION_CHECK_CONSTRUCTOR = "check-constructor";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -117,10 +117,14 @@ function walk(ctx) {
? tsutils_1.getChildOfKind(node, ts.SyntaxKind.ConstructorKeyword, ctx.sourceFile)
: node.name !== undefined ? node.name : node;
var memberName = node.name !== undefined && node.name.kind === ts.SyntaxKind.Identifier ? node.name.text : undefined;
- ctx.addFailureAtNode(nameNode, Rule.FAILURE_STRING_FACTORY(typeToString(node), memberName), Lint.Replacement.appendText(node.getStart(ctx.sourceFile), "public "));
+ ctx.addFailureAtNode(nameNode, Rule.FAILURE_STRING_FACTORY(typeToString(node), memberName), Lint.Replacement.appendText(getInsertionPosition(node, ctx.sourceFile), "public "));
}
}
}
+function getInsertionPosition(member, sourceFile) {
+ var node = member.decorators === undefined ? member : tsutils_1.getTokenAtPosition(member, member.decorators.end, sourceFile);
+ return node.getStart(sourceFile);
+}
function typeToString(node) {
switch (node.kind) {
case ts.SyntaxKind.MethodDeclaration:
diff --git a/node_modules/tslint/lib/rules/memberOrderingRule.js b/node_modules/tslint/lib/rules/memberOrderingRule.js
index c96c89e80..f5b6d0683 100644
--- a/node_modules/tslint/lib/rules/memberOrderingRule.js
+++ b/node_modules/tslint/lib/rules/memberOrderingRule.js
@@ -97,7 +97,7 @@ function namesMarkdown(names) {
return names.map(function (name) { return "* `" + name + "`"; }).join("\n ");
}
var optionsDescription = (_a = ["\n One argument, which is an object, must be provided. It should contain an `order` property.\n The `order` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for `order` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], _a.raw = ["\n One argument, which is an object, must be provided. It should contain an \\`order\\` property.\n The \\`order\\` property should have a value of one of the following strings:\n\n ", "\n\n Alternatively, the value for \\`order\\` maybe be an array consisting of the following strings:\n\n ", "\n\n You can also omit the access modifier to refer to \"public-\", \"protected-\", and \"private-\" all at once; for example, \"static-field\".\n\n You can also make your own categories by using an object instead of a string:\n\n {\n \"name\": \"static non-private\",\n \"kinds\": [\n \"public-static-field\",\n \"protected-static-field\",\n \"public-static-method\",\n \"protected-static-method\"\n ]\n }\n\n The '", "' option will enforce that members within the same category should be alphabetically sorted by name."], Lint.Utils.dedent(_a, namesMarkdown(PRESET_NAMES), namesMarkdown(allMemberKindNames), OPTION_ALPHABETIZE));
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -181,7 +181,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var MemberOrderingWalker = (function (_super) {
+var MemberOrderingWalker = /** @class */ (function (_super) {
tslib_1.__extends(MemberOrderingWalker, _super);
function MemberOrderingWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -324,7 +324,7 @@ function getMemberKind(member) {
return Lint.hasModifier(member.modifiers, kind);
}
}
-var MemberCategory = (function () {
+var MemberCategory = /** @class */ (function () {
function MemberCategory(name, kinds) {
this.name = name;
this.kinds = kinds;
diff --git a/node_modules/tslint/lib/rules/newParensRule.js b/node_modules/tslint/lib/rules/newParensRule.js
index e207cedc6..f0a82ad08 100644
--- a/node_modules/tslint/lib/rules/newParensRule.js
+++ b/node_modules/tslint/lib/rules/newParensRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js
index 50d353457..aed998980 100644
--- a/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js
+++ b/node_modules/tslint/lib/rules/newlineBeforeReturnRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -44,7 +44,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NewlineBeforeReturnWalker = (function (_super) {
+var NewlineBeforeReturnWalker = /** @class */ (function (_super) {
tslib_1.__extends(NewlineBeforeReturnWalker, _super);
function NewlineBeforeReturnWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
index 9cf180943..18d780e31 100644
--- a/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noAngleBracketTypeAssertionRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noAnyRule.js b/node_modules/tslint/lib/rules/noAnyRule.js
index 939311248..d438dabca 100644
--- a/node_modules/tslint/lib/rules/noAnyRule.js
+++ b/node_modules/tslint/lib/rules/noAnyRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noArgRule.js b/node_modules/tslint/lib/rules/noArgRule.js
index dc8a47aaa..e5fe14932 100644
--- a/node_modules/tslint/lib/rules/noArgRule.js
+++ b/node_modules/tslint/lib/rules/noArgRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noBitwiseRule.js b/node_modules/tslint/lib/rules/noBitwiseRule.js
index 0d9d7ff85..4a3d413a6 100644
--- a/node_modules/tslint/lib/rules/noBitwiseRule.js
+++ b/node_modules/tslint/lib/rules/noBitwiseRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
index 8501972f2..cefd393ec 100644
--- a/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
+++ b/node_modules/tslint/lib/rules/noBooleanLiteralCompareRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -30,7 +30,7 @@ var Rule = (function (_super) {
return "This expression is unnecessarily compared to a boolean. Just " + (negate ? "negate it" : "use it directly") + ".";
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
index cefa22d89..f437d1a63 100644
--- a/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noConditionalAssignmentRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -45,7 +45,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoConditionalAssignmentWalker = (function (_super) {
+var NoConditionalAssignmentWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoConditionalAssignmentWalker, _super);
function NoConditionalAssignmentWalker() {
var _this = _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
index 544e5b309..8e6253ba5 100644
--- a/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
+++ b/node_modules/tslint/lib/rules/noConsecutiveBlankLinesRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noConsoleRule.js b/node_modules/tslint/lib/rules/noConsoleRule.js
index 506a017cf..384154d12 100644
--- a/node_modules/tslint/lib/rules/noConsoleRule.js
+++ b/node_modules/tslint/lib/rules/noConsoleRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noConstructRule.js b/node_modules/tslint/lib/rules/noConstructRule.js
index a7fccceaa..bc6130b24 100644
--- a/node_modules/tslint/lib/rules/noConstructRule.js
+++ b/node_modules/tslint/lib/rules/noConstructRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noDebuggerRule.js b/node_modules/tslint/lib/rules/noDebuggerRule.js
index 00b3e7245..591c32862 100644
--- a/node_modules/tslint/lib/rules/noDebuggerRule.js
+++ b/node_modules/tslint/lib/rules/noDebuggerRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noDefaultExportRule.js b/node_modules/tslint/lib/rules/noDefaultExportRule.js
index 15fa1f729..da53773d5 100644
--- a/node_modules/tslint/lib/rules/noDefaultExportRule.js
+++ b/node_modules/tslint/lib/rules/noDefaultExportRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
index 18f6f2760..f8bd79d04 100644
--- a/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateImportsRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -45,7 +45,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoDuplicateImportsWalker = (function (_super) {
+var NoDuplicateImportsWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoDuplicateImportsWalker, _super);
function NoDuplicateImportsWalker() {
var _this = _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
index 1256d81a2..39e07d472 100644
--- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
index 757d17e4c..f546ddfc4 100644
--- a/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
+++ b/node_modules/tslint/lib/rules/noDuplicateVariableRule.js
@@ -21,7 +21,7 @@ var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_CHECK_PARAMETERS = "check-parameters";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -56,7 +56,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoDuplicateVariableWalker = (function (_super) {
+var NoDuplicateVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoDuplicateVariableWalker, _super);
function NoDuplicateVariableWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js
index 411026490..ae42d72e6 100644
--- a/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js
+++ b/node_modules/tslint/lib/rules/noEmptyInterfaceRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noEmptyRule.js b/node_modules/tslint/lib/rules/noEmptyRule.js
index 48af2183e..115875816 100644
--- a/node_modules/tslint/lib/rules/noEmptyRule.js
+++ b/node_modules/tslint/lib/rules/noEmptyRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var ALLOW_EMPTY_CATCH = "allow-empty-catch";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noEvalRule.js b/node_modules/tslint/lib/rules/noEvalRule.js
index 7c24fbca4..9067a3fd8 100644
--- a/node_modules/tslint/lib/rules/noEvalRule.js
+++ b/node_modules/tslint/lib/rules/noEvalRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
index 6fe6d3329..152a03eab 100644
--- a/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
+++ b/node_modules/tslint/lib/rules/noFloatingPromisesRule.js
@@ -20,19 +20,19 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); }, ["Promise"].concat(this.ruleArguments));
+ return this.applyWithFunction(sourceFile, walk, ["Promise"].concat(this.ruleArguments), program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-floating-promises",
description: "Promises returned by functions must be handled appropriately.",
- descriptionDetails: "Use `no-unused-expressions` in addition to this rule to reveal even more floating promises.",
+ 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)),
options: {
type: "list",
diff --git a/node_modules/tslint/lib/rules/noForInArrayRule.js b/node_modules/tslint/lib/rules/noForInArrayRule.js
index 732c8bbfd..a5a2ad6b8 100644
--- a/node_modules/tslint/lib/rules/noForInArrayRule.js
+++ b/node_modules/tslint/lib/rules/noForInArrayRule.js
@@ -19,13 +19,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -44,10 +44,10 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-function walk(ctx, program) {
+function walk(ctx, checker) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (node.kind === ts.SyntaxKind.ForInStatement) {
- var type = program.getTypeChecker().getTypeAtLocation(node.expression);
+ var type = checker.getTypeAtLocation(node.expression);
if (type.symbol !== undefined && type.symbol.name === "Array" ||
// tslint:disable-next-line:no-bitwise
(type.flags & ts.TypeFlags.StringLike) !== 0) {
diff --git a/node_modules/tslint/lib/rules/noImportSideEffectRule.js b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
index 2821cd7f7..a2b6afb0a 100644
--- a/node_modules/tslint/lib/rules/noImportSideEffectRule.js
+++ b/node_modules/tslint/lib/rules/noImportSideEffectRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var Lint = require("../index");
var OPTION_IGNORE_MODULE = "ignore-module";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noInferrableTypesRule.js b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
index bbb51fab4..a9da20d83 100644
--- a/node_modules/tslint/lib/rules/noInferrableTypesRule.js
+++ b/node_modules/tslint/lib/rules/noInferrableTypesRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_PARMS = "ignore-params";
var OPTION_IGNORE_PROPERTIES = "ignore-properties";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -64,7 +64,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoInferrableTypesWalker = (function (_super) {
+var NoInferrableTypesWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoInferrableTypesWalker, _super);
function NoInferrableTypesWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
index 254098ec6..df4b9304c 100644
--- a/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
+++ b/node_modules/tslint/lib/rules/noInferredEmptyObjectTypeRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -45,7 +45,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-var NoInferredEmptyObjectTypeRule = (function (_super) {
+var NoInferredEmptyObjectTypeRule = /** @class */ (function (_super) {
tslib_1.__extends(NoInferredEmptyObjectTypeRule, _super);
function NoInferredEmptyObjectTypeRule(sourceFile, ruleName, checker) {
var _this = _super.call(this, sourceFile, ruleName, undefined) || this;
diff --git a/node_modules/tslint/lib/rules/noInternalModuleRule.js b/node_modules/tslint/lib/rules/noInternalModuleRule.js
index 85efb2530..06ed07e24 100644
--- a/node_modules/tslint/lib/rules/noInternalModuleRule.js
+++ b/node_modules/tslint/lib/rules/noInternalModuleRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -44,7 +44,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoInternalModuleWalker = (function (_super) {
+var NoInternalModuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoInternalModuleWalker, _super);
function NoInternalModuleWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
index d3ee747f2..3fe553081 100644
--- a/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidTemplateStringsRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -52,10 +52,18 @@ function walk(ctx) {
return ts.forEachChild(node, cb);
});
function check(node) {
- var idx = node.text.search(/\$\{/);
- if (idx !== -1) {
- var textStart = node.getStart() + 1;
- ctx.addFailureAt(textStart + idx, 2, Rule.FAILURE_STRING);
+ var text = node.getText(ctx.sourceFile);
+ var findTemplateStrings = /\\*\$\{/g;
+ var instance = findTemplateStrings.exec(text);
+ while (instance !== null) {
+ var matchLength = instance[0].length;
+ var backslashCount = matchLength - 2;
+ var instanceIsEscaped = backslashCount % 2 === 1;
+ if (!instanceIsEscaped) {
+ var start = node.getStart() + (instance.index + backslashCount);
+ ctx.addFailureAt(start, 2, Rule.FAILURE_STRING);
+ }
+ instance = findTemplateStrings.exec(text);
}
}
}
diff --git a/node_modules/tslint/lib/rules/noInvalidThisRule.js b/node_modules/tslint/lib/rules/noInvalidThisRule.js
index 2c5ce8486..b9b04a842 100644
--- a/node_modules/tslint/lib/rules/noInvalidThisRule.js
+++ b/node_modules/tslint/lib/rules/noInvalidThisRule.js
@@ -21,7 +21,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_FUNCTION_IN_METHOD = "check-function-in-method";
var DEPRECATED_OPTION_FUNCTION_IN_METHOD = "no-this-in-function-in-method";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
index d82f0f5da..4c0baeb89 100644
--- a/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noIrregularWhitespaceRule.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noMagicNumbersRule.js b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
index 8888ceb38..483130dfe 100644
--- a/node_modules/tslint/lib/rules/noMagicNumbersRule.js
+++ b/node_modules/tslint/lib/rules/noMagicNumbersRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../language/utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -64,7 +64,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoMagicNumbersWalker = (function (_super) {
+var NoMagicNumbersWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoMagicNumbersWalker, _super);
function NoMagicNumbersWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js
index 82d24ed0e..09eb11ee8 100644
--- a/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js
+++ b/node_modules/tslint/lib/rules/noMergeableNamespaceRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -44,7 +44,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var Walker = (function (_super) {
+var Walker = /** @class */ (function (_super) {
tslib_1.__extends(Walker, _super);
function Walker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noMisusedNewRule.js b/node_modules/tslint/lib/rules/noMisusedNewRule.js
index 3aa870bc7..4f166eb36 100644
--- a/node_modules/tslint/lib/rules/noMisusedNewRule.js
+++ b/node_modules/tslint/lib/rules/noMisusedNewRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noNamespaceRule.js b/node_modules/tslint/lib/rules/noNamespaceRule.js
index 381a211d9..4afdb2ee4 100644
--- a/node_modules/tslint/lib/rules/noNamespaceRule.js
+++ b/node_modules/tslint/lib/rules/noNamespaceRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_DECLARATIONS = "allow-declarations";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -66,6 +66,7 @@ function walk(ctx) {
var node = _a[_i];
if (node.kind === ts.SyntaxKind.ModuleDeclaration) {
if (node.name.kind !== ts.SyntaxKind.StringLiteral &&
+ !tsutils_1.isNodeFlagSet(node, ts.NodeFlags.GlobalAugmentation) &&
(!ctx.options.allowDeclarations || !tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword))) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
index d708687f9..f0c2d20f3 100644
--- a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noNullKeywordRule.js b/node_modules/tslint/lib/rules/noNullKeywordRule.js
index d02e85130..b54f9170c 100644
--- a/node_modules/tslint/lib/rules/noNullKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noNullKeywordRule.js
@@ -21,7 +21,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
index dd5a8f8ea..1690165bd 100644
--- a/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noObjectLiteralTypeAssertionRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
index d0b929650..c852cee9c 100644
--- a/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
+++ b/node_modules/tslint/lib/rules/noParameterPropertiesRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
new file mode 100644
index 000000000..117f46536
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noParameterReassignmentRule.d.ts
@@ -0,0 +1,7 @@
+import * as ts from "typescript";
+import * as Lint from "../index";
+export declare class Rule extends Lint.Rules.AbstractRule {
+ static metadata: Lint.IRuleMetadata;
+ static FAILURE_STRING(name: string): string;
+ apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
+}
diff --git a/node_modules/tslint/lib/rules/noParameterReassignmentRule.js b/node_modules/tslint/lib/rules/noParameterReassignmentRule.js
new file mode 100644
index 000000000..0006201c8
--- /dev/null
+++ b/node_modules/tslint/lib/rules/noParameterReassignmentRule.js
@@ -0,0 +1,70 @@
+"use strict";
+/**
+ * @license
+ * Copyright 2017 Palantir Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
+var ts = require("typescript");
+var Lint = require("../index");
+var Rule = /** @class */ (function (_super) {
+ tslib_1.__extends(Rule, _super);
+ function Rule() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /* tslint:enable:object-literal-sort-keys */
+ Rule.FAILURE_STRING = function (name) {
+ return "Reassigning parameter '" + name + "' is forbidden.";
+ };
+ Rule.prototype.apply = function (sourceFile) {
+ return this.applyWithFunction(sourceFile, walk);
+ };
+ /* tslint:disable:object-literal-sort-keys */
+ Rule.metadata = {
+ ruleName: "no-parameter-reassignment",
+ description: "Disallows reassigning parameters.",
+ optionsDescription: "Not configurable.",
+ options: null,
+ optionExamples: [true],
+ type: "typescript",
+ typescriptOnly: false,
+ };
+ return Rule;
+}(Lint.Rules.AbstractRule));
+exports.Rule = Rule;
+function walk(ctx) {
+ tsutils_1.collectVariableUsage(ctx.sourceFile).forEach(function (variable, identifier) {
+ if (!isParameter(identifier.parent)) {
+ return;
+ }
+ for (var _i = 0, _a = variable.uses; _i < _a.length; _i++) {
+ var use = _a[_i];
+ if (tsutils_1.isReassignmentTarget(use.location)) {
+ ctx.addFailureAtNode(use.location, Rule.FAILURE_STRING(identifier.text));
+ }
+ }
+ });
+}
+function isParameter(node) {
+ switch (node.kind) {
+ case ts.SyntaxKind.Parameter:
+ return true;
+ case ts.SyntaxKind.BindingElement:
+ return tsutils_1.getDeclarationOfBindingElement(node).kind === ts.SyntaxKind.Parameter;
+ default:
+ return false;
+ }
+}
diff --git a/node_modules/tslint/lib/rules/noReferenceImportRule.js b/node_modules/tslint/lib/rules/noReferenceImportRule.js
index 25452c73e..8579b5eee 100644
--- a/node_modules/tslint/lib/rules/noReferenceImportRule.js
+++ b/node_modules/tslint/lib/rules/noReferenceImportRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -44,7 +44,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoReferenceImportWalker = (function (_super) {
+var NoReferenceImportWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoReferenceImportWalker, _super);
function NoReferenceImportWalker() {
var _this = _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noReferenceRule.js b/node_modules/tslint/lib/rules/noReferenceRule.js
index 56d5b10e9..e3325e20a 100644
--- a/node_modules/tslint/lib/rules/noReferenceRule.js
+++ b/node_modules/tslint/lib/rules/noReferenceRule.js
@@ -18,7 +18,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noRequireImportsRule.js b/node_modules/tslint/lib/rules/noRequireImportsRule.js
index a98236155..77c7d155f 100644
--- a/node_modules/tslint/lib/rules/noRequireImportsRule.js
+++ b/node_modules/tslint/lib/rules/noRequireImportsRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noShadowedVariableRule.js b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
index 7aa485c18..6ca830085 100644
--- a/node_modules/tslint/lib/rules/noShadowedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noShadowedVariableRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -64,7 +64,7 @@ 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);
}
-var Scope = (function () {
+var Scope = /** @class */ (function () {
function Scope(functionScope) {
this.variables = new Map();
this.variablesSeen = new Map();
@@ -86,7 +86,7 @@ var Scope = (function () {
};
return Scope;
}());
-var NoShadowedVariableWalker = (function (_super) {
+var NoShadowedVariableWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoShadowedVariableWalker, _super);
function NoShadowedVariableWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noSparseArraysRule.js b/node_modules/tslint/lib/rules/noSparseArraysRule.js
index e8bd49d3e..387b4cc50 100644
--- a/node_modules/tslint/lib/rules/noSparseArraysRule.js
+++ b/node_modules/tslint/lib/rules/noSparseArraysRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.js b/node_modules/tslint/lib/rules/noStringLiteralRule.js
index 5786e6f5e..7774cbcb2 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.js
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noStringThrowRule.js b/node_modules/tslint/lib/rules/noStringThrowRule.js
index 0dddcb10a..1640b91cf 100644
--- a/node_modules/tslint/lib/rules/noStringThrowRule.js
+++ b/node_modules/tslint/lib/rules/noStringThrowRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
index 5a638301c..37e661b1f 100644
--- a/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
+++ b/node_modules/tslint/lib/rules/noSubmoduleImportsRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -33,15 +33,14 @@ var Rule = (function (_super) {
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)),
- optionsDescription: "A list of packages whose submodules are whitelisted.",
+ optionsDescription: "A list of whitelisted package or submodule names.",
options: {
type: "array",
items: {
type: "string",
},
- minLength: 0,
},
- optionExamples: [true, [true, "rxjs", "@angular/core"]],
+ optionExamples: [true, [true, "rxjs", "@angular/platform-browser", "@angular/core/testing"]],
type: "functionality",
typescriptOnly: false,
};
@@ -49,7 +48,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoSubmoduleImportsWalker = (function (_super) {
+var NoSubmoduleImportsWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoSubmoduleImportsWalker, _super);
function NoSubmoduleImportsWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -80,18 +79,18 @@ var NoSubmoduleImportsWalker = (function (_super) {
}
};
NoSubmoduleImportsWalker.prototype.checkForBannedImport = function (expression) {
- if (tsutils_1.isTextualLiteral(expression)) {
- if (isAbsoluteOrRelativePath(expression.text) || !isSubmodulePath(expression.text)) {
- return;
- }
- /**
+ if (tsutils_1.isTextualLiteral(expression) &&
+ // TODO remove assertion on upgrade to typescript@2.5.2
+ !ts.isExternalModuleNameRelative(expression.text) &&
+ isSubmodulePath(expression.text)) {
+ /*
* A submodule is being imported.
* Check if its path contains any
* of the whitelist packages.
*/
for (var _i = 0, _a = this.options; _i < _a.length; _i++) {
var option = _a[_i];
- if (expression.text.startsWith(option + "/")) {
+ if (expression.text === option || expression.text.startsWith(option + "/")) {
return;
}
}
@@ -100,9 +99,6 @@ var NoSubmoduleImportsWalker = (function (_super) {
};
return NoSubmoduleImportsWalker;
}(Lint.AbstractWalker));
-function isAbsoluteOrRelativePath(path) {
- return /^(..?(\/|$)|\/)/.test(path);
-}
function isScopedPath(path) {
return path[0] === "@";
}
diff --git a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
index db7d04575..713e91fae 100644
--- a/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
+++ b/node_modules/tslint/lib/rules/noSwitchCaseFallThroughRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -47,7 +47,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoSwitchCaseFallThroughWalker = (function (_super) {
+var NoSwitchCaseFallThroughWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoSwitchCaseFallThroughWalker, _super);
function NoSwitchCaseFallThroughWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noThisAssignmentRule.js b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
index 64cacccf8..5d509faa8 100644
--- a/node_modules/tslint/lib/rules/noThisAssignmentRule.js
+++ b/node_modules/tslint/lib/rules/noThisAssignmentRule.js
@@ -33,7 +33,7 @@ var parseConfigOptions = function (configOptions) {
}
return { allowedNames: allowedNames, allowDestructuring: allowDestructuring };
};
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -82,7 +82,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoThisAssignmentWalker = (function (_super) {
+var NoThisAssignmentWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoThisAssignmentWalker, _super);
function NoThisAssignmentWalker() {
var _this = _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
index b29aec663..3531bc9ae 100644
--- a/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/noTrailingWhitespaceRule.js
@@ -24,7 +24,7 @@ var noConsecutiveBlankLinesRule_1 = require("./noConsecutiveBlankLinesRule");
var OPTION_IGNORE_COMMENTS = "ignore-comments";
var OPTION_IGNORE_JSDOC = "ignore-jsdoc";
var OPTION_IGNORE_TEMPLATE_STRINGS = "ignore-template-strings";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noUnboundMethodRule.js b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
index 80804b58d..a60eb6335 100644
--- a/node_modules/tslint/lib/rules/noUnboundMethodRule.js
+++ b/node_modules/tslint/lib/rules/noUnboundMethodRule.js
@@ -21,15 +21,15 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_STATIC = "ignore-static";
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); }, {
+ return this.applyWithFunction(sourceFile, walk, {
ignoreStatic: this.ruleArguments.indexOf(OPTION_IGNORE_STATIC) !== -1,
- });
+ }, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
index 69977baf5..25c7f9173 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryCallbackWrapperRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -76,6 +76,7 @@ function isRedundantCallback(parameters, args, expression) {
arg = arg.expression;
}
if (!tsutils_1.isIdentifier(name) || !tsutils_1.isIdentifier(arg) || name.text !== arg.text
+ // If the invoked expression is one of the parameters, bail.
|| expression.text === name.text) {
return false;
}
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
index e02c3a905..794c668fb 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryInitializerRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
index 374854d97..ff2858c41 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryQualifierRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -30,7 +30,7 @@ var Rule = (function (_super) {
return "Qualifier is unnecessary since '" + name + "' is in scope.";
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -94,7 +94,7 @@ function walk(ctx, checker) {
}
// If the symbol in scope is different, the qualifier is necessary.
var fromScope = getSymbolInScope(qualifier, accessedSymbol.flags, name.text);
- return fromScope === undefined || Lint.Utils.arraysAreEqual(fromScope.declarations, accessedSymbol.declarations, function (a, b) { return a === b; });
+ return fromScope === undefined || symbolsAreEqual(accessedSymbol, fromScope);
}
function getSymbolInScope(node, flags, name) {
// TODO:PERF `getSymbolsInScope` gets a long list. Is there a better way?
@@ -112,6 +112,16 @@ function walk(ctx, checker) {
var alias = tryGetAliasedSymbol(symbol, 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;
+ }
+ return accessed === inScope ||
+ // For compatibility with typescript@2.5: compare declarations because the symbols don't have the same reference
+ Lint.Utils.arraysAreEqual(accessed.declarations, inScope.declarations, function (a, b) { return a === b; });
+ }
}
function tryGetAliasedSymbol(symbol, checker) {
return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
diff --git a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
index 8b31e4da7..d2d51d1d1 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.d.ts
@@ -1,19 +1,3 @@
-/**
- * @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 aedcf3a1a..97a06adfc 100644
--- a/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
+++ b/node_modules/tslint/lib/rules/noUnnecessaryTypeAssertionRule.js
@@ -17,9 +17,10 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
+var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -43,7 +44,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-var Walker = (function (_super) {
+var Walker = /** @class */ (function (_super) {
tslib_1.__extends(Walker, _super);
function Walker(sourceFile, ruleName, checker) {
var _this = _super.call(this, sourceFile, ruleName, undefined) || this;
@@ -68,6 +69,14 @@ var Walker = (function (_super) {
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))) {
+ // 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;
+ }
var uncastType = this.checker.getTypeAtLocation(node.expression);
if (uncastType === castType) {
this.addFailureAtNode(node, Rule.FAILURE_STRING, node.kind === ts.SyntaxKind.TypeAssertionExpression
diff --git a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
index 60ba3aabb..3ff493ce9 100644
--- a/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeAnyRule.js
@@ -20,13 +20,13 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
index 4196c41af..ea28c23f4 100644
--- a/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
+++ b/node_modules/tslint/lib/rules/noUnsafeFinallyRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
index 2e389b732..7390a6984 100644
--- a/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedExpressionRule.js
@@ -23,7 +23,7 @@ var Lint = require("../index");
var ALLOW_FAST_NULL_CHECKS = "allow-fast-null-checks";
var ALLOW_NEW = "allow-new";
var ALLOW_TAGGED_TEMPLATE = "allow-tagged-template";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noUnusedVariableRule.js b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
index e4fab8a3e..02506f434 100644
--- a/node_modules/tslint/lib/rules/noUnusedVariableRule.js
+++ b/node_modules/tslint/lib/rules/noUnusedVariableRule.js
@@ -22,20 +22,19 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_CHECK_PARAMETERS = "check-parameters";
var OPTION_IGNORE_PATTERN = "ignore-pattern";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* tslint:enable:object-literal-sort-keys */
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- var _this = this;
var x = program.getCompilerOptions();
if (x.noUnusedLocals && x.noUnusedParameters) {
console.warn("WARNING: 'no-unused-variable' lint rule does not need to be set if " +
"the 'no-unused-locals' and 'no-unused-parameters' compiler options are enabled.");
}
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program, parseOptions(_this.ruleArguments)); });
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments), program);
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -87,9 +86,8 @@ function parseOptions(options) {
}
return { checkParameters: checkParameters, ignorePattern: ignorePattern };
}
-function walk(ctx, program, _a) {
- var checkParameters = _a.checkParameters, ignorePattern = _a.ignorePattern;
- var sourceFile = ctx.sourceFile;
+function walk(ctx, program) {
+ var sourceFile = ctx.sourceFile, _a = ctx.options, checkParameters = _a.checkParameters, ignorePattern = _a.ignorePattern;
var unusedCheckedProgram = getUnusedCheckedProgram(program, checkParameters);
var diagnostics = ts.getPreEmitDiagnostics(unusedCheckedProgram, sourceFile);
var checker = unusedCheckedProgram.getTypeChecker(); // Doesn't matter which program is used for this.
@@ -207,6 +205,11 @@ function addImportSpecifierFailures(ctx, failures, sourceFile) {
function removeAll(errorNode, failure) {
var start = importNode.getStart();
var end = importNode.getEnd();
+ utils.forEachToken(importNode, function (token) {
+ ts.forEachTrailingCommentRange(ctx.sourceFile.text, token.end, function (_, commentEnd, __) {
+ end = commentEnd;
+ });
+ }, ctx.sourceFile);
if (isEntireLine(start, end)) {
end = getNextLineStart(end);
}
diff --git a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
index c46ebc417..5c742bfbd 100644
--- a/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
+++ b/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -29,7 +29,7 @@ var Rule = (function (_super) {
return "variable '" + name + "' used before declaration";
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/noVarKeywordRule.js b/node_modules/tslint/lib/rules/noVarKeywordRule.js
index e0b4d3438..e79d9c65f 100644
--- a/node_modules/tslint/lib/rules/noVarKeywordRule.js
+++ b/node_modules/tslint/lib/rules/noVarKeywordRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -51,6 +51,7 @@ function walk(ctx) {
var parent = node.parent;
if (tsutils_1.isVariableDeclarationList(node)
&& !tsutils_1.isBlockScopedVariableDeclarationList(node)
+ // If !isVariableStatement, this is inside of a for loop.
&& (!tsutils_1.isVariableStatement(parent) || !isGlobalVarDeclaration(parent))) {
var start = node.getStart(sourceFile);
var width = "var".length;
diff --git a/node_modules/tslint/lib/rules/noVarRequiresRule.js b/node_modules/tslint/lib/rules/noVarRequiresRule.js
index 6c8782ca7..25e212b3a 100644
--- a/node_modules/tslint/lib/rules/noVarRequiresRule.js
+++ b/node_modules/tslint/lib/rules/noVarRequiresRule.js
@@ -21,7 +21,7 @@ var tslib_1 = require("tslib");
// (https://github.com/palantir/tslint/pull/2341)
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -46,7 +46,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var NoVarRequiresWalker = (function (_super) {
+var NoVarRequiresWalker = /** @class */ (function (_super) {
tslib_1.__extends(NoVarRequiresWalker, _super);
function NoVarRequiresWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/noVoidExpressionRule.js b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
index a580bc5cb..daaded82d 100644
--- a/node_modules/tslint/lib/rules/noVoidExpressionRule.js
+++ b/node_modules/tslint/lib/rules/noVoidExpressionRule.js
@@ -21,14 +21,14 @@ var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../language/utils");
var OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND = "ignore-arrow-function-shorthand";
-var Rule = (function (_super) {
+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) {
var ignoreArrowFunctionShorthand = this.ruleArguments.indexOf(OPTION_IGNORE_ARROW_FUNCTION_SHORTHAND) !== -1;
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); }, { ignoreArrowFunctionShorthand: ignoreArrowFunctionShorthand });
+ return this.applyWithFunction(sourceFile, walk, { ignoreArrowFunctionShorthand: ignoreArrowFunctionShorthand }, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
index 98a15a471..bdcb5c699 100644
--- a/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
+++ b/node_modules/tslint/lib/rules/numberLiteralFormatRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
index 5ab8bfa3a..d216bdfc6 100644
--- a/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralKeyQuotesRule.js
@@ -24,7 +24,7 @@ var OPTION_ALWAYS = "always";
var OPTION_AS_NEEDED = "as-needed";
var OPTION_CONSISTENT = "consistent";
var OPTION_CONSISTENT_AS_NEEDED = "consistent-as-needed";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -60,7 +60,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var ObjectLiteralKeyQuotesWalker = (function (_super) {
+var ObjectLiteralKeyQuotesWalker = /** @class */ (function (_super) {
tslib_1.__extends(ObjectLiteralKeyQuotesWalker, _super);
function ObjectLiteralKeyQuotesWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
index b3e7947e1..78d9d3bc9 100644
--- a/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralShorthandRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
index 1cd1b8c5c..7ea64b163 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.d.ts
@@ -1,7 +1,9 @@
import * as ts from "typescript";
import * as Lint from "../index";
-export declare class Rule extends Lint.Rules.AbstractRule {
+export declare class Rule extends Lint.Rules.OptionallyTypedRule {
static metadata: Lint.IRuleMetadata;
- static FAILURE_STRING_FACTORY(name: string): string;
+ static FAILURE_STRING_ALPHABETICAL(name: string): string;
+ static FAILURE_STRING_USE_DECLARATION_ORDER(propName: string, typeName: string | undefined): 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 6b6ed3303..ab8a4c332 100644
--- a/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
+++ b/node_modules/tslint/lib/rules/objectLiteralSortKeysRule.js
@@ -21,67 +21,151 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_CASE = "ignore-case";
-var Rule = (function (_super) {
+var OPTION_MATCH_DECLARATION_ORDER = "match-declaration-order";
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* tslint:enable:object-literal-sort-keys */
- Rule.FAILURE_STRING_FACTORY = function (name) {
+ Rule.FAILURE_STRING_ALPHABETICAL = function (name) {
return "The key '" + name + "' is not sorted alphabetically";
};
+ Rule.FAILURE_STRING_USE_DECLARATION_ORDER = function (propName, typeName) {
+ var type = typeName === undefined ? "its type declaration" : "'" + typeName + "'";
+ return "The key '" + propName + "' is not in the same order as it is in " + type + ".";
+ };
Rule.prototype.apply = function (sourceFile) {
- return this.applyWithFunction(sourceFile, walk, {
- ignoreCase: this.ruleArguments.indexOf(OPTION_IGNORE_CASE) !== -1,
- });
+ var options = parseOptions(this.ruleArguments);
+ if (options.matchDeclarationOrder) {
+ throw new Error(this.ruleName + " needs type info to use \"" + OPTION_MATCH_DECLARATION_ORDER + "\".");
+ }
+ return this.applyWithFunction(sourceFile, walk, options);
+ };
+ Rule.prototype.applyWithProgram = function (sourceFile, program) {
+ return this.applyWithFunction(sourceFile, walk, parseOptions(this.ruleArguments), program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "object-literal-sort-keys",
- description: "Requires keys in object literals to be sorted alphabetically",
+ description: "Checks ordering of keys in object literals.",
rationale: "Useful in preventing merge conflicts",
- optionsDescription: "You may optionally pass \"" + OPTION_IGNORE_CASE + "\" to compare keys case insensitive.",
+ optionsDescription: (_a = ["\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 "], _a.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(_a, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER)),
options: {
type: "string",
- enum: [OPTION_IGNORE_CASE],
+ enum: [OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
},
optionExamples: [
true,
- [true, OPTION_IGNORE_CASE],
+ [true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER],
],
type: "maintainability",
typescriptOnly: false,
};
return Rule;
-}(Lint.Rules.AbstractRule));
+}(Lint.Rules.OptionallyTypedRule));
exports.Rule = Rule;
-function walk(ctx) {
- return ts.forEachChild(ctx.sourceFile, function cb(node) {
- if (tsutils_1.isObjectLiteralExpression(node) && node.properties.length > 1 &&
- !tsutils_1.isSameLine(ctx.sourceFile, node.properties.pos, node.end)) {
- var lastKey = void 0;
- var ignoreCase = ctx.options.ignoreCase;
- outer: for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var property = _a[_i];
- switch (property.kind) {
- case ts.SyntaxKind.SpreadAssignment:
- lastKey = undefined; // reset at spread
- break;
- case ts.SyntaxKind.ShorthandPropertyAssignment:
- case ts.SyntaxKind.PropertyAssignment:
- if (property.name.kind === ts.SyntaxKind.Identifier ||
- property.name.kind === ts.SyntaxKind.StringLiteral) {
- var key = ignoreCase ? property.name.text.toLowerCase() : property.name.text;
- // comparison with undefined is expected
- if (lastKey > key) {
- ctx.addFailureAtNode(property.name, Rule.FAILURE_STRING_FACTORY(property.name.text));
- break outer; // only show warning on first out-of-order property
- }
- lastKey = key;
+function parseOptions(ruleArguments) {
+ return {
+ ignoreCase: has(OPTION_IGNORE_CASE),
+ matchDeclarationOrder: has(OPTION_MATCH_DECLARATION_ORDER),
+ };
+ 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;
+ ts.forEachChild(sourceFile, function cb(node) {
+ if (tsutils_1.isObjectLiteralExpression(node) && node.properties.length > 1) {
+ check(node);
+ }
+ ts.forEachChild(node, cb);
+ });
+ function check(node) {
+ if (matchDeclarationOrder) {
+ var type = getContextualType(node, checker);
+ // If type has an index signature, we can't check ordering.
+ // If type has call/construct signatures, it can't be satisfied by an object literal anyway.
+ if (type !== undefined
+ && type.members.every(function (m) { return m.kind === ts.SyntaxKind.PropertySignature || m.kind === ts.SyntaxKind.MethodSignature; })) {
+ checkMatchesDeclarationOrder(node, type, type.members);
+ return;
+ }
+ }
+ checkAlphabetical(node);
+ }
+ function checkAlphabetical(node) {
+ if (tsutils_1.isSameLine(ctx.sourceFile, node.properties.pos, node.end)) {
+ return;
+ }
+ var lastKey;
+ for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
+ var property = _a[_i];
+ switch (property.kind) {
+ case ts.SyntaxKind.SpreadAssignment:
+ lastKey = undefined; // reset at spread
+ break;
+ case ts.SyntaxKind.ShorthandPropertyAssignment:
+ case ts.SyntaxKind.PropertyAssignment:
+ if (property.name.kind === ts.SyntaxKind.Identifier ||
+ property.name.kind === ts.SyntaxKind.StringLiteral) {
+ var key = ignoreCase ? property.name.text.toLowerCase() : property.name.text;
+ // comparison with undefined is expected
+ if (lastKey > key) {
+ ctx.addFailureAtNode(property.name, Rule.FAILURE_STRING_ALPHABETICAL(property.name.text));
+ return; // only show warning on first out-of-order property
}
+ lastKey = key;
+ }
+ }
+ }
+ }
+ function checkMatchesDeclarationOrder(_a, type, members) {
+ var properties = _a.properties;
+ var memberIndex = 0;
+ outer: for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
+ var prop = properties_1[_i];
+ if (prop.kind === ts.SyntaxKind.SpreadAssignment) {
+ memberIndex = 0;
+ continue;
+ }
+ if (prop.name.kind === ts.SyntaxKind.ComputedPropertyName) {
+ continue;
+ }
+ var propName = prop.name.text;
+ for (; memberIndex !== members.length; memberIndex++) {
+ var memberName = members[memberIndex].name;
+ if (memberName.kind !== ts.SyntaxKind.ComputedPropertyName && propName === memberName.text) {
+ continue outer; // tslint:disable-line no-unsafe-any (fixed in tslint 5.4)
}
}
+ // This We didn't find the member we were looking for past the previous member,
+ // so it must have come before it and is therefore out of order.
+ ctx.addFailureAtNode(prop.name, Rule.FAILURE_STRING_USE_DECLARATION_ORDER(propName, getTypeName(type)));
+ // Don't bother with multiple errors.
+ break;
}
- return ts.forEachChild(node, cb);
- });
+ }
+}
+function getTypeName(t) {
+ var parent = t.parent;
+ return t.kind === ts.SyntaxKind.InterfaceDeclaration
+ ? t.name.text
+ : tsutils_1.isTypeAliasDeclaration(parent)
+ ? parent.name.text
+ : undefined;
+}
+function getContextualType(node, checker) {
+ var c = checker.getContextualType(node);
+ if (c === undefined || c.symbol === undefined) {
+ return undefined;
+ }
+ var declarations = c.symbol.declarations;
+ if (declarations === undefined || declarations.length !== 1) {
+ return undefined;
+ }
+ var decl = declarations[0];
+ return tsutils_1.isInterfaceDeclaration(decl) || tsutils_1.isTypeLiteralNode(decl) ? decl : undefined;
}
+var _a;
diff --git a/node_modules/tslint/lib/rules/oneLineRule.js b/node_modules/tslint/lib/rules/oneLineRule.js
index 08d1ef212..dcbd2169d 100644
--- a/node_modules/tslint/lib/rules/oneLineRule.js
+++ b/node_modules/tslint/lib/rules/oneLineRule.js
@@ -25,7 +25,7 @@ var OPTION_CATCH = "check-catch";
var OPTION_ELSE = "check-else";
var OPTION_FINALLY = "check-finally";
var OPTION_WHITESPACE = "check-whitespace";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -61,7 +61,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var OneLineWalker = (function (_super) {
+var OneLineWalker = /** @class */ (function (_super) {
tslib_1.__extends(OneLineWalker, _super);
function OneLineWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
index dc741a54e..42ee49cac 100644
--- a/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
+++ b/node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_IGNORE_FOR_LOOP = "ignore-for-loop";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
index 3d59a921c..36239c5b8 100644
--- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
+++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_DECLARATIONS = "allow-declarations";
var OPTION_ALLOW_NAMED_FUNCTIONS = "allow-named-functions";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/orderedImportsRule.js b/node_modules/tslint/lib/rules/orderedImportsRule.js
index 9190d6860..c40d197b1 100644
--- a/node_modules/tslint/lib/rules/orderedImportsRule.js
+++ b/node_modules/tslint/lib/rules/orderedImportsRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -76,7 +76,7 @@ function parseOptions(ruleArguments) {
namedImportsOrderTransform: TRANSFORMS.get(named),
};
}
-var Walker = (function (_super) {
+var Walker = /** @class */ (function (_super) {
tslib_1.__extends(Walker, _super);
function Walker() {
var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -177,7 +177,7 @@ var Walker = (function (_super) {
};
return Walker;
}(Lint.AbstractWalker));
-var ImportsBlock = (function () {
+var ImportsBlock = /** @class */ (function () {
function ImportsBlock() {
this.importDeclarations = [];
}
diff --git a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
index b8f8693df..a6f7f173c 100644
--- a/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
+++ b/node_modules/tslint/lib/rules/preferConditionalExpressionRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_CHECK_ELSE_IF = "check-else-if";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/preferConstRule.js b/node_modules/tslint/lib/rules/preferConstRule.js
index 1efc5b1e0..6bb1a3cd0 100644
--- a/node_modules/tslint/lib/rules/preferConstRule.js
+++ b/node_modules/tslint/lib/rules/preferConstRule.js
@@ -22,7 +22,7 @@ var Lint = require("../index");
var utils = require("tsutils");
var OPTION_DESTRUCTURING_ALL = "all";
var OPTION_DESTRUCTURING_ANY = "any";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -64,7 +64,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var Scope = (function () {
+var Scope = /** @class */ (function () {
function Scope(functionScope) {
this.variables = new Map();
this.reassigned = new Set();
@@ -83,7 +83,7 @@ var Scope = (function () {
};
return Scope;
}());
-var PreferConstWalker = (function (_super) {
+var PreferConstWalker = /** @class */ (function (_super) {
tslib_1.__extends(PreferConstWalker, _super);
function PreferConstWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -137,10 +137,12 @@ var PreferConstWalker = (function (_super) {
_this.handleVariableDeclaration(node);
}
else if (node.kind === ts.SyntaxKind.CatchClause) {
- _this.handleBindingName(node.variableDeclaration.name, {
- canBeConst: false,
- isBlockScoped: true,
- });
+ if (node.variableDeclaration !== undefined) {
+ _this.handleBindingName(node.variableDeclaration.name, {
+ canBeConst: false,
+ isBlockScoped: true,
+ });
+ }
}
else if (node.kind === ts.SyntaxKind.Parameter) {
_this.handleBindingName(node.name, {
diff --git a/node_modules/tslint/lib/rules/preferForOfRule.js b/node_modules/tslint/lib/rules/preferForOfRule.js
index f0fb70d89..a738d3774 100644
--- a/node_modules/tslint/lib/rules/preferForOfRule.js
+++ b/node_modules/tslint/lib/rules/preferForOfRule.js
@@ -21,7 +21,7 @@ var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../language/utils");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -65,8 +65,8 @@ function walk(ctx) {
}
for (var _i = 0, _a = variables.get(indexVariable).uses; _i < _a.length; _i++) {
var location = _a[_i].location;
- if (location.pos < node.initializer.end || location.pos >= node.end ||
- location.pos >= node.statement.pos &&
+ if (location.pos < node.initializer.end || location.pos >= node.end || // bail out on use outside of for loop
+ location.pos >= node.statement.pos && // only check uses in loop body
isNonSimpleIncrementorUse(location, arrayExpr, sourceFile)) {
return;
}
@@ -78,7 +78,9 @@ function isNonSimpleIncrementorUse(node, arrayExpr, sourceFile) {
// check if iterator is used for something other than reading data from array
var parent = node.parent;
return !utils.isElementAccessExpression(parent)
+ // `a[i] = ...` or similar
|| utils.isReassignmentTarget(parent)
+ // `b[i]`
|| !nodeEquals(arrayExpr, utils_1.unwrapParentheses(parent.expression), sourceFile);
}
function nodeEquals(a, b, sourceFile) {
diff --git a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
index 83daf2363..9f145cef6 100644
--- a/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
+++ b/node_modules/tslint/lib/rules/preferFunctionOverMethodRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_PUBLIC = "allow-public";
var OPTION_ALLOW_PROTECTED = "allow-protected";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -54,7 +54,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var PreferFunctionOverMethodWalker = (function (_super) {
+var PreferFunctionOverMethodWalker = /** @class */ (function (_super) {
tslib_1.__extends(PreferFunctionOverMethodWalker, _super);
function PreferFunctionOverMethodWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -93,7 +93,7 @@ var PreferFunctionOverMethodWalker = (function (_super) {
};
PreferFunctionOverMethodWalker.prototype.isExempt = function (node) {
// TODO: handle the override keyword once it lands in the language
- return node.body === undefined ||
+ return node.body === undefined || // exclude abstract methods and overload signatures
// exclude object methods
node.parent.kind !== ts.SyntaxKind.ClassDeclaration && node.parent.kind !== ts.SyntaxKind.ClassExpression ||
tsutils_1.hasModifier(node.modifiers, ts.SyntaxKind.StaticKeyword) ||
diff --git a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
index 1eb800069..a3fe1e9be 100644
--- a/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
+++ b/node_modules/tslint/lib/rules/preferMethodSignatureRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/preferObjectSpreadRule.js b/node_modules/tslint/lib/rules/preferObjectSpreadRule.js
index c835ed693..8cd5005be 100644
--- a/node_modules/tslint/lib/rules/preferObjectSpreadRule.js
+++ b/node_modules/tslint/lib/rules/preferObjectSpreadRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -53,7 +53,14 @@ function walk(ctx) {
tsutils_1.isIdentifier(node.expression.expression) && node.expression.expression.text === "Object" &&
!ts.isFunctionLike(node.arguments[0]) &&
// Object.assign(...someArray) cannot be written as object spread
- !node.arguments.some(tsutils_1.isSpreadElement)) {
+ !node.arguments.some(tsutils_1.isSpreadElement) &&
+ /**
+ * @TODO
+ * Remove !node.arguments.some(isThisKeyword) when typescript get's
+ * support for spread types.
+ * PR: https://github.com/Microsoft/TypeScript/issues/10727
+ */
+ !node.arguments.some(isThisKeyword)) {
if (node.arguments[0].kind === ts.SyntaxKind.ObjectLiteralExpression) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING, createFix(node, ctx.sourceFile));
}
@@ -103,6 +110,9 @@ function createFix(node, sourceFile) {
}
return fix;
}
+function isThisKeyword(node) {
+ return node.kind === ts.SyntaxKind.ThisKeyword;
+}
function needsParens(node) {
switch (node.kind) {
case ts.SyntaxKind.ConditionalExpression:
diff --git a/node_modules/tslint/lib/rules/preferSwitchRule.js b/node_modules/tslint/lib/rules/preferSwitchRule.js
index feac8dd80..f9afd3650 100644
--- a/node_modules/tslint/lib/rules/preferSwitchRule.js
+++ b/node_modules/tslint/lib/rules/preferSwitchRule.js
@@ -21,7 +21,7 @@ var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_MIN_CASES = "min-cases";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/preferTemplateRule.js b/node_modules/tslint/lib/rules/preferTemplateRule.js
index 66eed83b7..5255a5f37 100644
--- a/node_modules/tslint/lib/rules/preferTemplateRule.js
+++ b/node_modules/tslint/lib/rules/preferTemplateRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_SINGLE_CONCAT = "allow-single-concat";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -31,7 +31,7 @@ var Rule = (function (_super) {
return []; // Not possible in a declaration file
}
var allowSingleConcat = this.ruleArguments.indexOf(OPTION_SINGLE_CONCAT) !== -1;
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, allowSingleConcat); });
+ return this.applyWithFunction(sourceFile, walk, { allowSingleConcat: allowSingleConcat });
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -52,7 +52,8 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-function walk(ctx, allowSingleConcat) {
+function walk(ctx) {
+ var allowSingleConcat = ctx.options.allowSingleConcat;
return ts.forEachChild(ctx.sourceFile, function cb(node) {
var failure = getError(node, allowSingleConcat);
if (failure !== undefined) {
diff --git a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
index 62f5f0957..aa6f8163e 100644
--- a/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
+++ b/node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js
@@ -20,13 +20,13 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.d.ts b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
index 2a96c3409..a79a13730 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.d.ts
+++ b/node_modules/tslint/lib/rules/quotemarkRule.d.ts
@@ -3,6 +3,5 @@ import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
static FAILURE_STRING(actual: string, expected: string): string;
- isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/quotemarkRule.js b/node_modules/tslint/lib/rules/quotemarkRule.js
index 1f1a76b4c..19586069a 100644
--- a/node_modules/tslint/lib/rules/quotemarkRule.js
+++ b/node_modules/tslint/lib/rules/quotemarkRule.js
@@ -19,7 +19,6 @@ 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");
var OPTION_SINGLE = "single";
var OPTION_DOUBLE = "double";
@@ -27,7 +26,7 @@ var OPTION_JSX_SINGLE = "jsx-single";
var OPTION_JSX_DOUBLE = "jsx-double";
var OPTION_AVOID_TEMPLATE = "avoid-template";
var OPTION_AVOID_ESCAPE = "avoid-escape";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -36,18 +35,9 @@ var Rule = (function (_super) {
Rule.FAILURE_STRING = function (actual, expected) {
return actual + " should be " + expected;
};
- Rule.prototype.isEnabled = function () {
- return _super.prototype.isEnabled.call(this) && (this.ruleArguments[0] === OPTION_SINGLE || this.ruleArguments[0] === OPTION_DOUBLE);
- };
Rule.prototype.apply = function (sourceFile) {
var args = this.ruleArguments;
- if (args.length > 0) {
- if (args[0] !== OPTION_SINGLE && args[0] !== OPTION_DOUBLE) {
- error_1.showWarningOnce("Warning: First argument to 'quotemark' rule should be \"" + OPTION_SINGLE + "\" or \"" + OPTION_DOUBLE + "\"");
- return [];
- }
- }
- var quoteMark = args[0] === OPTION_SINGLE ? "'" : '"';
+ var quoteMark = getQuotemarkPreference(args) === OPTION_SINGLE ? "'" : '"';
return this.applyWithFunction(sourceFile, walk, {
avoidEscape: hasArg(OPTION_AVOID_ESCAPE),
avoidTemplate: hasArg(OPTION_AVOID_TEMPLATE),
@@ -68,7 +58,7 @@ var Rule = (function (_super) {
type: "array",
items: {
type: "string",
- enum: [OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_ESCAPE],
+ enum: [OPTION_SINGLE, OPTION_DOUBLE, OPTION_JSX_SINGLE, OPTION_JSX_DOUBLE, OPTION_AVOID_ESCAPE, OPTION_AVOID_TEMPLATE],
},
minLength: 0,
maxLength: 5,
@@ -119,4 +109,13 @@ function walk(ctx) {
ts.forEachChild(node, cb);
});
}
+function getQuotemarkPreference(args) {
+ for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
+ var arg = args_1[_i];
+ if (arg === OPTION_SINGLE || arg === OPTION_DOUBLE) {
+ return arg;
+ }
+ }
+ return undefined;
+}
var _a;
diff --git a/node_modules/tslint/lib/rules/radixRule.js b/node_modules/tslint/lib/rules/radixRule.js
index 63907bec5..3d1f695de 100644
--- a/node_modules/tslint/lib/rules/radixRule.js
+++ b/node_modules/tslint/lib/rules/radixRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
index 930ce2892..1974ce47a 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
@@ -20,13 +20,13 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -44,10 +44,9 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-function walk(ctx, program) {
+function walk(ctx, tc) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.PlusToken) {
- var tc = program.getTypeChecker();
var leftType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.left));
var rightType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.right));
if (leftType === "invalid" || rightType === "invalid" || leftType !== rightType) {
diff --git a/node_modules/tslint/lib/rules/returnUndefinedRule.js b/node_modules/tslint/lib/rules/returnUndefinedRule.js
index 8a5509cf5..7cc14c04e 100644
--- a/node_modules/tslint/lib/rules/returnUndefinedRule.js
+++ b/node_modules/tslint/lib/rules/returnUndefinedRule.js
@@ -20,13 +20,13 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/semicolonRule.js b/node_modules/tslint/lib/rules/semicolonRule.js
index 13e3b53f2..a6e0dfb85 100644
--- a/node_modules/tslint/lib/rules/semicolonRule.js
+++ b/node_modules/tslint/lib/rules/semicolonRule.js
@@ -24,7 +24,7 @@ var OPTION_ALWAYS = "always";
var OPTION_NEVER = "never";
var OPTION_IGNORE_BOUND_CLASS_METHODS = "ignore-bound-class-methods";
var OPTION_IGNORE_INTERFACES = "ignore-interfaces";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -73,7 +73,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var SemicolonWalker = (function (_super) {
+var SemicolonWalker = /** @class */ (function (_super) {
tslib_1.__extends(SemicolonWalker, _super);
function SemicolonWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -173,7 +173,7 @@ var SemicolonWalker = (function (_super) {
};
return SemicolonWalker;
}(Lint.AbstractWalker));
-var SemicolonAlwaysWalker = (function (_super) {
+var SemicolonAlwaysWalker = /** @class */ (function (_super) {
tslib_1.__extends(SemicolonAlwaysWalker, _super);
function SemicolonAlwaysWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -237,7 +237,7 @@ var SemicolonAlwaysWalker = (function (_super) {
};
return SemicolonAlwaysWalker;
}(SemicolonWalker));
-var SemicolonNeverWalker = (function (_super) {
+var SemicolonNeverWalker = /** @class */ (function (_super) {
tslib_1.__extends(SemicolonNeverWalker, _super);
function SemicolonNeverWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
index 5188eee1b..712868566 100644
--- a/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
+++ b/node_modules/tslint/lib/rules/spaceBeforeFunctionParenRule.js
@@ -23,7 +23,7 @@ var ALWAYS_OR_NEVER = {
enum: ["always", "never"],
type: "string",
};
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/spaceWithinParensRule.js b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
index 1549239a6..55e7de0a9 100644
--- a/node_modules/tslint/lib/rules/spaceWithinParensRule.js
+++ b/node_modules/tslint/lib/rules/spaceWithinParensRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -66,7 +66,7 @@ function parseOptions(whitespaceSize) {
size: size,
};
}
-var SpaceWithinParensWalker = (function (_super) {
+var SpaceWithinParensWalker = /** @class */ (function (_super) {
tslib_1.__extends(SpaceWithinParensWalker, _super);
function SpaceWithinParensWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
index 0d1851179..5cc1e4b39 100644
--- a/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
+++ b/node_modules/tslint/lib/rules/strictBooleanExpressionsRule.js
@@ -26,14 +26,14 @@ var OPTION_ALLOW_NUMBER = "allow-number";
var OPTION_ALLOW_MIX = "allow-mix";
var OPTION_ALLOW_BOOLEAN_OR_UNDEFINED = "allow-boolean-or-undefined";
// tslint:disable object-literal-sort-keys switch-default
-var Rule = (function (_super) {
+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) {
var options = parseOptions(this.ruleArguments, Lint.isStrictNullChecksEnabled(program.getCompilerOptions()));
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); }, options);
+ return this.applyWithFunction(sourceFile, walk, options, program.getTypeChecker());
};
Rule.metadata = {
ruleName: "strict-boolean-expressions",
diff --git a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
index 26307b972..526116dd3 100644
--- a/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
+++ b/node_modules/tslint/lib/rules/strictTypePredicatesRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var error_1 = require("../error");
var Lint = require("../index");
// tslint:disable:no-bitwise
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -38,7 +38,7 @@ var Rule = (function (_super) {
error_1.showWarningOnce("strict-type-predicates does not work without --strictNullChecks");
return [];
}
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/switchDefaultRule.js b/node_modules/tslint/lib/rules/switchDefaultRule.js
index 5173ae400..0fc7d1aa6 100644
--- a/node_modules/tslint/lib/rules/switchDefaultRule.js
+++ b/node_modules/tslint/lib/rules/switchDefaultRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/switchFinalBreakRule.js b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
index ed5bcc4a7..d2477edab 100644
--- a/node_modules/tslint/lib/rules/switchFinalBreakRule.js
+++ b/node_modules/tslint/lib/rules/switchFinalBreakRule.js
@@ -21,7 +21,7 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALWAYS = "always";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/trailingCommaRule.js b/node_modules/tslint/lib/rules/trailingCommaRule.js
index 09003f90c..e183e4ea4 100644
--- a/node_modules/tslint/lib/rules/trailingCommaRule.js
+++ b/node_modules/tslint/lib/rules/trailingCommaRule.js
@@ -54,7 +54,7 @@ var metadataOptionShape = {
],
};
/* tslint:enable:object-literal-sort-keys */
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -103,7 +103,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var TrailingCommaWalker = (function (_super) {
+var TrailingCommaWalker = /** @class */ (function (_super) {
tslib_1.__extends(TrailingCommaWalker, _super);
function TrailingCommaWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/tripleEqualsRule.js b/node_modules/tslint/lib/rules/tripleEqualsRule.js
index c93c522e2..7b4490807 100644
--- a/node_modules/tslint/lib/rules/tripleEqualsRule.js
+++ b/node_modules/tslint/lib/rules/tripleEqualsRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var OPTION_ALLOW_NULL_CHECK = "allow-null-check";
var OPTION_ALLOW_UNDEFINED_CHECK = "allow-undefined-check";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
index 06c33b0d1..691ecffc5 100644
--- a/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
+++ b/node_modules/tslint/lib/rules/typeLiteralDelimiterRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/typedefRule.d.ts b/node_modules/tslint/lib/rules/typedefRule.d.ts
index 180453e09..6c60fe1ce 100644
--- a/node_modules/tslint/lib/rules/typedefRule.d.ts
+++ b/node_modules/tslint/lib/rules/typedefRule.d.ts
@@ -4,3 +4,4 @@ export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
+export declare function isNodeArray(nodeOrArray: ts.Node | ts.NodeArray<ts.Node>): nodeOrArray is ts.NodeArray<ts.Node>;
diff --git a/node_modules/tslint/lib/rules/typedefRule.js b/node_modules/tslint/lib/rules/typedefRule.js
index 14789d48e..76022abd9 100644
--- a/node_modules/tslint/lib/rules/typedefRule.js
+++ b/node_modules/tslint/lib/rules/typedefRule.js
@@ -37,7 +37,7 @@ function parseOptions(ruleArguments) {
}
return options;
}
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -77,7 +77,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var TypedefWalker = (function (_super) {
+var TypedefWalker = /** @class */ (function (_super) {
tslib_1.__extends(TypedefWalker, _super);
function TypedefWalker() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -176,7 +176,7 @@ var TypedefWalker = (function (_super) {
TypedefWalker.prototype.checkTypeAnnotation = function (option, location, typeAnnotation, name) {
if (this.options[option] === true && typeAnnotation === undefined) {
var failure = "expected " + option + (name === undefined ? "" : ": '" + name.getText() + "'") + " to have a typedef";
- if (Array.isArray(location)) {
+ if (isNodeArray(location)) {
this.addFailure(location.pos - 1, location.end + 1, failure);
}
else {
@@ -189,4 +189,8 @@ var TypedefWalker = (function (_super) {
function isTypedPropertyDeclaration(node) {
return utils.isPropertyDeclaration(node) && node.type !== undefined;
}
+function isNodeArray(nodeOrArray) {
+ return Array.isArray(nodeOrArray);
+}
+exports.isNodeArray = isNodeArray;
var _a;
diff --git a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
index e6e14aeec..04d58629e 100644
--- a/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
+++ b/node_modules/tslint/lib/rules/typedefWhitespaceRule.js
@@ -36,7 +36,7 @@ var SPACE_OBJECT = {
},
additionalProperties: false,
};
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -89,7 +89,7 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
-var TypedefWhitespaceWalker = (function (_super) {
+var TypedefWhitespaceWalker = /** @class */ (function (_super) {
tslib_1.__extends(TypedefWhitespaceWalker, _super);
function TypedefWhitespaceWalker() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/typeofCompareRule.js b/node_modules/tslint/lib/rules/typeofCompareRule.js
index 3aee80cf1..7734d9afd 100644
--- a/node_modules/tslint/lib/rules/typeofCompareRule.js
+++ b/node_modules/tslint/lib/rules/typeofCompareRule.js
@@ -21,7 +21,7 @@ var tsutils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var LEGAL_TYPEOF_RESULTS = new Set(["undefined", "string", "boolean", "number", "function", "object", "symbol"]);
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/unifiedSignaturesRule.js b/node_modules/tslint/lib/rules/unifiedSignaturesRule.js
index 771ef1604..c0f8f0d2e 100644
--- a/node_modules/tslint/lib/rules/unifiedSignaturesRule.js
+++ b/node_modules/tslint/lib/rules/unifiedSignaturesRule.js
@@ -22,7 +22,7 @@ var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
var adjacentOverloadSignaturesRule_1 = require("./adjacentOverloadSignaturesRule");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
index 5d32087fc..5036e75e2 100644
--- a/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
+++ b/node_modules/tslint/lib/rules/useDefaultTypeParameterRule.js
@@ -21,13 +21,13 @@ var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var utils_1 = require("../utils");
-var Rule = (function (_super) {
+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, function (ctx) { return walk(ctx, program.getTypeChecker()); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
diff --git a/node_modules/tslint/lib/rules/useIsnanRule.js b/node_modules/tslint/lib/rules/useIsnanRule.js
index 343088e97..bbb845580 100644
--- a/node_modules/tslint/lib/rules/useIsnanRule.js
+++ b/node_modules/tslint/lib/rules/useIsnanRule.js
@@ -20,7 +20,7 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/variableNameRule.js b/node_modules/tslint/lib/rules/variableNameRule.js
index 7e0af2daa..b095c75a8 100644
--- a/node_modules/tslint/lib/rules/variableNameRule.js
+++ b/node_modules/tslint/lib/rules/variableNameRule.js
@@ -30,7 +30,7 @@ var OPTION_BAN_KEYWORDS = "ban-keywords";
var OPTION_CHECK_FORMAT = "check-format";
var OPTION_ALLOW_PASCAL_CASE = "allow-pascal-case";
var OPTION_ALLOW_SNAKE_CASE = "allow-snake-case";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.d.ts b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
index cce59d100..d35e1e5ad 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.d.ts
+++ b/node_modules/tslint/lib/rules/whitespaceRule.d.ts
@@ -2,6 +2,7 @@ import * as ts from "typescript";
import * as Lint from "../index";
export declare class Rule extends Lint.Rules.AbstractRule {
static metadata: Lint.IRuleMetadata;
- static FAILURE_STRING: string;
+ static FAILURE_STRING_MISSING: string;
+ static FAILURE_STRING_INVALID: string;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[];
}
diff --git a/node_modules/tslint/lib/rules/whitespaceRule.js b/node_modules/tslint/lib/rules/whitespaceRule.js
index 4829fa623..67a8bdfb9 100644
--- a/node_modules/tslint/lib/rules/whitespaceRule.js
+++ b/node_modules/tslint/lib/rules/whitespaceRule.js
@@ -26,10 +26,12 @@ var OPTION_DECL = "check-decl";
var OPTION_OPERATOR = "check-operator";
var OPTION_MODULE = "check-module";
var OPTION_SEPARATOR = "check-separator";
+var OPTION_REST_SPREAD = "check-rest-spread";
var OPTION_TYPE = "check-type";
var OPTION_TYPECAST = "check-typecast";
+var OPTION_TYPE_OPERATOR = "check-type-operator";
var OPTION_PREBLOCK = "check-preblock";
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
@@ -41,22 +43,25 @@ var Rule = (function (_super) {
ruleName: "whitespace",
description: "Enforces whitespace style conventions.",
rationale: "Helps maintain a readable, consistent style in your codebase.",
- optionsDescription: (_a = ["\n Eight arguments may be optionally provided:\n\n * `\"check-branch\"` checks branching statements (`if`/`else`/`for`/`while`) are followed by whitespace.\n * `\"check-decl\"`checks that variable declarations have whitespace around the equals token.\n * `\"check-operator\"` checks for whitespace around operator tokens.\n * `\"check-module\"` checks for whitespace in import & export statements.\n * `\"check-separator\"` checks for whitespace after separator tokens (`,`/`;`).\n * `\"check-type\"` checks for whitespace before a variable type specification.\n * `\"check-typecast\"` checks for whitespace between a typecast and its target.\n * `\"check-preblock\"` checks for whitespace before the opening brace of a block"], _a.raw = ["\n Eight arguments may be optionally provided:\n\n * \\`\"check-branch\"\\` checks branching statements (\\`if\\`/\\`else\\`/\\`for\\`/\\`while\\`) are followed by whitespace.\n * \\`\"check-decl\"\\`checks that variable declarations have whitespace around the equals token.\n * \\`\"check-operator\"\\` checks for whitespace around operator tokens.\n * \\`\"check-module\"\\` checks for whitespace in import & export statements.\n * \\`\"check-separator\"\\` checks for whitespace after separator tokens (\\`,\\`/\\`;\\`).\n * \\`\"check-type\"\\` checks for whitespace before a variable type specification.\n * \\`\"check-typecast\"\\` checks for whitespace between a typecast and its target.\n * \\`\"check-preblock\"\\` checks for whitespace before the opening brace of a block"], Lint.Utils.dedent(_a)),
+ 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)),
options: {
type: "array",
items: {
type: "string",
- enum: ["check-branch", "check-decl", "check-operator", "check-module",
- "check-separator", "check-type", "check-typecast", "check-preblock"],
+ enum: [
+ "check-branch", "check-decl", "check-operator", "check-module", "check-separator",
+ "check-rest-spread", "check-type", "check-typecast", "check-type-operator", "check-preblock",
+ ],
},
minLength: 0,
- maxLength: 7,
+ maxLength: 10,
},
optionExamples: [[true, "check-branch", "check-operator", "check-typecast"]],
type: "style",
typescriptOnly: false,
};
- Rule.FAILURE_STRING = "missing whitespace";
+ Rule.FAILURE_STRING_MISSING = "missing whitespace";
+ Rule.FAILURE_STRING_INVALID = "invalid whitespace";
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
@@ -67,8 +72,10 @@ function parseOptions(ruleArguments) {
operator: has(OPTION_OPERATOR),
module: has(OPTION_MODULE),
separator: has(OPTION_SEPARATOR),
+ restSpread: has(OPTION_REST_SPREAD),
type: has(OPTION_TYPE),
typecast: has(OPTION_TYPECAST),
+ typeOperator: has(OPTION_TYPE_OPERATOR),
preblock: has(OPTION_PREBLOCK),
};
function has(option) {
@@ -169,6 +176,34 @@ function walk(ctx) {
if (options.decl && initializer !== undefined) {
checkForTrailingWhitespace((type !== undefined ? type : name).getEnd());
}
+ break;
+ case ts.SyntaxKind.BindingElement:
+ case ts.SyntaxKind.Parameter:
+ var dotDotDotToken = node.dotDotDotToken;
+ if (options.restSpread && dotDotDotToken !== undefined) {
+ checkForExcessiveWhitespace(dotDotDotToken.end);
+ }
+ break;
+ case ts.SyntaxKind.SpreadAssignment:
+ case ts.SyntaxKind.SpreadElement:
+ if (options.restSpread) {
+ var position = node.expression.getFullStart();
+ checkForExcessiveWhitespace(position);
+ }
+ break;
+ case ts.SyntaxKind.UnionType:
+ case ts.SyntaxKind.IntersectionType:
+ if (options.typeOperator) {
+ var types_1 = node.types;
+ types_1.forEach(function (typeNode, index) {
+ if (index > 0) {
+ checkForTrailingWhitespace(typeNode.getFullStart());
+ }
+ if (index < types_1.length - 1) {
+ checkForTrailingWhitespace(typeNode.getEnd());
+ }
+ });
+ }
}
ts.forEachChild(node, cb);
});
@@ -197,11 +232,22 @@ function walk(ctx) {
}
break;
case ts.SyntaxKind.CommaToken:
- case ts.SyntaxKind.SemicolonToken:
if (options.separator) {
prevTokenShouldBeFollowedByWhitespace = true;
}
break;
+ case ts.SyntaxKind.SemicolonToken:
+ if (!options.separator) {
+ break;
+ }
+ var nextPosition = range.pos + 1;
+ var semicolonInTrivialFor = parent.kind === ts.SyntaxKind.ForStatement &&
+ nextPosition !== sourceFile.end &&
+ (sourceFile.text[nextPosition] === ";" || sourceFile.text[nextPosition] === ")");
+ if (!semicolonInTrivialFor) {
+ prevTokenShouldBeFollowedByWhitespace = true;
+ }
+ break;
case ts.SyntaxKind.EqualsToken:
if (options.decl && parent.kind !== ts.SyntaxKind.JsxAttribute) {
prevTokenShouldBeFollowedByWhitespace = true;
@@ -249,7 +295,16 @@ function walk(ctx) {
return;
}
var fix = Lint.Replacement.appendText(position, " ");
- ctx.addFailureAt(position, 1, Rule.FAILURE_STRING, fix);
+ ctx.addFailureAt(position, 1, Rule.FAILURE_STRING_MISSING, fix);
+ }
+ function checkForExcessiveWhitespace(position) {
+ if (position !== sourceFile.end && Lint.isWhiteSpace(sourceFile.text.charCodeAt(position))) {
+ addInvalidWhitespaceErrorAt(position);
+ }
+ }
+ function addInvalidWhitespaceErrorAt(position) {
+ var fix = Lint.Replacement.deleteText(position, 1);
+ ctx.addFailureAt(position, 1, Rule.FAILURE_STRING_INVALID, fix);
}
}
var _a;
diff --git a/node_modules/tslint/lib/runner.js b/node_modules/tslint/lib/runner.js
index 0bcf5b9ed..d8d138a7f 100644
--- a/node_modules/tslint/lib/runner.js
+++ b/node_modules/tslint/lib/runner.js
@@ -26,7 +26,6 @@ var ts = require("typescript");
var configuration_1 = require("./configuration");
var error_1 = require("./error");
var Linter = require("./linter");
-var test_1 = require("./test");
var utils_1 = require("./utils");
function run(options, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -52,7 +51,7 @@ function run(options, logger) {
exports.run = run;
function runWorker(options, logger) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
- var results, _a, output, errorCount;
+ var test_1, results, _a, output, errorCount;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@@ -63,17 +62,22 @@ function runWorker(options, logger) {
fs.writeFileSync(configuration_1.CONFIG_FILENAME, JSON.stringify(configuration_1.DEFAULT_CONFIG, undefined, " "));
return [2 /*return*/, 0 /* Ok */];
}
- if (options.test) {
- results = test_1.runTests((options.files || []).map(trimSingleQuotes), options.rulesDirectory);
- return [2 /*return*/, test_1.consoleTestResultsHandler(results) ? 0 /* Ok */ : 1 /* FatalError */];
- }
+ if (!options.test) return [3 /*break*/, 2];
+ return [4 /*yield*/, Promise.resolve().then(function () { return require("./test"); })];
+ case 1:
+ test_1 = _b.sent();
+ results = test_1.runTests((options.files || []).map(trimSingleQuotes), options.rulesDirectory);
+ return [2 /*return*/, test_1.consoleTestResultsHandler(results) ? 0 /* Ok */ : 1 /* FatalError */];
+ case 2:
if (options.config && !fs.existsSync(options.config)) {
throw new error_1.FatalError("Invalid option for configuration: " + options.config);
}
return [4 /*yield*/, runLinter(options, logger)];
- case 1:
+ case 3:
_a = _b.sent(), output = _a.output, errorCount = _a.errorCount;
- logger.log(output);
+ if (output && output.trim()) {
+ logger.log(output);
+ }
return [2 /*return*/, options.force || errorCount === 0 ? 0 /* Ok */ : 2 /* LintError */];
}
});
diff --git a/node_modules/tslint/lib/utils.d.ts b/node_modules/tslint/lib/utils.d.ts
index 09100398c..07f3bf5e5 100644
--- a/node_modules/tslint/lib/utils.d.ts
+++ b/node_modules/tslint/lib/utils.d.ts
@@ -52,7 +52,7 @@ export declare function find<T, U>(inputs: T[], getResult: (t: T) => U | undefin
/** Returns an array that is the concatenation of all output arrays. */
export declare function flatMap<T, U>(inputs: ReadonlyArray<T>, getOutputs: (input: T, index: number) => ReadonlyArray<U>): U[];
/** Returns an array of all outputs that are not `undefined`. */
-export declare function mapDefined<T, U>(inputs: T[], getOutput: (input: T) => U | undefined): U[];
+export declare function mapDefined<T, U>(inputs: ReadonlyArray<T>, getOutput: (input: T) => U | undefined): U[];
export declare function readBufferWithDetectedEncoding(buffer: Buffer): string;
export declare type Encoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
export declare function detectBufferEncoding(buffer: Buffer, length?: number): Encoding;
diff --git a/node_modules/tslint/lib/verify/lines.js b/node_modules/tslint/lib/verify/lines.js
index c95fd0f8a..3b15c0875 100644
--- a/node_modules/tslint/lib/verify/lines.js
+++ b/node_modules/tslint/lib/verify/lines.js
@@ -17,13 +17,13 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// Use classes here instead of interfaces because we want runtime type data
-var Line = (function () {
+var Line = /** @class */ (function () {
function Line() {
}
return Line;
}());
exports.Line = Line;
-var CodeLine = (function (_super) {
+var CodeLine = /** @class */ (function (_super) {
tslib_1.__extends(CodeLine, _super);
function CodeLine(contents) {
var _this = _super.call(this) || this;
@@ -33,7 +33,7 @@ var CodeLine = (function (_super) {
return CodeLine;
}(Line));
exports.CodeLine = CodeLine;
-var MessageSubstitutionLine = (function (_super) {
+var MessageSubstitutionLine = /** @class */ (function (_super) {
tslib_1.__extends(MessageSubstitutionLine, _super);
function MessageSubstitutionLine(key, message) {
var _this = _super.call(this) || this;
@@ -44,7 +44,7 @@ var MessageSubstitutionLine = (function (_super) {
return MessageSubstitutionLine;
}(Line));
exports.MessageSubstitutionLine = MessageSubstitutionLine;
-var ErrorLine = (function (_super) {
+var ErrorLine = /** @class */ (function (_super) {
tslib_1.__extends(ErrorLine, _super);
function ErrorLine(startCol) {
var _this = _super.call(this) || this;
@@ -54,7 +54,7 @@ var ErrorLine = (function (_super) {
return ErrorLine;
}(Line));
exports.ErrorLine = ErrorLine;
-var MultilineErrorLine = (function (_super) {
+var MultilineErrorLine = /** @class */ (function (_super) {
tslib_1.__extends(MultilineErrorLine, _super);
function MultilineErrorLine(startCol) {
return _super.call(this, startCol) || this;
@@ -62,7 +62,7 @@ var MultilineErrorLine = (function (_super) {
return MultilineErrorLine;
}(ErrorLine));
exports.MultilineErrorLine = MultilineErrorLine;
-var EndErrorLine = (function (_super) {
+var EndErrorLine = /** @class */ (function (_super) {
tslib_1.__extends(EndErrorLine, _super);
function EndErrorLine(startCol, endCol, message) {
var _this = _super.call(this, startCol) || this;
diff --git a/node_modules/tslint/package.json b/node_modules/tslint/package.json
index 5bf1e75a1..1031df0b2 100644
--- a/node_modules/tslint/package.json
+++ b/node_modules/tslint/package.json
@@ -1,6 +1,6 @@
{
"name": "tslint",
- "version": "5.6.0",
+ "version": "5.7.0",
"description": "An extensible static analysis linter for the TypeScript language",
"bin": {
"tslint": "./bin/tslint"
@@ -46,10 +46,10 @@
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.7.1",
- "tsutils": "^2.7.1"
+ "tsutils": "^2.8.1"
},
"peerDependencies": {
- "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev"
+ "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev"
},
"devDependencies": {
"@types/babel-code-frame": "^6.20.0",
@@ -72,9 +72,9 @@
"npm-run-all": "^4.0.2",
"nyc": "^10.2.0",
"rimraf": "^2.5.4",
- "tslint": "^5.5.0",
+ "tslint": "^5.6.0",
"tslint-test-config-non-relative": "file:test/external/tslint-test-config-non-relative",
- "typescript": "~2.4.1"
+ "typescript": "~2.5.1"
},
"license": "Apache-2.0",
"engines": {