Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Fix incorrect definitions for react/require-default-props #213

Closed
wants to merge 1 commit into from

Conversation

controversial
Copy link

@controversial controversial commented Jul 19, 2023

See the documentation for this rule’s options.

Neither the classes option nor the functions option accepts an object value, so the previous type definition here is incorrect and broken.

Example of correctly written eslint config being assigned an erroneous type error:

config-error

 

I also added a @deprecated label for the option that is listed as such in the documentation.

See the [documentation](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md#rule-options) for this rule’s options. 

Neither the `classes` option nor the `functions` option accepts an object value, so the previous type definition here is broken.
@Shinigami92
Copy link
Member

The rules/*.d.ts files are auto-generated

Please forward this issue to https://github.com/jsx-eslint/eslint-plugin-react/blob/31282dd27c8488efdb53967271d31c79d3072f74/lib/rules/require-default-props.js#L43-L52

There you can see that the enum is wrapped in an allow and I think this needs to be removed

a working example can be found here: https://github.com/jsx-eslint/eslint-plugin-react/blob/31282dd27c8488efdb53967271d31c79d3072f74/lib/rules/jsx-sort-props.js#L370-L373

For the deprecation, please check if this can be achieved via json-schema as well

@controversial
Copy link
Author

Thanks for the note; I filed jsx-eslint/eslint-plugin-react#3604.

@Shinigami92
Copy link
Member

Checked, but the newest commit it still not released, so I wait for 7.34

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

Successfully merging this pull request may close these issues.

2 participants