Closed MQYForverT closed 2 weeks ago
You can already use vue/no-undef-components
and set ignorePatterns
to exclude some components.
You can already use
vue/no-undef-components
and setignorePatterns
to exclude some components.
IgnorePatterns have significant limitations, such as when I use Element ui, I will match all components starting with El, IgnorePatterns: ['El (\ \ - \ \ w+)+'] For example, my custom components are also automatically imported, and I want to filter them out. This will require all my components to start with Xd in order to be hit by this rule, IgnorePatterns: ['El (\ \ - \ \ w+)+', ['Xd (\ \ - \ \ w+)+'] Am I correct in understanding this way?
Yes, either all your components have a common prefix (or suffix) that you can match, or you list the components manually in ignorePatterns
. But there is no way that an eslint-plugin-vue rule could know which components are auto-imported and which ones are not.
Note that there is a style guide rule that suggests using a common prefix for core components anyway: https://vuejs.org/style-guide/rules-strongly-recommended.html#base-component-names
Please describe what the rule should do:
It will detect undefined components, but exclude automatically imported components [unplugin vue components/vite]
What category should the rule belong to?
[ ] Enforces code style (layout) [ ] Warns about a potential error (problem) [x] Suggests an alternate way of doing something (suggestion) [] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
"Unplugin Vue components/vite" will automatically generate a "components. d. ts" file
HelloWorld will not error HelloWorld2 will report an error
Additional context
“vue/no-undef-components-exclude-auto-import” can accept a file[components. d. ts] path ,This rule can filter configuration files based on this path
by the way I just want to implement this feature, of course, it may be because I didn't realize it had already been implemented. If it has been implemented, please tell me how to write。thanks