Skip to content

Commit

Permalink
feat(languageRule): callerNames as array
Browse files Browse the repository at this point in the history
  • Loading branch information
paibamboo committed Dec 26, 2018
1 parent 396c73a commit 9afd819
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/languageRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface ILanguageData {
}

class LanguageRule extends Lint.RuleWalker {
private callerName: string = "Translator";
private callerNames: string[] = ["Translator"];

constructor(
sourceFile: ts.SourceFile,
Expand All @@ -16,8 +16,8 @@ class LanguageRule extends Lint.RuleWalker {
private readonly languageData: ILanguageData
) {
super(sourceFile, options);
if (options.ruleArguments[0] && options.ruleArguments[0].callerName) {
this.callerName = options.ruleArguments[0].callerName;
if (options.ruleArguments[0] && options.ruleArguments[0].callerNames) {
this.callerNames = options.ruleArguments[0].callerNames;
}
}

Expand All @@ -28,7 +28,7 @@ class LanguageRule extends Lint.RuleWalker {
}
const leftSideType: ts.Type = this.program.getTypeChecker().getTypeAtLocation(node.expression.getChildAt(0));
const leftSideString = this.program.getTypeChecker().typeToString(leftSideType);
if (leftSideString !== this.callerName) {
if (this.callerNames.indexOf(leftSideString) === -1) {
return;
}
const key: ts.StringLiteral = node.arguments[0] as ts.StringLiteral;
Expand Down

0 comments on commit 9afd819

Please sign in to comment.