File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 1212 * @typedef { import("@html-eslint/types").TemplateLiteral } TemplateLiteral
1313 * @typedef { import("@html-eslint/types").OpenTemplate } OpenTemplate
1414 * @typedef { import("@html-eslint/types").CloseTemplate } CloseTemplate
15+ * @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
16+ * @typedef { import("@html-eslint/types").StyleTag } StyleTag
1517 *
1618 * @typedef {AnyNode | Line } AnyNodeOrLine
1719 * @typedef {Object } IndentType
@@ -40,6 +42,8 @@ const {
4042 isLine,
4143 isTag,
4244 hasTemplate,
45+ isScript,
46+ isStyle,
4347} = require ( "../utils/node" ) ;
4448const {
4549 shouldCheckTaggedTemplateExpression,
@@ -121,7 +125,7 @@ module.exports = {
121125 const { indentType, indentSize, indentChar } = getIndentOptionInfo ( context ) ;
122126
123127 /**
124- * @param {Tag } node
128+ * @param {Tag | ScriptTag | StyleTag } node
125129 * @return {number }
126130 */
127131 function getTagIncreasingLevel ( node ) {
@@ -150,7 +154,7 @@ module.exports = {
150154 if ( isLine ( node ) ) {
151155 return 1 ;
152156 }
153- if ( isTag ( node ) ) {
157+ if ( isTag ( node ) || isScript ( node ) || isStyle ( node ) ) {
154158 return getTagIncreasingLevel ( node ) ;
155159 }
156160 const type = node . type ;
Original file line number Diff line number Diff line change @@ -391,6 +391,44 @@ function createTests() {
391391 } ,
392392 {
393393 code : `
394+ <!DOCTYPE html>
395+ <html>
396+ <body>
397+ </body>
398+ <script src=""></script>
399+ </html>
400+ ` ,
401+ options : [
402+ 2 ,
403+ {
404+ tagChildrenIndent : {
405+ html : 0 ,
406+ body : 0 ,
407+ } ,
408+ } ,
409+ ] ,
410+ } ,
411+ {
412+ code : `
413+ <!DOCTYPE html>
414+ <html>
415+ <body>
416+ </body>
417+ <style></style>
418+ </html>
419+ ` ,
420+ options : [
421+ 2 ,
422+ {
423+ tagChildrenIndent : {
424+ html : 0 ,
425+ body : 0 ,
426+ } ,
427+ } ,
428+ ] ,
429+ } ,
430+ {
431+ code : `
394432<style>
395433</style>
396434<script>
You can’t perform that action at this time.
0 commit comments