Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue-eslint-parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.4.1
Choose a base ref
...
head repository: vuejs/vue-eslint-parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.4.2
Choose a head ref
  • 2 commits
  • 12 files changed
  • 1 contributor

Commits on Jan 22, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2b3a762 View commit details
  2. 9.4.2

    ota-meshi committed Jan 22, 2024
    Copy the full SHA
    d79bcad View commit details
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-eslint-parser",
"version": "9.4.1",
"version": "9.4.2",
"description": "The ESLint custom parser for `.vue` files.",
"engines": {
"node": "^14.17.0 || >=16.0.0"
33 changes: 21 additions & 12 deletions src/script/generic.ts
Original file line number Diff line number Diff line change
@@ -124,31 +124,40 @@ function getConstraint(node: TSESTree.TSTypeParameter, rawParam: string) {
if (!node.constraint) {
return "unknown"
}
let startIndex = rawParam.indexOf(node.name.name) + node.name.name.length
while (startIndex < rawParam.length) {
if (rawParam.startsWith("extends", startIndex)) {
return rawParam.slice(startIndex + 7)
let index = rawParam.indexOf(node.name.name) + node.name.name.length
let startIndex: number | null = null
while (index < rawParam.length) {
if (startIndex == null) {
if (rawParam.startsWith("extends", index)) {
startIndex = index = index + 7
continue
}
} else if (rawParam[index] === "=") {
return rawParam.slice(startIndex, index)
}
if (rawParam.startsWith("//", startIndex)) {
const lfIndex = rawParam.indexOf("\n", startIndex)
if (rawParam.startsWith("//", index)) {
const lfIndex = rawParam.indexOf("\n", index)
if (lfIndex >= 0) {
startIndex = lfIndex + 1
index = lfIndex + 1
continue
}
return "unknown"
}
if (rawParam.startsWith("/*", startIndex)) {
const endIndex = rawParam.indexOf("*/", startIndex)
if (rawParam.startsWith("/*", index)) {
const endIndex = rawParam.indexOf("*/", index)
if (endIndex >= 0) {
startIndex = endIndex + 2
index = endIndex + 2
continue
}
return "unknown"
}
startIndex++
index++
}
if (startIndex == null) {
return "unknown"
}

return "unknown"
return rawParam.slice(startIndex)
}

/** Remove variable def */
Loading