You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-vue repo and open the issue in eslint-plugin-vue repo if there is no solution.
I have tried restarting my IDE and the issue persists.
I have updated to the latest version of the packages.
What version of ESLint are you using?
8.32.0
What version of eslint-plugin-vue and vue-eslint-parser are you using?
<script setup lang="ts">
import { Ref, ref } from'vue'defineProps<{ msg:string }>()const count:Ref<number|undefined> =ref(0)function incrementCount() {const c = <number>count.value// <- type assertion is herecount.value=c+1}
</script>
What did you expect to happen?
Code lints without errors; or, at least, ESLint is able to parse the Vue component source file.
What actually happened?
Closing brace of the incrementCount() function produces the following parsing error:
/Users/david/Work/Scratch/ts-test/src/components/HelloWorld.vue
12:0 error Parsing error: Unexpected token. Did you mean `{'}'}` or `}`?
✖ 1 problem (1 error, 0 warnings)
I filed vuejs/eslint-config-typescript#55. I agree that using as syntax for type assertions would be better, but unfortunately, even if @typescript-eslint/consistent-type-assertions is set to enforce as syntax instead of angle bracket syntax, this doesn't help as the angle bracket syntax in the component will not be parsed and so cannot be identified as a failure. Maybe I should file an issue on @typescript-eslint/parser?
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
8.32.0
What version of
eslint-plugin-vue
andvue-eslint-parser
are you using?What did you do?
Configuration
What did you expect to happen?
Code lints without errors; or, at least, ESLint is able to parse the Vue component source file.
What actually happened?
Closing brace of the
incrementCount()
function produces the following parsing error:Link to Minimal Reproducible Example
https://github.com/dmolesUC/ts-test
Additional comments
This is the out-of-the box Vite Vue3/Typescript example, slightly modified to add ESLint and the offending code.
Run
yarn lint
from the project root (oryarn eslint --ext .js,.ts,.vue src
).Relevant code is in
src/components/HelloWorld.vue
.Note that identical code in
src/helpers/helpers.ts
parses & lints without error.The text was updated successfully, but these errors were encountered: