-
-
Notifications
You must be signed in to change notification settings - Fork 48
Description
What rule do you want to change?
no-unused-keys
Does this change cause the rule to produce more or fewer warnings?
Less warnings. The rule will begin to see i18n keys in VNode creation code (e.g., render functions), which were previously ignored.
How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior. The rule will be extended to detect static keypath
and path
props when i18n components are created as VNodes using h()
or createVNode()
in script/code.
Please provide some example code that this change will affect:
<script setup>
const showConfirmModal = (valueFrom, valueTo) => {
Modal.show({
...
description: h(I18nT, { keypath: 'settings.confirm.description' }, {
value_from: () => h('span', {class: 'font-semibold'}, valueFrom),
value_to: () => h('span', {class: 'font-semibold'}, valueTo)
})
...
})
}
</script>
What does the rule currently do for this code?
A warning "Unused key in locale" is produced for key settings.confirm.description
, which actually used in VNode creation.
What will the rule do after it's changed?
The rule will see i18n keys when they are used as static props in VNode creation (h()
or createVNode()
), just as it does for template usage.
Additional context
This change ensures the rule covers all static usages of i18n keys, including render-function and JSX code. It will help teams validate localization keys regardless of how their components are created.