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

Allow a custom message with forbid props #2615

Conversation

@geshwho
Copy link
Contributor

@geshwho geshwho commented Apr 3, 2020

Hi team! When considering using the forbid-component-props and forbid-dom-props rules, an early topic of discussion was whether or not it would be possible to provide a custom error message. This gives the user a chance to better explain why the prop is forbidden, and possible offer an alternative, or best practice, etc.

This PR aims to add custom messaging functionality to both rules of these rules. Let me know if such an enhancement is something you would consider adding and I'm happy to make improvements on it and take any suggestions! Thanks!

…sage with forbid props

Co-authored-by: Mangesh Tamhankar <mangesh@gusto.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
docs/rules/forbid-component-props.md Outdated Show resolved Hide resolved
docs/rules/forbid-dom-props.md Outdated Show resolved Hide resolved
@geshwho geshwho requested a review from ljharb Apr 14, 2020
@geshwho
Copy link
Contributor Author

@geshwho geshwho commented May 3, 2020

@ljharb Any chance you'll have time to take another look at this soon? Thanks!

@ljharb
ljharb approved these changes May 9, 2020
Copy link
Collaborator

@ljharb ljharb left a comment

This looks great overall, thanks!

lib/rules/forbid-dom-props.js Outdated Show resolved Hide resolved
@ljharb ljharb force-pushed the geshwho:features/allow-custom-message-with-forbid-props branch from 7d74249 to 9861469 May 9, 2020
@ljharb ljharb merged commit 9861469 into yannickcr:master May 9, 2020
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.004%) to 97.621%
Details
geshwho added a commit to Gusto/eslint-config-gusto that referenced this pull request May 13, 2020
The latest version includes an update to forbid-component-props and
forbid-dom-props rules to allow for a custom message
(yannickcr/eslint-plugin-react#2615). Upgrading will allow us to use
this feature in Gusto/zenpayroll#59591.
geshwho added a commit to Gusto/eslint-config-gusto that referenced this pull request May 14, 2020
* Upgrade eslint-plugin-react to 7.20.0

The latest version includes an update to forbid-component-props and
forbid-dom-props rules to allow for a custom message
(yannickcr/eslint-plugin-react#2615). Upgrading will allow us to use
this feature in Gusto/zenpayroll#59591.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants