Skip to content

Some issues about VOnExpression node range when line-breaking style is CRLF. #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kamilic opened this issue Nov 6, 2019 · 1 comment · Fixed by #74
Closed

Some issues about VOnExpression node range when line-breaking style is CRLF. #59

kamilic opened this issue Nov 6, 2019 · 1 comment · Fixed by #74

Comments

@kamilic
Copy link

kamilic commented Nov 6, 2019

Hello.
I am using 'eslint-plugin-vue' to do some checking job for my project, but I happened some problems.

Here is the repository for reproducing this problem.
https://github.com/kamilic/reproduce-of-location-problem
In LF, everything runs well, but in CRLF, it seems to go wrong.
(--fix also)

I did some research by reading some source code.
After some code reading, I found that it's not an issues from 'eslint-plugin-vue'.
The rule vue/space-infix-ops is simply a wrapper of eslint rule space-infix-ops.

Eslint implements space-infix-ops rule depending on ast node range.
https://github.com/eslint/eslint/blob/master/lib/rules/space-infix-ops.js#L55

Estree node range is produced by vue-eslint-parser.

<template>
    <div @click="a = b"></div>
</template>

image

image

I tried to count location manually.
Range of a should be [29, 30].
Range of = should be [31, 32].
Range of b should be [33, 34].

Then, I did some step by step debugging.
Range still correct before location fixing.
https://github.com/mysticatea/vue-eslint-parser/blob/master/src/script/index.ts#L101
It seem something bad happened in fixLocation method.

Hope it is helpful for fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant