-
Notifications
You must be signed in to change notification settings - Fork 13
Using typescript causes "declared but never read" errors for components/variables only used in pug template #27
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
Does that warning come from eslint itself or from somewhere else? |
Looks like it's coming from the typescript compiler, not eslint. I found a few issues describing the same thing vuejs/eslint-plugin-vue#1810 and vuejs/language-tools#604, both of which recommended using this package https://github.com/Shinigami92/eslint-plugin-vue-pug-sfc. But that has since been archived in favor of this package. |
Sadly eslint-plugin-vue-pug can only provide pug support to eslint rules. Eslint can include a typescript pass and there is @vue/eslint-config-typescript which helps setting up typescript inside eslint. eslint-plugin-vue-pug can't teach other typescript (editor) tools how to parse pug though. The direct ts integration in vscode for example isn't aware of pug, leading to the issue you describe. There is https://www.npmjs.com/package/@vue/language-plugin-pug. I haven't tried that out myself though. |
At a first glance, it looks like |
@vue/language-plugin-pug is right. thinks. But I have another question |
Please create a separate issue for this new problem, with a clean reproduction if possible. |
@Dylancyclone would you help me on how to include @vue/language-plugin-pug to eslint flat config - thank you! |
@simonmaass You should be able to just follow these instructions: https://www.npmjs.com/package/@vue/language-plugin-pug |
I'm working on a project with the following structure:
And I'm having trouble getting this plugin to work with typescript. Whenever I have my SFC with both the template using
pug
and the script usingts
, typescript cannot find components/variables being used in the template and throws an error saying they're unused..eslint.cjs:
Thank you for your awesome work on this plugin!
The text was updated successfully, but these errors were encountered: