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 342bc52

Browse files
Fix tsc errors
1 parent c210505 commit 342bc52

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎lib/rules/no-empty-component-block.js‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,34 @@
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
*/
1821
function 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
*/
3340
function 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' &&

0 commit comments

Comments
(0)

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