Skip to content

Commit

Permalink
Fix false positives for import brace in vue/script-indent rule (#1770)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Jan 24, 2022
1 parent f527e27 commit a2c4af2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/utils/indent-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,10 +1573,10 @@ module.exports.defineVisitor = function create(
)
)
processNodeList(namedSpecifiers, leftBrace, rightBrace, 1)
for (const token of tokenStore.getTokensBetween(
leftBrace,
for (const token of [
...tokenStore.getTokensBetween(leftBrace, rightBrace),
rightBrace
)) {
]) {
const i = beforeTokens.indexOf(token)
if (i >= 0) {
beforeTokens.splice(i, 1)
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/script-indent/import-declaration-12.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--{}-->
<script>
import Def, {
foo
} from 'mod';
import
Def2, {
bar
} from 'mod';
</script>
<!-- https://github.com/vuejs/eslint-plugin-vue/issues/1766 -->

0 comments on commit a2c4af2

Please sign in to comment.