From 06793cd442c42188723de9ad1719b2a33d5849ed Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Fri, 25 Jun 2021 18:29:38 +0900 Subject: [PATCH] Fix false positives for trailing comma with import in `vue/script-indent` rule --- lib/utils/indent-common.js | 7 +++++-- tests/fixtures/script-indent/import-declaration-11.vue | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/script-indent/import-declaration-11.vue diff --git a/lib/utils/indent-common.js b/lib/utils/indent-common.js index 7d2349d3c..8ec6bbe41 100644 --- a/lib/utils/indent-common.js +++ b/lib/utils/indent-common.js @@ -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( diff --git a/tests/fixtures/script-indent/import-declaration-11.vue b/tests/fixtures/script-indent/import-declaration-11.vue new file mode 100644 index 000000000..83289b1f4 --- /dev/null +++ b/tests/fixtures/script-indent/import-declaration-11.vue @@ -0,0 +1,7 @@ + + +