File tree Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -257,10 +257,6 @@ function create(context: RuleContext): RuleListener {
257
257
return true
258
258
}
259
259
260
- if ( node . type === 'YAMLPair' ) {
261
- yamlKeyNodes . add ( node . key )
262
- return true
263
- }
264
260
if ( yamlKeyNodes . has ( node ) ) {
265
261
// within key node
266
262
return true
@@ -271,6 +267,10 @@ function create(context: RuleContext): RuleListener {
271
267
yamlKeyNodes . add ( node )
272
268
return true
273
269
}
270
+ if ( node . type === 'YAMLPair' ) {
271
+ yamlKeyNodes . add ( node . key )
272
+ return true
273
+ }
274
274
return false
275
275
} ,
276
276
resolveKey ( node ) {
Original file line number Diff line number Diff line change @@ -321,10 +321,6 @@ function create(context: RuleContext): RuleListener {
321
321
return true
322
322
}
323
323
324
- if ( node . type === 'YAMLPair' ) {
325
- yamlKeyNodes . add ( node . key )
326
- return true
327
- }
328
324
if ( yamlKeyNodes . has ( node ) ) {
329
325
// within key node
330
326
return true
@@ -335,6 +331,10 @@ function create(context: RuleContext): RuleListener {
335
331
yamlKeyNodes . add ( node )
336
332
return true
337
333
}
334
+ if ( node . type === 'YAMLPair' ) {
335
+ yamlKeyNodes . add ( node . key )
336
+ return true
337
+ }
338
338
return false
339
339
} ,
340
340
/**
Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ new RuleTester({
61
61
</i18n>
62
62
<template></template>
63
63
<script></script>`
64
+ } ,
65
+ {
66
+ filename : 'test.vue' ,
67
+ code : `
68
+ <i18n lang="yaml">
69
+ en:
70
+ ? [{foo: {bar: baz}}]
71
+ : 123
72
+ foo: {bar: baz}
73
+ </i18n>
74
+ <template></template>
75
+ <script></script>`
64
76
}
65
77
] ,
66
78
invalid : [
Original file line number Diff line number Diff line change @@ -910,6 +910,17 @@ ${' '.repeat(6)}
910
910
]
911
911
}
912
912
]
913
+ } ,
914
+ {
915
+ filename : 'test.vue' ,
916
+ code : `
917
+ <i18n locale="en" lang="yaml">
918
+ ? [{foo: bar}]
919
+ : {foo: bar}
920
+ </i18n>
921
+ <template></template>
922
+ <script></script>` ,
923
+ errors : [ `unused '["[{foo: bar}]"].foo' key` ]
913
924
}
914
925
]
915
926
} )
You can’t perform that action at this time.
0 commit comments