File tree Expand file tree Collapse file tree 2 files changed +41
-6
lines changed Expand file tree Collapse file tree 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(
301301 tokenStore . getTokenAfter ( node )
302302
303303 /** @type {SourceCode.CursorWithSkipOptions } */
304- const option = {
304+ const cursorOptions = {
305305 includeComments : true ,
306306 filter : ( token ) =>
307307 token != null &&
@@ -311,11 +311,11 @@ module.exports.defineVisitor = function create(
311311 token . type === 'HTMLEndTagOpen' ||
312312 token . type === 'HTMLComment' )
313313 }
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 ) {
319319 ignoreTokens . add ( token )
320320 }
321321 ignoreTokens . add ( endToken )
Original file line number Diff line number Diff line change @@ -403,6 +403,22 @@ tester.run(
403403 text <span /> <!-- comment --></pre>
404404 </template>
405405 `
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+ `
406422 }
407423 ] ,
408424
@@ -929,6 +945,25 @@ tester.run(
929945 line : 2
930946 }
931947 ]
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+ ]
932967 }
933968 ]
934969 )
You can’t perform that action at this time.
0 commit comments