Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f)

This commit is contained in:
anaarmas 2020-04-28 16:46:47 +02:00
commit 28ccc3db2d
13974 changed files with 2618436 additions and 0 deletions

View file

@ -0,0 +1,38 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { IOptions } from "../rule/rule";
import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";
/**
* @deprecated See comment on ScopeAwareRuleWalker.
*
* An AST walker that is aware of block scopes in addition to regular scopes. Block scopes
* are a superset of regular scopes (new block scopes are created more frequently in a program).
*/
export declare abstract class BlockScopeAwareRuleWalker<T, U> extends ScopeAwareRuleWalker<T> {
private readonly blockScopeStack;
constructor(sourceFile: ts.SourceFile, options: IOptions);
abstract createBlockScope(node: ts.Node): U;
getAllBlockScopes(): U[];
getCurrentBlockScope(): U;
getCurrentBlockDepth(): number;
onBlockScopeStart(): void;
onBlockScopeEnd(): void;
findBlockScope(predicate: (scope: U) => boolean): U | undefined;
protected visitNode(node: ts.Node): void;
private isBlockScopeBoundary;
}

View file

@ -0,0 +1,84 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var utils_1 = require("../utils");
var scopeAwareRuleWalker_1 = require("./scopeAwareRuleWalker");
// tslint:disable:deprecation (extends deprecated class and uses deprecated utils - doesn't matter because it's deprecated, too)
/**
* @deprecated See comment on ScopeAwareRuleWalker.
*
* 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 = /** @class */ (function (_super) {
tslib_1.__extends(BlockScopeAwareRuleWalker, _super);
function BlockScopeAwareRuleWalker(sourceFile, options) {
var _this = _super.call(this, sourceFile, options) || this;
// initialize with global scope if file is not a module
_this.blockScopeStack = ts.isExternalModule(sourceFile)
? []
: [_this.createBlockScope(sourceFile)];
return _this;
}
// get all block scopes available at this depth
BlockScopeAwareRuleWalker.prototype.getAllBlockScopes = function () {
return this.blockScopeStack;
};
BlockScopeAwareRuleWalker.prototype.getCurrentBlockScope = function () {
return this.blockScopeStack[this.blockScopeStack.length - 1];
};
BlockScopeAwareRuleWalker.prototype.getCurrentBlockDepth = function () {
return this.blockScopeStack.length;
};
// callback notifier when a block scope begins
BlockScopeAwareRuleWalker.prototype.onBlockScopeStart = function () {
return;
};
// callback notifier when a block scope ends
BlockScopeAwareRuleWalker.prototype.onBlockScopeEnd = function () {
return;
};
BlockScopeAwareRuleWalker.prototype.findBlockScope = function (predicate) {
// look through block scopes from local -> global
for (var i = this.blockScopeStack.length - 1; i >= 0; i--) {
if (predicate(this.blockScopeStack[i])) {
return this.blockScopeStack[i];
}
}
return undefined;
};
BlockScopeAwareRuleWalker.prototype.visitNode = function (node) {
var isNewBlockScope = this.isBlockScopeBoundary(node);
if (isNewBlockScope) {
this.blockScopeStack.push(this.createBlockScope(node));
this.onBlockScopeStart();
}
_super.prototype.visitNode.call(this, node);
if (isNewBlockScope) {
this.onBlockScopeEnd();
this.blockScopeStack.pop();
}
};
BlockScopeAwareRuleWalker.prototype.isBlockScopeBoundary = function (node) {
return utils_1.isBlockScopeBoundary(node);
};
return BlockScopeAwareRuleWalker;
}(scopeAwareRuleWalker_1.ScopeAwareRuleWalker));
exports.BlockScopeAwareRuleWalker = BlockScopeAwareRuleWalker;

23
node_modules/tslint/lib/language/walker/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,23 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from "./blockScopeAwareRuleWalker";
export * from "./programAwareRuleWalker";
export * from "./ruleWalker";
export * from "./scopeAwareRuleWalker";
export * from "./syntaxWalker";
export * from "./walkContext";
export * from "./walker";

26
node_modules/tslint/lib/language/walker/index.js generated vendored Normal file
View file

@ -0,0 +1,26 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./blockScopeAwareRuleWalker"), exports);
tslib_1.__exportStar(require("./programAwareRuleWalker"), exports);
tslib_1.__exportStar(require("./ruleWalker"), exports);
tslib_1.__exportStar(require("./scopeAwareRuleWalker"), exports);
tslib_1.__exportStar(require("./syntaxWalker"), exports);
tslib_1.__exportStar(require("./walkContext"), exports);
tslib_1.__exportStar(require("./walker"), exports);

View file

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { IOptions } from "../rule/rule";
import { RuleWalker } from "./ruleWalker";
/**
* @deprecated
* RuleWalker-based rules are slow,
* so it's generally preferable to use applyWithFunction instead of applyWithWalker.
* @see https://github.com/palantir/tslint/issues/2522
*/
export declare class ProgramAwareRuleWalker extends RuleWalker {
private readonly program;
private readonly typeChecker;
constructor(sourceFile: ts.SourceFile, options: IOptions, program: ts.Program);
getProgram(): ts.Program;
getTypeChecker(): ts.TypeChecker;
}

View file

@ -0,0 +1,44 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ruleWalker_1 = require("./ruleWalker");
/**
* @deprecated
* RuleWalker-based rules are slow,
* so it's generally preferable to use applyWithFunction instead of applyWithWalker.
* @see https://github.com/palantir/tslint/issues/2522
*/
// tslint:disable-next-line deprecation
var ProgramAwareRuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(ProgramAwareRuleWalker, _super);
function ProgramAwareRuleWalker(sourceFile, options, program) {
var _this = _super.call(this, sourceFile, options) || this;
_this.program = program;
_this.typeChecker = program.getTypeChecker();
return _this;
}
ProgramAwareRuleWalker.prototype.getProgram = function () {
return this.program;
};
ProgramAwareRuleWalker.prototype.getTypeChecker = function () {
return this.typeChecker;
};
return ProgramAwareRuleWalker;
}(ruleWalker_1.RuleWalker));
exports.ProgramAwareRuleWalker = ProgramAwareRuleWalker;

View file

@ -0,0 +1,55 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { Fix, IOptions, Replacement, RuleFailure } from "../rule/rule";
import { SyntaxWalker } from "./syntaxWalker";
import { IWalker } from "./walker";
/**
* @deprecated
* RuleWalker-based rules are slow,
* so it's generally preferable to use applyWithFunction instead of applyWithWalker.
* @see https://github.com/palantir/tslint/issues/2522
*/
export declare class RuleWalker extends SyntaxWalker implements IWalker {
private readonly sourceFile;
private readonly limit;
private readonly options?;
private readonly failures;
private readonly ruleName;
constructor(sourceFile: ts.SourceFile, options: IOptions);
getSourceFile(): ts.SourceFile;
getLineAndCharacterOfPosition(position: number): ts.LineAndCharacter;
getFailures(): RuleFailure[];
getLimit(): number;
getOptions(): any;
hasOption(option: string): boolean;
/** @deprecated Prefer `addFailureAt` and its variants. */
createFailure(start: number, width: number, failure: string, fix?: Fix): RuleFailure;
/** @deprecated Prefer `addFailureAt` and its variants. */
addFailure(failure: RuleFailure): void;
/** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
addFailureAt(start: number, width: number, failure: string, fix?: Fix): void;
/** Like `addFailureAt` but uses start and end instead of start and width. */
addFailureFromStartToEnd(start: number, end: number, failure: string, fix?: Fix): void;
/** Add a failure using a node's span. */
addFailureAtNode(node: ts.Node, failure: string, fix?: Fix): void;
createReplacement(start: number, length: number, text: string): Replacement;
appendText(start: number, text: string): Replacement;
deleteText(start: number, length: number): Replacement;
deleteFromTo(start: number, end: number): Replacement;
getRuleName(): string;
}

102
node_modules/tslint/lib/language/walker/ruleWalker.js generated vendored Normal file
View file

@ -0,0 +1,102 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var rule_1 = require("../rule/rule");
var syntaxWalker_1 = require("./syntaxWalker");
/**
* @deprecated
* RuleWalker-based rules are slow,
* so it's generally preferable to use applyWithFunction instead of applyWithWalker.
* @see https://github.com/palantir/tslint/issues/2522
*/
var RuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(RuleWalker, _super);
function RuleWalker(sourceFile, options) {
var _this = _super.call(this) || this;
_this.sourceFile = sourceFile;
_this.failures = [];
_this.options = options.ruleArguments;
_this.limit = _this.sourceFile.getFullWidth();
_this.ruleName = options.ruleName;
return _this;
}
RuleWalker.prototype.getSourceFile = function () {
return this.sourceFile;
};
RuleWalker.prototype.getLineAndCharacterOfPosition = function (position) {
return this.sourceFile.getLineAndCharacterOfPosition(position);
};
RuleWalker.prototype.getFailures = function () {
return this.failures;
};
RuleWalker.prototype.getLimit = function () {
return this.limit;
};
RuleWalker.prototype.getOptions = function () {
return this.options;
};
RuleWalker.prototype.hasOption = function (option) {
if (this.options !== undefined) {
return this.options.indexOf(option) !== -1;
}
else {
return false;
}
};
/** @deprecated Prefer `addFailureAt` and its variants. */
RuleWalker.prototype.createFailure = function (start, width, failure, fix) {
var from = start > this.limit ? this.limit : start;
var to = start + width > this.limit ? this.limit : start + width;
return new rule_1.RuleFailure(this.sourceFile, from, to, failure, this.ruleName, fix);
};
/** @deprecated Prefer `addFailureAt` and its variants. */
RuleWalker.prototype.addFailure = function (failure) {
this.failures.push(failure);
};
/** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
RuleWalker.prototype.addFailureAt = function (start, width, failure, fix) {
// tslint:disable-next-line deprecation
this.addFailure(this.createFailure(start, width, failure, fix));
};
/** Like `addFailureAt` but uses start and end instead of start and width. */
RuleWalker.prototype.addFailureFromStartToEnd = function (start, end, failure, fix) {
this.addFailureAt(start, end - start, failure, fix);
};
/** Add a failure using a node's span. */
RuleWalker.prototype.addFailureAtNode = function (node, failure, fix) {
this.addFailureAt(node.getStart(this.sourceFile), node.getWidth(this.sourceFile), failure, fix);
};
RuleWalker.prototype.createReplacement = function (start, length, text) {
return new rule_1.Replacement(start, length, text);
};
RuleWalker.prototype.appendText = function (start, text) {
return this.createReplacement(start, 0, text);
};
RuleWalker.prototype.deleteText = function (start, length) {
return this.createReplacement(start, length, "");
};
RuleWalker.prototype.deleteFromTo = function (start, end) {
return this.createReplacement(start, end - start, "");
};
RuleWalker.prototype.getRuleName = function () {
return this.ruleName;
};
return RuleWalker;
}(syntaxWalker_1.SyntaxWalker));
exports.RuleWalker = RuleWalker;

View file

@ -0,0 +1,65 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { IOptions } from "../rule/rule";
import { RuleWalker } from "./ruleWalker";
/**
* @deprecated Prefer to manually maintain any contextual information.
*
* For example, imagine a `no-break` rule that warns on `break` in `for` but not in `switch`:
*
* function walk(ctx: Lint.WalkContext): void {
* let isInFor = false;
* ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void {
* switch (node.kind) {
* case ts.SyntaxKind.Break:
* if (isInFor) {
* ctx.addFailureAtNode(node, "!");
* }
* break;
* case ts.SyntaxKind.ForStatement: {
* const old = isInFor;
* isInFor = true;
* ts.forEachChild(node, cb);
* isInFor = old;
* break;
* }
* case ts.SyntaxKind.SwitchStatement: {
* const old = isInFor;
* isInFor = false;
* ts.forEachChild(node, cb);
* isInFor = old;
* break;
* }
* default:
* ts.forEachChild(node, cb);
* }
* });
* }
*/
export declare abstract class ScopeAwareRuleWalker<T> extends RuleWalker {
private readonly scopeStack;
constructor(sourceFile: ts.SourceFile, options: IOptions);
abstract createScope(node: ts.Node): T;
getCurrentScope(): T;
getAllScopes(): T[];
getCurrentDepth(): number;
onScopeStart(): void;
onScopeEnd(): void;
protected visitNode(node: ts.Node): void;
protected isScopeBoundary(node: ts.Node): boolean;
}

View file

@ -0,0 +1,101 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ts = require("typescript");
var utils_1 = require("../utils");
var ruleWalker_1 = require("./ruleWalker");
/**
* @deprecated Prefer to manually maintain any contextual information.
*
* For example, imagine a `no-break` rule that warns on `break` in `for` but not in `switch`:
*
* function walk(ctx: Lint.WalkContext): void {
* let isInFor = false;
* ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void {
* switch (node.kind) {
* case ts.SyntaxKind.Break:
* if (isInFor) {
* ctx.addFailureAtNode(node, "!");
* }
* break;
* case ts.SyntaxKind.ForStatement: {
* const old = isInFor;
* isInFor = true;
* ts.forEachChild(node, cb);
* isInFor = old;
* break;
* }
* case ts.SyntaxKind.SwitchStatement: {
* const old = isInFor;
* isInFor = false;
* ts.forEachChild(node, cb);
* isInFor = old;
* break;
* }
* default:
* ts.forEachChild(node, cb);
* }
* });
* }
*/
// tslint:disable-next-line deprecation
var ScopeAwareRuleWalker = /** @class */ (function (_super) {
tslib_1.__extends(ScopeAwareRuleWalker, _super);
function ScopeAwareRuleWalker(sourceFile, options) {
var _this = _super.call(this, sourceFile, options) || this;
// initialize with global scope if file is not a module
_this.scopeStack = ts.isExternalModule(sourceFile) ? [] : [_this.createScope(sourceFile)];
return _this;
}
ScopeAwareRuleWalker.prototype.getCurrentScope = function () {
return this.scopeStack[this.scopeStack.length - 1];
};
// get all scopes available at this depth
ScopeAwareRuleWalker.prototype.getAllScopes = function () {
return this.scopeStack;
};
ScopeAwareRuleWalker.prototype.getCurrentDepth = function () {
return this.scopeStack.length;
};
// callback notifier when a scope begins
ScopeAwareRuleWalker.prototype.onScopeStart = function () {
return;
};
// callback notifier when a scope ends
ScopeAwareRuleWalker.prototype.onScopeEnd = function () {
return;
};
ScopeAwareRuleWalker.prototype.visitNode = function (node) {
var isNewScope = this.isScopeBoundary(node);
if (isNewScope) {
this.scopeStack.push(this.createScope(node));
this.onScopeStart();
}
_super.prototype.visitNode.call(this, node);
if (isNewScope) {
this.onScopeEnd();
this.scopeStack.pop();
}
};
ScopeAwareRuleWalker.prototype.isScopeBoundary = function (node) {
return utils_1.isScopeBoundary(node); // tslint:disable-line:deprecation
};
return ScopeAwareRuleWalker;
}(ruleWalker_1.RuleWalker));
exports.ScopeAwareRuleWalker = ScopeAwareRuleWalker;

View file

