typescript-eslint: Parsing errors when combined with `eslint-plugin-vue` as of 1.5.0
PR #367 seems to have introduced a number of unexpected false linter errors when used in combination with eslint-plugin-vue. I think the problem boils down to the assumption from the PR that this function will only get called twice if in watch or fix mode not being valid.
With single-file-components in .vue files, this function winds up getting called for each section of the file that may contain scripts. Naturally this includes the <script></script> block, but also includes things like interpolations and v-bind’s, etc. Each time getting called with the same filePath.
What code were you trying to parse?
See the following reproducer: https://github.com/thebanjomatic/lint-repro
What did you expect to happen?
Running lint should not produce false errors
What actually happened?
Parsing appears to be broken and a multitude of different lint errors are produced.
Versions
| package | version |
|---|---|
@typescript-eslint/typescript-estree |
>= 1.5.0 |
TypeScript |
3.3.4000 |
node |
8.15.0 |
npm |
6.4.1 |
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 23 (8 by maintainers)
It doesn’t actually do the fake file names, it just passes the same filename
"BlahBlah.vue"for each of the code sections with a different body text.I’ve experimented with the sending fake filenames earlier (https://github.com/typescript-eslint/typescript-eslint/issues/404#issuecomment-506064727) but the problem was still that the typescript parser was loading the .vue files as if they were typescript because they were included in the project.
I can take another look at this myself, but i’m not 100% familiar with the project so I might have some questions along the way.
Unfortunately, I don’t currently have bandwidth to address this. I’d be happy to help review any PRs addressing it, though.
I ask too, why?
I solved remove the option extraFileExtensions , I think the problem is here, because with or without this option , eslint typescript work too in vue files correctly !
Example!
Please ignore all dependencies from my personal project. I think that if I remove something from the package.json, it could affect the result
eslint.js:
package.json