Skip to content

Commit b713026

Browse files
rbondoc96ljharb
authored andcommitted
[Fix] prop-types: props missing in validation when using generic types from a namespace import
1 parent 66ae4c1 commit b713026

File tree

3 files changed

+469
-1
lines changed

3 files changed

+469
-1
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1111
* [`no-danger`]: avoid a crash on a nested component name ([#3833][] @ljharb)
1212
* [Fix] types: correct generated type declaration ([#3840][] @ocavue)
1313
* [`no-unknown-property`]: support `precedence` prop in react 19 ([#3829][] @acusti)
14+
* [`prop-types`]: props missing in validation when using generic types from a namespace import ([#3859][] @rbondoc96)
1415

1516
### Changed
1617
* [Tests] [`jsx-no-script-url`]: Improve tests ([#3849][] @radu2147)
1718
* [Docs] fix broken links: [`default-props-match-prop-types`], [`jsx-boolean-value`], [`jsx-curly-brace-presence`], [`jsx-no-bind`], [`no-array-index-key`], [`no-is-mounted`], [`no-render-return-value`], [`require-default-props`] ([#3841][] @bastiendmt)
1819

20+
[#3859]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3859
1921
[#3849]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3849
2022
[#3841]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3841
2123
[#3840]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3840

Diff for: lib/util/propTypes.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ module.exports = function propTypesInstructions(context, components, utils) {
107107
const defaults = { customValidators: [] };
108108
const configuration = Object.assign({}, defaults, context.options[0] || {});
109109
const customValidators = configuration.customValidators;
110-
const allowedGenericTypes = new Set(['forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
110+
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
111111
const genericTypeParamIndexWherePropsArePresent = {
112+
ComponentProps: 0,
113+
ComponentPropsWithoutRef: 0,
112114
ForwardRefRenderFunction: 1,
113115
forwardRef: 1,
114116
VoidFunctionComponent: 0,

0 commit comments

Comments
 (0)