-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Version
3.0.0-rc.3
Reproduction link
https://github.com/st-sloth/vue-cli-typescript-eslint-parser
Steps to reproduce
npm i
npm run lint-parserOptions-parser
What is expected?
Probably, no errors should be reported.
What is actually happening?
1:7 error Parsing error: Unexpected token :
The issue is that eslint-config-typescript puts parser inside of parserOptions instead of the root. Most likely because it is silently expected that eslint-plugin-vue is also used and it defines parser as vue-eslint-parser that in turn uses parserOptions.parser, defined in eslint-config-typescript (with this configuration, there is no error - npm run lint-vue-plugin in repro).
In our team we use sharable eslint configs that extend great vue configs and are split by feature - our TypeScript partial config extends eslint-config-typescript. And in the project using TypeScript without using Vue we now faced the problem that typescript-eslint-parser does not get used as the parser.
Of course, all this is probably by design, and we must explicitly add typescript-eslint-parser in our config (as npm run lint-parser in repro), but I've only come to this realization after hours of debugging, searching through the docs and code of different related repos and such.
Perhaps, at least the reason why in eslint-config-typescript parser is defined inside parserOptions should be explained in the config and/or docs and readers should be warned that in order to use this config without eslint-pliugin-vue they must specify parser themselves?