-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Disabling eslint rule for react/forbid-foreign-prop-types does not work on all references #2328
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
Comments
That should certainly work. What's your eslint config and versions? |
I was not able to reproduce the issue on the above snipped using |
Closing pending confirmation of version numbers used. |
This was happening with eslint 5; reopening. |
Was not able to reproduce it with ESLint@5 either, do you have more information @ljharb? |
Closing. Happy to reopen and fix ASAP with a repro repo, or a failing test, but it's unlikely this continues to be a problem. |
Summary of the issue
Here's a snippet from the code in our repo for prop types hoisting in an HOC:
Even though linting on the the first reference of
WrappedComponent.propTypes
is disabled, it fails linting.Screenshot:
Result in CI:
133:24 error Using propTypes from another component is not safe because they may be removed in production builds react/forbid-foreign-prop-types
Attempted solutions
❌ Didn't work
/* eslint-disable react/forbid-foreign-prop-types */
and/* eslint-enable react/forbid-foreign-prop-types */
// eslint-disable-next-line
to disable all rules for that line✅ Worked
/* eslint-disable react/forbid-foreign-prop-types */
at the top of the filecc @ljharb
The text was updated successfully, but these errors were encountered: