Skip to content

Commit

Permalink
fix(languageRule): fix detection inside callback
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhck committed Nov 21, 2018
1 parent 6f1918a commit e8b62c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/languageRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Lint from "tslint";
import * as ts from "typescript";

interface ILanguageData {
reference: {base: string, group: string}[];
reference: { base: string, group: string }[];
}

class LanguageRule extends Lint.RuleWalker {
Expand All @@ -16,7 +16,8 @@ class LanguageRule extends Lint.RuleWalker {
super(sourceFile, option);
}

public visitCallExpression(node: ts.CallExpression): any {
public visitCallExpression(node: ts.CallExpression): void {
super.visitCallExpression(node);
if (!node.expression.getChildAt(0)) {
return;
}
Expand All @@ -30,8 +31,8 @@ class LanguageRule extends Lint.RuleWalker {
return;
}
this.addFailureAtNode(node.arguments[0], "Translation string not found");
super.visitCallExpression(node);
}

private doesKeyExist(key: string): boolean {
return this.languageData.reference.some((d) => d.base === key);
}
Expand Down

0 comments on commit e8b62c6

Please sign in to comment.