File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 88// Requirements
99// ------------------------------------------------------------------------------
1010
11+ const { isVElement } = require ( '../utils' )
12+
1113// ------------------------------------------------------------------------------
1214// Rule Definition
1315// ------------------------------------------------------------------------------
1416
1517/**
1618 * check whether has attribute `src`
19+ * @param {VElement } componentBlock
1720 */
1821function hasAttributeSrc ( componentBlock ) {
1922 const hasAttribute = componentBlock . startTag . attributes . length > 0
2023
2124 const hasSrc =
2225 componentBlock . startTag . attributes . filter (
2326 ( attribute ) =>
24- attribute . key . name === 'src' && attribute . value . value !== ''
27+ ! attribute . directive &&
28+ attribute . key . name === 'src' &&
29+ attribute . value &&
30+ attribute . value . value !== ''
2531 ) . length > 0
2632
2733 return hasAttribute && hasSrc
2834}
2935
3036/**
3137 * check whether value under the component block is only whitespaces or break lines
38+ * @param {VElement } componentBlock
3239 */
3340function isValueOnlyWhiteSpacesOrLineBreaks ( componentBlock ) {
3441 return (
@@ -63,11 +70,12 @@ module.exports = {
6370 return { }
6471 }
6572
66- const componentBlocks = context . parserServices . getDocumentFragment ( )
67- . children
73+ const componentBlocks = context . parserServices
74+ . getDocumentFragment ( )
75+ . children . filter ( isVElement )
6876
6977 return {
70- Program ( node ) {
78+ Program ( ) {
7179 for ( const componentBlock of componentBlocks ) {
7280 if (
7381 componentBlock . name !== 'template' &&
You can’t perform that action at this time.
0 commit comments