@ -0,0 +1,105 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
export declare class SyntaxWalker {
walk(node: ts.Node): void;
protected visitAnyKeyword(node: ts.Node): void;
protected visitArrayLiteralExpression(node: ts.ArrayLiteralExpression): void;
protected visitArrayType(node: ts.ArrayTypeNode): void;
protected visitArrowFunction(node: ts.ArrowFunction): void;
protected visitBinaryExpression(node: ts.BinaryExpression): void;
protected visitBindingElement(node: ts.BindingElement): void;
protected visitBindingPattern(node: ts.BindingPattern): void;
protected visitBlock(node: ts.Block): void;
protected visitBreakStatement(node: ts.BreakOrContinueStatement): void;
protected visitCallExpression(node: ts.CallExpression): void;
protected visitCallSignature(node: ts.SignatureDeclaration): void;
protected visitCaseClause(node: ts.CaseClause): void;
protected visitClassDeclaration(node: ts.ClassDeclaration): void;
protected visitClassExpression(node: ts.ClassExpression): void;
protected visitCatchClause(node: ts.CatchClause): void;
protected visitConditionalExpression(node: ts.ConditionalExpression): void;
protected visitConstructSignature(node: ts.ConstructSignatureDeclaration): void;
protected visitConstructorDeclaration(node: ts.ConstructorDeclaration): void;
protected visitConstructorType(node: ts.FunctionOrConstructorTypeNode): void;
protected visitContinueStatement(node: ts.BreakOrContinueStatement): void;
protected visitDebuggerStatement(node: ts.Statement): void;
protected visitDefaultClause(node: ts.DefaultClause): void;
protected visitDoStatement(node: ts.DoStatement): void;
protected visitElementAccessExpression(node: ts.ElementAccessExpression): void;
protected visitEndOfFileToken(node: ts.Node): void;
protected visitEnumDeclaration(node: ts.EnumDeclaration): void;
protected visitEnumMember(node: ts.EnumMember): void;
protected visitExportAssignment(node: ts.ExportAssignment): void;
protected visitExpressionStatement(node: ts.ExpressionStatement): void;
protected visitForStatement(node: ts.ForStatement): void;
protected visitForInStatement(node: ts.ForInStatement): void;
protected visitForOfStatement(node: ts.ForOfStatement): void;
protected visitFunctionDeclaration(node: ts.FunctionDeclaration): void;
protected visitFunctionExpression(node: ts.FunctionExpression): void;
protected visitFunctionType(node: ts.FunctionOrConstructorTypeNode): void;
protected visitGetAccessor(node: ts.AccessorDeclaration): void;
protected visitIdentifier(node: ts.Identifier): void;
protected visitIfStatement(node: ts.IfStatement): void;
protected visitImportDeclaration(node: ts.ImportDeclaration): void;
protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void;
protected visitIndexSignatureDeclaration(node: ts.IndexSignatureDeclaration): void;
protected visitInterfaceDeclaration(node: ts.InterfaceDeclaration): void;
protected visitJsxAttribute(node: ts.JsxAttribute): void;
protected visitJsxElement(node: ts.JsxElement): void;
protected visitJsxExpression(node: ts.JsxExpression): void;
protected visitJsxSelfClosingElement(node: ts.JsxSelfClosingElement): void;
protected visitJsxSpreadAttribute(node: ts.JsxSpreadAttribute): void;
protected visitLabeledStatement(node: ts.LabeledStatement): void;
protected visitMethodDeclaration(node: ts.MethodDeclaration): void;
protected visitMethodSignature(node: ts.SignatureDeclaration): void;
protected visitModuleDeclaration(node: ts.ModuleDeclaration): void;
protected visitNamedImports(node: ts.NamedImports): void;
protected visitNamespaceImport(node: ts.NamespaceImport): void;
protected visitNewExpression(node: ts.NewExpression): void;
protected visitNonNullExpression(node: ts.NonNullExpression): void;
protected visitNumericLiteral(node: ts.NumericLiteral): void;
protected visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): void;
protected visitParameterDeclaration(node: ts.ParameterDeclaration): void;
protected visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression): void;
protected visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression): void;
protected visitPropertyAccessExpression(node: ts.PropertyAccessExpression): void;
protected visitPropertyAssignment(node: ts.PropertyAssignment): void;
protected visitPropertyDeclaration(node: ts.PropertyDeclaration): void;
protected visitPropertySignature(node: ts.Node): void;
protected visitRegularExpressionLiteral(node: ts.Node): void;
protected visitReturnStatement(node: ts.ReturnStatement): void;
protected visitSetAccessor(node: ts.AccessorDeclaration): void;
protected visitSourceFile(node: ts.SourceFile): void;
protected visitStringLiteral(node: ts.StringLiteral): void;
protected visitSwitchStatement(node: ts.SwitchStatement): void;
protected visitTemplateExpression(node: ts.TemplateExpression): void;
protected visitThrowStatement(node: ts.ThrowStatement): void;
protected visitTryStatement(node: ts.TryStatement): void;
protected visitTupleType(node: ts.TupleTypeNode): void;
protected visitTypeAliasDeclaration(node: ts.TypeAliasDeclaration): void;
protected visitTypeAssertionExpression(node: ts.TypeAssertion): void;
protected visitTypeLiteral(node: ts.TypeLiteralNode): void;
protected visitTypeReference(node: ts.TypeReferenceNode): void;
protected visitVariableDeclaration(node: ts.VariableDeclaration): void;
protected visitVariableDeclarationList(node: ts.VariableDeclarationList): void;
protected visitVariableStatement(node: ts.VariableStatement): void;
protected visitWhileStatement(node: ts.WhileStatement): void;
protected visitWithStatement(node: ts.WithStatement): void;
protected visitNode(node: ts.Node): void;
protected walkChildren(node: ts.Node): void;
}

539
node_modules/tslint/lib/language/walker/syntaxWalker.js generated vendored Normal file
View file

