Open
Description
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.57.0, 9.29.0
What version of eslint-plugin-vue
and vue-eslint-parser
are you using?
- vue-eslint-parser@0.0.0
- eslint-plugin-vue@9.33.0, @10.2.0
What did you do?
<script lang="ts" setup>
const test = () => {
// This comment goes second
console.log('hello')
}
</script>
<script lang="ts">
/**
* This comment goes first.
*/
export default {}
</script>
<template>
<div @click="test" />
</template>

What did you expect to happen?
The comments array should be ordered according to their position in the original source code.
Otherwise, this could impact the functionality of certain rules, such as @eslint-stylistic/padded-blocks
. For example, when using sourceCode.getTokenAfter(node, { includeComments: true })
, the incorrect comment order could lead to inaccurate results. See vuejs/eslint-plugin-vue#2764.
What actually happened?

Link to Minimal Reproducible Example
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels