File tree 2 files changed +41
-6
lines changed
2 files changed +41
-6
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ module.exports.defineVisitor = function create(
301
301
tokenStore . getTokenAfter ( node )
302
302
303
303
/** @type {SourceCode.CursorWithSkipOptions } */
304
- const option = {
304
+ const cursorOptions = {
305
305
includeComments : true ,
306
306
filter : ( token ) =>
307
307
token != null &&
@@ -311,11 +311,11 @@ module.exports.defineVisitor = function create(
311
311
token . type === 'HTMLEndTagOpen' ||
312
312
token . type === 'HTMLComment' )
313
313
}
314
- for ( const token of tokenStore . getTokensBetween (
315
- node . startTag ,
316
- endToken ,
317
- option
318
- ) ) {
314
+ const contentTokens = endToken
315
+ ? tokenStore . getTokensBetween ( node . startTag , endToken , cursorOptions )
316
+ : tokenStore . getTokensAfter ( node . startTag , cursorOptions )
317
+
318
+ for ( const token of contentTokens ) {
319
319
ignoreTokens . add ( token )
320
320
}
321
321
ignoreTokens . add ( endToken )
Original file line number Diff line number Diff line change @@ -403,6 +403,22 @@ tester.run(
403
403
text <span /> <!-- comment --></pre>
404
404
</template>
405
405
`
406
+ } ,
407
+ {
408
+ filename : 'test.vue' ,
409
+ code : unIndent `
410
+ <template>
411
+ <textarea>
412
+ </template>
413
+ `
414
+ } ,
415
+ {
416
+ filename : 'test.vue' ,
417
+ code : unIndent `
418
+ <template>
419
+ <pre>
420
+ </template>
421
+ `
406
422
}
407
423
] ,
408
424
@@ -929,6 +945,25 @@ tester.run(
929
945
line : 2
930
946
}
931
947
]
948
+ } ,
949
+ {
950
+ filename : 'test.vue' ,
951
+ code : unIndent `
952
+ <template>
953
+ <textarea>
954
+ </template>
955
+ ` ,
956
+ output : unIndent `
957
+ <template>
958
+ <textarea>
959
+ </template>
960
+ ` ,
961
+ errors : [
962
+ {
963
+ message : 'Expected indentation of 2 spaces but found 4 spaces.' ,
964
+ line : 2
965
+ }
966
+ ]
932
967
}
933
968
]
934
969
)
You can’t perform that action at this time.
0 commit comments