Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-bags-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-vue": patch
---

Fixed false positives for `TSImportType` in `vue/script-indent` rule
21 changes: 16 additions & 5 deletions lib/utils/indent-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1199,14 +1199,25 @@ function defineVisitor({
isOpeningParenToken
)
setOffset(leftParenToken, 1, firstToken)
const argument =
node.argument ||
/** @type {any} typescript-eslint v5 */ (node).parameter

const args = []
if (node.source) {
args.push(node.source)
} else {
// For old typescript-eslint parser
args.push(
node.argument ||
/** @type {any} typescript-eslint v5 */ (node).parameter
)
}
if (node.options) {
args.push(node.options)
}
const rightParenToken = tokenStore.getTokenAfter(
argument,
args[args.length - 1],
isClosingParenToken
)
processNodeList([argument], leftParenToken, rightParenToken, 1)
processNodeList(args, leftParenToken, rightParenToken, 1)
if (node.qualifier) {
const dotToken = tokenStore.getTokenBefore(node.qualifier)
const propertyToken = tokenStore.getTokenAfter(dotToken)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "lib/index.d.ts",
"scripts": {
"new": "node tools/new-rule.js",
"start": "npm run test:base -- --watch --growl",
"start": "npm run test:base -- --watch",
"test:base": "vitest run --reporter=dot tests/lib",
"test": "vitest run",
"test:integrations": "vitest run tests/integrations",
Expand Down
Loading