Skip to content

Commit 1d4beb7

Browse files
authoredMar 5, 2025··
Drop support for vue-i18n v8 syntax (#616)
* Drop support for vue-i18n v8 syntax * Create cyan-needles-sniff.md * fix
1 parent 830c5f8 commit 1d4beb7

14 files changed

+60
-1445
lines changed
 

‎.changeset/cyan-needles-sniff.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@intlify/eslint-plugin-vue-i18n": major
3+
---
4+
5+
Drop support for vue-i18n v8 syntax

‎docs/.vitepress/components/eslint-code-block.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default {
5858
},
5959
messageSyntaxVersion: {
6060
type: String,
61-
default: '^9'
61+
default: '^11'
6262
}
6363
},
6464

‎docs/started.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default [
7373

7474
// Specify the version of `vue-i18n` you are using.
7575
// If not specified, the message will be parsed twice.
76-
messageSyntaxVersion: '^9.0.0'
76+
messageSyntaxVersion: '^11.0.0'
7777
}
7878
}
7979
}
@@ -144,7 +144,7 @@ module.exports = {
144144

145145
// Specify the version of `vue-i18n` you are using.
146146
// If not specified, the message will be parsed twice.
147-
messageSyntaxVersion: '^9.0.0'
147+
messageSyntaxVersion: '^11.0.0'
148148
}
149149
}
150150
}

‎lib/rules/prefer-linked-key-with-paren.ts

+2-56
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
NodeTypes
2020
} from '../utils/message-compiler/utils'
2121
import { parse } from '../utils/message-compiler/parser'
22-
import { parse as parseForV8 } from '../utils/message-compiler/parser-v8'
2322
import { traverseNode } from '../utils/message-compiler/traverser'
2423
import { getFilename, getSourceCode } from '../utils/compat'
2524

@@ -42,7 +41,7 @@ function create(context: RuleContext): RuleListener {
4241
const sourceCode = getSourceCode(context)
4342
const messageSyntaxVersions = getMessageSyntaxVersions(context)
4443

45-
function verifyForNewSyntax(
44+
function verifySyntax(
4645
message: string,
4746
reportNode: JSONAST.JSONStringLiteral | YAMLAST.YAMLScalar,
4847
getReportOffset: GetReportOffset
@@ -83,49 +82,6 @@ function create(context: RuleContext): RuleListener {
8382
})
8483
}
8584

86-
function verifyForV8(
87-
message: string,
88-
reportNode: JSONAST.JSONStringLiteral | YAMLAST.YAMLScalar,
89-
getReportOffset: GetReportOffset
90-
) {
91-
const { ast, errors } = parseForV8(message)
92-
if (errors.length) {
93-
return
94-
}
95-
traverseNode(ast, node => {
96-
if (node.type !== NodeTypes.LinkedKey) {
97-
return
98-
}
99-
if (message[node.loc!.start.offset - 1] === '(') {
100-
return
101-
}
102-
let range: [number, number] | null = null
103-
const start = getReportOffset(node.loc!.start.offset)
104-
const end = getReportOffset(node.loc!.end.offset)
105-
if (start != null && end != null) {
106-
range = [start, end]
107-
}
108-
context.report({
109-
loc: range
110-
? {
111-
start: sourceCode.getLocFromIndex(range[0]),
112-
end: sourceCode.getLocFromIndex(range[1])
113-
}
114-
: reportNode.loc,
115-
message: 'The linked message key must be enclosed in parentheses.',
116-
fix(fixer) {
117-
if (!range) {
118-
return null
119-
}
120-
return [
121-
fixer.insertTextBeforeRange(range, '('),
122-
fixer.insertTextAfterRange(range, ')')
123-
]
124-
}
125-
})
126-
})
127-
}
128-
12985
function verifyMessage(
13086
message: string,
13187
reportNode: JSONAST.JSONStringLiteral | YAMLAST.YAMLScalar,
@@ -134,18 +90,8 @@ function create(context: RuleContext): RuleListener {
13490
if (messageSyntaxVersions.reportIfMissingSetting()) {
13591
return
13692
}
137-
const newSyntax = messageSyntaxVersions.v9 || messageSyntaxVersions.v10
138-
const v8Syntax = messageSyntaxVersions.v8
139-
if (newSyntax && v8Syntax) {
140-
// This rule cannot support two versions in the same project.
141-
return
142-
}
14393

144-
if (newSyntax) {
145-
verifyForNewSyntax(message, reportNode, getReportOffset)
146-
} else if (v8Syntax) {
147-
verifyForV8(message, reportNode, getReportOffset)
148-
}
94+
verifySyntax(message, reportNode, getReportOffset)
14995
}
15096

15197
const createVisitorForJson = defineCreateVisitorForJson(verifyMessage)

‎lib/rules/valid-message-syntax.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
} from '../utils/message-compiler/utils'
1616
import { parse } from '../utils/message-compiler/parser'
1717
import { parse as parseForV9 } from '../utils/message-compiler/parser-v9'
18-
import { parse as parseForV8 } from '../utils/message-compiler/parser-v8'
1918
import type { CompileError } from '@intlify/message-compiler'
2019
import { createRule } from '../utils/rule'
2120
import { getFilename, getSourceCode } from '../utils/compat'
@@ -28,19 +27,15 @@ function create(context: RuleContext): RuleListener {
2827
const messageSyntaxVersions = getMessageSyntaxVersions(context)
2928

3029
function* extractMessageErrors(message: string) {
31-
// v10 and v9 generate nearly identical errors so only one of them will be returned.
32-
const errorsForV10OrV9: CompileError[] = []
33-
if (messageSyntaxVersions.v10) {
34-
errorsForV10OrV9.push(...parse(message).errors)
30+
// v10/v11 and v9 generate nearly identical errors so only one of them will be returned.
31+
const errors: CompileError[] = []
32+
if (messageSyntaxVersions.v10 || messageSyntaxVersions.v11) {
33+
errors.push(...parse(message).errors)
3534
}
36-
if (messageSyntaxVersions.v9 && !errorsForV10OrV9.length) {
37-
errorsForV10OrV9.push(...parseForV9(message).errors)
38-
}
39-
yield* errorsForV10OrV9
40-
41-
if (messageSyntaxVersions.v8) {
42-
yield* parseForV8(message).errors
35+
if (messageSyntaxVersions.v9 && !errors.length) {
36+
errors.push(...parseForV9(message).errors)
4337
}
38+
yield* errors
4439
}
4540
function verifyMessage(
4641
message: string | number | undefined | null | boolean | bigint | RegExp,

‎lib/utils/collect-linked-keys.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { traverseNode } from './message-compiler/traverser'
77
import type { I18nLocaleMessageDictionary, RuleContext } from '../types'
88
import { parse } from './message-compiler/parser'
99
import { parse as parseForV9 } from './message-compiler/parser-v9'
10-
import { parse as parseForV8 } from './message-compiler/parser-v8'
1110
import type { MessageSyntaxVersions } from './message-compiler/utils'
1211
import { NodeTypes } from './message-compiler/utils'
1312
import { getMessageSyntaxVersions } from './message-compiler/utils'
@@ -28,15 +27,12 @@ function* extractUsedKeysFromLinks(
2827
if (typeof value === 'object') {
2928
yield* extractUsedKeysFromLinks(value, messageSyntaxVersions)
3029
} else if (typeof value === 'string') {
31-
if (messageSyntaxVersions.v10) {
30+
if (messageSyntaxVersions.v10 || messageSyntaxVersions.v11) {
3231
yield* extractUsedKeysFromAST(parse(value).ast)
3332
}
3433
if (messageSyntaxVersions.v9) {
3534
yield* extractUsedKeysFromAST(parseForV9(value).ast)
3635
}
37-
if (messageSyntaxVersions.v8) {
38-
yield* extractUsedKeysFromAST(parseForV8(value).ast)
39-
}
4036
}
4137
}
4238
}

‎lib/utils/message-compiler/parser-v8.ts

-333
This file was deleted.

‎lib/utils/message-compiler/utils.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export const NodeTypes = {
1717
} as const
1818

1919
export type MessageSyntaxVersions = {
20-
v8: boolean
2120
v9: boolean
2221
v10: boolean
22+
v11: boolean
2323
isNotSet: boolean
2424
reportIfMissingSetting: () => boolean
2525
}
@@ -36,9 +36,9 @@ export function getMessageSyntaxVersions(
3636

3737
if (!messageSyntaxVersion) {
3838
return {
39-
v8: true,
4039
v9: true,
4140
v10: true,
41+
v11: true,
4242
isNotSet: true,
4343
reportIfMissingSetting: () => {
4444
if (!puttedSettingsError.has(context)) {
@@ -54,10 +54,20 @@ export function getMessageSyntaxVersions(
5454
}
5555
}
5656
const range = new Range(messageSyntaxVersion)
57+
const v9 = intersects(range, '^9.0.0-0')
58+
const v10 = intersects(range, '^10.0.0-0')
59+
const v11 = intersects(range, '>=11.0.0-0')
60+
if (!v9 && !v10 && !v11 && !puttedSettingsError.has(context)) {
61+
context.report({
62+
loc: { line: 1, column: 0 },
63+
message: `Please specify 9 or higher for 'messageSyntaxVersion' at 'settings'.`
64+
})
65+
puttedSettingsError.add(context)
66+
}
5767
return {
58-
v8: intersects(range, '^8.0.0 || <=8.0.0'),
59-
v9: intersects(range, '^9.0.0-0'),
60-
v10: intersects(range, '>=10.0.0-0'),
68+
v9,
69+
v10,
70+
v11,
6171
isNotSet: false,
6272
reportIfMissingSetting: () => false
6373
}

‎tests/lib/rules/prefer-linked-key-with-paren.ts

+13-142
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
2727
`,
2828
...options.yaml()
2929
},
30-
{
31-
code: `
32-
{
33-
"foo": {
34-
"bar": "baz"
35-
}
36-
}
37-
`,
38-
...options.json('^8')
39-
},
4030
{
4131
code: `
4232
foo:
@@ -51,20 +41,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
5141
`,
5242
...options.json()
5343
},
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-
},
6844
{
6945
code: `
7046
<i18n>
@@ -77,28 +53,12 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
7753
`,
7854
...options.vue()
7955
},
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-
8956
{
9057
// message parse error
9158
code: `
9259
a: "@.:link"
9360
`,
9461
...options.yaml('^9')
95-
},
96-
{
97-
// message parse error
98-
code: `
99-
a: "@.:link"
100-
`,
101-
...options.yaml('^8')
10262
}
10363
],
10464

@@ -139,42 +99,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
13999
}
140100
]
141101
},
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-
},
178102
{
179103
code: `
180104
<i18n>
@@ -212,43 +136,6 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
212136
}
213137
]
214138
},
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-
},
252139

253140
{
254141
code: `
@@ -304,47 +191,31 @@ tester.run('prefer-linked-key-with-paren', rule as never, {
304191
'The linked message key must be enclosed in brackets.'
305192
]
306193
},
194+
307195
{
308196
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'}"
330199
`,
200+
...options.yaml(null),
201+
output: null,
331202
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`
336204
]
337205
},
338206

339207
{
340208
code: `
341-
a: "@:(link)"
342-
b: "@:{'link'}"
209+
{
210+
"foo": {
211+
"bar": "baz"
212+
}
213+
}
343214
`,
344-
...options.yaml(null),
215+
...options.json('^8'),
345216
output: null,
346217
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'."
348219
]
349220
}
350221
]

‎tests/lib/rules/valid-message-syntax.ts

+2-237
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ const options = {
2121
}
2222
}
2323
},
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-
},
3424
v9: {
3525
languageOptions: { parser: jsonParser },
3626
filename: join(localesRoot, 'test.json'),
@@ -52,16 +42,6 @@ const options = {
5242
}
5343
}
5444
},
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-
},
6545
v9: {
6646
languageOptions: { parser: yamlParser },
6747
filename: join(localesRoot, 'test.yaml'),
@@ -118,18 +98,6 @@ tester.run('valid-message-syntax', rule as never, {
11898
`,
11999
...options.yaml.default
120100
},
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-
},
133101
{
134102
code: `
135103
key: message {foo}
@@ -164,20 +132,10 @@ tester.run('valid-message-syntax', rule as never, {
164132
line: 3,
165133
column: 32
166134
},
167-
{
168-
message: 'Unexpected placeholder key',
169-
line: 3,
170-
column: 32
171-
},
172135
{
173136
message: 'Not allowed nest placeholder',
174137
line: 4,
175138
column: 33
176-
},
177-
{
178-
message: 'Unexpected placeholder key',
179-
line: 4,
180-
column: 33
181139
}
182140
]
183141
},
@@ -202,136 +160,6 @@ tester.run('valid-message-syntax', rule as never, {
202160
}
203161
]
204162
},
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-
// },
335163
{
336164
code: `
337165
<i18n lang="yaml">
@@ -344,6 +172,7 @@ tester.run('valid-message-syntax', rule as never, {
344172
a: "message {invalid"
345173
b: [ "message {valid}" ]
346174
</i18n>
175+
<!-- with v9 -->
347176
`,
348177
...options.vue.v9,
349178
errors: [
@@ -371,6 +200,7 @@ tester.run('valid-message-syntax', rule as never, {
371200
a: "message {invalid"
372201
b: [ "message {valid}" ]
373202
</i18n>
203+
<!-- with default -->
374204
`,
375205
...options.vue.default,
376206
errors: [
@@ -384,78 +214,13 @@ tester.run('valid-message-syntax', rule as never, {
384214
line: 4,
385215
column: 22
386216
},
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-
},
397217
{
398218
message: 'Unterminated closing brace',
399219
line: 9,
400220
column: 22
401221
}
402222
]
403223
},
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',
428-
line: 5,
429-
column: 28
430-
},
431-
{
432-
message: 'Expected linked modifier value',
433-
line: 7,
434-
column: 14
435-
},
436-
{
437-
message: "Unexpected 'number' message",
438-
line: 8,
439-
column: 16,
440-
endLine: 8,
441-
endColumn: 18
442-
},
443-
{
444-
message: "Unexpected 'RegExp' message",
445-
line: 9,
446-
column: 16,
447-
endLine: 9,
448-
endColumn: 25
449-
},
450-
{
451-
message: "Unexpected 'null' message",
452-
line: 10,
453-
column: 16,
454-
endLine: 10,
455-
endColumn: 50
456-
}
457-
]
458-
},
459224
{
460225
code: `
461226
foo:

‎tests/lib/utils/collect-linked-keys.ts

+3-21
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,7 @@ describe('collectLinkedKeys', () => {
3939
const expected = ['message.homeAddress']
4040
deepStrictEqual(collectLinkedKeys(object, createContext()), expected)
4141
})
42-
it('should be get the keys used in the linked message with brackets.', () => {
43-
const object = {
44-
message: {
45-
dio: 'DIO',
46-
linked: "There's a reason, you lost, @:(message.dio)."
47-
}
48-
}
49-
50-
const expected = ['message.dio']
51-
deepStrictEqual(collectLinkedKeys(object, createContext()), expected)
52-
})
53-
it('should be get the keys used in the linked message for v9.', () => {
42+
it('should be get the keys used in the linked message.', () => {
5443
const object = {
5544
message: {
5645
dio: 'DIO',
@@ -97,22 +86,15 @@ describe('collectLinkedKeys', () => {
9786
expected
9887
)
9988
})
100-
it('v8', () => {
101-
const expected = ['bar.a', 'bar.b', 'bar.c.a', 'foo.a', 'foo.b']
102-
deepStrictEqual(
103-
collectLinkedKeys(object as never, createContext('^8.0.0')).sort(),
104-
expected
105-
)
106-
})
10789
it('default', () => {
108-
const expected = ['bar.a', 'bar.b', 'bar.c.a', 'bar.d', 'foo.a', 'foo.b']
90+
const expected = ['bar.a', 'bar.c.a', 'bar.d', 'foo.a', 'foo.b']
10991
deepStrictEqual(
11092
collectLinkedKeys(object as never, createContext()).sort(),
11193
expected
11294
)
11395
})
11496
it('>=v8', () => {
115-
const expected = ['bar.a', 'bar.b', 'bar.c.a', 'bar.d', 'foo.a', 'foo.b']
97+
const expected = ['bar.a', 'bar.c.a', 'bar.d', 'foo.a', 'foo.b']
11698
deepStrictEqual(
11799
collectLinkedKeys(object as never, createContext('>=8.0.0')).sort(),
118100
expected

‎tests/lib/utils/message-compiler/parser-v8-data.ts

-475
This file was deleted.

‎tests/lib/utils/message-compiler/parser-v8.ts

-141
This file was deleted.

‎tests/lib/utils/message-compiler/utils.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,34 @@ describe('message-compiler utils', () => {
1818
return data
1919
}
2020
it('should be equal to the expected value', () => {
21-
deepStrictEqual(get('^8.0.0'), {
22-
v8: true,
23-
v9: false,
24-
v10: false,
25-
isNotSet: false
26-
})
2721
deepStrictEqual(get('^9.0.0'), {
28-
v8: false,
2922
v9: true,
3023
v10: false,
24+
v11: false,
3125
isNotSet: false
3226
})
33-
deepStrictEqual(get('^7.0.0'), {
34-
v8: true,
27+
deepStrictEqual(get('^10.0.0'), {
3528
v9: false,
36-
v10: false,
29+
v10: true,
30+
v11: false,
3731
isNotSet: false
3832
})
39-
deepStrictEqual(get('^10.0.0'), {
40-
v8: false,
33+
deepStrictEqual(get('^11.0.0'), {
4134
v9: false,
42-
v10: true,
35+
v10: false,
36+
v11: true,
4337
isNotSet: false
4438
})
4539
deepStrictEqual(get('>=5.0.0'), {
46-
v8: true,
4740
v9: true,
4841
v10: true,
42+
v11: true,
4943
isNotSet: false
5044
})
5145
deepStrictEqual(get('^9.0.0-beta.8'), {
52-
v8: false,
5346
v9: true,
5447
v10: false,
48+
v11: false,
5549
isNotSet: false
5650
})
5751
})

0 commit comments

Comments
 (0)
Please sign in to comment.