mirror of https://github.com/sveltejs/svelte
feat: warn on implicitly closed tags (#15932)
* warn on implicitly closed tags * lint * changeset * separate tests for parent/sibling case * account for attributes in opening tag * tweak * update message --------- Co-authored-by: 7nik <kifiranet@gmail.com> Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/15959/head
parent
7183886a73
commit
c66a43940a
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: warn on implicitly closed tags
|
@ -0,0 +1,6 @@
|
|||||||
|
<main><div class="hello"></main>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div class="hello">
|
||||||
|
<p>hello</p>
|
||||||
|
</main>
|
@ -0,0 +1,26 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "element_implicitly_closed",
|
||||||
|
"message": "This element is implicitly closed by the following `</main>`, which can cause an unexpected DOM structure. Add an explicit `</div>` to avoid surprises.",
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "element_implicitly_closed",
|
||||||
|
"message": "This element is implicitly closed by the following `</main>`, which can cause an unexpected DOM structure. Add an explicit `</div>` to avoid surprises.",
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,9 @@
|
|||||||
|
<div>
|
||||||
|
<p class="hello">
|
||||||
|
<span></span>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p class="hello"><p></p>
|
||||||
|
</div>
|
@ -0,0 +1,26 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "element_implicitly_closed",
|
||||||
|
"message": "This element is implicitly closed by the following `<p>`, which can cause an unexpected DOM structure. Add an explicit `</p>` to avoid surprises.",
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "element_implicitly_closed",
|
||||||
|
"message": "This element is implicitly closed by the following `<p>`, which can cause an unexpected DOM structure. Add an explicit `</p>` to avoid surprises.",
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in new issue