@ -0,0 +1,539 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var SyntaxWalker = /** @class */ (function () {
function SyntaxWalker() {
}
SyntaxWalker.prototype.walk = function (node) {
this.visitNode(node);
};
SyntaxWalker.prototype.visitAnyKeyword = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitArrayType = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitArrowFunction = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitBinaryExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitBindingElement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitBindingPattern = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitBlock = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitBreakStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitCallExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitCallSignature = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitCaseClause = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitClassDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitClassExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitCatchClause = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitConditionalExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitConstructSignature = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitConstructorDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitConstructorType = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitContinueStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitDebuggerStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitDefaultClause = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitDoStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitElementAccessExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitEndOfFileToken = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitEnumDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitEnumMember = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitExportAssignment = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitExpressionStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitForStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitForInStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitForOfStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitFunctionDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitFunctionExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitFunctionType = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitGetAccessor = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitIdentifier = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitIfStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitImportDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitImportEqualsDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitIndexSignatureDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitJsxAttribute = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitJsxElement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitJsxExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitJsxSelfClosingElement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitJsxSpreadAttribute = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitLabeledStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitMethodDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitMethodSignature = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitModuleDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNamedImports = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNamespaceImport = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNewExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNonNullExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNumericLiteral = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitParameterDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPropertyAccessExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPropertyAssignment = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPropertyDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitPropertySignature = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitRegularExpressionLiteral = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitReturnStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitSetAccessor = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitSourceFile = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitStringLiteral = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitSwitchStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTemplateExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitThrowStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTryStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTupleType = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTypeAliasDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTypeAssertionExpression = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTypeLiteral = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitTypeReference = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitVariableDeclaration = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitVariableDeclarationList = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitVariableStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitWhileStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitWithStatement = function (node) {
this.walkChildren(node);
};
SyntaxWalker.prototype.visitNode = function (node) {
switch (node.kind) {
case ts.SyntaxKind.AnyKeyword:
this.visitAnyKeyword(node);
break;
case ts.SyntaxKind.ArrayBindingPattern:
this.visitBindingPattern(node);
break;
case ts.SyntaxKind.ArrayLiteralExpression:
this.visitArrayLiteralExpression(node);
break;
case ts.SyntaxKind.ArrayType:
this.visitArrayType(node);
break;
case ts.SyntaxKind.ArrowFunction:
this.visitArrowFunction(node);
break;
case ts.SyntaxKind.BinaryExpression:
this.visitBinaryExpression(node);
break;
case ts.SyntaxKind.BindingElement:
this.visitBindingElement(node);
break;
case ts.SyntaxKind.Block:
this.visitBlock(node);
break;
case ts.SyntaxKind.BreakStatement:
this.visitBreakStatement(node);
break;
case ts.SyntaxKind.CallExpression:
this.visitCallExpression(node);
break;
case ts.SyntaxKind.CallSignature:
this.visitCallSignature(node);
break;
case ts.SyntaxKind.CaseClause:
this.visitCaseClause(node);
break;
case ts.SyntaxKind.ClassDeclaration:
this.visitClassDeclaration(node);
break;
case ts.SyntaxKind.ClassExpression:
this.visitClassExpression(node);
break;
case ts.SyntaxKind.CatchClause:
this.visitCatchClause(node);
break;
case ts.SyntaxKind.ConditionalExpression:
this.visitConditionalExpression(node);
break;
case ts.SyntaxKind.ConstructSignature:
this.visitConstructSignature(node);
break;
case ts.SyntaxKind.Constructor:
this.visitConstructorDeclaration(node);
break;
case ts.SyntaxKind.ConstructorType:
this.visitConstructorType(node);
break;
case ts.SyntaxKind.ContinueStatement:
this.visitContinueStatement(node);
break;
case ts.SyntaxKind.DebuggerStatement:
this.visitDebuggerStatement(node);
break;
case ts.SyntaxKind.DefaultClause:
this.visitDefaultClause(node);
break;
case ts.SyntaxKind.DoStatement:
this.visitDoStatement(node);
break;
case ts.SyntaxKind.ElementAccessExpression:
this.visitElementAccessExpression(node);
break;
case ts.SyntaxKind.EndOfFileToken:
this.visitEndOfFileToken(node);
break;
case ts.SyntaxKind.EnumDeclaration:
this.visitEnumDeclaration(node);
break;
case ts.SyntaxKind.EnumMember:
this.visitEnumMember(node);
break;
case ts.SyntaxKind.ExportAssignment:
this.visitExportAssignment(node);
break;
case ts.SyntaxKind.ExpressionStatement:
this.visitExpressionStatement(node);
break;
case ts.SyntaxKind.ForStatement:
this.visitForStatement(node);
break;
case ts.SyntaxKind.ForInStatement:
this.visitForInStatement(node);
break;
case ts.SyntaxKind.ForOfStatement:
this.visitForOfStatement(node);
break;
case ts.SyntaxKind.FunctionDeclaration:
this.visitFunctionDeclaration(node);
break;
case ts.SyntaxKind.FunctionExpression:
this.visitFunctionExpression(node);
break;
case ts.SyntaxKind.FunctionType:
this.visitFunctionType(node);
break;
case ts.SyntaxKind.GetAccessor:
this.visitGetAccessor(node);
break;
case ts.SyntaxKind.Identifier:
this.visitIdentifier(node);
break;
case ts.SyntaxKind.IfStatement:
this.visitIfStatement(node);
break;
case ts.SyntaxKind.ImportDeclaration:
this.visitImportDeclaration(node);
break;
case ts.SyntaxKind.ImportEqualsDeclaration:
this.visitImportEqualsDeclaration(node);
break;
case ts.SyntaxKind.IndexSignature:
this.visitIndexSignatureDeclaration(node);
break;
case ts.SyntaxKind.InterfaceDeclaration:
this.visitInterfaceDeclaration(node);
break;
case ts.SyntaxKind.JsxAttribute:
this.visitJsxAttribute(node);
break;
case ts.SyntaxKind.JsxElement:
this.visitJsxElement(node);
break;
case ts.SyntaxKind.JsxExpression:
this.visitJsxExpression(node);
break;
case ts.SyntaxKind.JsxSelfClosingElement:
this.visitJsxSelfClosingElement(node);
break;
case ts.SyntaxKind.JsxSpreadAttribute:
this.visitJsxSpreadAttribute(node);
break;
case ts.SyntaxKind.LabeledStatement:
this.visitLabeledStatement(node);
break;
case ts.SyntaxKind.MethodDeclaration:
this.visitMethodDeclaration(node);
break;
case ts.SyntaxKind.MethodSignature:
this.visitMethodSignature(node);
break;
case ts.SyntaxKind.ModuleDeclaration:
this.visitModuleDeclaration(node);
break;
case ts.SyntaxKind.NamedImports:
this.visitNamedImports(node);
break;
case ts.SyntaxKind.NamespaceImport:
this.visitNamespaceImport(node);
break;
case ts.SyntaxKind.NewExpression:
this.visitNewExpression(node);
break;
case ts.SyntaxKind.NonNullExpression:
this.visitNonNullExpression(node);
break;
case ts.SyntaxKind.NumericLiteral:
this.visitNumericLiteral(node);
break;
case ts.SyntaxKind.ObjectBindingPattern:
this.visitBindingPattern(node);
break;
case ts.SyntaxKind.ObjectLiteralExpression:
this.visitObjectLiteralExpression(node);
break;
case ts.SyntaxKind.Parameter:
this.visitParameterDeclaration(node);
break;
case ts.SyntaxKind.PostfixUnaryExpression:
this.visitPostfixUnaryExpression(node);
break;
case ts.SyntaxKind.PrefixUnaryExpression:
this.visitPrefixUnaryExpression(node);
break;
case ts.SyntaxKind.PropertyAccessExpression:
this.visitPropertyAccessExpression(node);
break;
case ts.SyntaxKind.PropertyAssignment:
this.visitPropertyAssignment(node);
break;
case ts.SyntaxKind.PropertyDeclaration:
this.visitPropertyDeclaration(node);
break;
case ts.SyntaxKind.PropertySignature:
this.visitPropertySignature(node);
break;
case ts.SyntaxKind.RegularExpressionLiteral:
this.visitRegularExpressionLiteral(node);
break;
case ts.SyntaxKind.ReturnStatement:
this.visitReturnStatement(node);
break;
case ts.SyntaxKind.SetAccessor:
this.visitSetAccessor(node);
break;
case ts.SyntaxKind.SourceFile:
this.visitSourceFile(node);
break;
case ts.SyntaxKind.StringLiteral:
this.visitStringLiteral(node);
break;
case ts.SyntaxKind.SwitchStatement:
this.visitSwitchStatement(node);
break;
case ts.SyntaxKind.TemplateExpression:
this.visitTemplateExpression(node);
break;
case ts.SyntaxKind.ThrowStatement:
this.visitThrowStatement(node);
break;
case ts.SyntaxKind.TryStatement:
this.visitTryStatement(node);
break;
case ts.SyntaxKind.TupleType:
this.visitTupleType(node);
break;
case ts.SyntaxKind.TypeAliasDeclaration:
this.visitTypeAliasDeclaration(node);
break;
case ts.SyntaxKind.TypeAssertionExpression:
this.visitTypeAssertionExpression(node);
break;
case ts.SyntaxKind.TypeLiteral:
this.visitTypeLiteral(node);
break;
case ts.SyntaxKind.TypeReference:
this.visitTypeReference(node);
break;
case ts.SyntaxKind.VariableDeclaration:
this.visitVariableDeclaration(node);
break;
case ts.SyntaxKind.VariableDeclarationList:
this.visitVariableDeclarationList(node);
break;
case ts.SyntaxKind.VariableStatement:
this.visitVariableStatement(node);
break;
case ts.SyntaxKind.WhileStatement:
this.visitWhileStatement(node);
break;
case ts.SyntaxKind.WithStatement:
this.visitWithStatement(node);
break;
default:
this.walkChildren(node);
}
};
SyntaxWalker.prototype.walkChildren = function (node) {
var _this = this;
ts.forEachChild(node, function (child) { return _this.visitNode(child); });
};
return SyntaxWalker;
}());
exports.SyntaxWalker = SyntaxWalker;

