There is a bug in the use fix action of v-for-delimiter-style under special syntax
759325100 opened this issue · comments
Before You File a Bug Report Please Confirm You Have Done The Following...
- I'm using eslint-plugin-vue.
- 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.52.0
What version of eslint-plugin-vue
and vue-eslint-parser
are you using?
- vue-eslint-parser@9.3.2
- eslint-plugin-vue@9.18.0
What did you do?
Configuration
{
"rules": {
"vue/v-for-delimiter-style": ["error", "in"],
}
}
<!-- fix before -->
<template>
<div>
<span v-for="(item,) in items" :text="item.text" :key="item.id"></span>
</div>
</template>
<!-- fix after -->
<template>
<div>
<span v-for="(itemin) in items" :text="item.text" :key="item.id"></span>
</div>
</template>
What did you expect to happen?
ESLint Check Result:
Expected 'in' instead of ',' in 'v-for'.eslintvue/v-for-delimiter-style
Using fix action:
remove trailing comma
What actually happened?
ESLint Check Result:
Expected 'in' instead of ',' in 'v-for'.eslintvue/v-for-delimiter-style
Using fix action:
The fix tool replaced in to the trailing comma, causing the variable name to be abnormal.
Link to Minimal Reproducible Example
N/A
Additional comments
No response
This might be an issue with the eslint-plugin-vue repo.
Update: follow up on this in vuejs/eslint-plugin-vue#2416
@waynzh thank you