facebook / docusaurus Public
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
Make a distributed eslint plugin to enforce best Docusaurus practices #6472
Comments
|
yes we definitively want an eslint plugin |
|
Hello can I be assigned this issue? |
|
@dave-sh Sure, please go ahead. You have a week to send your initial work. Good luck! |
|
This issue is up for grabs again, since @dave-sh seems to be unavailable. |
|
can I contribute to this? |
|
@Ash-KODES Sure—again, the work needed is given in the description. If you have any doubts, you can ask on the Discord server. You have a week to send your initial work. Good luck! |
|
Due to the unresponsive nature of these kinds of issues, if anyone wants to grab the issue, just send a PR directly. No need to ask for permissions. |


Have you read the Contributing Guidelines on issues?
Motivation
I realized there are a few text labels in our repo that are accidentally not translated. This has happened a few times in the past as well (see #4542). It would be interesting if we can make an eslint plugin with two rules:
no-dynamic-i18n-messages: ensures that all translate calls are plain text labelsno-untranslated-text: ensures all text labels in JSX are wrapped by translate calls (may have lots of false positives, but interesting to see how close we can get)See https://docusaurus.io/docs/next/i18n/tutorial#translate-your-react-code for some documentation of the mental model of translate APIs.
We can publish this plugin as
@docusaurus/eslint-plugin, so users can use this for themselves, as well as plugin/theme authors.We may even ensure more best practices:
prefer-docusaurus-link: ensures@docusaurus/Linkis used instead ofatagsprefer-ideal-image: ensures@theme/IdealImageis used instead ofimgtagsprefer-docusaurus-heading: ensures@theme/Headingis used instead ofh2tagsno-hardcoded-src: ensures allsrcattributes are eitherrequireoruseBaseUrlno-window-eq-undefined: forbidtypeof window !== 'undefined'because this is not an adequate way to escape SSRSelf-service
The text was updated successfully, but these errors were encountered: