-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(no-unlocalized-strings): add patterns for ignore functions
- Loading branch information
1 parent
a407d3d
commit 20cb248
Showing
7 changed files
with
153 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { parse } from '@typescript-eslint/parser' | ||
import { TSESTree } from '@typescript-eslint/utils' | ||
import { buildCalleePath } from './helpers' | ||
|
||
describe('buildCalleePath', () => { | ||
function buildCallExp(code: string) { | ||
const t = parse(code) | ||
|
||
return (t.body[0] as TSESTree.ExpressionStatement).expression as TSESTree.CallExpression | ||
} | ||
|
||
it('Should build callee path', () => { | ||
const exp = buildCallExp('one.two.three.four()') | ||
|
||
expect(buildCalleePath(exp.callee)).toBe('one.two.three.four') | ||
}) | ||
|
||
it('Should build with dynamic element', () => { | ||
const exp = buildCallExp('one.two.three[getProp()]()') | ||
|
||
expect(buildCalleePath(exp.callee)).toBe('one.two.three.$') | ||
}) | ||
|
||
it('Should build with dynamic first element', () => { | ||
const exp = buildCallExp('getData().two.three.four()') | ||
|
||
expect(buildCalleePath(exp.callee)).toBe('$.two.three.four') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters