From 0556775c8828553bcfeba078e88f7ed84463b5fb Mon Sep 17 00:00:00 2001 From: Mario Lamacchia Date: Tue, 24 Oct 2017 13:55:43 +0100 Subject: [PATCH 1/3] Add test case --- tests/lib/rules/html-end-tags.js | 4 ++++ 1 file changed, 4 insertions(+) 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: [ From 7f5750e8fd00e15ee7e7fc7f2a85d3fdc0ee874f Mon Sep 17 00:00:00 2001 From: Mario Lamacchia Date: Tue, 24 Oct 2017 13:56:11 +0100 Subject: [PATCH 2/3] Fix html-end-tags for self closing elements --- lib/rules/html-end-tags.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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, From e328b4a89eb8edaf1fcc9a1ff063ef4a79c5d34b Mon Sep 17 00:00:00 2001 From: Mario Lamacchia Date: Tue, 24 Oct 2017 13:57:38 +0100 Subject: [PATCH 3/3] Add self closing example in html-end-tags doc --- docs/rules/html-end-tags.md | 1 + 1 file changed, 1 insertion(+) 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:

+