Page MenuHomePhabricator

Replace jsduck with JSDoc3 across all Wikimedia code bases
Closed, ResolvedPublic

Assigned To
Authored By
Jhernandez
Jun 22 2016, 2:12 PM
Referenced Files
F41522432: Screenshot 2023-11-20 at 5.42.55 PM.png
Nov 21 2023, 1:43 AM
F12518296: Screen Shot 2018-01-12 at 22.58.24.png
Jan 12 2018, 10:58 PM
F12518294: Screen Shot 2018-01-12 at 22.58.10.png
Jan 12 2018, 10:58 PM
Tokens
"Party Time" token, awarded by KBach."Love" token, awarded by Bmueller."Like" token, awarded by SCherukuwada."Orange Medal" token, awarded by Aklapper."100" token, awarded by MusikAnimal."Barnstar" token, awarded by Sportzpikachu."100" token, awarded by Niedzielski."Orange Medal" token, awarded by Krinkle.

Description

JSDuck is formally unmaintained and seems abandonware by now. It is hurting our ability to properly document our code.

  1. Examples of problems:
    • No support for @interface
    • No support for namespaced events (change:title is invalid)
    • No support for ES6 (T156469)
  2. Links that show it is unmaintained:
  3. Proposed alternatives:

Migration plan

  1. Research: Start researching who uses the JS HTML docs and what features are important to them, including:
  1. Scope improvements to the WMF theme: Informed by user feedback and documentation best practices, compile a list of critical usability fixes in the form of Phabricator tasks with clear descriptions and acceptance criteria. See T187672: Release jsdoc-wmf-theme 1.0 (Wikimedia theme for JSDoc3) and T138401#9079509.
  1. Consider temporary mitigations: To address concerns about the impact to documentation usability while work on the theme is in progress, we looked into options to help mitigate that impact in the short term. For MediaWiki core, we decided to use the MediaWiki version 1.41 JSDuck docs as a backup while the migration is in progress with the goal of completing the migration in time for version 1.42. In addition, after looking into a few other open-source theme options, we decided to move forward with the WMF theme.

Codebases to port to JSDoc

Only codebases that previously had a published doc.wikimedia.org JSDuck site are in scope. Once these are all converted, this ticket can be closed.

Please compare to the old JSDuck docs when converting these, to help with the conversion and to make sure nothing breaks or is missed.

Done?RepoTicketCurrently has JSDuck site
on doc.wikimedia.org?
(needs conversion)
Currently has JSDoc site
on doc.wikimedia.org?
(yay. all done)
Notes
mediawiki/coreT352308JSDoc site
mediawiki/extensions/CollaborationKitT138401JSDoc site
mediawiki/extensions/EventLoggingT357444JSDoc site
mediawiki/extensions/FlowJSDuck siteSkipping conversion due to Flow's imminent undeployment. See T379671
mediawiki/extensions/GuidedTourT367507JSDoc site
mediawiki/extensions/KartographerT342864JSDoc site
mediawiki/extensions/MobileFrontendT188261JSDoc site
mediawiki/extensions/TemplateDataGerritJSDoc siteNot on jsdoc-wmf-theme yet due to 5 globals (fatal error) that need to be fixed. Tracked in T379427
mediawiki/extensions/VisualEditor (MediaWiki integration)T250843JSDoc site
mediawiki/extensions/WikibaseT342905JSDuck site was disabled as a result of discussion on T342905
mediawiki/skins/MinervaGerritJSDoc site
oojs/coreGerritJSDoc site
oojs/ui (OOUI)T185396JSDoc site
oojs/routerT358813JSDuck siteJSDoc site (part of MediaWiki core)Cleanup work tracked in T379430
VisualEditor/VisualEditor (Standalone)T250843JSDoc site

Checklist for each migration

  • Code documentation works fine, fix any problems
  • Docs get properly published to docs.wikimedia.org e.g. https://doc.wikimedia.org/MobileFrontend/master/js/
  • CI lints documentation properly with jenkins-bot on patches
  • Documentation about how to run documentation in mw.org, README, etc is updated to point to the new instructions if any change

Migration guide

For how to set up JSDoc, see https://www.mediawiki.org/wiki/JSDoc.

JSDuck to JSDoc mapping

JSDuck tagJSDoc tag and notes
@abstract@abstract
@accessor Unsupported. Only used by ExtJSBase.
@alias prefix.name@alias aliasNamepath
@alternateClassName OtherClassName What to do? @alias aliasNamepath? @typedef {type} namepath? Sparse usage.
@aside name Unsupported. No usage.
@author Some name...@author name <emailAddress>
@cfg, @cfg name, @cfg {Type} name, @cfg {Type} [name="default value"], @cfg {Type} name.subpropertyUse @param, or use`@typedef` for shared types
@chainableUse @return {Type} where {Type} refers to the memberof class of the function instead.
@class, @class ClassName@class name
@constructor@return {type} description
@deprecated@deprecated
@docauthor Some name... Unsupported and unused.
@enum, @enum {Type}, @enum {Type} EnumName, @enum [EnumName=alias.*]@enum {type}
@event, @event name@event ~'className.eventName' (example: ~'util.addPortlet')
@evented Unsupported. Only used by ExtJSBase.
@example@example
@experimental, @experimental 2.0 Some description...@experimental
@extends ParentClassName@extends namepath
@fires eventName (in 5.x beta)For hooks: @fires Hooks~'className.eventName' (example:Hooks~'util.addPortletLink')
@ftype name Unsupported. No usage.
@hide Unsupported. Only used by ExtJSBase.
@ignore@ignore
@inheritable What to do? Delete?
@inheritdoc, @inheritdoc ClassName, @inheritdoc #memberName, @inheritdoc ClassName#memberName, @inheritdoc ClassName#static-type-memberNameWhat to do? If no value, @inheritdoc. If value, @extends value?
@localdoc This documentation is only visible inside this class/member. (in 5.x beta) What to do? Delete?
@markdown Unsupported. No usage.
@member ClassName What to do? @member {type} name, @memberof parentNamepath @memberof! parentNamepath, or something else?
@method, @method name@method FunctionName
@mixins ClassName@mixes OtherObjectPath
@new Unsupported. No usage.
@override OverriddenClassName@override
@param name, @param {Type} name, @param {Type} [name], @param {Type} [name="default-value"], @param {Type} name.subproperty@param {type} name description. For an optional parameter: @param {type} [name] description or @param {type} [name=default value] description. See jsdoc.app.
@preventable Unsupported. Only used by ExtJSBase.
@private@private [{typeExpression}]
@property, @property name, @property {Type} name, @property {Type} [name="default value"], @property {Type} name.subproperty@property {type} name description. For an optional property: @property {type} [name] description
@protected@protected [{typeExpression}]
@ptype name Unsupported. No usage.
@readonly@readonly
@removed, @removed 2.0 Some description... Unsupported. One usage in SemanticMediaWiki and otherwise only used by ExtJSBase.
@requires ClassName@requires someModuleName
@return {Type}, @return {Type} return.subproperty (Multiple @return tags )Replace with single @return {Type} description and use @typedef {Object} Type to document the type.
@scss-mixin Unsupported. No usage.
@since Ext JS 4.0 beta@since versionDescription
@singleton What to do? Custom tag?
@static@static
@template@template
@throws, @throws {Type}@throws {type} free-form description
@type {Type}, @type Type@type {type} free-form description
@uses ClassName@see namepath or @see text. Mapping isn't one-to-one.
@var, @var $some-name, @var {Type} $some-name, @var {Type} [$some-name="default value"]@member {type} name
@xtype Unsupported. One usage in ExtTab and otherwise only uses by ExtJSBase.
{@link Class#member link text}{@link namepathOrURL}, [link text]{@link namepathOrURL}, {@link namepathOrURL%7clink text}, {@link namepathOrURL link text (after the first space)}
{@img path/to/image.png alt text}Usupported. Only used by ExtJSBase.
{@video vimeo 465123 Some description here...} Unsupported. No usage.

Details

SubjectRepoBranchLines +/-
operations/deployment-chartsmaster+1 -1
mediawiki/extensions/WikibaseQualityConstraintsmaster+30 -18
mediawiki/extensions/ExternalGuidancemaster+8 -8
mediawiki/extensions/CampaignEventsmaster+12 -9
mediawiki/extensions/Mathmaster+1 -1
mediawiki/extensions/MobileFrontendmaster+2 -2
mediawiki/extensions/WikibaseLexememaster+3 -3
mediawiki/extensions/UniversalLanguageSelectormaster+8 -8
mediawiki/extensions/Translatemaster+3 -3
mediawiki/services/kartotherianmaster+4 -4
mediawiki/services/cxservermaster+10 -9
mediawiki/extensions/AdvancedSearchmaster+16 -14
mediawiki/extensions/GrowthExperimentsmaster+27 -24
mediawiki/extensions/MultimediaViewermaster+5 -5
mediawiki/extensions/ContentTranslationmaster+52 -52
mediawiki/extensions/Citemaster+5 -3
mediawiki/extensions/Flowmaster+43 -43
mediawiki/extensions/CentralAuthmaster+1 -1
mediawiki/extensions/TemplateDatamaster+6 -6
mediawiki/extensions/TemplateWizardmaster+20 -11
mediawiki/extensions/Citoidmaster+4 -4
mediawiki/extensions/Echomaster+104 -102
integration/configmaster+5 -0
mediawiki/extensions/UploadWizardmaster+189 -114
mediawiki/extensions/UploadWizardmaster+519 -22
mediawiki/extensions/Translatemaster+21 -14
mediawiki/extensions/Citoidmaster+1 -1
mediawiki/extensions/Flowmaster+2 -2
mediawiki/extensions/Graphmaster+1 -1
mediawiki/extensions/SyntaxHighlight_GeSHimaster+1 -1
mediawiki/coremaster+2 -3 K
mediawiki/extensions/Flowmaster+1 -225
integration/configmaster+0 -1
mediawiki/coremaster+3 -450
mediawiki/coremaster+638 -51
mediawiki/extensions/Kartographermaster+12 -450
mediawiki/extensions/Kartographermaster+455 -17
mediawiki/extensions/TemplateDatamaster+186 -37
mediawiki/extensions/GlobalWatchlistmaster+870 -616
mediawiki/coremaster+172 -483
mediawiki/coremaster+3 -4
mediawiki/coremaster+0 -0
integration/configmaster+4 -5
integration/configmaster+1 -1
mediawiki/skins/MinervaNeuemaster+57 -68
mediawiki/services/parsoidmaster+13 -1
mediawiki/services/parsoidmaster+367 -404
Show related patches Customize query in gerrit

Related Objects

StatusSubtypeAssignedTask
OpenFeatureNone
Resolvedhashar
OpenNone
StalledNone
Resolvedapaskulin
Resolved Jhernandez
DuplicateNone
ResolvedKrinkle
Resolvedapaskulin
OpenNone
ResolvedEsanders
ResolvedEsanders
ResolvedBUG REPORTKrinkle
ResolvedJdlrobson
DuplicateNone
DuplicateNone
DuplicateNone
Resolved nray
ResolvedJdforrester-WMF
Resolvedmatmarex
DeclinedNone
Resolvedcscott
ResolvedTheDJ
ResolvedSamwilson
ResolvedNone
OpenNone
DeclinedNone
Resolvedapaskulin
ResolvedKrinkle
Resolvedmatmarex
Resolvedapaskulin
DeclinedBUG REPORTJdlrobson
Resolvedapaskulin
Resolvedegardner
OpenNone
OpenNone
OpenNone
ResolvedNovem_Linguae
ResolvedNovem_Linguae
ResolvedNovem_Linguae

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change #1036565 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/AdvancedSearch@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036565

Change #1036567 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CentralAuth@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036567

Change #1035901 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1035901

Change #1036558 merged by jenkins-bot:

[mediawiki/extensions/TemplateWizard@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036558

Change #1036562 merged by jenkins-bot:

[mediawiki/extensions/Citoid@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036562

Change #1036554 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036554

Change #1036567 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036567

Change #1036627 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/Flow@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036627

Change #1036627 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036627

Change #1036563 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036563

Change #1036641 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/ContentTranslation@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036641

Change #1036645 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/GrowthExperiments@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036645

Change #1036670 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/MultimediaViewer@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036670

Change #1036641 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036641

Change #1036670 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036670

Change #1036645 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036645

Change #1036565 merged by jenkins-bot:

[mediawiki/extensions/AdvancedSearch@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1036565

Change #1037019 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/services/kartotherian@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037019

Change #1037020 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/WikibaseLexeme@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037020

Change #1037021 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/UniversalLanguageSelector@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037021

Change #1037022 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/Translate@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037022

Change #1037023 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/Math@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037023

Change #1037024 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/ExternalGuidance@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037024

Change #1037025 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/CampaignEvents@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037025

Change #1037126 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/MobileFrontend@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037126

Change #1037127 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/extensions/WikibaseQualityConstraints@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037127

Change #1037128 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/services/cxserver@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037128

Change #1037128 merged by jenkins-bot:

[mediawiki/services/cxserver@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037128

Change #1037019 merged by jenkins-bot:

[mediawiki/services/kartotherian@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037019

Change #1037022 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037022

Change #1037021 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037021

Change #1037020 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037020

Change #1037126 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037126

Change #1037023 merged by jenkins-bot:

[mediawiki/extensions/Math@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037023

I diffed all the JSDuck tags and all the JSDoc tags, and came up with the following list of tags that only occur in JSDuck (and therefore should be mass refactored):

https://www.mediawiki.org/wiki/JSDoc#Converting_from_JSDuck_to_JSDoc

Doing codesearches of each tag, the following are present in our codebases:

@alternateClassName
@inheritable
@localdoc
@mixins
@singleton
@template
@uses

Will work on these as time permits. Lots of patches incoming. Let me know if I should switch to a sub-ticket. (Done, T366230) Also let me know if one of these tags should not be refactored (e.g. we support it via a plugin (@chainable), or we want to keep it because it makes the code more readable (@constructor))

Change #1037025 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037025

Change #1037024 merged by jenkins-bot:

[mediawiki/extensions/ExternalGuidance@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037024

Change #1037127 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] JSDoc: convert @cfg to @param

https://gerrit.wikimedia.org/r/1037127

@apaskulin or anyone. The following extensions in this ticket are marked as done translating from JSDuck to JSDoc but do not have a jsdoc file (so probably aren't generating /docs/). Should I write patches for these repos to generate /docs/? We don't have to put them on doc.wikimedia.org, but it seems like it might be hard to check that a repo is fully transitioned from JSDuck to JSDoc without at least generating and looking at the /docs/

  • Citoid
  • Flow
  • Graph
  • SyntaxHighlight_GeSHi

Flow will be undeployed soon. I'm not sure it's worth working on. Just my 2c.

Flow will be undeployed soon. I'm not sure it's worth working on. Just my 2c.

+1. We've removed jsduck for ease of maintenance (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Flow/+/988013) but no point implementing jsdoc.

I chatted with Alex today and got some direction on this project.

Just now, in this ticket, I went ahead and converted the todo list of extensions into a table with some additional columns such as "JSDoc website link".

Proposal to change the acceptance criteria

Proposal: I wonder if we should make the acceptance criteria for this task "convert websites currently on doc.wikimedia.org that are still JSDuck to JSDoc", and then just delete the rest of the extensions on the todo list. That way this task doesn't stay open forever, and that way folks don't go accidentally adding JSDoc /docs/ to extensions that don't need them like I did for UploadWizard and Translate. With hindsight I now know that those two extensions didn't previously have a JSDuck documentation site, so probably don't need a JSDoc one.

Using codesearch, I have been doing mass refactorings such as @cfg and @mixins (T366230), and looking for keywords such as "jsduck". Because of this, I think it might be safe to say "good enough" for remaining extensions with unpublished/no doc website, and skip a detailed look at them.

The new acceptance criteria would mean this ticket would be closed when we finish converting CollaborationKit, GuidedTour, Wikibase, and oojs/router, which are the last 4 remaining repos to have JSDuck documentation published on doc.wikimedia.org. (Excluding Flow, which we decided above not to work on since it is getting undeployed soon.)

Thoughts?

Thanks, @Novem_Linguae! I think that sounds good. With the exception that oojs/router has already been migrated as part of moving into MediaWiki core; I've updated to task description to reflect this.

Change #1042603 had a related patch set uploaded (by KartikMistry; author: KartikMistry):

[operations/deployment-charts@master] Update cxserver to 2024-06-13-045621-production

https://gerrit.wikimedia.org/r/1042603

Change #1042603 merged by jenkins-bot:

[operations/deployment-charts@master] Update cxserver to 2024-06-13-045621-production

https://gerrit.wikimedia.org/r/1042603

apaskulin closed this task as Resolved.EditedTue, Nov 12, 11:36 PM

This task is now complete! Aside from a few outliers and cleanup tasks that we'll be tracking separately, all codebases that were publishing JSDuck sites have been migrated to JSDoc 🎉

There are a few codebases in Wikimedia Gerrit still using JSDuck. We'll be looking to codebase maintainers to start these migrations and tracking them separately. I've opened tasks to track migration for: cxserver (T379690), Wikispeech (T379691), ArticleCreationWorkflow (T379692), DonationInterface (T379693), FormWizard (T379694), ImportArticles (T379697), and MediaUploader (T379698).

A huge thanks to everyone who contributed and helped make this happen: Jon Robson, Anne Tomasevich, Roan Kattouw, NovemLinguae, James Forrester, Kamil Bach, Timo Tijhof, TheDJ, C. Scott Ananian, and many others who commented on the task, helped with migration, and provided feedback. Great work everyone!