You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <textarea> element is non-void and as such needs a closing tag, and should not be self-closing.
What actually happened?
When a <textarea> element has a closing tag:
<textarearows="10"bind:value={$value}></textarea>
...the html-self-closing rule reports:
error Require self-closing on HTML elements svelte/html-self-closing
This is because the default preset for that rule sets all element types (void, normal, foreign, component, svelte) to "always".
If you follow the above advice and change it to be self-closing:
<textarearows="10"bind:value={$value} />
...the valid-compile rule reports:
error Self-closing HTML tags for non-void elements are ambiguous — use `<textarea ...></textarea>` rather than `<textarea ... />
If you relax the html-self-closing options to "normal": "never", that does satisfy both rules.
However, any other non-void, normal, self-closing elements (that valid-compile doesn't complain about) now need to be changed to have closing tags (<slot></slot>).
I'm not sure what the right answer here is, but it seems that the out-of-box experience for these two rules could be improved to avoid such conflicting advice.
Suggest either:
Changing the default preset for html-self-closing to set "normal": "never" to align the guidance for <textarea> elements to match the valid-compile rule, or
Changing the valid-compile rule not to warn on self-closing <textarea/> elements in the same way that it doesn't warn on self-closing <slot/> elements, or
Changing the valid-compile rule to warn on self-closing <slot/> elements in the same way that it warns on self-closing <textarea/> elements.
Link to GitHub Repo with Minimal Reproducible Example
(Note: I can't get the issue to reproduce in the online playground link above, but then again I can't get any eslint-plugin-svelte warnings to show in the playground?)
Additional comments
No response
The text was updated successfully, but these errors were encountered:
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.16.0
What version of
eslint-plugin-svelte
are you using?2.46.1
What did you do?
Configuration
What did you expect to happen?
No errors.
The
<textarea>
element is non-void and as such needs a closing tag, and should not be self-closing.What actually happened?
When a
<textarea>
element has a closing tag:...the
html-self-closing
rule reports:This is because the default preset for that rule sets all element types (void, normal, foreign, component, svelte) to "always".
If you follow the above advice and change it to be self-closing:
...the
valid-compile
rule reports:If you relax the
html-self-closing
options to"normal": "never"
, that does satisfy both rules.However, any other non-void, normal, self-closing elements (that
valid-compile
doesn't complain about) now need to be changed to have closing tags (<slot></slot>
).I'm not sure what the right answer here is, but it seems that the out-of-box experience for these two rules could be improved to avoid such conflicting advice.
Suggest either:
html-self-closing
to set"normal": "never"
to align the guidance for<textarea>
elements to match thevalid-compile
rule, orvalid-compile
rule not to warn on self-closing<textarea/>
elements in the same way that it doesn't warn on self-closing<slot/>
elements, orvalid-compile
rule to warn on self-closing<slot/>
elements in the same way that it warns on self-closing<textarea/>
elements.Link to GitHub Repo with Minimal Reproducible Example
https://eslint-online-playground.netlify.app/#eNp1kMFuwyAQRH9ltccotturm+TUvwg5ELx2aTEgwGmqyP/eNSZSKyUXbLRvmNm5YQyqoascvaE6XsgkwhZ3UQXt00FYAEMJLtJM9CbsrikDAGH5muiaZCAJwX3HvcDXF4Fw1rZrs2J/y5+5OeAWKRptU62c7fVQf0a20aN3IcFqC31wI4jCVd5Mg7bVOhPI5sLSNfMd9XIyCY5LvLouscvL8SiwNzI1ZxlZd9ou0G05AHptKLasw82m2RTdnQEIUx4XmFfElWh4C91Vyo2eHxDYLilDcEFgUf5hP9Joqkimr5RxUdvhH7/ic5Yt54n34m68VF9yIG7FWe4lJxCYfnxxG13H2YqdwI4u7+TJdmSVprgwJfS9vlXGNVDk/5LyWbcP0UfDnFrYGedfCOi9RA==
(Note: I can't get the issue to reproduce in the online playground link above, but then again I can't get any eslint-plugin-svelte warnings to show in the playground?)
Additional comments
No response
The text was updated successfully, but these errors were encountered: