-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Misleading error message, when only open tag is in if else block #4131
Comments
I think this behaviour is correct. If you look at the simplified example below: https://svelte.dev/repl/529ae6f101a548ac8bc0c0ad2f1eac63?version=3.16.5 Although it could be considered "misleading", actually, you are opening a new block, and then opening a new logic tag. So the error is correct. I suppose it depends on how far you want to go into Svelte becoming some sort of html validator/linter/formatter, and I think the answer is, not very far. |
I understand your point and if I would be a code parser then I would see it is a new logic block and it is not the if block anymore. |
I checked all the way back to first release of 3.0 and the message hasn't changed. So treat all Svelte keywords as creating scope because that's what they do essentially. |
These error messages have improved in 3.18.2 - https://svelte.dev/repl/116df8158726422db28a6904f8bb49f2?version=3.18.2 |
Thank you, it is way more helpful now. |
Describe the bug
Wrong error message when the open html tag is in a condition.
Cannot have an {:else} block outside an {#if ...} or {#each ...} block (3:6)
To Reproduce
https://svelte.dev/repl/116df8158726422db28a6904f8bb49f2?version=3.16.5
Expected behavior
A message that informs me about I cannot have only open tag between conditions.
Severity
Low, but it can mislead debug
The text was updated successfully, but these errors were encountered: