Reword invalid_rest_eachblock_binding warning to better communicate about variables in nested rest properties

pull/8555/head
Nguyen Tran 3 years ago
parent 561c602e84
commit af865cd40a

@ -220,7 +220,7 @@ export default {
},
invalid_rest_eachblock_binding: (rest_element_name: string) => ({
code: 'invalid-rest-eachblock-binding',
message: `...${rest_element_name} operator will create a new object and binding propagation with original object will not work`
message: `The rest operator (...) will create a new object and binding '${rest_element_name}' with original object will not work`
}),
avoid_mouse_events_on_document: {
code: 'avoid-mouse-events-on-document',

@ -1,8 +1,8 @@
[
{
"code": "invalid-rest-eachblock-binding",
"message": "...rest operator will create a new object and binding propagation with original object will not work",
"start": { "line": 8, "column": 24 },
"message": "The rest operator (...) will create a new object and binding 'rest' with original object will not work",
"start": { "line": 8, "column": 27 },
"end": { "line": 8, "column": 31 }
}
]

@ -1,8 +1,8 @@
[
{
"code": "invalid-rest-eachblock-binding",
"message": "...rest operator will create a new object and binding propagation with original object will not work",
"start": { "line": 5, "column": 32 },
"message": "The rest operator (...) will create a new object and binding 'rest' with original object will not work",
"start": { "line": 5, "column": 35 },
"end": { "line": 5, "column": 39 }
}
]

@ -0,0 +1,9 @@
<script>
const a = [[1, 2, 3, 4, 5]];
</script>
{#each a as [first, second, ...[third, ...{ length }]]}
<p>{first}, {second}, {length}</p>
<input bind:value={third} />
<input bind:value={length} />
{/each}

@ -0,0 +1,26 @@
[
{
"code": "invalid-rest-eachblock-binding",
"end": {
"column": 37,
"line": 5
},
"message": "The rest operator (...) will create a new object and binding 'third' with original object will not work",
"start": {
"column": 32,
"line": 5
}
},
{
"code": "invalid-rest-eachblock-binding",
"end": {
"column": 50,
"line": 5
},
"message": "The rest operator (...) will create a new object and binding 'length' with original object will not work",
"start": {
"column": 44,
"line": 5
}
}
]

@ -1,8 +1,8 @@
[
{
"code": "invalid-rest-eachblock-binding",
"message": "...rest operator will create a new object and binding propagation with original object will not work",
"start": { "line": 5, "column": 25 },
"message": "The rest operator (...) will create a new object and binding 'rest' with original object will not work",
"start": { "line": 5, "column": 28 },
"end": { "line": 5, "column": 32 }
}
]

Loading…
Cancel
Save