Skip to content

There is a bug in the use fix action of v-for-delimiter-style under special syntax #226

Closed
vuejs/eslint-plugin-vue
#2416
@759325100

Description

@759325100

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?

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>

real images
image
image
image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions