mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 20:22:21 +08:00
Chore: Update no-untranslated-strings
to check tooltip and template literals (#98281)
This commit is contained in:
@ -5,7 +5,7 @@ const createRule = ESLintUtils.RuleCreator(
|
||||
(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({
|
||||
create(context) {
|
||||
@ -17,7 +17,8 @@ const noUntranslatedStrings = createRule({
|
||||
|
||||
const isUntranslatedProp =
|
||||
(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) {
|
||||
return context.report({
|
||||
|
Reference in New Issue
Block a user