-
Notifications
You must be signed in to change notification settings - Fork 11
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
[IDEA] Detect globally registered components #10
Comments
That’s a good idea 👍🏻 |
A quick thought --- in the case of Vue 2, maybe you could scan
using some regex:
Then scan all project
If the user defines the component name using kebab-case, then they will have to reference it in their project using the same. If they define the component name using PascalCase, you'd have to check for both cases, since you can use either case when referencing it in your project. |
Good catch, although it might be difficult to decide which files to scan. Of course |
So I didn't get a chance to test this specific codebase locally, but I am right in thinking that you guys parse the entire Vue file contents, and then use RegExp to look for a file path? If so, wouldn't it be as easy as also checking if the component name was presented as I don't use Vue.component(...) in a main.js file, I created a file called _register-globally.js that looks like this:
I'm not sure how common that is, but it always seemed like a DRY-er way of registering. If you want want to tell me how to run your checking function locally I could try to make a fork and PR? Would love to contribute to OS stuff if I can. Apologies if my understanding about the parsing of the file is incorrect, but that's how I was reading it in the src :) |
At the moment, the repository relies on import or require statements to determine if a Vue file has been used. But this doesn't take into account files that are globally registered and can be used in your Vue component without having to import/require. I had a look at trying to do this myself by cloning the repo but I've never worked with TS and the commit instructions were pretty strict so I gave up 🤔. Be cool to have though
The text was updated successfully, but these errors were encountered: