Skip to content

Commit

Permalink
fix: trying to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Dec 17, 2024
1 parent 9837c0e commit 92c42ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/rules/no-unlocalized-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,9 @@ function isStringLiteralFromUnionType(
if (isStringLiteralType(nodeType)) {
return true
}
} catch (error) {}

return false
} catch (error) {
return false
}
return false

Check warning on line 189 in src/rules/no-unlocalized-strings.ts

View check run for this annotation

Codecov / codecov/patch

src/rules/no-unlocalized-strings.ts#L189

Added line #L189 was not covered by tests
}

export const name = 'no-unlocalized-strings'
Expand Down
9 changes: 9 additions & 0 deletions tests/src/rules/no-unlocalized-strings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@ ruleTester.run(name, rule, {
options: [{ useTsTypes: true }],
errors: [{ messageId: 'default' }],
},
{
name: 'handles type system error gracefully',
code: `
// This should cause type system issues but not crash
const x = (unknown as any).nonexistent("test");
`,
options: [{ useTsTypes: true }],
errors: [{ messageId: 'default' }],
},
],
})

Expand Down

0 comments on commit 92c42ec

Please sign in to comment.