fix: improve error messages for invalid template tags in HTML start tags#499
Closed
dupontbertrand wants to merge 2 commits intometeor:release-3.1.0from
Closed
fix: improve error messages for invalid template tags in HTML start tags#499dupontbertrand wants to merge 2 commits intometeor:release-3.1.0from
dupontbertrand wants to merge 2 commits intometeor:release-3.1.0from
Conversation
Replace the generic "Reactive HTML attributes must either have a constant name..."
message with specific, actionable errors for each case:
- {{#if}}/{{#unless}} in start tag: suggests attribute="{{helper}}" pattern
- {{{triple-stache}}} in start tag: explains raw HTML issue
- {{> inclusion}} in start tag: mentions it's not allowed
- Custom block helpers: clear rejection message
Switch from regex to string substring matching for test.throws assertions, which is more reliable across Tinytest versions.
Collaborator
|
@dupontbertrand @wreiske can you please check if this may conflict with pr #481 |
Contributor
|
I believe #481 does cover this use case, yes.
|
Author
|
My bad, don't know something like that was already there ! @wreiske @jankapunkt |
Contributor
|
No worries at all! It shows that multiple people thought it needed improvement so there's some validation there! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
<input {{#if isDisabled}}disabled{{/if}}>causes a silent compiler crash with a misleading error:Cannot find module '../.././imports/ui/.../template.html'andTemplate.xxx is not defined. Developers waste hours debugging a module resolution issue that is actually a Spacebars syntax problem.{{#if}}/{{#unless}}/{{#each}}/{{#with}}in start tag: suggests theattribute="{{helper}}"pattern with Bad/Good syntax example{{{triple-stache}}}in start tag: explains the raw HTML issue{{> inclusion}}in start tag: clear rejection messageBefore
After
Test plan
{{#if}}standalone attribute shows new message with Bad/Good example{{{triple-stache}}}in start tag shows raw HTML message{{> inclusion}}in start tag shows inclusion message{{#if}}inside attribute value) still compiles and runs