Replace all instances of JSDoc generic Function with detailed @callback definition (type-only changes).

This commit is contained in:
David Anson 2023-09-04 21:41:16 -07:00
parent 8bb97dadfe
commit 07f403173c
6 changed files with 199 additions and 38 deletions

View file

@ -520,7 +520,7 @@ function getEnabledRulesPerLineNumber(
* @param {boolean} handleRuleFailures Whether to handle exceptions in rules.
* @param {boolean} noInlineConfig Whether to allow inline configuration.
* @param {number} resultVersion Version of the LintResults object to return.
* @param {Function} callback Callback (err, result) function.
* @param {LintContentCallback} callback Callback (err, result) function.
* @returns {void}
*/
function lintContent(
@ -809,7 +809,7 @@ function lintContent(
* @param {number} resultVersion Version of the LintResults object to return.
* @param {Object} fs File system implementation.
* @param {boolean} synchronous Whether to execute synchronously.
* @param {Function} callback Callback (err, result) function.
* @param {LintContentCallback} callback Callback (err, result) function.
* @returns {void}
*/
function lintFile(
@ -859,7 +859,7 @@ function lintFile(
*
* @param {Options | null} options Options object.
* @param {boolean} synchronous Whether to execute synchronously.
* @param {Function} callback Callback (err, result) function.
* @param {LintCallback} callback Callback (err, result) function.
* @returns {void}
*/
function lintInput(options, synchronous, callback) {
@ -1022,7 +1022,7 @@ function markdownlintPromise(options) {
* @returns {LintResults} Results object.
*/
function markdownlintSync(options) {
let results = {};
let results = null;
lintInput(options, true, function callback(error, res) {
if (error) {
throw error;
@ -1417,12 +1417,21 @@ module.exports = markdownlint;
* @property {string} [insertText] Text to insert (after deleting).
*/
/**
* Called with the result of linting a string or document.
*
* @callback LintContentCallback
* @param {Error | null} error Error iff failed.
* @param {LintError[]} [result] Result iff successful.
* @returns {void}
*/
/**
* Called with the result of the lint function.
*
* @callback LintCallback
* @param {Error | null} err Error object or null.
* @param {LintResults} [results] Lint results.
* @param {Error | null} error Error object iff failed.
* @param {LintResults} [results] Lint results iff succeeded.
* @returns {void}
*/