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
Copy link
Contributor Author

geshwho commented May 3, 2020

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

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great overall, thanks!

lib/rules/forbid-dom-props.js Outdated Show resolved Hide resolved
@ljharb ljharb force-pushed the features/allow-custom-message-with-forbid-props branch from 7d74249 to 9861469 Compare May 9, 2020 16:34
@ljharb ljharb merged commit 9861469 into jsx-eslint:master May 9, 2020
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
(jsx-eslint/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
(jsx-eslint/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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants