Skip to content

Commit 04bf33b

Browse files
committed
✨ add syntax error for illegal slot-scope (vuejs/eslint-plugin-vue#670)
1 parent e414e2e commit 04bf33b

File tree

13 files changed

+2764
-0
lines changed

13 files changed

+2764
-0
lines changed

src/script/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,15 @@ export function parseSlotScopeExpression(
600600
tokens.pop()
601601
tokens.pop()
602602

603+
// Verify syntax.
604+
const extraToken = tokens.find(t => t.range[0] >= id.range[1])
605+
if (extraToken) {
606+
throwUnexpectedTokenError(extraToken.value, extraToken)
607+
}
608+
if (id.type === "RestElement") {
609+
throwUnexpectedTokenError("...", id)
610+
}
611+
603612
return { expression, tokens, comments, references, variables }
604613
} catch (err) {
605614
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator)

0 commit comments

Comments
 (0)