question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support message placeholders for error messages

See original GitHub issue

ESLinst’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:open
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Jun 16, 2021

@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.

0reactions
rwjbluecommented, Jun 18, 2021

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found