-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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. |
I would like to take up this issue @Josh-Cena . I would require some pointers as well on solving this issue. |
@alceil This issue would require you to have some understanding in developing ESLing plugins, or at least working with ASTs in general. Are you looking for pointers on how to develop an ESLint plugin, or just how to translate my issue description into more concrete demand? I can elaborate on the latter, but probably not on the former. |
Also cc @armano2 not sure about your availability, but I guess you would like this? This issue would probably not be resolved in a while, so whenever you have time you can take a look |
I would like some pointer on developing eslint plugins. I can get it done @Josh-Cena . Also I would like to know more about the issue |
I don't have many good resources to share, but https://eslint.org/docs/developer-guide/working-with-plugins and other related docs there would be a good starting point. When I work on ESLint I also find the AST explorer quite useful (you should use the TS-ESLint parser + ESLint v8 Transform). The TS-ESLint playground is quite good as well, but since we don't use type-aware linting here, AST explorer should be more preferable since you can visualize fixers. Now this issue does assume you have some understanding in ESLint (as I said), so I will not go through the 101s of working with ASTs or fixers. You can try to learn from the resources above—the API is quite straightforward (I'd say much better than Babel's, because the goal is much simpler). |
Okay got it @Josh-Cena |
Okay, i see a PR merged, why is it still open? What else should be done? Thank you! |
Please check the list in the issue description—there are a lot of missing features that could be implemented as follow-up. If you want to take a shot feel free to. |
@Josh-Cena I would like to work on this, is necessary to cover all the good practices mentioned, or can I submit the ones I can develop? |
@Josh-Cena can I work on these
|
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/Link
is used instead ofa
tagsprefer-ideal-image
: ensures@theme/IdealImage
is used instead ofimg
tagsprefer-docusaurus-heading
: ensures@theme/Heading
is used instead ofh2
tagsno-hardcoded-src
: ensures allsrc
attributes are eitherrequire
oruseBaseUrl
no-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: