We currently maintain an exclude list of files that should not be included in jsdoc documentation. This was expedited to unblock use of ES6 in MediaWiki core. We hope to complete this porting by the next MediaWiki 1.42 Release, although CI will need to continue supporting JSDuck to generate the documentation for the REL1_39 branch which is supported until November 2025.
https://gerrit.wikimedia.org/g/mediawiki/core/+/29af4dd074ecc71c67bb9e530d82daddcf45c724/jsdoc.js#18
Migration plan
- 1. Switch to JSDoc from JSDuck for one module and provide link to old version of documentation so that use of ES6 is unblocked.
- Review documentation example with technical documentation team.
- 2. Port all other files to jsdoc. Porting should be prioritized based on user needs. During this phase we should consider what code should not be ported to the new documentation and pay attention to improving documentation where possible e.g. adding examples.
- Go through the following list and decide whether the code needs to included in the documentation or excluded from the documented. We will prioritize porting of public stable APIs used by gadget developers and alter the priorities based on feedback from the talk page.
- 3. Final review. After everything is ported, review with technical documentation team and identify follow up work. (Tracking spreadsheet)
- Phase 1: Review for information parity with JSDuck. Output: T360237: Add missing methods and properties to JSDoc, T360240: JSDoc missing property defaults
- Phase 2: Review for usability and consistency. Output: T360238: Duplicated hooks in MediaWiki core JSDoc, T360241: MediaWiki core JSDoc cleanup
TODO
- Claim an item in the list by adding your name next to it.
- Make sure you have the latest version of MediaWiki core.
- Edit jsdoc.js, and move the file that you're migrating from the exclude section to the include section.
- Run npm run doc to update the local docs site.
- Open docs/js/index.html to view the site.
- Look through the local docs site, and find the elements from the file you're migrating. Does everything not marked as @private show up? Is it organized in a way that makes sense? You can check out the same content on the old JSDuck site for MediaWiki version 1.41 to see if the new site is presenting the same information in roughly the same way. If not, you'll need to adjust the tags to comply with JSDoc. See the chart on T138401 for specific mappings from JSDuck tags to JSDoc tags.
- Re-run npm run doc to preview your changes.
Tips and best practices:
- Only public and stable methods should appear on the docs site.
- Make sure every function has a description in the main section of the doc block.
- Add an @example if you think they will be useful.
- For singleton classes, use a @namespace tag.
- Follow patterns in existing examples. Document hooks under namespace Hooks and jQuery plugins under jQueryPlugins namespace.
- Fix any related jsdoc warnings.
- You can run npx grunt eslint to find JSDoc errors.
- If something isn't appearing on the docs site, you may need to add a @memberof tag with the namespace.
In order of priority:
Check the box once the patch is merged.
Phase 1
- resources/src/mediawiki.util (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/975921/)
- resources/src/mediawiki.base (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/978717)
- resources/src/mediawiki.notification (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/978717)
- resources/src/startup (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/978717)
- resources/src/mediawiki.Title https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982917
- resources/src/mediawiki.user.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983265, https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983973)
- resources/src/mediawiki.api (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982932)
- resources/src/mediawiki.Uri (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982815, https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983973)
- resources/src/mediawiki.ForeignUpload.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982939
- resources/src/mediawiki.String.js [Jon] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982509
Phase 2
- resources/src/jquery.lengthLimit.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982856)
- resources/src/mediawiki.experiments.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982861)
- resources/src/mediawiki.Upload.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/982939/1)
- resources/src/mediawiki.cookie (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983220)
- resources/src/mediawiki.storage.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983263)
- resources/src/mediawiki.page.watch.ajax (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983498)
- resources/src/mediawiki.page.ready https://gerrit.wikimedia.org/r/c/mediawiki/core/+/984266
- resources/src/mediawiki.template.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987490
- resources/src/mediawiki.template.mustache.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987490
- resources/src/mediawiki.feedback https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987825
- resources/src/jquery https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987836
- resources/src/jquery.spinner https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987836
- resources/src/jquery.tablesorter https://gerrit.wikimedia.org/r/c/mediawiki/core/+/987836
- resources/src/mediawiki.widgets https://gerrit.wikimedia.org/r/c/mediawiki/core/+/988731
Phase 3 [https://gerrit.wikimedia.org/r/c/mediawiki/core/+/988733/]
The following modules do not appear to have public APIs. We should include them in jsdoc.json and make sure no changes happen to the documentation. You may need to add @ignore to a few things.
- resources/src/mediawiki.page.image.pagination.js
- resources/src/mediawiki.page.media.js
- resources/src/mediawiki.special.block.js
- resources/src/mediawiki.page.gallery.js
- resources/src/mediawiki.userSuggest.js
- resources/src/mediawiki.special.userrights.js
- resources/src/mediawiki.special.search.commonsInterwikiWidget.js
- resources/src/mediawiki.special.contributions.js
- resources/src/mediawiki.checkboxtoggle.js
- resources/src/mediawiki.special.changeslist.legend.js
- resources/src/mediawiki.special.changeemail.js
- resources/src/mediawiki.special.changecredentails.js
- resources/src/mediawiki.misc-authed-pref
- resources/src/mediawiki.toc
- resources/src/mediawiki.pulsatingdot
- resources/src/mediawiki.skinning
- resources/src/mediawiki.special
- resources/src/mediawiki.action
- resources/src/mediawiki.action.edit
- resources/src/mediawiki.special.changeslist
- resources/src/mediawiki.apipretty
- resources/src/mediawiki.special.changeslist.watchlistexpiry
- resources/src/mediawiki.special.createaccount
- resources/src/mediawiki.special.editrecovery
- resources/src/mediawiki.special.search
- resources/src/mediawiki.diff
- resources/src/mediawiki.special.unwatchedPages
- resources/src/mediawiki.editRecovery
- resources/src/mediawiki.filewarning
- resources/src/mediawiki.special.watchlist
- resources/src/mediawiki.helplink
- resources/src/mediawiki.htmlform
- resources/src/mediawiki.tempUserBanner
- resources/src/mediawiki.language.names
- resources/src/mediawiki.misc-authed-curate
- resources/src/mediawiki.misc-authed-ooui
Phase 4
- resources/src/mediawiki.page.preview.js (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983511)
- resources/src/mediawiki.cldr https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.feedlink https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.visibleTimeout https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.confirmCloseWindow.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.debug https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.deflate https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.libs.pluralruleparser https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991408
- resources/src/mediawiki.watchstar.widgets https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991658
- resources/src/mediawiki.widgets.visibleLengthLimit https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991658 [Jon, CR: Anne ]
- resources/src/mediawiki.tempUserCreated https://gerrit.wikimedia.org/r/c/mediawiki/core/+/995268 [Jon]
- resources/src/mediawiki.searchSuggest https://gerrit.wikimedia.org/r/c/mediawiki/core/+/995267 [Jon]
- resources/src/mediawiki.libs.jpegmeta https://gerrit.wikimedia.org/r/c/mediawiki/core/+/995274 [Bartosz]
- resources/src/mediawiki.language [Anne] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1002641
- resources/src/mediawiki.language.months [Anne] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1002641
- resources/src/mediawiki.page.gallery.slideshow.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/995275 [Jon]
- resources/src/mediawiki.messagePoster https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1003046 [Anne]
- resources/src/mediawiki.jqueryMsg https://gerrit.wikimedia.org/r/c/mediawiki/core/+/988730 [Jon, CR: Roan]
- resources/src/mediawiki.widgets.datetime [Anne] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1003785
- resources/src/mediawiki.ForeignApi (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/983280) [Roan]
- resources/src/mediawiki.rcfilters https://gerrit.wikimedia.org/r/c/mediawiki/core/+/991655 [Jon, CR: Roan ]
- resources/src/mediawiki.htmlform.ooui [Jon] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1004261
- resources/src/mediawiki.ForeignStructuredUpload.BookletLayout (https://gerrit.wikimedia.org/r/1003992) [Roan]
- resources/src/mediawiki.Upload.BookletLayout (https://gerrit.wikimedia.org/r/1003992) [Roan]
- resources/src/mediawiki.Upload.Dialog.js (https://gerrit.wikimedia.org/r/1003992) [Roan]
Sign off steps
- Check https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1003046/3/resources/src/mediawiki.messagePoster/factory.js#113 was taken care of
Files we didn't migrate
To do: For each of these, decide whether they should be excluded in the JSDoc config, documented, or marked with @ignore or @private tags
- resources/src/mediawiki.language.specialCharacters (exports JSON) https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009368
- resources/src/mediawiki.notification.convertmessagebox.js (exports a function) https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009369
- resources/src/mediawiki.special.apisandbox https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009578
- resources/src/vue https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009576
- resources/src/codex (no longer exists) https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1008973
- resources/src/codex-search (no longer exists) https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1008973
- resources/src/ooui-local.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009368
- resources/src/mediawiki.router No JSDoc annotations as-is; opened a followup task to merge into core: T358813: Document mediawiki-router, move oojs-router into core
- resources/src/qunitjs (CSS only)
- resources/src/oojs-global.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009368
- resources/src/skip-web2017-polyfills.js (used to prevent code loading for browsers that don't need it)
- resources/src/mediawiki.inspect.js https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009580
- resources/src/mediawiki.special.preferences.ooui (ok to leave as-is)
- resources/src/moment https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1009372
- resources/src/mediawiki.special.upload (private)