mirror of https://github.com/sveltejs/svelte
parent
b70b5dfdde
commit
0fc9ea08ff
@ -0,0 +1,17 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "assignment-to-const",
|
||||||
|
"message": "You are assigning to a const",
|
||||||
|
"start": {
|
||||||
|
"line": 14,
|
||||||
|
"column": 3,
|
||||||
|
"character": 172
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 14,
|
||||||
|
"column": 10,
|
||||||
|
"character": 179
|
||||||
|
},
|
||||||
|
"pos": 172
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<script>
|
||||||
|
const foo = 'hello';
|
||||||
|
|
||||||
|
function shouldNotError() {
|
||||||
|
let foo = 0;
|
||||||
|
|
||||||
|
function inner() {
|
||||||
|
foo = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldError() {
|
||||||
|
function inner() {
|
||||||
|
foo = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={shouldNotError}>click</button>
|
||||||
|
<button on:click={shouldError}>click</button>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "assignment-to-const",
|
||||||
|
"message": "You are assigning to a const",
|
||||||
|
"start": {
|
||||||
|
"line": 17,
|
||||||
|
"column": 2,
|
||||||
|
"character": 189
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 17,
|
||||||
|
"column": 9,
|
||||||
|
"character": 196
|
||||||
|
},
|
||||||
|
"pos": 189
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
const foo = 'hello';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={() => {
|
||||||
|
let foo = 0;
|
||||||
|
|
||||||
|
function inner() {
|
||||||
|
foo = 1;
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
click
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button on:click={() => {
|
||||||
|
function inner() {
|
||||||
|
foo = 1;
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
click
|
||||||
|
</button>
|
||||||
Loading…
Reference in new issue