Skip to content

Commit 662c003

Browse files
committed
Fix incorrectly flags rule valid-template-root for pug
fixes vuejs#165
1 parent 71929fa commit 662c003

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/rules/valid-template-root.js

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ function create (context) {
3131
return
3232
}
3333

34+
const lang = utils.getAttribute(element, 'lang')
35+
if (lang && lang.value.value !== 'html') {
36+
return // Ignore pug and ....
37+
}
38+
3439
const hasSrc = utils.hasAttribute(element, 'src')
3540
const rootElements = []
3641
let extraText = null

tests/lib/rules/valid-template-root.js

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ tester.run('valid-template-root', rule, {
3131
filename: 'test.vue',
3232
code: '<template><div>abc</div></template>'
3333
},
34+
{
35+
filename: 'test.vue',
36+
code: '<template lang="pug"></template>'
37+
},
3438
{
3539
filename: 'test.vue',
3640
code: '<template>\n <div>abc</div>\n</template>'

0 commit comments

Comments
 (0)