Skip to content

Commit 7f58627

Browse files
committed
fix: patch heading-has-content rule
1 parent 28280bb commit 7f58627

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

lib/rules/heading-has-content.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ module.exports = {
3434
return;
3535
} else if (utils.hasAccessibleChild(node)) {
3636
return;
37+
} else if (utils.getDirective(node, 'text')) {
38+
return;
3739
}
3840

3941
context.report({

tests/lib/rules/heading-has-content.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var tester = new RuleTester({
2121

2222
tester.run('heading-has-content', rule, {
2323
valid: [
24-
{
24+
{
2525
filename: 'test.vue',
2626
code: '<template><h1 v-text="msg"></h1></template>',
2727
},
@@ -30,24 +30,26 @@ tester.run('heading-has-content', rule, {
3030
code: '<template><h1><span>test</span></h1></template>',
3131
},
3232
],
33-
invalid: [{
34-
filename: 'test.vue',
35-
code: '<template><h1></h1></template>',
36-
errors: [{
37-
message: errorMessage
38-
}]
39-
},{
40-
code: `
41-
export default {
42-
render (h) {
43-
return (
44-
<h2></h2>
45-
)
46-
},
47-
}
48-
`,
49-
errors: [{
50-
message: errorMessage
51-
}]
52-
}],
33+
invalid: [
34+
{
35+
filename: 'test.vue',
36+
code: '<template><h1></h1></template>',
37+
errors: [{
38+
message: errorMessage
39+
}]
40+
},{
41+
code: `
42+
export default {
43+
render (h) {
44+
return (
45+
<h2></h2>
46+
)
47+
},
48+
}
49+
`,
50+
errors: [{
51+
message: errorMessage
52+
}]
53+
}
54+
],
5355
});

0 commit comments

Comments
 (0)