Skip to content

Commit cd32f03

Browse files
authored
Ignore blocks in vue/html-self-closing (#2223)
1 parent d1f1eea commit cd32f03

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/rules/html-self-closing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module.exports = {
131131
context,
132132
{
133133
VElement(node) {
134-
if (hasInvalidEOF) {
134+
if (hasInvalidEOF || node.parent.type === 'VDocumentFragment') {
135135
return
136136
}
137137

tests/lib/rules/html-self-closing.js

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ tester.run('html-self-closing', rule, {
6464
'<template><div a=">test</div></template>',
6565
'<template><div><!--test</div></template>',
6666

67+
// Empty top-level tags
68+
'<template></template><script></script><docs></docs>',
69+
6770
// https://github.com/vuejs/eslint-plugin-vue/issues/1403
6871
{
6972
code: `

0 commit comments

Comments
 (0)