aboutsummaryrefslogtreecommitdiffstats
path: root/packages/tslint-config/rules/walkers
diff options
context:
space:
mode:
authorHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
committerHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
commit7ae38906926dc09bc10670c361af0d2bf0050426 (patch)
tree5fb10ae366b987db09e4ddb4bc3ba0f75404ad08 /packages/tslint-config/rules/walkers
parentb5fd3c72a08aaa6957917d74c333387a16edf66b (diff)
downloaddexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.gz
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.zst
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.zip
Update dependency packages
Diffstat (limited to 'packages/tslint-config/rules/walkers')
-rw-r--r--packages/tslint-config/rules/walkers/async_suffix.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/packages/tslint-config/rules/walkers/async_suffix.ts b/packages/tslint-config/rules/walkers/async_suffix.ts
deleted file mode 100644
index 4e12152e8..000000000
--- a/packages/tslint-config/rules/walkers/async_suffix.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import * as _ from 'lodash';
-import * as Lint from 'tslint';
-import * as ts from 'typescript';
-
-export class AsyncSuffixWalker extends Lint.RuleWalker {
- public static FAILURE_STRING = 'async functions/methods must have an Async suffix';
- public visitFunctionDeclaration(node: ts.FunctionDeclaration): void {
- this._visitFunctionOrMethodDeclaration(node);
- super.visitFunctionDeclaration(node);
- }
- public visitMethodDeclaration(node: ts.MethodDeclaration): void {
- this._visitFunctionOrMethodDeclaration(node);
- super.visitMethodDeclaration(node);
- }
- private _visitFunctionOrMethodDeclaration(node: ts.MethodDeclaration | ts.FunctionDeclaration): void {
- const nameNode = node.name;
- if (!_.isUndefined(nameNode)) {
- const name = nameNode.getText();
- if (!_.isUndefined(node.type)) {
- if (node.type.kind === ts.SyntaxKind.TypeReference) {
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
- if (returnTypeName === 'Promise' && !name.endsWith('Async')) {
- const failure = this.createFailure(
- nameNode.getStart(),
- nameNode.getWidth(),
- AsyncSuffixWalker.FAILURE_STRING,
- );
- this.addFailure(failure);
- }
- }
- }
- }
- }
-}