Skip to content

Commit

Permalink
fix: update no-unlocalized to properly utilize ignoreFunction option (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
coreylight authored Sep 28, 2023
1 parent 341ccde commit 5e95b3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/no-unlocalized-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const rule: RuleModule<string, Option[]> = {
if (callee.name === 'require') {
return true
}
return calleeWhitelists.complex.indexOf(callee.name) !== -1
return calleeWhitelists.simple.indexOf(callee.name) !== -1
}
default:
return false
Expand Down
4 changes: 4 additions & 0 deletions tests/src/rules/no-unlocalized-strings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ ruleTester.run<string, Option[]>('no-unlocalized-strings', rule, {
code: 'new Error("hello")',
options: [{ ignoreFunction: ['Error'] }],
},
{
code: 'hello("Hello")',
options: [{ ignoreFunction: ['hello'] }],
},
{ code: '<div>&nbsp; </div>' },
{ code: "plural('hello')" },
{ code: "select('hello')" },
Expand Down

0 comments on commit 5e95b3e

Please sign in to comment.