Skip to content

Commit

Permalink
Fix false positives for trailing comma with import in `vue/script-ind…
Browse files Browse the repository at this point in the history
…ent` rule (#1525)
  • Loading branch information
ota-meshi committed Jun 25, 2021
1 parent 4a86231 commit 2bb5279
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/utils/indent-common.js
Expand Up @@ -1498,8 +1498,11 @@ module.exports.defineVisitor = function create(
}
if (namedSpecifiers.length) {
const leftBrace = tokenStore.getTokenBefore(namedSpecifiers[0])
const rightBrace = tokenStore.getTokenAfter(
namedSpecifiers[namedSpecifiers.length - 1]
const rightBrace = /** @type {Token} */ (
tokenStore.getTokenAfter(
namedSpecifiers[namedSpecifiers.length - 1],
isClosingBraceToken
)
)
processNodeList(namedSpecifiers, leftBrace, rightBrace, 1)
for (const token of tokenStore.getTokensBetween(
Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/script-indent/import-declaration-11.vue
@@ -0,0 +1,7 @@
<!--{ "options": [4, { "baseIndent": 1, "switchCase": 1 } ] }-->
<script>
import {
computed, defineComponent, PropType, ref, watch,
} from '@vue/composition-api';
</script>
<!-- https://github.com/vuejs/eslint-plugin-vue/issues/1524 -->

0 comments on commit 2bb5279

Please sign in to comment.