You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tests/lib/rules/prefer-linked-key-with-paren.ts
+13-142
Original file line number
Diff line number
Diff line change
@@ -27,16 +27,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
27
27
`,
28
28
...options.yaml()
29
29
},
30
-
{
31
-
code: `
32
-
{
33
-
"foo": {
34
-
"bar": "baz"
35
-
}
36
-
}
37
-
`,
38
-
...options.json('^8')
39
-
},
40
30
{
41
31
code: `
42
32
foo:
@@ -51,20 +41,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
51
41
`,
52
42
...options.json()
53
43
},
54
-
{
55
-
code: `
56
-
foo:
57
-
bar: "@:(baz)"
58
-
`,
59
-
...options.yaml('^8')
60
-
},
61
-
{
62
-
code: `
63
-
{"foo": {
64
-
"bar": "@:(baz)" } }
65
-
`,
66
-
...options.json('^8')
67
-
},
68
44
{
69
45
code: `
70
46
<i18n>
@@ -77,28 +53,12 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
77
53
`,
78
54
...options.vue()
79
55
},
80
-
81
-
{
82
-
// This rule cannot support two versions in the same project.
83
-
code: `
84
-
a: "@:link"
85
-
`,
86
-
...options.yaml('^8 || ^9')
87
-
},
88
-
89
56
{
90
57
// message parse error
91
58
code: `
92
59
a: "@.:link"
93
60
`,
94
61
...options.yaml('^9')
95
-
},
96
-
{
97
-
// message parse error
98
-
code: `
99
-
a: "@.:link"
100
-
`,
101
-
...options.yaml('^8')
102
62
}
103
63
],
104
64
@@ -139,42 +99,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
139
99
}
140
100
]
141
101
},
142
-
{
143
-
code: `
144
-
foo: "@:baz"
145
-
`,
146
-
...options.yaml('^8'),
147
-
output: `
148
-
foo: "@:(baz)"
149
-
`,
150
-
errors: [
151
-
{
152
-
message: 'The linked message key must be enclosed in parentheses.',
153
-
line: 2,
154
-
column: 15,
155
-
endLine: 2,
156
-
endColumn: 18
157
-
}
158
-
]
159
-
},
160
-
{
161
-
code: `
162
-
{ "foo": "@:baz" }
163
-
`,
164
-
...options.json('^8'),
165
-
output: `
166
-
{ "foo": "@:(baz)" }
167
-
`,
168
-
errors: [
169
-
{
170
-
message: 'The linked message key must be enclosed in parentheses.',
171
-
line: 2,
172
-
column: 19,
173
-
endLine: 2,
174
-
endColumn: 22
175
-
}
176
-
]
177
-
},
178
102
{
179
103
code: `
180
104
<i18n>
@@ -212,43 +136,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
212
136
}
213
137
]
214
138
},
215
-
{
216
-
code: `
217
-
<i18n>
218
-
{ "foo": "@:baz" }
219
-
</i18n>
220
-
<i18n lang="yaml">
221
-
"foo":
222
-
- "@:baz"
223
-
</i18n>
224
-
`,
225
-
...options.vue('^8'),
226
-
output: `
227
-
<i18n>
228
-
{ "foo": "@:(baz)" }
229
-
</i18n>
230
-
<i18n lang="yaml">
231
-
"foo":
232
-
- "@:(baz)"
233
-
</i18n>
234
-
`,
235
-
errors: [
236
-
{
237
-
message: 'The linked message key must be enclosed in parentheses.',
238
-
line: 3,
239
-
column: 19,
240
-
endLine: 3,
241
-
endColumn: 22
242
-
},
243
-
{
244
-
message: 'The linked message key must be enclosed in parentheses.',
245
-
line: 7,
246
-
column: 14,
247
-
endLine: 7,
248
-
endColumn: 17
249
-
}
250
-
]
251
-
},
252
139
253
140
{
254
141
code: `
@@ -304,47 +191,31 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
304
191
'The linked message key must be enclosed in brackets.'
305
192
]
306
193
},
194
+
307
195
{
308
196
code: `
309
-
a: message @:foo
310
-
b: 'message @:foo'
311
-
c: |
312
-
message @:foo
313
-
message @:foo
314
-
? [{"message @:foo": "message @:foo"}]
315
-
:
316
-
? "message @:foo"
317
-
: "foo"
318
-
`,
319
-
...options.yaml('^8'),
320
-
output: `
321
-
a: message @:(foo)
322
-
b: 'message @:(foo)'
323
-
c: |
324
-
message @:foo
325
-
message @:foo
326
-
? [{"message @:foo": "message @:foo"}]
327
-
:
328
-
? "message @:foo"
329
-
: "foo"
197
+
a: "@:(link)"
198
+
b: "@:{'link'}"
330
199
`,
200
+
...options.yaml(null),
201
+
output: null,
331
202
errors: [
332
-
'The linked message key must be enclosed in parentheses.',
333
-
'The linked message key must be enclosed in parentheses.',
334
-
'The linked message key must be enclosed in parentheses.',
335
-
'The linked message key must be enclosed in parentheses.'
203
+
`If you want to use '${TEST_RULE_ID_PREFIX}prefer-linked-key-with-paren' rule, you need to set 'messageSyntaxVersion' at 'settings'. See the 'eslint-plugin-vue-i18n' documentation`
336
204
]
337
205
},
338
206
339
207
{
340
208
code: `
341
-
a: "@:(link)"
342
-
b: "@:{'link'}"
209
+
{
210
+
"foo": {
211
+
"bar": "baz"
212
+
}
213
+
}
343
214
`,
344
-
...options.yaml(null),
215
+
...options.json('^8'),
345
216
output: null,
346
217
errors: [
347
-
`If you want to use '${TEST_RULE_ID_PREFIX}prefer-linked-key-with-paren' rule, you need to set 'messageSyntaxVersion' at 'settings'. See the 'eslint-plugin-vue-i18n' documentation`
218
+
"Please specify 9 or higher for 'messageSyntaxVersion' at 'settings'."
Copy file name to clipboardexpand all lines: tests/lib/rules/valid-message-syntax.ts
+2-237
Original file line number
Diff line number
Diff line change
@@ -21,16 +21,6 @@ const options = {
21
21
}
22
22
}
23
23
},
24
-
v8: {
25
-
languageOptions: {parser: jsonParser},
26
-
filename: join(localesRoot,'test.json'),
27
-
settings: {
28
-
'vue-i18n': {
29
-
localeDir: `${localesRoot}/*.{json,yaml,yml}`,
30
-
messageSyntaxVersion: '^8.0.0'
31
-
}
32
-
}
33
-
},
34
24
v9: {
35
25
languageOptions: {parser: jsonParser},
36
26
filename: join(localesRoot,'test.json'),
@@ -52,16 +42,6 @@ const options = {
52
42
}
53
43
}
54
44
},
55
-
v8: {
56
-
languageOptions: {parser: yamlParser},
57
-
filename: join(localesRoot,'test.yaml'),
58
-
settings: {
59
-
'vue-i18n': {
60
-
localeDir: `${localesRoot}/*.{json,yaml,yml}`,
61
-
messageSyntaxVersion: '^8.0.0'
62
-
}
63
-
}
64
-
},
65
45
v9: {
66
46
languageOptions: {parser: yamlParser},
67
47
filename: join(localesRoot,'test.yaml'),
@@ -118,18 +98,6 @@ tester.run('valid-message-syntax', rule as never, {
118
98
`,
119
99
...options.yaml.default
120
100
},
121
-
{
122
-
code: `
123
-
key: message {foo}
124
-
`,
125
-
...options.yaml.v8
126
-
},
127
-
{
128
-
code: `
129
-
key: message @:(v8)
130
-
`,
131
-
...options.yaml.v8
132
-
},
133
101
{
134
102
code: `
135
103
key: message {foo}
@@ -164,20 +132,10 @@ tester.run('valid-message-syntax', rule as never, {
164
132
line: 3,
165
133
column: 32
166
134
},
167
-
{
168
-
message: 'Unexpected placeholder key',
169
-
line: 3,
170
-
column: 32
171
-
},
172
135
{
173
136
message: 'Not allowed nest placeholder',
174
137
line: 4,
175
138
column: 33
176
-
},
177
-
{
178
-
message: 'Unexpected placeholder key',
179
-
line: 4,
180
-
column: 33
181
139
}
182
140
]
183
141
},
@@ -202,136 +160,6 @@ tester.run('valid-message-syntax', rule as never, {
202
160
}
203
161
]
204
162
},
205
-
{
206
-
code: `
207
-
{
208
-
"list-hello": "Hello! {{0}}",
209
-
"named-hello": "Hello! {{name}}"
210
-
}
211
-
`,
212
-
...options.json.v8,
213
-
errors: [
214
-
{
215
-
message: 'Unexpected placeholder key',
216
-
line: 3,
217
-
column: 32
218
-
},
219
-
{
220
-
message: 'Unexpected placeholder key',
221
-
line: 4,
222
-
column: 33
223
-
}
224
-
]
225
-
},
226
-
// {
227
-
// // The syntax is now allowed.
228
-
// code: `
229
-
// key: message @:(v8)
230
-
// `,
231
-
// ...options.yaml.default,
232
-
// errors: [
233
-
// {
234
-
// message: `If you want to use '${TEST_RULE_ID_PREFIX}valid-message-syntax' rule, you need to set 'messageSyntaxVersion' at 'settings'. See the 'eslint-plugin-vue-i18n' documentation`,
235
-
// line: 1,
236
-
// column: 1
237
-
// },
238
-
// {
239
-
// message: 'Unexpected empty linked key',
240
-
// line: 2,
241
-
// column: 21
242
-
// }
243
-
// ]
244
-
// },
245
-
{
246
-
code: `
247
-
key: message { v9 }
248
-
`,
249
-
...options.yaml.default,
250
-
errors: [
251
-
{
252
-
message: `If you want to use '${TEST_RULE_ID_PREFIX}valid-message-syntax' rule, you need to set 'messageSyntaxVersion' at 'settings'. See the 'eslint-plugin-vue-i18n' documentation`,
253
-
line: 1,
254
-
column: 1
255
-
},
256
-
{
257
-
message: 'Unexpected space before or after the placeholder key',
258
-
line: 2,
259
-
column: 21
260
-
}
261
-
]
262
-
},
263
-
{
264
-
code: `
265
-
key: message { v9 }
266
-
`,
267
-
...options.yaml.v8,
268
-
errors: [
269
-
{
270
-
message: 'Unexpected space before or after the placeholder key',
271
-
line: 2,
272
-
column: 21
273
-
}
274
-
]
275
-
},
276
-
// {
277
-
// // The syntax is now allowed.
278
-
// code: `
279
-
// key: message @:(v8)
280
-
// `,
281
-
// ...options.yaml.v9,
282
-
// errors: [
283
-
// {
284
-
// message: 'Unexpected empty linked key',
285
-
// line: 2,
286
-
// column: 21
287
-
// }
288
-
// ]
289
-
// },
290
-
// {
291
-
// // The syntax is now allowed.
292
-
// code: `
293
-
// key: message new line
294
-
// @:(v8)
295
-
// `,
296
-
// ...options.yaml.v9,
297
-
// errors: [
298
-
// {
299
-
// message: 'Unexpected empty linked key',
300
-
// line: 3,
301
-
// column: 10
302
-
// }
303
-
// ]
304
-
// },
305
-
// {
306
-
// // The syntax is now allowed.
307
-
// code: `
308
-
// key: "message new line
309
-
// @:(v8)"
310
-
// `,
311
-
// ...options.yaml.v9,
312
-
// errors: [
313
-
// {
314
-
// message: 'Unexpected empty linked key',
315
-
// line: 3,
316
-
// column: 10
317
-
// }
318
-
// ]
319
-
// },
320
-
// {
321
-
// // The syntax is now allowed.
322
-
// code: `
323
-
// key: 'message new line
324
-
// @:(v8)'
325
-
// `,
326
-
// ...options.yaml.v9,
327
-
// errors: [
328
-
// {
329
-
// message: 'Unexpected empty linked key',
330
-
// line: 3,
331
-
// column: 10
332
-
// }
333
-
// ]
334
-
// },
335
163
{
336
164
code: `
337
165
<i18n lang="yaml">
@@ -344,6 +172,7 @@ tester.run('valid-message-syntax', rule as never, {
344
172
a: "message {invalid"
345
173
b: [ "message {valid}" ]
346
174
</i18n>
175
+
<!-- with v9 -->
347
176
`,
348
177
...options.vue.v9,
349
178
errors: [
@@ -371,6 +200,7 @@ tester.run('valid-message-syntax', rule as never, {
371
200
a: "message {invalid"
372
201
b: [ "message {valid}" ]
373
202
</i18n>
203
+
<!-- with default -->
374
204
`,
375
205
...options.vue.default,
376
206
errors: [
@@ -384,78 +214,13 @@ tester.run('valid-message-syntax', rule as never, {
384
214
line: 4,
385
215
column: 22
386
216
},
387
-
{
388
-
message: 'Unterminated closing brace',
389
-
line: 4,
390
-
column: 22
391
-
},
392
-
{
393
-
message: 'Unterminated closing brace',
394
-
line: 9,
395
-
column: 22
396
-
},
397
217
{
398
218
message: 'Unterminated closing brace',
399
219
line: 9,
400
220
column: 22
401
221
}
402
222
]
403
223
},
404
-
405
-
{
406
-
code: `
407
-
{
408
-
"foo": {
409
-
"a": "message {invalid",
410
-
"b": [ "message { v8invalid }" ],
411
-
"c": \`message
412
-
@.:invalid"\`,
413
-
"d": 42,
414
-
"e": /message/,
415
-
"f": ["message valid",,"message valid"]
416
-
}
417
-
}
418
-
`,
419
-
...options.json.v8,
420
-
errors: [
421
-
{
422
-
message: 'Unterminated closing brace',
423
-
line: 4,
424
-
column: 26
425
-
},
426
-
{
427
-
message: 'Unexpected space before or after the placeholder key',
0 commit comments