-
Notifications
You must be signed in to change notification settings - Fork 70
Upgrading from 0.2.0 -> 0.3.0 breaks @typescript-eslint/consistent-type-imports in vue files with only template syntax #388
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
Comments
We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. |
@antfu Yep, sorry about that, is this minimal repro enough? https://stackblitz.com/edit/github-hlcarv |
It's a bit tricky for me to inspect what is going on internally, since we didn't touch the legacy config other than bumping the dependencies. Would you consider moving to the flat config format https://eslint.nuxt.com/packages/config#flat-config-format or even directly the module https://eslint.nuxt.com/packages/module ? - I am sure |
Yep, to be honest before trying to raise the issue, I tried migrating to flat config, but some plugins aren't supported yet (the eslint config I'm trying to migrate is in the source code link above), the eslint-plugin-import doesn't support flat config yet, if there's some suggestions you could give for an easier/alternative migration experience, I'd definitely be willing to try that out Edit: Just tried out changing to @nuxt/eslint flat config module, still receiving the same parser issue with vue-eslint-parser, read in some issues but apparently we can't use parser services rules in custom paresers like vue-eslint parser ref: vuejs/vue-eslint-parser#104 (comment) It might be because the recently bumped deps of typescript eslint parser somehow now requires @typescript-eslint/consistent-type-imports to use a parser service Edit 2: Yep, the issue is because typescript eslint v6 -> v7 parser somehow now requires that specific rule to generate parser services... The issue is I have no idea what parser services are and if there's just an easy way for me to specifiy all the custom rules I want in a single array, instead of doing all these weird overrides to specify specific files, though it's probably due to the way vue files work that it requires separate rules |
Ok, after some migration pains, seems like it was ok to migrate, didn't know that there was an eslint-import-plugin-x that has v9 eslint compatible config, so that was great For anyone else who stumbles upon this, an equivalent migrated config I have here is: https://github.com/Esposter/Esposter/blob/main/eslint.config.js The new eslint module inherently has If people still want to stick with the old legacy config, the issue is that typescript eslint v6 -> v7 parser changes some rules apparently, I haven't really investigated and don't plan to since it's legacy, but if anyone wants a workaround, simply just add override in package.json as follows
I'll close this now |
Uh oh!
There was an error while loading. Please reload this page.
Environment
Package
Eslint-Config/legacy
Reproduction
Source code: https://github.com/Esposter/Esposter/blob/main/.eslintrc
Minimal repro: https://stackblitz.com/edit/github-hlcarv
Describe the bug
After running
pnpm lint
I get the following error. I'm not sure if it's been a recent change with vue-eslint-parser? But it was working in v0.2.0 and I don't really want to remove the @typescript-eslint/consistent-type-imports rule, since it would make my script setup in vue files not have consistent top level import syntax. This seems to only happen if I have vue files that do not have script setup, only template syntax.Edit: While I'm at it, is there an easy option to add rules that require parser services (e.g. all the typescript strict plugins) to include the script setup ts section as well? Currently using overrides only does it for pure ts files, which isn't great
ESLint: 8.57.0
Error: Error while loading rule '@typescript-eslint/consistent-type-imports': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Parser: ....pnpm\[email protected][email protected]\node_modules\vue-eslint-parser\index.js
Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.
Occurred while linting ...\assets\dungeons\icons\DungeonGate.vue
at throwError (...\node_modules.pnpm@[email protected][email protected][email protected]\node_modules@typescript-eslint\utils\dist\eslint-utils\getParserServices.js:40:11)
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: