Chore: Update no-untranslated-strings to check tooltip and template literals (#98281)

This commit is contained in:
Tom Ratcliffe 2025-01-10 16:26:03 +00:00 committed by GitHub
parent 6568f3669d
commit 1ba9a27f70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 562 additions and 223 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ const createRule = ESLintUtils.RuleCreator(
(name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-eslint-rules/README.md#${name}` (name) => `https://github.com/grafana/grafana/blob/main/packages/grafana-eslint-rules/README.md#${name}`
); );
const propsToCheck = ['label', 'description', 'placeholder', 'aria-label', 'title', 'text']; const propsToCheck = ['label', 'description', 'placeholder', 'aria-label', 'title', 'text', 'tooltip'];
const noUntranslatedStrings = createRule({ const noUntranslatedStrings = createRule({
create(context) { create(context) {
@ -17,7 +17,8 @@ const noUntranslatedStrings = createRule({
const isUntranslatedProp = const isUntranslatedProp =
(node.value.type === 'Literal' && node.value.value !== '') || (node.value.type === 'Literal' && node.value.value !== '') ||
(node.value.type === 'JSXExpressionContainer' && node.value.expression.type === 'Literal'); (node.value.type === 'JSXExpressionContainer' &&
(node.value.expression.type === 'Literal' || node.value.expression.type === 'TemplateLiteral'));
if (isUntranslatedProp) { if (isUntranslatedProp) {
return context.report({ return context.report({