Closed doubleaxe closed 2 months ago
To resolve the issue, you need to configure all parserOptions to include extraFileExtensions. Could you please try it?
https://github.com/typescript-eslint/typescript-eslint/issues/6778
you are right, this config works:
root: true
extends:
- 'eslint:recommended'
parserOptions:
project: './tsconfig.json'
overrides:
-
files:
- "*.ts"
extends:
- plugin:@typescript-eslint/recommended-type-checked
parser: "@typescript-eslint/parser"
parserOptions:
extraFileExtensions: ['.vue']
-
files:
- "*.vue"
extends:
- plugin:@typescript-eslint/recommended-type-checked
- plugin:vue/recommended
parser: vue-eslint-parser
parserOptions:
parser: "@typescript-eslint/parser"
extraFileExtensions: ['.vue']
Checklist
Tell us about your environment
Please show your full configuration: .eslintrc.yml file
tsconfig.json file
package.json file
What did you do?
file.vue
file.ts
What actually happened?
I provided 5 files for minimal reproducible example. With above config, if you lint files separately, i.e.
npx eslint . --ext .ts
andnpx eslint . --ext .vue
everything works fine. If you lint them both with justnpx eslint .
ornpx eslint . --ext .ts,.vue
- eslint fails to validate vue file with the following exception:It took me 3 days to figure out why my config sometimes works, sometimes doesn't work and isolate issue :). I guess there is conflict somewhere, because both plain typescript parser and vue typescript parser use the same typescript processor. Package manager doesn't matter, the same issue occurs with yarn.
Repository to reproduce this issue
https://github.com/doubleaxe/eslint-plugin-vue-bugreport