[docs-infra] Prevent to set `undefined` as a default value
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Why not?
/**
* The height of the chart in px. If not defined, it takes the height of the parent element.
*/
height: PropTypes.number,
It looks funny on the API page:
As far as I know, we only do this if it's null. undefined is the default "prop default value". In https://github.com/mui/material-ui/pull/41114 I try to improve its display.
If this change makes sense, then I think we should throw an error in docs-infra when the default is undefined, saying to remove it as redundant, to prevent future regressions.
Originally posted by @oliviertassinari in https://github.com/mui/mui-x/pull/11996#discussion_r1491248717
Search keywords:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the docs-infra handling for prop default values and compare the API-page example shown in the issue with the intended null behavior. Reproduce the displayed undefined default, then verify that docs-infra rejects redundant undefined defaults while still allowing null; no specific file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100