Skip to content

Commit 383e682

Browse files
mclerota-meshi
andauthored
Fix not triggering rule no-dynamic-keys in non-vue files (#637)
* fix: fix not triggering no-dynamic-keys in non-vue files * Create empty-steaks-stare.md --------- Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
1 parent 98b9f70 commit 383e682

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.changeset/empty-steaks-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@intlify/eslint-plugin-vue-i18n": minor
3+
---
4+
5+
Improved to apply no-dynamic-keys rule to non-Vue files as well.

lib/rules/no-dynamic-keys.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/**
22
* @author kazuya kawaguchi (a.k.a. kazupon)
33
*/
4-
import { defineTemplateBodyVisitor, isStaticLiteral } from '../utils/index'
4+
import {
5+
compositingVisitors,
6+
defineTemplateBodyVisitor,
7+
isStaticLiteral
8+
} from '../utils/index'
59
import type { RuleContext, RuleListener } from '../types'
610
import type { AST as VAST } from 'vue-eslint-parser'
711
import { createRule } from '../utils/rule'
@@ -93,9 +97,8 @@ function checkCallExpression(
9397
}
9498

9599
function create(context: RuleContext): RuleListener {
96-
return defineTemplateBodyVisitor(
97-
context,
98-
{
100+
return compositingVisitors(
101+
defineTemplateBodyVisitor(context, {
99102
"VAttribute[directive=true][key.name='t']"(node: VAST.VDirective) {
100103
checkDirective(context, node)
101104
},
@@ -113,7 +116,7 @@ function create(context: RuleContext): RuleListener {
113116
CallExpression(node: VAST.ESLintCallExpression) {
114117
checkCallExpression(context, node)
115118
}
116-
},
119+
}),
117120
{
118121
CallExpression(node: VAST.ESLintCallExpression) {
119122
checkCallExpression(context, node)

0 commit comments

Comments
 (0)