diff --git a/docs/rules/html-end-tags.md b/docs/rules/html-end-tags.md index 059fc3fed..51acebeda 100644 --- a/docs/rules/html-end-tags.md +++ b/docs/rules/html-end-tags.md @@ -36,6 +36,7 @@ This rule reports the following elements:

+

diff --git a/lib/rules/html-end-tags.js b/lib/rules/html-end-tags.js index 9a0f5bc22..05ba6464e 100644 --- a/lib/rules/html-end-tags.js +++ b/lib/rules/html-end-tags.js @@ -27,6 +27,7 @@ function create (context) { const name = node.name const isVoid = utils.isHtmlVoidElementName(name) const hasEndTag = node.endTag != null + const isSelfClosing = node.startTag.selfClosing if (isVoid && hasEndTag) { context.report({ @@ -37,7 +38,7 @@ function create (context) { fix: (fixer) => fixer.remove(node.endTag) }) } - if (!isVoid && !hasEndTag) { + if (!isVoid && !(hasEndTag || isSelfClosing)) { context.report({ node: node.startTag, loc: node.startTag.loc, diff --git a/tests/lib/rules/html-end-tags.js b/tests/lib/rules/html-end-tags.js index b4d648d56..3884290df 100644 --- a/tests/lib/rules/html-end-tags.js +++ b/tests/lib/rules/html-end-tags.js @@ -46,6 +46,10 @@ tester.run('html-end-tags', rule, { { filename: 'test.vue', code: '' + }, + { + filename: 'test.vue', + code: '' } ], invalid: [