Docs: Improve wp-admin JSDoc structural data globally.

JSDoc takes it structural data from `@namespace`, `@lends` and `@memberOf`. This change fixes these tags for all JavaScript files in the wp-admin folder.

* Add jsdoc configuration to parse wp-admin/js files. Use `jsdoc -c jsdoc.conf.json` to generate JSDoc.
* Define all used namespaces using `@namespace`.
* Define each usage of the extend function as a prototype assignment using `@lends`.
* Add `@alias` if JSDoc cannot detect the correct name automatically.

This has previously been corrected for all `wp-includes` JavaScript files: [41351].

Props herregroen.
Fixes #42485.

Built from https://develop.svn.wordpress.org/trunk@42403


git-svn-id: http://core.svn.wordpress.org/trunk@42232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
atimmer
2017-12-15 13:42:46 +00:00
parent 36498bd601
commit 1f707de9dd
29 changed files with 583 additions and 459 deletions

View File

@@ -1,7 +1,13 @@
if ( 'undefined' === typeof window.wp ) {
/**
* @namespace wp
*/
window.wp = {};
}
if ( 'undefined' === typeof window.wp.codeEditor ) {
/**
* @namespace wp.codeEditor
*/
window.wp.codeEditor = {};
}
@@ -33,6 +39,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
* @param {object} settings.codeMirror - Settings for CodeMirror.
* @param {Function} settings.onChangeLintingErrors - Callback for when there are changes to linting errors.
* @param {Function} settings.onUpdateErrorNotice - Callback to update error notice.
*
* @returns {void}
*/
function configureLinting( editor, settings ) { // eslint-disable-line complexity
@@ -202,6 +209,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
* @param {object} settings.codeMirror - Settings for CodeMirror.
* @param {Function} settings.onTabNext - Callback to handle tabbing to the next tabbable element.
* @param {Function} settings.onTabPrevious - Callback to handle tabbing to the previous tabbable element.
*
* @returns {void}
*/
function configureTabbing( codemirror, settings ) {
@@ -240,7 +248,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
}
/**
* @typedef {object} CodeEditorInstance
* @typedef {object} wp.codeEditor~CodeEditorInstance
* @property {object} settings - The code editor settings.
* @property {CodeMirror} codemirror - The CodeMirror instance.
*/
@@ -260,6 +268,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
* @param {object} [settings.csslint] - Rules for CSSLint.
* @param {object} [settings.htmlhint] - Rules for HTMLHint.
* @param {object} [settings.jshint] - Rules for JSHint.
*
* @returns {CodeEditorInstance} Instance.
*/
wp.codeEditor.initialize = function initialize( textarea, settings ) {