Downport "Replace deprecated require-jsdoc, valid-jsdoc with jsdoc plugin for eslint"

Enabled and fixed for `check-alignment`, `implements-on-classes`,
`newline-after-description`, `require-param-name`, `require-param-type`,
`require-returns-type` and `valid-types`.

Change-Id: I493b498d81d5f8d908bb45de37de9c9ef956f7d8
This commit is contained in:
Tao Zhou
2019-12-17 09:59:28 +01:00
committed by Thomas Draebing
parent 3445b3d2c4
commit 25673abbae
75 changed files with 278 additions and 26 deletions

View File

@@ -7,6 +7,7 @@
"eslint": "^6.6.0", "eslint": "^6.6.0",
"eslint-config-google": "^0.13.0", "eslint-config-google": "^0.13.0",
"eslint-plugin-html": "^6.0.0", "eslint-plugin-html": "^6.0.0",
"eslint-plugin-jsdoc": "^18.4.3",
"fried-twinkie": "^0.2.2", "fried-twinkie": "^0.2.2",
"polylint": "^2.10.4", "polylint": "^2.10.4",
"typescript": "^2.x.x", "typescript": "^2.x.x",

View File

@@ -88,13 +88,41 @@
"prefer-promise-reject-errors": "off", "prefer-promise-reject-errors": "off",
"prefer-spread": "error", "prefer-spread": "error",
"quote-props": ["error", "consistent-as-needed"], "quote-props": ["error", "consistent-as-needed"],
"require-jsdoc": "off",
"semi": [2, "always"], "semi": [2, "always"],
"template-curly-spacing": "error", "template-curly-spacing": "error",
"valid-jsdoc": "off"
"require-jsdoc": 0,
"valid-jsdoc": 0,
"jsdoc/check-alignment": 2,
"jsdoc/check-examples": 0,
"jsdoc/check-indentation": 0,
"jsdoc/check-param-names": 0,
"jsdoc/check-syntax": 0,
"jsdoc/check-tag-names": 0,
"jsdoc/check-types": 0,
"jsdoc/implements-on-classes": 2,
"jsdoc/match-description": 0,
"jsdoc/newline-after-description": 2,
"jsdoc/no-types": 0,
"jsdoc/no-undefined-types": 0,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-param-name": 2,
"jsdoc/require-param-type": 2,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-check": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-returns-type": 2,
"jsdoc/valid-types": 2
}, },
"plugins": [ "plugins": [
"html" "html",
"jsdoc"
], ],
"settings": { "settings": {
"html/report-bad-indent": "error" "html/report-bad-indent": "error"

View File

@@ -31,6 +31,7 @@ limitations under the License.
/** /**
* Get the docs base URL from either the server config or by probing. * Get the docs base URL from either the server config or by probing.
*
* @param {Object} config The server config. * @param {Object} config The server config.
* @param {!Object} restApi A REST API instance * @param {!Object} restApi A REST API instance
* @return {!Promise<string>} A promise that resolves with the docs base * @return {!Promise<string>} A promise that resolves with the docs base

View File

@@ -25,6 +25,7 @@ limitations under the License.
/** /**
* Are any ancestors of the element (or the element itself) members of the * Are any ancestors of the element (or the element itself) members of the
* given class. * given class.
*
* @param {!Element} element * @param {!Element} element
* @param {string} className * @param {string} className
* @param {Element=} opt_stopElement If provided, stop traversing the * @param {Element=} opt_stopElement If provided, stop traversing the

View File

@@ -41,6 +41,7 @@ limitations under the License.
/** /**
* Returns the complement to the given column array * Returns the complement to the given column array
*
* @param {Array} columns * @param {Array} columns
* @return {!Array} * @return {!Array}
*/ */
@@ -63,6 +64,7 @@ limitations under the License.
* The Project column was renamed to Repo, but some users may have * The Project column was renamed to Repo, but some users may have
* preferences that use its old name. If that column is found, rename it * preferences that use its old name. If that column is found, rename it
* before use. * before use.
*
* @param {!Array<string>} columns * @param {!Array<string>} columns
* @return {!Array<string>} If the column was renamed, returns a new array * @return {!Array<string>} If the column was renamed, returns a new array
* with the corrected name. Otherwise, it returns the original param. * with the corrected name. Otherwise, it returns the original param.

View File

@@ -52,6 +52,7 @@ limitations under the License.
/** /**
* Whether the given patch is a numbered parent of a merge (i.e. a negative * Whether the given patch is a numbered parent of a merge (i.e. a negative
* number). * number).
*
* @param {string|number} n * @param {string|number} n
* @return {Boolean} * @return {Boolean}
*/ */
@@ -264,6 +265,7 @@ limitations under the License.
/** /**
* Convert parent indexes from patch range expressions to numbers. * Convert parent indexes from patch range expressions to numbers.
* For example, in a patch range expression `"-3"` becomes `3`. * For example, in a patch range expression `"-3"` becomes `3`.
*
* @param {number|string} rangeBase * @param {number|string} rangeBase
* @return {number} * @return {number}
*/ */

View File

@@ -25,6 +25,7 @@ limitations under the License.
/** /**
* Pretty-encodes a URL. Double-encodes the string, and then replaces * Pretty-encodes a URL. Double-encodes the string, and then replaces
* benevolent characters for legibility. * benevolent characters for legibility.
*
* @param {string} url * @param {string} url
* @param {boolean=} replaceSlashes * @param {boolean=} replaceSlashes
* @return {string} * @return {string}
@@ -45,6 +46,7 @@ limitations under the License.
* Single decode for URL components. Will decode plus signs ('+') to spaces. * Single decode for URL components. Will decode plus signs ('+') to spaces.
* Note: because this function decodes once, it is not the inverse of * Note: because this function decodes once, it is not the inverse of
* encodeURL. * encodeURL.
*
* @param {string} url * @param {string} url
* @return {string} * @return {string}
*/ */

View File

@@ -28,6 +28,7 @@ limitations under the License.
/** /**
* Wraps a string to be used as a URL. An error is thrown if the string cannot * Wraps a string to be used as a URL. An error is thrown if the string cannot
* be considered safe. * be considered safe.
*
* @constructor * @constructor
* @param {string} url the unwrapped, potentially unsafe URL. * @param {string} url the unwrapped, potentially unsafe URL.
*/ */
@@ -40,6 +41,7 @@ limitations under the License.
/** /**
* Get the string representation of the safe URL. * Get the string representation of the safe URL.
*
* @returns {string} * @returns {string}
*/ */
Gerrit.SafeTypes.SafeUrl.prototype.asString = function() { Gerrit.SafeTypes.SafeUrl.prototype.asString = function() {

View File

@@ -25,6 +25,7 @@
/** /**
* Fired when a section that was previously added was removed. * Fired when a section that was previously added was removed.
*
* @event added-section-removed * @event added-section-removed
*/ */

View File

@@ -87,6 +87,7 @@
/** /**
* Opens the create overlay if the route has a hash 'create' * Opens the create overlay if the route has a hash 'create'
*
* @param {!Object} params * @param {!Object} params
*/ */
_maybeOpenCreateOverlay(params) { _maybeOpenCreateOverlay(params) {

View File

@@ -32,6 +32,7 @@
/** /**
* Fired when a permission that was previously added was removed. * Fired when a permission that was previously added was removed.
*
* @event added-permission-removed * @event added-permission-removed
*/ */

View File

@@ -345,6 +345,7 @@
/** /**
* As add / delete both can happen in the new section, * As add / delete both can happen in the new section,
* so here to make sure it will remove the deleted ones. * so here to make sure it will remove the deleted ones.
*
* @see Issue 11339 * @see Issue 11339
*/ */
this._recursivelyRemoveDeleted(addRemoveObj.add[k]); this._recursivelyRemoveDeleted(addRemoveObj.add[k]);

View File

@@ -90,6 +90,7 @@
/** /**
* Opens the create overlay if the route has a hash 'create' * Opens the create overlay if the route has a hash 'create'
*
* @param {!Object} params * @param {!Object} params
*/ */
_maybeOpenCreateOverlay(params) { _maybeOpenCreateOverlay(params) {

View File

@@ -25,6 +25,7 @@
/** /**
* Fired when a rule that was previously added was removed. * Fired when a rule that was previously added was removed.
*
* @event added-rule-removed * @event added-rule-removed
*/ */

View File

@@ -70,6 +70,7 @@
* *
* Need sub-property declaration since it is used in template before * Need sub-property declaration since it is used in template before
* assignment. * assignment.
*
* @type {{ selectedChangeIndex: (number|undefined) }} * @type {{ selectedChangeIndex: (number|undefined) }}
* *
*/ */

View File

@@ -39,6 +39,7 @@
placeholder: String, placeholder: String,
/** /**
* Needed for template checking since value is initially set to null. * Needed for template checking since value is initially set to null.
*
* @type {?Object} */ * @type {?Object} */
pendingConfirmation: { pendingConfirmation: {
type: Object, type: Object,

View File

@@ -203,7 +203,7 @@
/** /**
* Fired when an action is tapped. * Fired when an action is tapped.
* *
* @event <action key>-tap * @event custom-tap - naming pattern: <action key>-tap
*/ */
/** /**
@@ -800,6 +800,7 @@
/** /**
* Capitalize the first letter and lowecase all others. * Capitalize the first letter and lowecase all others.
*
* @param {string} s * @param {string} s
* @return {string} * @return {string}
*/ */
@@ -1295,6 +1296,7 @@
/** /**
* Merge sources of change actions into a single ordered array of action * Merge sources of change actions into a single ordered array of action
* values. * values.
*
* @param {!Array} changeActionsRecord * @param {!Array} changeActionsRecord
* @param {!Array} revisionActionsRecord * @param {!Array} revisionActionsRecord
* @param {!Array} primariesRecord * @param {!Array} primariesRecord

View File

@@ -410,6 +410,7 @@
/** /**
* Get the user with the specified role on the change. Returns null if the * Get the user with the specified role on the change. Returns null if the
* user with that role is the same as the owner. * user with that role is the same as the owner.
*
* @param {!Object} change * @param {!Object} change
* @param {string} role One of the values from _CHANGE_ROLE * @param {string} role One of the values from _CHANGE_ROLE
* @return {Object|null} either an accound or null. * @return {Object|null} either an accound or null.

View File

@@ -810,6 +810,7 @@
/** /**
* Gets base patch number, if it is a parent try and decide from * Gets base patch number, if it is a parent try and decide from
* preference weather to default to `auto merge`, `Parent 1` or `PARENT`. * preference weather to default to `auto merge`, `Parent 1` or `PARENT`.
*
* @param {Object} change * @param {Object} change
* @param {Object} patchRange * @param {Object} patchRange
* @return {number|string} * @return {number|string}
@@ -1282,6 +1283,7 @@
/** /**
* Reload the change. * Reload the change.
*
* @param {boolean=} opt_reloadRelatedChanges Reloads the related chanegs * @param {boolean=} opt_reloadRelatedChanges Reloads the related chanegs
* when true. * when true.
* @return {Promise} A promise that resolves when the core data has loaded. * @return {Promise} A promise that resolves when the core data has loaded.

View File

@@ -160,6 +160,7 @@
/** /**
* Update the patchset description with the rest API. * Update the patchset description with the rest API.
*
* @param {string} desc * @param {string} desc
* @param {?(Event|Node)} e * @param {?(Event|Node)} e
* @return {!Promise} * @return {!Promise}

View File

@@ -498,6 +498,7 @@
/** /**
* The closure compiler doesn't realize this.specialFilePathCompare is * The closure compiler doesn't realize this.specialFilePathCompare is
* valid. * valid.
*
* @suppress {checkTypes} * @suppress {checkTypes}
*/ */
_normalizeChangeFilesResponse(response) { _normalizeChangeFilesResponse(response) {
@@ -906,6 +907,7 @@
/** /**
* Get a descriptive label for use in the status indicator's tooltip and * Get a descriptive label for use in the status indicator's tooltip and
* ARIA label. * ARIA label.
*
* @param {string} status * @param {string} status
* @return {string} * @return {string}
*/ */
@@ -938,6 +940,7 @@
* entries in the expanded list, then render each diff corresponding in * entries in the expanded list, then render each diff corresponding in
* order by waiting for the previous diff to finish before starting the next * order by waiting for the previous diff to finish before starting the next
* one. * one.
*
* @param {!Array} record The splice record in the expanded paths list. * @param {!Array} record The splice record in the expanded paths list.
*/ */
_expandedPathsChanged(record) { _expandedPathsChanged(record) {
@@ -982,6 +985,7 @@
* Given an array of paths and a NodeList of diff elements, render the diff * Given an array of paths and a NodeList of diff elements, render the diff
* for each path in order, awaiting the previous render to complete before * for each path in order, awaiting the previous render to complete before
* continung. * continung.
*
* @param {!Array<string>} paths * @param {!Array<string>} paths
* @param {!NodeList<!Object>} diffElements (GrDiffHostElement) * @param {!NodeList<!Object>} diffElements (GrDiffHostElement)
* @param {number} initialCount The total number of paths in the pass. This * @param {number} initialCount The total number of paths in the pass. This
@@ -1027,6 +1031,7 @@
/** /**
* In the given NodeList of diff elements, find the diff for the given path. * In the given NodeList of diff elements, find the diff for the given path.
*
* @param {string} path * @param {string} path
* @param {!NodeList<!Object>} diffElements (GrDiffElement) * @param {!NodeList<!Object>} diffElements (GrDiffElement)
* @return {!Object|undefined} (GrDiffElement) * @return {!Object|undefined} (GrDiffElement)
@@ -1041,6 +1046,7 @@
/** /**
* Reset the comments of a modified thread * Reset the comments of a modified thread
*
* @param {string} rootId * @param {string} rootId
* @param {string} path * @param {string} path
*/ */
@@ -1087,6 +1093,7 @@
* Update the loading class for the file list rows. The update is inside a * Update the loading class for the file list rows. The update is inside a
* debouncer so that the file list doesn't flash gray when the API requests * debouncer so that the file list doesn't flash gray when the API requests
* are reasonably fast. * are reasonably fast.
*
* @param {boolean} loading * @param {boolean} loading
*/ */
_loadingChanged(loading) { _loadingChanged(loading) {
@@ -1112,6 +1119,7 @@
/** /**
* Given a file path, return whether that path should have visible size bars * Given a file path, return whether that path should have visible size bars
* and be included in the size bars calculation. * and be included in the size bars calculation.
*
* @param {string} path * @param {string} path
* @return {boolean} * @return {boolean}
*/ */
@@ -1121,6 +1129,7 @@
/** /**
* Compute size bar layout values from the file list. * Compute size bar layout values from the file list.
*
* @return {Defs.LayoutStats|undefined} * @return {Defs.LayoutStats|undefined}
*/ */
_computeSizeBarLayout(shownFilesRecord) { _computeSizeBarLayout(shownFilesRecord) {
@@ -1155,6 +1164,7 @@
/** /**
* Get the width of the addition bar for a file. * Get the width of the addition bar for a file.
*
* @param {Object} file * @param {Object} file
* @param {Defs.LayoutStats} stats * @param {Defs.LayoutStats} stats
* @return {number} * @return {number}
@@ -1172,6 +1182,7 @@
/** /**
* Get the x-offset of the addition bar for a file. * Get the x-offset of the addition bar for a file.
*
* @param {Object} file * @param {Object} file
* @param {Defs.LayoutStats} stats * @param {Defs.LayoutStats} stats
* @return {number} * @return {number}
@@ -1183,6 +1194,7 @@
/** /**
* Get the width of the deletion bar for a file. * Get the width of the deletion bar for a file.
*
* @param {Object} file * @param {Object} file
* @param {Defs.LayoutStats} stats * @param {Defs.LayoutStats} stats
* @return {number} * @return {number}
@@ -1200,6 +1212,7 @@
/** /**
* Get the x-offset of the deletion bar for a file. * Get the x-offset of the deletion bar for a file.
*
* @param {Defs.LayoutStats} stats * @param {Defs.LayoutStats} stats
* @return {number} * @return {number}
*/ */
@@ -1223,6 +1236,7 @@
/** /**
* Returns true if none of the inline diffs have been expanded. * Returns true if none of the inline diffs have been expanded.
*
* @return {boolean} * @return {boolean}
*/ */
_noDiffsExpanded() { _noDiffsExpanded() {
@@ -1233,6 +1247,7 @@
* Method to call via binding when each file list row is rendered. This * Method to call via binding when each file list row is rendered. This
* allows approximate detection of when the dom-repeat has completed * allows approximate detection of when the dom-repeat has completed
* rendering. * rendering.
*
* @param {number} index The index of the row being rendered. * @param {number} index The index of the row being rendered.
* @return {string} an empty string. * @return {string} an empty string.
*/ */

View File

@@ -206,6 +206,7 @@
* Computes message author's file comments for change's message. * Computes message author's file comments for change's message.
* Method uses this.messages to find next message and relies on messages * Method uses this.messages to find next message and relies on messages
* to be sorted by date field descending. * to be sorted by date field descending.
*
* @param {!Object} changeComments changeComment object, which includes * @param {!Object} changeComments changeComment object, which includes
* a method to get all published comments (including robot comments), * a method to get all published comments (including robot comments),
* which returns a Hash of arrays of comments, filename as key. * which returns a Hash of arrays of comments, filename as key.

View File

@@ -157,6 +157,7 @@
* Determines whether or not the given change has a parent change. If there * Determines whether or not the given change has a parent change. If there
* is a relation chain, and the change id is not the last item of the * is a relation chain, and the change id is not the last item of the
* relation chain, there is a parent. * relation chain, there is a parent.
*
* @param {number} currentChangeId * @param {number} currentChangeId
* @param {!Array} relatedChanges * @param {!Array} relatedChanges
* @return {boolean} * @return {boolean}
@@ -215,6 +216,7 @@
/** /**
* Do the given objects describe the same change? Compares the changes by * Do the given objects describe the same change? Compares the changes by
* their numbers. * their numbers.
*
* @see /Documentation/rest-api-changes.html#change-info * @see /Documentation/rest-api-changes.html#change-info
* @see /Documentation/rest-api-changes.html#related-change-and-commit-info * @see /Documentation/rest-api-changes.html#related-change-and-commit-info
* @param {!Object} a Either ChangeInfo or RelatedChangeAndCommitInfo * @param {!Object} a Either ChangeInfo or RelatedChangeAndCommitInfo
@@ -232,6 +234,7 @@
* SubmittedTogetherInfo responses) or get the change number from a * SubmittedTogetherInfo responses) or get the change number from a
* RelatedChangeAndCommitInfo (such as those included in a * RelatedChangeAndCommitInfo (such as those included in a
* RelatedChangesInfo response). * RelatedChangesInfo response).
*
* @see /Documentation/rest-api-changes.html#change-info * @see /Documentation/rest-api-changes.html#change-info
* @see /Documentation/rest-api-changes.html#related-change-and-commit-info * @see /Documentation/rest-api-changes.html#related-change-and-commit-info
* *

View File

@@ -677,6 +677,7 @@
* Generates a function to filter out reviewer/CC entries. When isCCs is * Generates a function to filter out reviewer/CC entries. When isCCs is
* truthy, the function filters out entries that already exist in this._ccs. * truthy, the function filters out entries that already exist in this._ccs.
* When falsy, the function filters entries that exist in this._reviewers. * When falsy, the function filters entries that exist in this._reviewers.
*
* @param {boolean} isCCs * @param {boolean} isCCs
* @return {!Function} * @return {!Function}
*/ */

View File

@@ -101,6 +101,7 @@
/** /**
* Returns hash of labels to max permitted score. * Returns hash of labels to max permitted score.
*
* @param {!Object} change * @param {!Object} change
* @returns {!Object} labels to max permitted scores hash * @returns {!Object} labels to max permitted scores hash
*/ */
@@ -115,6 +116,7 @@
/** /**
* Returns max permitted score for reviewer. * Returns max permitted score for reviewer.
*
* @param {!Object} reviewer * @param {!Object} reviewer
* @param {!Object} change * @param {!Object} change
* @param {string} label * @param {string} label

View File

@@ -62,6 +62,7 @@
* - Unresolved threads without drafts (reverse chronological) * - Unresolved threads without drafts (reverse chronological)
* - Resolved threads with drafts (reverse chronological) * - Resolved threads with drafts (reverse chronological)
* - Resolved threads without drafts (reverse chronological) * - Resolved threads without drafts (reverse chronological)
*
* @param {!Object} changeRecord * @param {!Object} changeRecord
*/ */
_computeSortedThreads(changeRecord) { _computeSortedThreads(changeRecord) {

View File

@@ -217,6 +217,7 @@ limitations under the License.
/** /**
* Setup router implementation. * Setup router implementation.
*
* @param {function(!string)} navigate the router-abstracted equivalent of * @param {function(!string)} navigate the router-abstracted equivalent of
* `window.location.href = ...`. Takes a string. * `window.location.href = ...`. Takes a string.
* @param {function(!Object): string} generateUrl generates a URL given * @param {function(!Object): string} generateUrl generates a URL given
@@ -253,6 +254,7 @@ limitations under the License.
/** /**
* Generate a URL for the given route parameters. * Generate a URL for the given route parameters.
*
* @param {Object} params * @param {Object} params
* @return {string} * @return {string}
*/ */
@@ -329,6 +331,7 @@ limitations under the License.
/** /**
* Navigate to a search for changes with the given status. * Navigate to a search for changes with the given status.
*
* @param {string} status * @param {string} status
*/ */
navigateToStatusSearch(status) { navigateToStatusSearch(status) {
@@ -340,6 +343,7 @@ limitations under the License.
/** /**
* Navigate to a search query * Navigate to a search query
*
* @param {string} query * @param {string} query
* @param {number=} opt_offset * @param {number=} opt_offset
*/ */
@@ -538,6 +542,7 @@ limitations under the License.
/** /**
* Navigate to an arbitrary relative URL. * Navigate to an arbitrary relative URL.
*
* @param {string} relativeUrl * @param {string} relativeUrl
*/ */
navigateToRelativeUrl(relativeUrl) { navigateToRelativeUrl(relativeUrl) {
@@ -560,6 +565,7 @@ limitations under the License.
/** /**
* Navigate to a repo settings page. * Navigate to a repo settings page.
*
* @param {string} repoName * @param {string} repoName
*/ */
navigateToRepo(repoName) { navigateToRepo(repoName) {

View File

@@ -175,6 +175,7 @@
/** /**
* The default reporter reports events immediately. * The default reporter reports events immediately.
*
* @param {string} type * @param {string} type
* @param {string} category * @param {string} category
* @param {string} eventName * @param {string} eventName
@@ -202,6 +203,7 @@
/** /**
* The caching reporter will queue reports until plugins have loaded, and * The caching reporter will queue reports until plugins have loaded, and
* log events immediately if they're reported after plugins have loaded. * log events immediately if they're reported after plugins have loaded.
*
* @param {string} type * @param {string} type
* @param {string} category * @param {string} category
* @param {string} eventName * @param {string} eventName
@@ -345,6 +347,7 @@
/** /**
* Reports just line timeEnd, but additionally reports an average given a * Reports just line timeEnd, but additionally reports an average given a
* denominator and a separate reporiting name for the average. * denominator and a separate reporiting name for the average.
*
* @param {string} name Timing name. * @param {string} name Timing name.
* @param {string} averageName Average timing name. * @param {string} averageName Average timing name.
* @param {number} denominator Number by which to divide the total to * @param {number} denominator Number by which to divide the total to
@@ -363,6 +366,7 @@
/** /**
* Send a timing report with an arbitrary time value. * Send a timing report with an arbitrary time value.
*
* @param {string} name Timing name. * @param {string} name Timing name.
* @param {number} time The time to report as an integer of milliseconds. * @param {number} time The time to report as an integer of milliseconds.
*/ */
@@ -375,6 +379,7 @@
* Get a timer object to for reporing a user timing. The start time will be * Get a timer object to for reporing a user timing. The start time will be
* the time that the object has been created, and the end time will be the * the time that the object has been created, and the end time will be the
* time that the "end" method is called on the object. * time that the "end" method is called on the object.
*
* @param {string} name Timing name. * @param {string} name Timing name.
* @returns {!Object} The timer object. * @returns {!Object} The timer object.
*/ */
@@ -421,6 +426,7 @@
/** /**
* Log timing information for an RPC. * Log timing information for an RPC.
*
* @param {string} anonymizedUrl The URL of the RPC with tokens obfuscated. * @param {string} anonymizedUrl The URL of the RPC with tokens obfuscated.
* @param {number} elapsed The time elapsed of the RPC. * @param {number} elapsed The time elapsed of the RPC.
*/ */

View File

@@ -103,6 +103,7 @@
/** /**
* Support vestigial params from GWT UI. * Support vestigial params from GWT UI.
*
* @see Issue 7673. * @see Issue 7673.
* @type {!RegExp} * @type {!RegExp}
*/ */
@@ -159,6 +160,7 @@
* the hash of diff URLs. In this format, a number on its own indicates that * the hash of diff URLs. In this format, a number on its own indicates that
* line number in the revision of the diff. A number prefixed by either an 'a' * line number in the revision of the diff. A number prefixed by either an 'a'
* or a 'b' indicates that line number of the base of the diff. * or a 'b' indicates that line number of the base of the diff.
*
* @type {RegExp} * @type {RegExp}
*/ */
const LINE_ADDRESS_PATTERN = /^([ab]?)(\d+)$/; const LINE_ADDRESS_PATTERN = /^([ab]?)(\d+)$/;
@@ -521,6 +523,7 @@
* Given an object of parameters, potentially including a `patchNum` or a * Given an object of parameters, potentially including a `patchNum` or a
* `basePatchNum` or both, return a string representation of that range. If * `basePatchNum` or both, return a string representation of that range. If
* no range is indicated in the params, the empty string is returned. * no range is indicated in the params, the empty string is returned.
*
* @param {!Object} params * @param {!Object} params
* @return {string} * @return {string}
*/ */
@@ -597,6 +600,7 @@
/** /**
* Redirect the user to login using the given return-URL for redirection * Redirect the user to login using the given return-URL for redirection
* after authentication success. * after authentication success.
*
* @param {string} returnUrl * @param {string} returnUrl
*/ */
_redirectToLogin(returnUrl) { _redirectToLogin(returnUrl) {
@@ -609,6 +613,7 @@
* Hashes parsed by page.js exclude "inner" hashes, so a URL like "/a#b#c" * Hashes parsed by page.js exclude "inner" hashes, so a URL like "/a#b#c"
* is parsed to have a hash of "b" rather than "b#c". Instead, this method * is parsed to have a hash of "b" rather than "b#c". Instead, this method
* parses hashes correctly. Will return an empty string if there is no hash. * parses hashes correctly. Will return an empty string if there is no hash.
*
* @param {!string} canonicalPath * @param {!string} canonicalPath
* @return {!string} Everything after the first '#' ("a#b#c" -> "b#c"). * @return {!string} Everything after the first '#' ("a#b#c" -> "b#c").
*/ */
@@ -629,6 +634,7 @@
* Check to see if the user is logged in and return a promise that only * Check to see if the user is logged in and return a promise that only
* resolves if the user is logged in. If the user us not logged in, the * resolves if the user is logged in. If the user us not logged in, the
* promise is rejected and the page is redirected to the login flow. * promise is rejected and the page is redirected to the login flow.
*
* @param {!Object} data The parsed route data. * @param {!Object} data The parsed route data.
* @return {!Promise<!Object>} A promise yielding the original route data * @return {!Promise<!Object>} A promise yielding the original route data
* (if it resolves). * (if it resolves).

View File

@@ -204,6 +204,7 @@
/** /**
* Determine what array of possible suggestions should be provided * Determine what array of possible suggestions should be provided
* to _getSearchSuggestions. * to _getSearchSuggestions.
*
* @param {string} input - The full search term, in lowercase. * @param {string} input - The full search term, in lowercase.
* @return {!Promise} This returns a promise that resolves to an array of * @return {!Promise} This returns a promise that resolves to an array of
* suggestion objects. * suggestion objects.
@@ -245,6 +246,7 @@
/** /**
* Get the sorted, pruned list of suggestions for the current search query. * Get the sorted, pruned list of suggestions for the current search query.
*
* @param {string} input - The complete search query. * @param {string} input - The complete search query.
* @return {!Promise} This returns a promise that resolves to an array of * @return {!Promise} This returns a promise that resolves to an array of
* suggestions. * suggestions.

View File

@@ -70,6 +70,7 @@
/** /**
* Fetch from the API the predicted projects. * Fetch from the API the predicted projects.
*
* @param {string} predicate - The first part of the search term, e.g. * @param {string} predicate - The first part of the search term, e.g.
* 'project' * 'project'
* @param {string} expression - The second part of the search term, e.g. * @param {string} expression - The second part of the search term, e.g.
@@ -90,6 +91,7 @@
/** /**
* Fetch from the API the predicted groups. * Fetch from the API the predicted groups.
*
* @param {string} predicate - The first part of the search term, e.g. * @param {string} predicate - The first part of the search term, e.g.
* 'ownerin' * 'ownerin'
* @param {string} expression - The second part of the search term, e.g. * @param {string} expression - The second part of the search term, e.g.
@@ -111,6 +113,7 @@
/** /**
* Fetch from the API the predicted accounts. * Fetch from the API the predicted accounts.
*
* @param {string} predicate - The first part of the search term, e.g. * @param {string} predicate - The first part of the search term, e.g.
* 'owner' * 'owner'
* @param {string} expression - The second part of the search term, e.g. * @param {string} expression - The second part of the search term, e.g.

View File

@@ -428,6 +428,7 @@
/** /**
* Whether the given comment should be included in the base side of the * Whether the given comment should be included in the base side of the
* given patch range. * given patch range.
*
* @param {!Object} comment * @param {!Object} comment
* @param {!Defs.patchRange} range * @param {!Defs.patchRange} range
* @return {boolean} * @return {boolean}
@@ -459,6 +460,7 @@
/** /**
* Whether the given comment should be included in the revision side of the * Whether the given comment should be included in the revision side of the
* given patch range. * given patch range.
*
* @param {!Object} comment * @param {!Object} comment
* @param {!Defs.patchRange} range * @param {!Defs.patchRange} range
* @return {boolean} * @return {boolean}
@@ -471,6 +473,7 @@
/** /**
* Whether the given comment should be included in the given patch range. * Whether the given comment should be included in the given patch range.
*
* @param {!Object} comment * @param {!Object} comment
* @param {!Defs.patchRange} range * @param {!Defs.patchRange} range
* @return {boolean|undefined} * @return {boolean|undefined}

View File

@@ -452,6 +452,7 @@ limitations under the License.
* which, in turn, triggers a reflow on the page. Create a hidden * which, in turn, triggers a reflow on the page. Create a hidden
* thread, attach it to the page, and remove it so the stylesheet will * thread, attach it to the page, and remove it so the stylesheet will
* already exist and the user's comment will be quick to load. * already exist and the user's comment will be quick to load.
*
* @see https://gerrit-review.googlesource.com/c/82213/ * @see https://gerrit-review.googlesource.com/c/82213/
*/ */
_preRenderThread() { _preRenderThread() {
@@ -489,6 +490,7 @@ limitations under the License.
/** /**
* Get the approximate length of the diff as the sum of the maximum * Get the approximate length of the diff as the sum of the maximum
* length of the chunks. * length of the chunks.
*
* @return {number} * @return {number}
*/ */
getDiffLength() { getDiffLength() {

View File

@@ -95,6 +95,7 @@
/** /**
* Abstract method * Abstract method
*
* @param {string} outputEl * @param {string} outputEl
* @param {number} fontSize * @param {number} fontSize
*/ */
@@ -104,6 +105,7 @@
/** /**
* Abstract method * Abstract method
*
* @param {Object} group * @param {Object} group
*/ */
GrDiffBuilder.prototype.buildSectionElement = function() { GrDiffBuilder.prototype.buildSectionElement = function() {
@@ -623,6 +625,7 @@
/** /**
* Finds the next DIV.contentText element following the given element, and on * Finds the next DIV.contentText element following the given element, and on
* the same side. Will only search within a group. * the same side. Will only search within a group.
*
* @param {HTMLElement} content * @param {HTMLElement} content
* @param {string} side Either 'left' or 'right' * @param {string} side Either 'left' or 'right'
* @return {HTMLElement} * @return {HTMLElement}
@@ -634,6 +637,7 @@
/** /**
* Determines whether the given group is either totally an addition or totally * Determines whether the given group is either totally an addition or totally
* a removal. * a removal.
*
* @param {!Object} group (GrDiffGroup) * @param {!Object} group (GrDiffGroup)
* @return {boolean} * @return {boolean}
*/ */
@@ -646,6 +650,7 @@
/** /**
* Set the blame information for the diff. For any already-rendered line, * Set the blame information for the diff. For any already-rendered line,
* re-render its blame cell content. * re-render its blame cell content.
*
* @param {Object} blame * @param {Object} blame
*/ */
GrDiffBuilder.prototype.setBlame = function(blame) { GrDiffBuilder.prototype.setBlame = function(blame) {
@@ -673,6 +678,7 @@
/** /**
* Find the blame cell for a given line number. * Find the blame cell for a given line number.
*
* @param {number} lineNum * @param {number} lineNum
* @return {HTMLTableDataCellElement} * @return {HTMLTableDataCellElement}
*/ */
@@ -685,6 +691,7 @@
* Given a base line number, return the commit containing that line in the * Given a base line number, return the commit containing that line in the
* current set of blame information. If no blame information has been * current set of blame information. If no blame information has been
* provided, null is returned. * provided, null is returned.
*
* @param {number} lineNum * @param {number} lineNum
* @return {Object} The commit information. * @return {Object} The commit information.
*/ */
@@ -704,6 +711,7 @@
/** /**
* Given the number of a base line, get the content for the blame cell of that * Given the number of a base line, get the content for the blame cell of that
* line. If there is no blame information for that line, returns null. * line. If there is no blame information for that line, returns null.
*
* @param {number} lineNum * @param {number} lineNum
* @param {Object=} opt_commit Optionally provide the commit object, so that * @param {Object=} opt_commit Optionally provide the commit object, so that
* it does not need to be searched. * it does not need to be searched.
@@ -728,6 +736,7 @@
/** /**
* Create a blame cell for the given base line. Blame information will be * Create a blame cell for the given base line. Blame information will be
* included in the cell if available. * included in the cell if available.
*
* @param {GrDiffLine} line * @param {GrDiffLine} line
* @return {HTMLTableDataCellElement} * @return {HTMLTableDataCellElement}
*/ */

View File

@@ -453,6 +453,7 @@
/** /**
* Load the project config when a project name has been provided. * Load the project config when a project name has been provided.
*
* @param {string} name The project name. * @param {string} name The project name.
*/ */
_projectNameChanged(name) { _projectNameChanged(name) {

View File

@@ -66,7 +66,7 @@
* the first chunk) the next time the diff renders. It is set back to null * the first chunk) the next time the diff renders. It is set back to null
* when used. * when used.
* *
* @type (?number) * @type {?number}
*/ */
initialLineNumber: { initialLineNumber: {
type: Number, type: Number,
@@ -173,6 +173,7 @@
/** /**
* Get the line number element targeted by the cursor row and side. * Get the line number element targeted by the cursor row and side.
*
* @return {?Element|undefined} * @return {?Element|undefined}
*/ */
getTargetLineElement() { getTargetLineElement() {
@@ -240,6 +241,7 @@
* {leftSide: false, number: 123} for line 123 of the revision, or * {leftSide: false, number: 123} for line 123 of the revision, or
* {leftSide: true, number: 321} for line 321 of the base patch. * {leftSide: true, number: 321} for line 321 of the base patch.
* Returns null if an address is not available. * Returns null if an address is not available.
*
* @return {?Object} * @return {?Object}
*/ */
getAddress() { getAddress() {
@@ -364,6 +366,7 @@
/** /**
* Setup and tear down on-render listeners for any diffs that are added or * Setup and tear down on-render listeners for any diffs that are added or
* removed from the cursor. * removed from the cursor.
*
* @private * @private
*/ */
_diffsChanged(changeRecord) { _diffsChanged(changeRecord) {

View File

@@ -31,6 +31,7 @@
/** /**
* The DOM API textContent.length calculation is broken when the text * The DOM API textContent.length calculation is broken when the text
* contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode . * contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode .
*
* @param {!Text} node text node. * @param {!Text} node text node.
* @return {number} The length of the text. * @return {number} The length of the text.
*/ */

View File

@@ -107,6 +107,7 @@
* Merges multiple ranges, accounts for triple click, accounts for * Merges multiple ranges, accounts for triple click, accounts for
* syntax highligh, convert native DOM Range objects to Gerrit concepts * syntax highligh, convert native DOM Range objects to Gerrit concepts
* (line, side, etc). * (line, side, etc).
*
* @return {({ * @return {({
* start: { * start: {
* node: Node, * node: Node,
@@ -142,6 +143,7 @@
/** /**
* Normalize a specific DOM Range. * Normalize a specific DOM Range.
*
* @return {!Object} fixed normalized range * @return {!Object} fixed normalized range
*/ */
_normalizeRange(domRange) { _normalizeRange(domRange) {

View File

@@ -97,6 +97,7 @@
/** /**
* The DOM API textContent.length calculation is broken when the text * The DOM API textContent.length calculation is broken when the text
* contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode . * contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode .
*
* @param {text} node A text node. * @param {text} node A text node.
* @return {number} The length of the text. * @return {number} The length of the text.
*/ */

View File

@@ -57,6 +57,7 @@
/** /**
* Fired when the user selects a line. * Fired when the user selects a line.
*
* @event line-selected * @event line-selected
*/ */
@@ -123,6 +124,7 @@
/** /**
* Special line number which should not be collapsed into a shared region. * Special line number which should not be collapsed into a shared region.
*
* @type {{ * @type {{
* number: number, * number: number,
* leftSide: {boolean} * leftSide: {boolean}
@@ -284,6 +286,7 @@
/** /**
* Load and display blame information for the base of the diff. * Load and display blame information for the base of the diff.
*
* @return {Promise} A promise that resolves when blame finishes rendering. * @return {Promise} A promise that resolves when blame finishes rendering.
*/ */
loadBlame() { loadBlame() {
@@ -458,6 +461,7 @@
* Take a diff that was loaded with a ignore-whitespace other than * Take a diff that was loaded with a ignore-whitespace other than
* IGNORE_NONE, and convert delta chunks labeled as common into shared * IGNORE_NONE, and convert delta chunks labeled as common into shared
* chunks. * chunks.
*
* @param {!Object} diff * @param {!Object} diff
* @returns {!Object} * @returns {!Object}
*/ */

View File

@@ -104,6 +104,7 @@
/** /**
* Asynchronously process the diff object into groups. As it processes, it * Asynchronously process the diff object into groups. As it processes, it
* will splice groups into the `groups` property of the component. * will splice groups into the `groups` property of the component.
*
* @return {Promise} A promise that resolves when the diff is completely * @return {Promise} A promise that resolves when the diff is completely
* processed. * processed.
*/ */
@@ -230,6 +231,7 @@
/** /**
* Take rows of a shared diff section and produce an array of corresponding * Take rows of a shared diff section and produce an array of corresponding
* (potentially collapsed) groups. * (potentially collapsed) groups.
*
* @param {!Array<string>} rows * @param {!Array<string>} rows
* @param {number} context * @param {number} context
* @param {number} startLineNumLeft * @param {number} startLineNumLeft
@@ -293,6 +295,7 @@
/** /**
* Take the rows of a delta diff section and produce the corresponding * Take the rows of a delta diff section and produce the corresponding
* group. * group.
*
* @param {!Array<string>} rowsAdded * @param {!Array<string>} rowsAdded
* @param {!Array<string>} rowsRemoved * @param {!Array<string>} rowsRemoved
* @param {number} startLineNumLeft * @param {number} startLineNumLeft
@@ -353,6 +356,7 @@
* In order to show comments out of the bounds of the selected context, * In order to show comments out of the bounds of the selected context,
* treat them as separate chunks within the model so that the content (and * treat them as separate chunks within the model so that the content (and
* context surrounding it) renders correctly. * context surrounding it) renders correctly.
*
* @param {?} content The diff content object. (has to be iterable) * @param {?} content The diff content object. (has to be iterable)
* @return {!Object} A new diff content object with regions split up. * @return {!Object} A new diff content object with regions split up.
*/ */
@@ -497,6 +501,7 @@
* If a group is an addition or a removal, break it down into smaller groups * If a group is an addition or a removal, break it down into smaller groups
* of that type using the MAX_GROUP_SIZE. If the group is a shared section * of that type using the MAX_GROUP_SIZE. If the group is a shared section
* or a delta it is returned as the single element of the result array. * or a delta it is returned as the single element of the result array.
*
* @param {!Object} group A raw chunk from a diff response. * @param {!Object} group A raw chunk from a diff response.
* @return {!Array<!Array<!Object>>} * @return {!Array<!Array<!Object>>}
*/ */
@@ -526,6 +531,7 @@
/** /**
* Given an array and a size, return an array of arrays where no inner array * Given an array and a size, return an array of arrays where no inner array
* is larger than that size, preserving the original order. * is larger than that size, preserving the original order.
*
* @param {!Array<T>} array * @param {!Array<T>} array
* @param {number} size * @param {number} size
* @return {!Array<!Array<T>>} * @return {!Array<!Array<T>>}

View File

@@ -101,6 +101,7 @@
/** /**
* Set the provided list of classes on the element, to the exclusion of all * Set the provided list of classes on the element, to the exclusion of all
* other SelectionClass values. * other SelectionClass values.
*
* @param {!Array<!string>} targetClasses * @param {!Array<!string>} targetClasses
*/ */
_setClasses(targetClasses) { _setClasses(targetClasses) {

View File

@@ -54,6 +54,7 @@
/** /**
* Fired when the user selects a line. * Fired when the user selects a line.
*
* @event line-selected * @event line-selected
*/ */
@@ -126,6 +127,7 @@
/** /**
* Special line number which should not be collapsed into a shared region. * Special line number which should not be collapsed into a shared region.
*
* @type {{ * @type {{
* number: number, * number: number,
* leftSide: {boolean} * leftSide: {boolean}
@@ -167,7 +169,7 @@
* bypassed. If the value is a number, then that number represents the * bypassed. If the value is a number, then that number represents the
* context preference to use when rendering the bypassed diff. * context preference to use when rendering the bypassed diff.
* *
* @type (number|null) * @type {number|null}
*/ */
_safetyBypass: { _safetyBypass: {
type: Number, type: Number,
@@ -746,6 +748,7 @@
/** /**
* Find the last chunk for the given side. * Find the last chunk for the given side.
*
* @param {!Object} diff * @param {!Object} diff
* @param {boolean} leftSide true if checking the base of the diff, * @param {boolean} leftSide true if checking the base of the diff,
* false if testing the revision. * false if testing the revision.
@@ -781,6 +784,7 @@
/** /**
* Check whether the specified side of the diff has a trailing newline. * Check whether the specified side of the diff has a trailing newline.
*
* @param {!Object} diff * @param {!Object} diff
* @param {boolean} leftSide true if checking the base of the diff, * @param {boolean} leftSide true if checking the base of the diff,
* false if testing the revision. * false if testing the revision.

View File

@@ -157,6 +157,7 @@
* The basePatchNum should always be <= patchNum -- because sortedRevisions * The basePatchNum should always be <= patchNum -- because sortedRevisions
* is sorted in reverse order (higher patchset nums first), invalid base * is sorted in reverse order (higher patchset nums first), invalid base
* patch nums have an index greater than the index of patchNum. * patch nums have an index greater than the index of patchNum.
*
* @param {number|string} basePatchNum The possible base patch num. * @param {number|string} basePatchNum The possible base patch num.
* @param {number|string} patchNum The current selected patch num. * @param {number|string} patchNum The current selected patch num.
* @param {!Array} sortedRevisions * @param {!Array} sortedRevisions

View File

@@ -46,6 +46,7 @@
/** /**
* Layer method to add annotations to a line. * Layer method to add annotations to a line.
*
* @param {!HTMLElement} el The DIV.contentText element to apply the * @param {!HTMLElement} el The DIV.contentText element to apply the
* annotation to. * annotation to.
* @param {!Object} line The line object. (GrDiffLine) * @param {!Object} line The line object. (GrDiffLine)
@@ -72,6 +73,7 @@
/** /**
* Register a listener for layer updates. * Register a listener for layer updates.
*
* @param {function(number, number, string)} fn The update handler function. * @param {function(number, number, string)} fn The update handler function.
* Should accept as arguments the line numbers for the start and end of * Should accept as arguments the line numbers for the start and end of
* the update and the side as a string. * the update and the side as a string.
@@ -82,6 +84,7 @@
/** /**
* Notify Layer listeners of changes to annotations. * Notify Layer listeners of changes to annotations.
*
* @param {number} start The line where the update starts. * @param {number} start The line where the update starts.
* @param {number} end The line where the update ends. * @param {number} end The line where the update ends.
* @param {string} side The side of the update. ('left' or 'right') * @param {string} side The side of the update. ('left' or 'right')
@@ -95,6 +98,7 @@
/** /**
* Handle change in the comments by updating the comment maps and by * Handle change in the comments by updating the comment maps and by
* emitting appropriate update notifications. * emitting appropriate update notifications.
*
* @param {Object} record The change record. * @param {Object} record The change record.
*/ */
_handleCommentChange(record) { _handleCommentChange(record) {
@@ -136,6 +140,7 @@
* Take a list of comments and return a sparse list mapping line numbers to * Take a list of comments and return a sparse list mapping line numbers to
* partial ranges. Uses an end-character-index of -1 to indicate the end of * partial ranges. Uses an end-character-index of -1 to indicate the end of
* the line. * the line.
*
* @param {?} commentList The list of comments. * @param {?} commentList The list of comments.
* Getting this param to match closure requirements caused problems. * Getting this param to match closure requirements caused problems.
* @return {!Object} The sparse list. * @return {!Object} The sparse list.

View File

@@ -168,6 +168,7 @@
/** /**
* Annotation layer method to add syntax annotations to the given element * Annotation layer method to add syntax annotations to the given element
* for the given line. * for the given line.
*
* @param {!HTMLElement} el * @param {!HTMLElement} el
* @param {!Object} line (GrDiffLine) * @param {!Object} line (GrDiffLine)
*/ */
@@ -204,6 +205,7 @@
/** /**
* Start processing symtax for the loaded diff and notify layer listeners * Start processing symtax for the loaded diff and notify layer listeners
* as syntax info comes online. * as syntax info comes online.
*
* @return {Promise} * @return {Promise}
*/ */
process() { process() {
@@ -291,6 +293,7 @@
* Take a string of HTML with the (potentially nested) syntax markers * Take a string of HTML with the (potentially nested) syntax markers
* Highlight.js emits and emit a list of text ranges and classes for the * Highlight.js emits and emit a list of text ranges and classes for the
* markers. * markers.
*
* @param {string} str The string of HTML. * @param {string} str The string of HTML.
* @return {!Array<!Object>} The list of ranges. * @return {!Array<!Object>} The list of ranges.
*/ */
@@ -326,6 +329,7 @@
/** /**
* For a given state, process the syntax for the next line (or pair of * For a given state, process the syntax for the next line (or pair of
* lines). * lines).
*
* @param {!Object} state The processing state for the layer. * @param {!Object} state The processing state for the layer.
*/ */
_processNextLine(state) { _processNextLine(state) {
@@ -438,6 +442,7 @@
/** /**
* Tells whether the state has exhausted its current section. * Tells whether the state has exhausted its current section.
*
* @param {!Object} state * @param {!Object} state
* @return {boolean} * @return {boolean}
*/ */
@@ -454,6 +459,7 @@
/** /**
* For a given state, notify layer listeners of any processed line ranges * For a given state, notify layer listeners of any processed line ranges
* that have not yet been notified. * that have not yet been notified.
*
* @param {!Object} state * @param {!Object} state
*/ */
_notify(state) { _notify(state) {

View File

@@ -111,6 +111,7 @@
/** /**
* Given a path string, checks that it is a valid file path. * Given a path string, checks that it is a valid file path.
*
* @param {string} path * @param {string} path
* @return {boolean} * @return {boolean}
*/ */
@@ -125,6 +126,7 @@
/** /**
* Given a dom event, gets the dialog that lies along this event path. * Given a dom event, gets the dialog that lies along this event path.
*
* @param {!Event} e * @param {!Event} e
* @return {!Element|undefined} * @return {!Element|undefined}
*/ */

View File

@@ -51,6 +51,7 @@
/** /**
* The last time the g key was pressed in milliseconds (or a keydown event * The last time the g key was pressed in milliseconds (or a keydown event
* was handled if the key is held down). * was handled if the key is held down).
*
* @type {number|null} * @type {number|null}
*/ */
_lastGKeyPressTimestamp: { _lastGKeyPressTimestamp: {

View File

@@ -28,6 +28,7 @@
/** /**
* Returns true if the property is defined on wrapped element. * Returns true if the property is defined on wrapped element.
*
* @param {string} name * @param {string} name
* @return {boolean} * @return {boolean}
*/ */

View File

@@ -76,6 +76,7 @@
/** /**
* Get instance of last DOM hook element attached into the endpoint. * Get instance of last DOM hook element attached into the endpoint.
* Returns a Promise, that's resolved when attachment is done. * Returns a Promise, that's resolved when attachment is done.
*
* @return {!Promise<!Element>} * @return {!Promise<!Element>}
*/ */
GrDomHook.prototype.getLastAttached = function() { GrDomHook.prototype.getLastAttached = function() {
@@ -108,6 +109,7 @@
/** /**
* Install a new callback to invoke when a new instance of DOM hook element * Install a new callback to invoke when a new instance of DOM hook element
* is attached. * is attached.
*
* @param {function(Element)} callback * @param {function(Element)} callback
*/ */
GrDomHook.prototype.onAttached = function(callback) { GrDomHook.prototype.onAttached = function(callback) {

View File

@@ -33,6 +33,7 @@
* This map prevents importing the same endpoint twice. * This map prevents importing the same endpoint twice.
* Without caching, if a plugin is loaded after the loaded plugins * Without caching, if a plugin is loaded after the loaded plugins
* callback fires, it will be imported twice and appear twice on the page. * callback fires, it will be imported twice and appear twice on the page.
*
* @type {!Map} * @type {!Map}
*/ */
_initializedPlugins: { _initializedPlugins: {

View File

@@ -25,6 +25,7 @@
/** /**
* Add a callback to arbitrary event. * Add a callback to arbitrary event.
* The callback may return false to prevent event bubbling. * The callback may return false to prevent event bubbling.
*
* @param {string} event Event name * @param {string} event Event name
* @param {function(Event):boolean} callback * @param {function(Event):boolean} callback
* @return {function()} Unsubscribe function. * @return {function()} Unsubscribe function.
@@ -36,6 +37,7 @@
/** /**
* Add a callback to element click or touch. * Add a callback to element click or touch.
* The callback may return false to prevent event bubbling. * The callback may return false to prevent event bubbling.
*
* @param {function(Event):boolean} callback * @param {function(Event):boolean} callback
* @return {function()} Unsubscribe function. * @return {function()} Unsubscribe function.
*/ */
@@ -48,6 +50,7 @@
* Callback is installed on parent during capture phase. * Callback is installed on parent during capture phase.
* https://www.w3.org/TR/DOM-Level-3-Events/#event-flow * https://www.w3.org/TR/DOM-Level-3-Events/#event-flow
* The callback may return false to cancel regular event listeners. * The callback may return false to cancel regular event listeners.
*
* @param {function(Event):boolean} callback * @param {function(Event):boolean} callback
* @return {function()} Unsubscribe function. * @return {function()} Unsubscribe function.
*/ */

View File

@@ -22,6 +22,7 @@
* Provides method for opening and closing popups from plugin. * Provides method for opening and closing popups from plugin.
* opt_moduleName is a name of custom element that will be automatically * opt_moduleName is a name of custom element that will be automatically
* inserted on popup opening. * inserted on popup opening.
*
* @param {!Object} plugin * @param {!Object} plugin
* @param {opt_moduleName=} string * @param {opt_moduleName=} string
*/ */
@@ -40,6 +41,7 @@
* Opens the popup, inserts it into DOM over current UI. * Opens the popup, inserts it into DOM over current UI.
* Creates the popup if not previously created. Creates popup content element, * Creates the popup if not previously created. Creates popup content element,
* if it was provided with constructor. * if it was provided with constructor.
*
* @returns {!Promise<!Object>} * @returns {!Promise<!Object>}
*/ */
GrPopupInterface.prototype.open = function() { GrPopupInterface.prototype.open = function() {

View File

@@ -38,6 +38,7 @@
/** /**
* Get the list of enabled column names from whichever checkboxes are * Get the list of enabled column names from whichever checkboxes are
* checked (excluding the number checkbox). * checked (excluding the number checkbox).
*
* @return {!Array<string>} * @return {!Array<string>}
*/ */
_getDisplayedColumns() { _getDisplayedColumns() {

View File

@@ -215,6 +215,7 @@
/** /**
* Set the text of the input without triggering the suggestion dropdown. * Set the text of the input without triggering the suggestion dropdown.
*
* @param {string} text The new text for the input. * @param {string} text The new text for the input.
*/ */
setText(text) { setText(text) {

View File

@@ -34,7 +34,7 @@
observer: '_updateIndex', observer: '_updateIndex',
}, },
/** /**
* @type (?Object) * @type {?Object}
*/ */
target: { target: {
type: Object, type: Object,
@@ -43,7 +43,8 @@
}, },
/** /**
* The height of content intended to be included with the target. * The height of content intended to be included with the target.
* @type (?number) *
* @type {?number}
*/ */
_targetHeight: Number, _targetHeight: Number,
@@ -69,7 +70,8 @@
* 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond * 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond
* the viewport. * the viewport.
* TODO (beckysiegel) figure out why it can be undefined * TODO (beckysiegel) figure out why it can be undefined
* @type (string|undefined) *
* @type {string|undefined}
*/ */
scrollBehavior: { scrollBehavior: {
type: String, type: String,
@@ -99,6 +101,7 @@
/** /**
* Set the cursor to an arbitrary element. * Set the cursor to an arbitrary element.
*
* @param {!HTMLElement} element * @param {!HTMLElement} element
* @param {boolean=} opt_noScroll prevent any potential scrolling in response * @param {boolean=} opt_noScroll prevent any potential scrolling in response
* setting the cursor. * setting the cursor.
@@ -146,6 +149,7 @@
/** /**
* Move the cursor forward or backward by delta. Noop if moving past either * Move the cursor forward or backward by delta. Noop if moving past either
* end of the stop list. * end of the stop list.
*
* @param {number} delta either -1 or 1. * @param {number} delta either -1 or 1.
* @param {!Function=} opt_condition Optional stop condition. If a condition * @param {!Function=} opt_condition Optional stop condition. If a condition
* is passed the cursor will continue to move in the specified direction * is passed the cursor will continue to move in the specified direction
@@ -200,6 +204,7 @@
/** /**
* Get the next stop index indicated by the delta direction. * Get the next stop index indicated by the delta direction.
*
* @param {number} delta either -1 or 1. * @param {number} delta either -1 or 1.
* @param {!Function=} opt_condition Optional stop condition. * @param {!Function=} opt_condition Optional stop condition.
* @return {number} the new index. * @return {number} the new index.
@@ -248,6 +253,7 @@
/** /**
* Calculate where the element is relative to the window. * Calculate where the element is relative to the window.
*
* @param {!Object} target Target to scroll to. * @param {!Object} target Target to scroll to.
* @return {number} Distance to top of the target. * @return {number} Distance to top of the target.
*/ */

View File

@@ -73,6 +73,7 @@
/** /**
* Handle a click on the iron-dropdown element. * Handle a click on the iron-dropdown element.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleDropdownClick(e) { _handleDropdownClick(e) {
@@ -85,6 +86,7 @@
/** /**
* Handle a click on the button to open the dropdown. * Handle a click on the button to open the dropdown.
*
* @param {!Event} e * @param {!Event} e
*/ */
_showDropdownTapHandler(e) { _showDropdownTapHandler(e) {

View File

@@ -92,6 +92,7 @@
/** /**
* Handle the up key. * Handle the up key.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleUp(e) { _handleUp(e) {
@@ -106,6 +107,7 @@
/** /**
* Handle the down key. * Handle the down key.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleDown(e) { _handleDown(e) {
@@ -120,6 +122,7 @@
/** /**
* Handle the tab key. * Handle the tab key.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleTab(e) { _handleTab(e) {
@@ -132,6 +135,7 @@
/** /**
* Handle the enter key. * Handle the enter key.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleEnter(e) { _handleEnter(e) {
@@ -150,6 +154,7 @@
/** /**
* Handle a click on the iron-dropdown element. * Handle a click on the iron-dropdown element.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleDropdownClick(e) { _handleDropdownClick(e) {
@@ -158,6 +163,7 @@
/** /**
* Hanlde a click on the button to open the dropdown. * Hanlde a click on the button to open the dropdown.
*
* @param {!Event} e * @param {!Event} e
*/ */
_dropdownTriggerTapHandler(e) { _dropdownTriggerTapHandler(e) {
@@ -190,6 +196,7 @@
/** /**
* Get the class for a top-content item based on the given boolean. * Get the class for a top-content item based on the given boolean.
*
* @param {boolean} bold Whether the item is bold. * @param {boolean} bold Whether the item is bold.
* @return {string} The class for the top-content item. * @return {string} The class for the top-content item.
*/ */
@@ -200,6 +207,7 @@
/** /**
* Build a URL for the given host and path. The base URL will be only added, * Build a URL for the given host and path. The base URL will be only added,
* if it is not already included in the path. * if it is not already included in the path.
*
* @param {!string} host * @param {!string} host
* @param {!string} path * @param {!string} path
* @return {!string} The scheme-relative URL. * @return {!string} The scheme-relative URL.
@@ -214,6 +222,7 @@
* Build a scheme-relative URL for the current host. Will include the base * Build a scheme-relative URL for the current host. Will include the base
* URL if one is present. Note: the URL will be scheme-relative but absolute * URL if one is present. Note: the URL will be scheme-relative but absolute
* with regard to the host. * with regard to the host.
*
* @param {!string} path The path for the URL. * @param {!string} path The path for the URL.
* @return {!string} The scheme-relative URL. * @return {!string} The scheme-relative URL.
*/ */
@@ -224,6 +233,7 @@
/** /**
* Compute the URL for a link object. * Compute the URL for a link object.
*
* @param {!Object} link The object describing the link. * @param {!Object} link The object describing the link.
* @return {!string} The URL. * @return {!string} The URL.
*/ */
@@ -241,6 +251,7 @@
* Compute the value for the rel attribute of an anchor for the given link * Compute the value for the rel attribute of an anchor for the given link
* object. If the link has a target value, then the rel must be "noopener" * object. If the link has a target value, then the rel must be "noopener"
* for security reasons. * for security reasons.
*
* @param {!Object} link The object describing the link. * @param {!Object} link The object describing the link.
* @return {?string} The rel value for the link. * @return {?string} The rel value for the link.
*/ */
@@ -253,6 +264,7 @@
/** /**
* Handle a click on an item of the dropdown. * Handle a click on an item of the dropdown.
*
* @param {!Event} e * @param {!Event} e
*/ */
_handleItemTap(e) { _handleItemTap(e) {
@@ -268,6 +280,7 @@
/** /**
* If a dropdown item is shown as a button, get the class for the button. * If a dropdown item is shown as a button, get the class for the button.
*
* @param {string} id * @param {string} id
* @param {!Object} disabledIdsRecord The change record for the disabled IDs * @param {!Object} disabledIdsRecord The change record for the disabled IDs
* list. * list.

View File

@@ -39,6 +39,7 @@
constructor() { constructor() {
/** /**
* Shared events map from name to the listeners. * Shared events map from name to the listeners.
*
* @type {!Object<string, Array<eventCallback>>} * @type {!Object<string, Array<eventCallback>>}
*/ */
this._listenersMap = new Map(); this._listenersMap = new Map();

View File

@@ -245,6 +245,7 @@
/** /**
* Map an array of block objects to an array of DOM nodes. * Map an array of block objects to an array of DOM nodes.
*
* @param {!Array<!Object>} blocks * @param {!Array<!Object>} blocks
* @return {!Array<!HTMLElement>} * @return {!Array<!HTMLElement>}
*/ */

View File

@@ -19,6 +19,7 @@
/** /**
* Used to create a context for GrAnnotationActionsInterface. * Used to create a context for GrAnnotationActionsInterface.
*
* @param {HTMLElement} el The DIV.contentText element to apply the * @param {HTMLElement} el The DIV.contentText element to apply the
* annotation to using annotateRange. * annotation to using annotateRange.
* @param {GrDiffLine} line The line object. * @param {GrDiffLine} line The line object.
@@ -37,6 +38,7 @@
/** /**
* Method to add annotations to a line. * Method to add annotations to a line.
*
* @param {Number} start The line number where the update starts. * @param {Number} start The line number where the update starts.
* @param {Number} end The line number where the update ends. * @param {Number} end The line number where the update ends.
* @param {String} cssClass The name of a CSS class created using Gerrit.css. * @param {String} cssClass The name of a CSS class created using Gerrit.css.

View File

@@ -34,6 +34,7 @@
* Register a function to call to apply annotations. Plugins should use * Register a function to call to apply annotations. Plugins should use
* GrAnnotationActionsContext.annotateRange to apply a CSS class to a range * GrAnnotationActionsContext.annotateRange to apply a CSS class to a range
* within a line. * within a line.
*
* @param {function(GrAnnotationActionsContext)} addLayerFunc The function * @param {function(GrAnnotationActionsContext)} addLayerFunc The function
* that will be called when the AnnotationLayer is ready to annotate. * that will be called when the AnnotationLayer is ready to annotate.
*/ */
@@ -45,6 +46,7 @@
/** /**
* The specified function will be called with a notify function for the plugin * The specified function will be called with a notify function for the plugin
* to call when it has all required data for annotation. Optional. * to call when it has all required data for annotation. Optional.
*
* @param {function(function(String, Number, Number, String))} notifyFunc See * @param {function(function(String, Number, Number, String))} notifyFunc See
* doc of the notify function below to see what it does. * doc of the notify function below to see what it does.
*/ */
@@ -97,6 +99,7 @@
* The notify function will call the listeners of all required annotation * The notify function will call the listeners of all required annotation
* layers. Intended to be called by the plugin when all required data for * layers. Intended to be called by the plugin when all required data for
* annotation is available. * annotation is available.
*
* @param {String} path The file path whose listeners should be notified. * @param {String} path The file path whose listeners should be notified.
* @param {Number} start The line where the update starts. * @param {Number} start The line where the update starts.
* @param {Number} end The line where the update ends. * @param {Number} end The line where the update ends.
@@ -117,6 +120,7 @@
/** /**
* Should be called to register annotation layers by the framework. Not * Should be called to register annotation layers by the framework. Not
* intended to be called by plugins. * intended to be called by plugins.
*
* @param {String} path The file path (eg: /COMMIT_MSG'). * @param {String} path The file path (eg: /COMMIT_MSG').
* @param {String} changeNum The Gerrit change number. * @param {String} changeNum The Gerrit change number.
* @param {String} patchNum The Gerrit patch number. * @param {String} patchNum The Gerrit patch number.
@@ -131,6 +135,7 @@
/** /**
* Used to create an instance of the Annotation Layer interface. * Used to create an instance of the Annotation Layer interface.
*
* @param {String} path The file path (eg: /COMMIT_MSG'). * @param {String} path The file path (eg: /COMMIT_MSG').
* @param {String} changeNum The Gerrit change number. * @param {String} changeNum The Gerrit change number.
* @param {String} patchNum The Gerrit patch number. * @param {String} patchNum The Gerrit patch number.
@@ -148,6 +153,7 @@
/** /**
* Register a listener for layer updates. * Register a listener for layer updates.
*
* @param {function(Number, Number, String)} fn The update handler function. * @param {function(Number, Number, String)} fn The update handler function.
* Should accept as arguments the line numbers for the start and end of * Should accept as arguments the line numbers for the start and end of
* the update and the side as a string. * the update and the side as a string.
@@ -158,6 +164,7 @@
/** /**
* Layer method to add annotations to a line. * Layer method to add annotations to a line.
*
* @param {HTMLElement} el The DIV.contentText element to apply the * @param {HTMLElement} el The DIV.contentText element to apply the
* annotation to. * annotation to.
* @param {GrDiffLine} line The line object. * @param {GrDiffLine} line The line object.
@@ -170,6 +177,7 @@
/** /**
* Notify Layer listeners of changes to annotations. * Notify Layer listeners of changes to annotations.
*
* @param {Number} start The line where the update starts. * @param {Number} start The line where the update starts.
* @param {Number} end The line where the update ends. * @param {Number} end The line where the update ends.
* @param {String} side The side of the update. ('left' or 'right') * @param {String} side The side of the update. ('left' or 'right')

View File

@@ -20,6 +20,7 @@
/** /**
* Ensure GrChangeActionsInterface instance has access to gr-change-actions * Ensure GrChangeActionsInterface instance has access to gr-change-actions
* element and retrieve if the interface was created before element. * element and retrieve if the interface was created before element.
*
* @param {!GrChangeActionsInterface} api * @param {!GrChangeActionsInterface} api
*/ */
function ensureEl(api) { function ensureEl(api) {
@@ -32,6 +33,7 @@
/** /**
* Set gr-change-actions element to a GrChangeActionsInterface instance. * Set gr-change-actions element to a GrChangeActionsInterface instance.
*
* @param {!GrChangeActionsInterface} api * @param {!GrChangeActionsInterface} api
* @param {!Element} el gr-change-actions * @param {!Element} el gr-change-actions
*/ */

View File

@@ -20,6 +20,7 @@
/** /**
* Ensure GrChangeReplyInterface instance has access to gr-reply-dialog * Ensure GrChangeReplyInterface instance has access to gr-reply-dialog
* element and retrieve if the interface was created before element. * element and retrieve if the interface was created before element.
*
* @param {!GrChangeReplyInterfaceOld} api * @param {!GrChangeReplyInterfaceOld} api
*/ */
function ensureEl(api) { function ensureEl(api) {

View File

@@ -66,6 +66,7 @@
/** /**
* Get detailed information about modules registered with an extension * Get detailed information about modules registered with an extension
* endpoint. * endpoint.
*
* @param {string} name Endpoint name. * @param {string} name Endpoint name.
* @param {?{ * @param {?{
* type: (string|undefined), * type: (string|undefined),
@@ -92,6 +93,7 @@
/** /**
* Get detailed module names for instantiating at the endpoint. * Get detailed module names for instantiating at the endpoint.
*
* @param {string} name Endpoint name. * @param {string} name Endpoint name.
* @param {?{ * @param {?{
* type: (string|undefined), * type: (string|undefined),
@@ -109,6 +111,7 @@
/** /**
* Get .html plugin URLs with element and module definitions. * Get .html plugin URLs with element and module definitions.
*
* @param {string} name Endpoint name. * @param {string} name Endpoint name.
* @param {?{ * @param {?{
* type: (string|undefined), * type: (string|undefined),

View File

@@ -48,6 +48,7 @@
/** /**
* Fetch and return native browser REST API Response. * Fetch and return native browser REST API Response.
*
* @param {string} method HTTP Method (GET, POST, etc) * @param {string} method HTTP Method (GET, POST, etc)
* @param {string} url URL without base path or plugin prefix * @param {string} url URL without base path or plugin prefix
* @param {Object=} payload Respected for POST and PUT only. * @param {Object=} payload Respected for POST and PUT only.
@@ -63,6 +64,7 @@
/** /**
* Fetch and parse REST API response, if request succeeds. * Fetch and parse REST API response, if request succeeds.
*
* @param {string} method HTTP Method (GET, POST, etc) * @param {string} method HTTP Method (GET, POST, etc)
* @param {string} url URL without base path or plugin prefix * @param {string} url URL without base path or plugin prefix
* @param {Object=} payload Respected for POST and PUT only. * @param {Object=} payload Respected for POST and PUT only.

View File

@@ -294,6 +294,7 @@
/** /**
* To make REST requests for plugin-provided endpoints, use * To make REST requests for plugin-provided endpoints, use
*
* @example * @example
* const pluginRestApi = plugin.restApi(plugin.url()); * const pluginRestApi = plugin.restApi(plugin.url());
* *
@@ -567,6 +568,7 @@
/** /**
* Install "stepping stones" API for GWT-compiled plugins by default. * Install "stepping stones" API for GWT-compiled plugins by default.
*
* @deprecated best effort support, will be removed with GWT UI. * @deprecated best effort support, will be removed with GWT UI.
*/ */
Gerrit.installGwt = function(url) { Gerrit.installGwt = function(url) {

View File

@@ -40,6 +40,7 @@
* Get the HLJS library. Returns a promise that resolves with a reference to * Get the HLJS library. Returns a promise that resolves with a reference to
* the library after it's been loaded. The promise resolves immediately if * the library after it's been loaded. The promise resolves immediately if
* it's already been loaded. * it's already been loaded.
*
* @return {!Promise<Object>} * @return {!Promise<Object>}
*/ */
getHLJS() { getHLJS() {
@@ -64,6 +65,7 @@
/** /**
* Loads the dark theme document. Returns a promise that resolves with a * Loads the dark theme document. Returns a promise that resolves with a
* custom-style DOM element. * custom-style DOM element.
*
* @return {!Promise<Element>} * @return {!Promise<Element>}
*/ */
getDarkTheme() { getDarkTheme() {
@@ -91,6 +93,7 @@
/** /**
* Get the HLJS library, assuming it has been loaded. Configure the library * Get the HLJS library, assuming it has been loaded. Configure the library
* if it hasn't already been configured. * if it hasn't already been configured.
*
* @return {!Object} * @return {!Object}
*/ */
_getHighlightLib() { _getHighlightLib() {
@@ -106,6 +109,7 @@
/** /**
* Get the resource path used to load the application. If the application * Get the resource path used to load the application. If the application
* was loaded through a CDN, then this will be the path to CDN resources. * was loaded through a CDN, then this will be the path to CDN resources.
*
* @return {string} * @return {string}
*/ */
_getLibRoot() { _getLibRoot() {
@@ -117,6 +121,7 @@
/** /**
* Load and execute a JS file from the lib root. * Load and execute a JS file from the lib root.
*
* @param {string} src The path to the JS file without the lib root. * @param {string} src The path to the JS file without the lib root.
* @return {Promise} a promise that resolves when the script's onload * @return {Promise} a promise that resolves when the script's onload
* executes. * executes.

View File

@@ -54,6 +54,7 @@
/** /**
* Because either the source text or the linkification config has changed, * Because either the source text or the linkification config has changed,
* the content should be re-parsed. * the content should be re-parsed.
*
* @param {string|null|undefined} content The raw, un-linkified source * @param {string|null|undefined} content The raw, un-linkified source
* string to parse. * string to parse.
* @param {Object|null|undefined} config The server config specifying * @param {Object|null|undefined} config The server config specifying
@@ -83,6 +84,7 @@
* element should be created and attached to the resulting DOM. * element should be created and attached to the resulting DOM.
* - To attach an arbitrary fragment: when called with only the `fragment` * - To attach an arbitrary fragment: when called with only the `fragment`
* argument, the fragment should be attached to the resulting DOM as is. * argument, the fragment should be attached to the resulting DOM as is.
*
* @param {string|null} text * @param {string|null} text
* @param {string|null} href * @param {string|null} href
* @param {DocumentFragment|undefined} fragment * @param {DocumentFragment|undefined} fragment

View File

@@ -30,6 +30,7 @@
/** /**
* Pattern describing URLs with supported protocols. * Pattern describing URLs with supported protocols.
*
* @type {RegExp} * @type {RegExp}
*/ */
const URL_PROTOCOL_PATTERN = /^(https?:\/\/|mailto:)/; const URL_PROTOCOL_PATTERN = /^(https?:\/\/|mailto:)/;
@@ -38,6 +39,7 @@
* Construct a parser for linkifying text. Will linkify plain URLs that appear * Construct a parser for linkifying text. Will linkify plain URLs that appear
* in the text as well as custom links if any are specified in the linkConfig * in the text as well as custom links if any are specified in the linkConfig
* parameter. * parameter.
*
* @param {Object|null|undefined} linkConfig Comment links as specified by the * @param {Object|null|undefined} linkConfig Comment links as specified by the
* commentlinks field on a project config. * commentlinks field on a project config.
* @param {Function} callback The callback to be fired when an intermediate * @param {Function} callback The callback to be fired when an intermediate
@@ -56,6 +58,7 @@
/** /**
* Emit a callback to create a link element. * Emit a callback to create a link element.
*
* @param {string} text The text of the link. * @param {string} text The text of the link.
* @param {string} href The URL to use as the href of the link. * @param {string} href The URL to use as the href of the link.
*/ */
@@ -67,6 +70,7 @@
/** /**
* Given the source text and a list of CommentLinkItem objects that were * Given the source text and a list of CommentLinkItem objects that were
* generated by the commentlinks config, emit parsing callbacks. * generated by the commentlinks config, emit parsing callbacks.
*
* @param {string} text The chuml of source text over which the outputArray * @param {string} text The chuml of source text over which the outputArray
* items range. * items range.
* @param {!Array<Defs.CommentLinkItem>} outputArray The list of items to add * @param {!Array<Defs.CommentLinkItem>} outputArray The list of items to add
@@ -104,6 +108,7 @@
/** /**
* Sort the given array of CommentLinkItems such that the positions are in * Sort the given array of CommentLinkItems such that the positions are in
* reverse order. * reverse order.
*
* @param {!Array<Defs.CommentLinkItem>} outputArray * @param {!Array<Defs.CommentLinkItem>} outputArray
*/ */
GrLinkTextParser.prototype.sortArrayReverse = function(outputArray) { GrLinkTextParser.prototype.sortArrayReverse = function(outputArray) {
@@ -119,6 +124,7 @@
* - With the `html` paremeter provided, and the `text` and `href` parameters * - With the `html` paremeter provided, and the `text` and `href` parameters
* passed as `null`. In this case, the string of HTML will be parsed and the * passed as `null`. In this case, the string of HTML will be parsed and the
* first resulting node will be used as the resulting content. * first resulting node will be used as the resulting content.
*
* @param {string|null} text The text to use if creating a link. * @param {string|null} text The text to use if creating a link.
* @param {string|null} href The href to use as the URL if creating a link. * @param {string|null} href The href to use as the URL if creating a link.
* @param {string|null} html The html to parse and use as the result. * @param {string|null} html The html to parse and use as the result.
@@ -161,6 +167,7 @@
/** /**
* Create a CommentLinkItem for a link and append it to the given output * Create a CommentLinkItem for a link and append it to the given output
* array. * array.
*
* @param {string|null} text The text for the link. * @param {string|null} text The text for the link.
* @param {string|null} href The href to use as the URL of the link. * @param {string|null} href The href to use as the URL of the link.
* @param {number} position The position inside the source text where the link * @param {number} position The position inside the source text where the link
@@ -183,6 +190,7 @@
/** /**
* Create a CommentLinkItem specified by an HTMl string and append it to the * Create a CommentLinkItem specified by an HTMl string and append it to the
* given output array. * given output array.
*
* @param {string|null} html The html to parse and use as the result. * @param {string|null} html The html to parse and use as the result.
* @param {number} position The position inside the source text where the item * @param {number} position The position inside the source text where the item
* starts. * starts.
@@ -203,6 +211,7 @@
/** /**
* Does the given range overlap with anything already in the item list. * Does the given range overlap with anything already in the item list.
*
* @param {number} position * @param {number} position
* @param {number} length * @param {number} length
* @param {!Array<Defs.CommentLinkItem>} outputArray * @param {!Array<Defs.CommentLinkItem>} outputArray
@@ -225,6 +234,7 @@
/** /**
* Parse the given source text and emit callbacks for the items that are * Parse the given source text and emit callbacks for the items that are
* parsed. * parsed.
*
* @param {string} text * @param {string} text
*/ */
GrLinkTextParser.prototype.parse = function(text) { GrLinkTextParser.prototype.parse = function(text) {
@@ -240,6 +250,7 @@
* ba-linkify has found a plain URL and wants it linkified. * ba-linkify has found a plain URL and wants it linkified.
* - With only a `text` parameter provided: this represents the non-link * - With only a `text` parameter provided: this represents the non-link
* content that lies between the links the library has found. * content that lies between the links the library has found.
*
* @param {string} text * @param {string} text
* @param {string|null|undefined} href * @param {string|null|undefined} href
*/ */
@@ -266,6 +277,7 @@
/** /**
* Walk over the given source text to find matches for comemntlink patterns * Walk over the given source text to find matches for comemntlink patterns
* and emit parse result callbacks. * and emit parse result callbacks.
*
* @param {string} text The raw source text. * @param {string} text The raw source text.
* @param {Object|null|undefined} patterns A comment links specification * @param {Object|null|undefined} patterns A comment links specification
* object. * object.

View File

@@ -30,6 +30,7 @@
/** /**
* Get or upgrade fetch options to include an ETag in a request. * Get or upgrade fetch options to include an ETag in a request.
*
* @param {string} url The URL being fetched. * @param {string} url The URL being fetched.
* @param {!Object=} opt_options Optional options object in which to include * @param {!Object=} opt_options Optional options object in which to include
* the ETag request header. If omitted, the result will be a fresh option * the ETag request header. If omitted, the result will be a fresh option
@@ -77,6 +78,7 @@
/** /**
* Get the cached payload for a given URL. * Get the cached payload for a given URL.
*
* @param {string} url * @param {string} url
* @return {string|undefined} Returns the unparsed JSON payload from the * @return {string|undefined} Returns the unparsed JSON payload from the
* cache. * cache.

View File

@@ -43,6 +43,7 @@
* - cancelCondition is a function that, if provided and returns true, will * - cancelCondition is a function that, if provided and returns true, will
* cancel the response after it resolves. * cancel the response after it resolves.
* - params is a key-value hash to specify get params for the request URL. * - params is a key-value hash to specify get params for the request URL.
*
* @typedef {{ * @typedef {{
* url: string, * url: string,
* errFn: (function(?Response, string=)|null|undefined), * errFn: (function(?Response, string=)|null|undefined),
@@ -82,6 +83,7 @@
* - headers is a key-value hash to describe HTTP headers for the request. * - headers is a key-value hash to describe HTTP headers for the request.
* - parseResponse states whether the result should be parsed as a JSON * - parseResponse states whether the result should be parsed as a JSON
* object using getResponseObject. * object using getResponseObject.
*
* @typedef {{ * @typedef {{
* method: string, * method: string,
* url: string, * url: string,
@@ -253,6 +255,7 @@
/** /**
* Wraps calls to the underlying authenticated fetch function (_auth.fetch) * Wraps calls to the underlying authenticated fetch function (_auth.fetch)
* with timing and logging. * with timing and logging.
*
* @param {Defs.FetchRequest} req * @param {Defs.FetchRequest} req
*/ */
_fetch(req) { _fetch(req) {
@@ -270,6 +273,7 @@
* Log information about a REST call. Because the elapsed time is determined * Log information about a REST call. Because the elapsed time is determined
* by this method, it should be called immediately after the request * by this method, it should be called immediately after the request
* finishes. * finishes.
*
* @param {Defs.FetchRequest} req * @param {Defs.FetchRequest} req
* @param {number} startTime the time that the request was started. * @param {number} startTime the time that the request was started.
* @param {number} status the HTTP status of the response. The status value * @param {number} status the HTTP status of the response. The status value
@@ -298,6 +302,7 @@
* Returns a Promise that resolves to a native Response. * Returns a Promise that resolves to a native Response.
* Doesn't do error checking. Supports cancel condition. Performs auth. * Doesn't do error checking. Supports cancel condition. Performs auth.
* Validates auth expiry errors. * Validates auth expiry errors.
*
* @param {Defs.FetchJSONRequest} req * @param {Defs.FetchJSONRequest} req
*/ */
_fetchRawJSON(req) { _fetchRawJSON(req) {
@@ -332,6 +337,7 @@
* Fetch JSON from url provided. * Fetch JSON from url provided.
* Returns a Promise that resolves to a parsed response. * Returns a Promise that resolves to a parsed response.
* Same as {@link _fetchRawJSON}, plus error handling. * Same as {@link _fetchRawJSON}, plus error handling.
*
* @param {Defs.FetchJSONRequest} req * @param {Defs.FetchJSONRequest} req
*/ */
_fetchJSON(req) { _fetchJSON(req) {
@@ -1293,6 +1299,7 @@
/** /**
* Inserts a change into _projectLookup iff it has a valid structure. * Inserts a change into _projectLookup iff it has a valid structure.
*
* @param {?{ _number: (number|string) }} change * @param {?{ _number: (number|string) }} change
*/ */
_maybeInsertInLookup(change) { _maybeInsertInLookup(change) {
@@ -1488,6 +1495,7 @@
/** /**
* The closure compiler doesn't realize this.specialFilePathCompare is * The closure compiler doesn't realize this.specialFilePathCompare is
* valid. * valid.
*
* @suppress {checkTypes} * @suppress {checkTypes}
*/ */
getChangeFilePathsAsSpeciallySortedArray(changeNum, patchRange) { getChangeFilePathsAsSpeciallySortedArray(changeNum, patchRange) {
@@ -2030,6 +2038,7 @@
/** /**
* Gets a file in a specific change and revision. * Gets a file in a specific change and revision.
*
* @param {number|string} changeNum * @param {number|string} changeNum
* @param {string} path * @param {string} path
* @param {number|string} patchNum * @param {number|string} patchNum
@@ -2049,6 +2058,7 @@
/** /**
* Gets a file in a change edit. * Gets a file in a change edit.
*
* @param {number|string} changeNum * @param {number|string} changeNum
* @param {string} path * @param {string} path
*/ */
@@ -2175,6 +2185,7 @@
/** /**
* Send an XHR. * Send an XHR.
*
* @param {Defs.SendRequest} req * @param {Defs.SendRequest} req
* @return {Promise} * @return {Promise}
*/ */
@@ -2227,6 +2238,7 @@
/** /**
* Public version of the _send method preserved for plugins. * Public version of the _send method preserved for plugins.
*
* @param {string} method * @param {string} method
* @param {string} url * @param {string} url
* @param {?string|number|Object=} opt_body passed as null sometimes * @param {?string|number|Object=} opt_body passed as null sometimes
@@ -2917,6 +2929,7 @@
/** /**
* Alias for _changeBaseURL.then(send). * Alias for _changeBaseURL.then(send).
*
* @todo(beckysiegel) clean up comments * @todo(beckysiegel) clean up comments
* @param {Defs.ChangeSendRequest} req * @param {Defs.ChangeSendRequest} req
* @return {!Promise<!Object>} * @return {!Promise<!Object>}
@@ -2944,6 +2957,7 @@
/** /**
* Alias for _changeBaseURL.then(_fetchJSON). * Alias for _changeBaseURL.then(_fetchJSON).
*
* @param {Defs.ChangeFetchRequest} req * @param {Defs.ChangeFetchRequest} req
* @return {!Promise<!Object>} * @return {!Promise<!Object>}
*/ */
@@ -2966,6 +2980,7 @@
/** /**
* Execute a change action or revision action on a change. * Execute a change action or revision action on a change.
*
* @param {number} changeNum * @param {number} changeNum
* @param {string} method * @param {string} method
* @param {string} endpoint * @param {string} endpoint
@@ -2988,6 +3003,7 @@
/** /**
* Get blame information for the given diff. * Get blame information for the given diff.
*
* @param {string|number} changeNum * @param {string|number} changeNum
* @param {string|number} patchNum * @param {string|number} patchNum
* @param {string} path * @param {string} path
@@ -3009,6 +3025,7 @@
/** /**
* Modify the given create draft request promise so that it fails and throws * Modify the given create draft request promise so that it fails and throws
* an error if the response bears HTTP status 200 instead of HTTP 201. * an error if the response bears HTTP status 200 instead of HTTP 201.
*
* @see Issue 7763 * @see Issue 7763
* @param {Promise} promise The original promise. * @param {Promise} promise The original promise.
* @return {Promise} The modified promise. * @return {Promise} The modified promise.
@@ -3038,6 +3055,7 @@
/** /**
* Fetch a project dashboard definition. * Fetch a project dashboard definition.
* https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-dashboard * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-dashboard
*
* @param {string} project * @param {string} project
* @param {string} dashboard * @param {string} dashboard
* @param {function(?Response, string=)=} opt_errFn * @param {function(?Response, string=)=} opt_errFn

View File

@@ -61,6 +61,7 @@
/** /**
* Is a part of _groupUpdates(). Creates a new batch of updates. * Is a part of _groupUpdates(). Creates a new batch of updates.
*
* @param {Object} update instance of ReviewerUpdateInfo * @param {Object} update instance of ReviewerUpdateInfo
*/ */
GrReviewerUpdatesParser.prototype._startBatch = function(update) { GrReviewerUpdatesParser.prototype._startBatch = function(update) {
@@ -76,6 +77,7 @@
* Is a part of _groupUpdates(). Validates current batch: * Is a part of _groupUpdates(). Validates current batch:
* - filters out updates that don't change reviewer state. * - filters out updates that don't change reviewer state.
* - updates current reviewer state. * - updates current reviewer state.
*
* @param {Object} update instance of ReviewerUpdateInfo * @param {Object} update instance of ReviewerUpdateInfo
*/ */
GrReviewerUpdatesParser.prototype._completeBatch = function(update) { GrReviewerUpdatesParser.prototype._completeBatch = function(update) {
@@ -137,6 +139,7 @@
/** /**
* Generates update message for reviewer state change. * Generates update message for reviewer state change.
*
* @param {string} prev previous reviewer state. * @param {string} prev previous reviewer state.
* @param {string} state current reviewer state. * @param {string} state current reviewer state.
* @return {string} * @return {string}
@@ -158,6 +161,7 @@
/** /**
* Groups updates for same category (eg CC->CC) into a hash arrays of * Groups updates for same category (eg CC->CC) into a hash arrays of
* reviewers. * reviewers.
*
* @param {!Array<!Object>} updates Array of ReviewerUpdateItemInfo. * @param {!Array<!Object>} updates Array of ReviewerUpdateItemInfo.
* @return {!Object} Hash of arrays of AccountInfo, message as key. * @return {!Object} Hash of arrays of AccountInfo, message as key.
*/ */
@@ -175,6 +179,7 @@
/** /**
* Generates text messages for grouped reviewer updates. * Generates text messages for grouped reviewer updates.
* Formats reviewer updates to a (not yet implemented) EventInfo instance. * Formats reviewer updates to a (not yet implemented) EventInfo instance.
*
* @see https://gerrit-review.googlesource.com/c/94490/ * @see https://gerrit-review.googlesource.com/c/94490/
*/ */
GrReviewerUpdatesParser.prototype._formatUpdates = function() { GrReviewerUpdatesParser.prototype._formatUpdates = function() {

View File

@@ -32,6 +32,7 @@ limitations under the License.
* example, with normal changes this will always return 1. For merge changes * example, with normal changes this will always return 1. For merge changes
* wherein the revisions are merge commits this will return 2 or potentially * wherein the revisions are merge commits this will return 2 or potentially
* more. * more.
*
* @return {Number} * @return {Number}
*/ */
RevisionInfo.prototype.getMaxParents = function() { RevisionInfo.prototype.getMaxParents = function() {
@@ -42,6 +43,7 @@ limitations under the License.
/** /**
* Get an object that maps revision numbers to the number of parents of the * Get an object that maps revision numbers to the number of parents of the
* commit of that revision. * commit of that revision.
*
* @return {!Object} * @return {!Object}
*/ */
RevisionInfo.prototype.getParentCountMap = function() { RevisionInfo.prototype.getParentCountMap = function() {
@@ -62,6 +64,7 @@ limitations under the License.
/** /**
* Get the commit ID of the (0-offset) indexed parent in the given revision * Get the commit ID of the (0-offset) indexed parent in the given revision
* number. * number.
*
* @param {number|string} patchNum * @param {number|string} patchNum
* @param {number} parentIndex (0-offset) * @param {number} parentIndex (0-offset)
* @return {string} * @return {string}

View File

@@ -28,6 +28,6 @@ cd ${UI_PATH}
# Linking global eslint packages to the local project. Required to use eslint plugins with a global # Linking global eslint packages to the local project. Required to use eslint plugins with a global
# eslint installation. # eslint installation.
npm link eslint eslint-config-google eslint-plugin-html npm link eslint eslint-config-google eslint-plugin-html eslint-plugin-jsdoc
${eslint_bin} -c ${UI_PATH}/.eslintrc.json --ext .html,.js ${UI_PATH} ${eslint_bin} -c ${UI_PATH}/.eslintrc.json --ext .html,.js ${UI_PATH}