diff --git a/.changeset/empty-steaks-stare.md b/.changeset/empty-steaks-stare.md new file mode 100644 index 00000000..4c0dd84a --- /dev/null +++ b/.changeset/empty-steaks-stare.md @@ -0,0 +1,5 @@ +--- +"@intlify/eslint-plugin-vue-i18n": minor +--- + +Improved to apply no-dynamic-keys rule to non-Vue files as well. diff --git a/lib/rules/no-dynamic-keys.ts b/lib/rules/no-dynamic-keys.ts index a5206777..3c297808 100644 --- a/lib/rules/no-dynamic-keys.ts +++ b/lib/rules/no-dynamic-keys.ts @@ -1,7 +1,11 @@ /** * @author kazuya kawaguchi (a.k.a. kazupon) */ -import { defineTemplateBodyVisitor, isStaticLiteral } from '../utils/index' +import { + compositingVisitors, + defineTemplateBodyVisitor, + isStaticLiteral +} from '../utils/index' import type { RuleContext, RuleListener } from '../types' import type { AST as VAST } from 'vue-eslint-parser' import { createRule } from '../utils/rule' @@ -93,9 +97,8 @@ function checkCallExpression( } function create(context: RuleContext): RuleListener { - return defineTemplateBodyVisitor( - context, - { + return compositingVisitors( + defineTemplateBodyVisitor(context, { "VAttribute[directive=true][key.name='t']"(node: VAST.VDirective) { checkDirective(context, node) }, @@ -113,7 +116,7 @@ function create(context: RuleContext): RuleListener { CallExpression(node: VAST.ESLintCallExpression) { checkCallExpression(context, node) } - }, + }), { CallExpression(node: VAST.ESLintCallExpression) { checkCallExpression(context, node)