Skip to content

vue/html-self-closing should consider <slot> to be a component tag, not a normal HTML tag #2190

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

Open
catrope opened this issue May 24, 2023 · 2 comments

Comments

@catrope
Copy link

catrope commented May 24, 2023

What rule do you want to change?
vue/html-self-closing

Does this change cause the rule to produce more or fewer warnings?
N/A

How will the change be implemented? (New option, new default behavior, etc.)?
utils.isCustomComponent() would return true for <slot> tags

Please provide some example code that this change will affect:

<slot />

What does the rule currently do for this code?
If configured with {"void": "never", "normal": "never", "component": "always"}, the rule rejects self-closing <slot /> tags, because it considers them to be in the "normal" category.

What will the rule do after it's changed?
It will accept self-closing <slot /> tags even if "normal": "never" is set, because it considers them to be special Vue tags (like component tags).

Additional context
{"void": "never", "normal": "never", "component": "always"} is not the default setting for this rule, but it's the one that produces the most HTML-like Vue template syntax. We are switching to this config for that reason, and we were surprised that it resulted in <slot /> being rejected and changed to <slot></slot>.

@FloEdelmann
Copy link
Member

FloEdelmann commented May 25, 2023

slot is indeed a valid HTML element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot

But I agree that it should rather be in the "component" category, since it has a special meaning in Vue. PR welcome!

@FloEdelmann
Copy link
Member

Actually, the same applies to template: It is both a HTML element and a Vue special "component". See also #2202.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants