-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
ESLint vue/no-unused-components conflict with components in markdown #47
Comments
I noticed the same with eslint and used the same workaround just yesterday. It got me thinking that component registration feels maybe a little bit strange. I wonder if it is better to register components to be used with edit: just noticed in the docs that globally registered components work fine in |
Thank you for the report @bencodezen :) We will plan to make it work with nuxt/components so it will automatically register the components used in Markdown without needing to import it and have the eslint error :) |
I was 1 second away to create a Great job by the way guys. Looking forward. |
Well, PR is more than welcome @alvarosaburido ! @nuxt/content needs to add a line with now the support of I suggest that it adds: components: [
{ path: '~/components/global', global: true' }
] And recommend users to use cc @pi0 on this, may find a nicer way. |
* chore: migrate to `@nuxt/test-utils` * fix: add playwright to resolve import issue * chore: update tests * chore: update test-utils
Problem
Since Nuxt allows components to import individual components that a markdown file will use (instead of registering all components in a markdown file globally), this is causing a small problem since anyone using the ESLint-Vue will get an error because technically it doesn't exist inside the component template (but it does exist in the markdown).
Example
This will throw the error:
Temporary Workaround
I've worked around this temporarily by disabling the rule on that page with
/* eslint-disable vue/no-unused-components */
but this feels hacky at best.
Next Steps
I wonder if there's a way to detect that a component is going to be used in a component before ESLint catches the error and stops the whole page from rendering on local dev? Anyhow, happy to chat more if it would help!
P.S. My apologies if I filed it in the wrong category. I didn't feel like this was a "bug" in the traditional sense, so I put it here to start.
The text was updated successfully, but these errors were encountered: