Skip to content
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

Support custom error messages for rules #907

Open
egucciar opened this issue Nov 17, 2022 · 4 comments
Open

Support custom error messages for rules #907

egucciar opened this issue Nov 17, 2022 · 4 comments

Comments

@egucciar
Copy link

Would love to be able to have a custom error message - I have created a custom component that takes in the onClick handler and an as prop and when developers go to implement onClick handlers on normal elements, would love to adjust the Message so i can point them to use our custom component.

@ljharb
Copy link
Member

ljharb commented Nov 17, 2022

Which rule do you have in mind?

eslint itself offers no facility for this, so each rule would have to be configured separately.

@egucciar
Copy link
Author

@ljharb these two rules are the ones we see wherever we apply onClick to normal elements. So being able to extend these messages to guide our developers to use the component we created for that use case would be ideal.

image

@ljharb
Copy link
Member

ljharb commented Nov 17, 2022

@egucciar Perhaps it would be easier to use react/forbid-dom-props, which already supports a custom message?

@egucciar
Copy link
Author

@ljharb oh, good catch, maybe that could work. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants