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

[docs] Include default values in IntelliSense #22447

Merged
merged 13 commits into from
Sep 4, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Sep 2, 2020

Not so sure about this one. I think @default is fundamentally flawed when spreading props. ButtonBase having type="button" is not the same as Button documenting this as a default value. This is only noticeable for custom variants at the moment though.

The default values (for documented props in e.g. https://material-ui.com/api/chip/#props) are now part of IntelliSense.

We verify that actual default values are kept in sync with default values from the @default annotation in yarn docs:api. This fails if:

  • there is a documented default value but no @default annotation

    JSDOC @default annotation not found for '${propName}'.

  • there is a documented default value but the @default annotation does not match

    Expected JSDOC @default annotation for prop '${propName}' of "${jsdocDefaultValue.value}" to equal runtime default value of "${defaultValue?.value}"

  • there is a @default annotation but no default value at runtime

    Declared a @default annotation in JSDOC for prop '${propName}' but could not find a default value in the implementation.

    This ensures that IntelliSense displays the same as the docs. One could argue that we have more space in IntelliSense and could therefore document more default values. We can follow-up on this with concrete use cases.

@eps1lon eps1lon added docs Improvements or additions to the documentation typescript labels Sep 2, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Sep 2, 2020

@material-ui/lab: parsed: +0.12% , gzip: +0.17%

Details of bundle changes

Generated by 🚫 dangerJS against 50d155b

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Nice!

docs/src/modules/utils/generateMarkdown.ts Outdated Show resolved Hide resolved
@eps1lon eps1lon merged commit d9ca53d into mui:next Sep 4, 2020
@eps1lon eps1lon deleted the docs/default-props-intellisense branch September 4, 2020 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants