@@ -12,13 +12,10 @@ import type { RuleContext, RuleListener } from '../types'
1212const debug = debugBuilder ( 'eslint-plugin-vue-i18n:no-html-messages' )
1313
1414function findHTMLNode (
15- node : parse5 . DefaultTreeDocumentFragment
16- ) : parse5 . DefaultTreeElement | undefined {
17- return node . childNodes . find ( ( child ) : child is parse5 . DefaultTreeElement => {
18- if (
19- child . nodeName !== '#text' &&
20- ( child as parse5 . DefaultTreeElement ) . tagName
21- ) {
15+ node : parse5 . DocumentFragment
16+ ) : parse5 . Element | undefined {
17+ return node . childNodes . find ( ( child ) : child is parse5 . Element => {
18+ if ( child . nodeName !== '#text' && ( child as parse5 . Element ) . tagName ) {
2219 return true
2320 }
2421 return false
@@ -38,7 +35,7 @@ function create(context: RuleContext): RuleListener {
3835 }
3936 const htmlNode = parse5 . parseFragment ( `${ node . value } ` , {
4037 sourceCodeLocationInfo : true
41- } ) as parse5 . DefaultTreeDocumentFragment
38+ } ) as parse5 . DocumentFragment
4239 const foundNode = findHTMLNode ( htmlNode )
4340 if ( ! foundNode ) {
4441 return
@@ -66,7 +63,7 @@ function create(context: RuleContext): RuleListener {
6663 }
6764 const htmlNode = parse5 . parseFragment ( `${ node . value } ` , {
6865 sourceCodeLocationInfo : true
69- } ) as parse5 . DefaultTreeDocumentFragment
66+ } ) as parse5 . DocumentFragment
7067 const foundNode = findHTMLNode ( htmlNode )
7168 if ( ! foundNode ) {
7269 return
0 commit comments