Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd6ed4f

Browse files
armano2mysticatea
authored andcommitted
Fix: Ignore templates with 'src' attribute in no-unused-components (fixes #598)(#607)
1 parent 096949b commit dd6ed4f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

‎lib/rules/no-unused-components.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ module.exports = {
6666
"VElement[name='template']:exit" (rootNode) {
6767
if (
6868
rootNode.loc.start !== templateLocation ||
69-
ignoreReporting
69+
ignoreReporting ||
70+
utils.hasAttribute(rootNode, 'src')
7071
) return
7172

7273
registeredComponents

‎tests/lib/rules/no-unused-components.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ tester.run('no-unused-components', rule, {
334334
options: [{ ignoreWhenBindingPresent: true }]
335335
},
336336

337-
// Ignore when `render` is used instead of temoplate
337+
// Ignore when `render` is used instead of template
338338
{
339339
filename: 'test.vue',
340340
code: `
@@ -348,6 +348,30 @@ tester.run('no-unused-components', rule, {
348348
}
349349
}
350350
</script>`
351+
},
352+
{
353+
filename: 'test.vue',
354+
code: `
355+
<template src="./test.html" />
356+
<script>
357+
export default {
358+
components: {
359+
TheButton
360+
}
361+
}
362+
</script>`
363+
},
364+
{
365+
filename: 'test.vue',
366+
code: `
367+
<template src="./test.html"></template>
368+
<script>
369+
export default {
370+
components: {
371+
TheButton
372+
}
373+
}
374+
</script>`
351375
}
352376
],
353377
invalid: [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /