Skip to content

Commit

Permalink
✨ add syntax error for illegal slot-scope (vuejs/eslint-plugin-vue#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Nov 24, 2018
1 parent e414e2e commit 04bf33b
Show file tree
Hide file tree
Showing 13 changed files with 2,764 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,15 @@ export function parseSlotScopeExpression(
tokens.pop()
tokens.pop()

// Verify syntax.
const extraToken = tokens.find(t => t.range[0] >= id.range[1])
if (extraToken) {
throwUnexpectedTokenError(extraToken.value, extraToken)
}
if (id.type === "RestElement") {
throwUnexpectedTokenError("...", id)
}

return { expression, tokens, comments, references, variables }
} catch (err) {
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator)
Expand Down
Loading

0 comments on commit 04bf33b

Please sign in to comment.