Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4b59cce

Browse files
ota-meshimysticatea
authored andcommitted
Fix: false positives in html-indent (issue #729) (#730)
1 parent 34b9e38 commit 4b59cce

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

‎lib/utils/indent-common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ module.exports.defineVisitor = function create (context, tokenStore, defaultOpti
895895
if (!PREFORMATTED_ELEMENT_NAMES.includes(node.name)) {
896896
const isTopLevel = node.parent.type !== 'VElement'
897897
const offset = isTopLevel ? options.baseIndent : 1
898-
processNodeList(node.children.filter(isNotEmptyTextNode), node.startTag, node.endTag, offset)
898+
processNodeList(node.children.filter(isNotEmptyTextNode), node.startTag, node.endTag, offset,false)
899899
} else {
900900
const startTagToken = tokenStore.getFirstToken(node)
901901
const endTagToken = node.endTag && tokenStore.getFirstToken(node.endTag)
@@ -991,7 +991,7 @@ module.exports.defineVisitor = function create (context, tokenStore, defaultOpti
991991
const firstTokenInfo = offsets.get(tokenStore.getFirstToken(node))
992992

993993
for (const token of tokens) {
994-
offsets.set(token, firstTokenInfo)
994+
offsets.set(token, Object.assign({},firstTokenInfo))
995995
}
996996
},
997997

‎tests/fixtures/html-indent/issue729.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!--{}-->
2+
<template>
3+
<div>
4+
<div>text
5+
<a/>
6+
</div>
7+
<div>text
8+
text
9+
<a/>
10+
</div>
11+
<div>text
12+
<!-- comment -->
13+
<a/>
14+
</div>
15+
<div>text
16+
<!-- comment -->
17+
</div>
18+
<div><a/>
19+
<a/>
20+
</div>
21+
<div><a/>
22+
<!-- comment -->
23+
<a/>
24+
</div>
25+
<div><a/>
26+
<a/>
27+
</div>
28+
</div>
29+
</template>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /