-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[POC][docs] JSDoc comments as deprecation source of truth #42280
[POC][docs] JSDoc comments as deprecation source of truth #42280
Conversation
Netlify deploy previewhttps://deploy-preview-42280--material-ui.netlify.app/ Bundle size report |
c34468e
to
16d2b82
Compare
Looks promising 👍 Quick note: the text are usually stored in a translation files even if we do not support translation yet.
This might be harder since it's not a one to one relation ship. For example when you will deprecate one of the List sub component. Not sure the time spent on using JSDocs to show warning in Demo pages is worth compared to doing a copy/paste which add more flexibility (for ex: putting the warning in the section that introduce the subcomponent instead of the header) |
I'm assuming we'll need to duplicate the deprecated message in the JSDoc and the translation file. In that case, I'm not sure using JSDoc as the source of truth to display the deprecated message in the API page makes sense. What still makes sense is allowing the usage of JSDoc tags in components/hooks so consumers receive that in their IDE.
Probably not worth it, yeah. btw, do we have translations in md files? |
To be clear, translation files are generated from the JSDocs by
@michaldudak recently worked on cleaning this pipeline
Not sure. Translation got removed when I joined (2 years ago) If I remember correctly, it was done by using markdown files with |
Thanks for the input @alexfauquette. I'll go ahead and separate this PR into two:
|
As of today, we don't show deprecation messages in component API pages. The general idea of this PR is to treat JSDoc comments as the source of truth to mark components as deprecated in the docs.
@deprecated
JSDoc tags (and any other tag) in components.Preview link: https://deploy-preview-42280--material-ui.netlify.app/material-ui/api/hidden/
Potential improvements:
Use JSDoc as the source of truth for the deprecation message in markdown-generated pages, too, so it would work in all markdown-based pages too, like Base pages.Right now, deprecation messages are hardcoded in .md files (example).It would require some work to include the deprecation alert in the middle of markdown-generated pages since the whole page is rendered as a single markdown block, but definitely doable.