mirror of https://github.com/sveltejs/svelte
Adds a compiler warning that warns about legacy component instantiation (i.e. using `new Component(..)`). This won't catch all cases, but the most obvious ones which probably make up ~80%pull/12648/head
parent
e417d3a2d2
commit
4d8bcd9302
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import Foo from './Somewhere.svelte';
|
||||
import Bar from './somewhereelse';
|
||||
|
||||
let Baz;
|
||||
|
||||
new Foo();
|
||||
new Bar();
|
||||
new Baz();
|
||||
</script>
|
||||
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "legacy_component_creation",
|
||||
"end": {
|
||||
"column": 10,
|
||||
"line": 7
|
||||
},
|
||||
"message": "Svelte 5 components are no longer classes. Instantiate them using `mount` or `hydrate` (imported from 'svelte') instead.",
|
||||
"start": {
|
||||
"column": 1,
|
||||
"line": 7
|
||||
}
|
||||
}
|
||||
]
|
||||
Loading…
Reference in new issue