Support message placeholders for error messages
See original GitHub issueESLinst’s context.report
is the API used to report linting validations (similar to ember-template-eslint
’s log
method).
context.report
’s argument accepts an optional data
object to be used to provide values for placeholders in messages.
This is useful when a rule provides a default error message and the opportunity to customize such error message. Using placeholders users are still able to add information that are only available at runtime to their custom error message making it more useful and understandable.
My suggestion would be to update log
’s input object to support a similar format of message and placeholders.
Any thoughts?
Sample implementation
https://github.com/ember-template-lint/ember-template-lint/pull/1926
References
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Overriding the Message — FluentValidation documentation
For a complete list of error message placeholders see the Built in Validators page. Each built in validator has its own supported placeholders....
Read more >The Importance of Error Messages - HB Design
Well-crafted error messages offer a chance to support branding, user experience, and create an opportunity to change frustration to delight.
Read more >[Form] Support "{{ label }}" placeholder in error messages
The ViolationMapper adds the FormError with the $message/$messageTemplate. I suppose the message should be transformed/translated at that point ...
Read more >Using placeholders - Zendesk help
Placeholders are references to ticket and user data that you include in the subject and body of email notifications.
Read more >Error messages and message numbers - Sybase Infocenter
The combination of message number (error) and language ID (langid) ... s”—all within quotes—is a placeholder for the name of a particular database...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ventuno - Can you give more context around when you’d be using these placeholders? As I mentioned before, if you are planning to author new rules and use this system I see no benefit at all over using template strings in the original source. However, based on your last comment, it seems like you are trying to override the built-in rule’s messages? How do you plan on doing that? For example, I don’t think subclassing of the built-in rules is something that we support.
AHA! OK, that was a really important missing piece. I totally did not understand that you meant you wanted to customize the message on the configuration side (I had previously thought that you wanted to do this when you were authoring a rule, at which point I legitimately think that template strings are much better).