View file

@ -0,0 +1,30 @@
/**
* @license
* Copyright 2017 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { Fix, RuleFailure } from "../rule/rule";
export declare class WalkContext<T = undefined> {
readonly sourceFile: ts.SourceFile;
readonly ruleName: string;
readonly options: T;
readonly failures: RuleFailure[];
constructor(sourceFile: ts.SourceFile, ruleName: string, options: T);
/** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
addFailureAt(start: number, width: number, failure: string, fix?: Fix): void;
addFailure(start: number, end: number, failure: string, fix?: Fix): void;
/** Add a failure using a node's span. */
addFailureAtNode(node: ts.Node, failure: string, fix?: Fix): void;
}

41
node_modules/tslint/lib/language/walker/walkContext.js generated vendored Normal file
View file

@ -0,0 +1,41 @@
"use strict";
/**
* @license
* Copyright 2017 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var rule_1 = require("../rule/rule");
var WalkContext = /** @class */ (function () {
function WalkContext(sourceFile, ruleName, options) {
this.sourceFile = sourceFile;
this.ruleName = ruleName;
this.options = options;
this.failures = [];
}
/** Add a failure with any arbitrary span. Prefer `addFailureAtNode` if possible. */
WalkContext.prototype.addFailureAt = function (start, width, failure, fix) {
this.addFailure(start, start + width, failure, fix);
};
WalkContext.prototype.addFailure = function (start, end, failure, fix) {
var fileLength = this.sourceFile.end;
this.failures.push(new rule_1.RuleFailure(this.sourceFile, Math.min(start, fileLength), Math.min(end, fileLength), failure, this.ruleName, fix));
};
/** Add a failure using a node's span. */
WalkContext.prototype.addFailureAtNode = function (node, failure, fix) {
this.addFailure(node.getStart(this.sourceFile), node.getEnd(), failure, fix);
};
return WalkContext;
}());
exports.WalkContext = WalkContext;

29
node_modules/tslint/lib/language/walker/walker.d.ts generated vendored Normal file
View file

@ -0,0 +1,29 @@
/**
* @license
* Copyright 2017 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as ts from "typescript";
import { RuleFailure } from "../rule/rule";
import { WalkContext } from "./walkContext";
export interface IWalker {
getSourceFile(): ts.SourceFile;
walk(sourceFile: ts.SourceFile): void;
getFailures(): RuleFailure[];
}
export declare abstract class AbstractWalker<T = undefined> extends WalkContext<T> implements IWalker {
abstract walk(sourceFile: ts.SourceFile): void;
getSourceFile(): ts.SourceFile;
getFailures(): RuleFailure[];
}

34
node_modules/tslint/lib/language/walker/walker.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
"use strict";
/**
* @license
* Copyright 2017 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var walkContext_1 = require("./walkContext");
var AbstractWalker = /** @class */ (function (_super) {
tslib_1.__extends(AbstractWalker, _super);
function AbstractWalker() {
return _super !== null && _super.apply(this, arguments) || this;
}
AbstractWalker.prototype.getSourceFile = function () {
return this.sourceFile;
};
AbstractWalker.prototype.getFailures = function () {
return this.failures;
};
return AbstractWalker;
}(walkContext_1.WalkContext));
exports.AbstractWalker = AbstractWalker;