Skip to content
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

too strict "warn for possible use of component without uppercase tag name (#5302)" #5570

Closed
burningTyger opened this issue Oct 23, 2020 · 6 comments
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@burningTyger
Copy link
Contributor

Describe the bug
PR #5302 is too strict and will warn on any import that bears an html element name

To Reproduce

<script>
	import {b} from './some.js'
</script>

<b>Hello {b}!</b>

https://svelte.dev/repl/e29cafcb75874c8082a849ffbdd65dc1?version=3.29.4

It should only warn on real components.

@Conduitry
Copy link
Member

What would you suggest changing the heuristics to? Keep in mind that we cannot tell what's in the imported file.

@burningTyger
Copy link
Contributor Author

Seeing the warning in my app I opened the PR I assuming there was an array of "valid" elements (such as listed here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element) but it only checks elements against imported names. No problem with that. It just causes the issued behaviour. Would it be a good idea to create such a list of valid elements? Or check against such a list as well to filter out false positives? The downside would be that it is basically an evergrowing list and it would add rather unncecessary weight to the compiler (since the checks against that list would only be for positives).

@Conduitry Conduitry added the awaiting submitter needs a reproduction, or clarification label Oct 24, 2020
@burningTyger
Copy link
Contributor Author

I have no issue with closing this if it doesn't affect anybody else.

@ziggi
Copy link

ziggi commented Nov 22, 2020

I import time from store (as in example https://svelte.dev/examples#readable-stores), put it in <time> tag, and got this warning. Of course I can use other tag of variable name, but it would be nice to mute this, maybe something like this:

<time ignore:component-name-lowercase>{time}</time>

@hmt
Copy link
Contributor

hmt commented Nov 22, 2020

@ziggi You can use comments to ignore the warning: https://svelte.dev/docs#Comments

In this case you want to use:

<!-- svelte-ignore component-name-lowercase -->
<time>{time}</time>

@ziggi
Copy link

ziggi commented Nov 22, 2020

@hmt oh, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

4 participants