mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 05:35:11 +00:00
ignore weirder cases
This commit is contained in:
parent
30d53de356
commit
f11536c927
2 changed files with 8 additions and 1 deletions
|
@ -23,7 +23,7 @@ function collectMembers(node) {
|
|||
*/
|
||||
function walkDown(locale, path) {
|
||||
if (!locale) return null;
|
||||
if (!path || path.length === 0) return locale;
|
||||
if (!path || path.length === 0 || !path[0]) return locale;
|
||||
return walkDown(locale[path[0]], path.slice(1));
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,11 @@ function theRule(context) {
|
|||
return;
|
||||
}
|
||||
|
||||
// we hit something weird, assume the programmers know what
|
||||
// they're doing (this is usually some complicated slicing of
|
||||
// the translation structure)
|
||||
if (typeof(translation) !== 'string') return;
|
||||
|
||||
// some more checks on how the translation is called
|
||||
if (method == 'ts') {
|
||||
if (translation.match(/\{/)) {
|
||||
|
|
|
@ -11,6 +11,8 @@ ruleTester.run(
|
|||
{
|
||||
valid: [
|
||||
{code: 'i18n.ts.foo.bar', options: [locale] },
|
||||
// we don't detect the problem here, but should still accept it
|
||||
{code: 'i18n.ts.foo["something"]', options: [locale] },
|
||||
{code: 'i18n.ts.top', options: [locale] },
|
||||
{code: 'i18n.tsx.foo.baz({x:1})', options: [locale] },
|
||||
{code: 'whatever.i18n.ts.blah.blah', options: [locale] },
|
||||
|
|
Loading…
Reference in a new issue