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
Docs: Explicitly state a preference for messageId vs message in custom rules docs #17854
Comments
As with most things, we actually don't have a preference here, and I'm not sure it makes sense to state one. I hesitate to be overly prescriptive as it leads us down the line of "well why have two ways to do things if you want us to use just one?" But, I don't feel particularly strongly. If any other team members think this is worthwhile, I'm happy to go along. |
I don't have a strong opinion on preference here either. |
The docs section about
Maybe we could elaborate on that description to include the other advantages noted in #6740 if they are still relevant. Rule developers would be able to take a more informed decision by themselves. |
As the author of eslint-plugin/prefer-message-ids, I am in favor of offering a "recommendation" in the docs for
|
@bmish those are some good bullet points. I agree, let's add a recommendation for |
Yes I'll open a PR: #18050 |
Docs page(s)
https://eslint.org/docs/latest/extend/custom-rules
What documentation issue do you want to solve?
The ESLint Custom Rules docs describe the two ways to set the message text of a rule report:
message
(older): Directly allows setting message textmessageId
(added in New: Add context.report({ messageId }) (fixes #6740) #9165): Keys message texts to rule metadata...but nothing in the docs page explicitly says which is preferable. I think this implies to developers that either is fine - despite the advantages of
messageId
mentioned in #6740 -> #9165.What do you think is the correct solution?
I think the docs should state that
messageId
s are preferred for the reasons noted in #6740. A further example of the better tooling support is the set of lint rules in https://github.com/eslint-community/eslint-plugin-eslint-plugin that support them:eslint-plugin/no-missing-message-ids
andeslint-plugin/no-unused-message-ids
.The
eslint-plugin/prefer-message-ids
rule is even enabled in theplugin:eslint-plugin/recommended
preset.Participation
Additional comments
https://github.com/eslint-community/eslint-plugin-eslint-plugin is mentioned at the bottom of https://eslint.org/docs/latest/extend/plugins too:
eslint/docs/src/extend/plugins.md
Line 189 in ba87a06
That comes across to me as a recommendation to adhere to the plugin's recommendations.
The text was updated successfully, but these errors were encountered: