From 7617d26264acc92a4cbdb03d7e0a88b1aae1eb75 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Wed, 12 Oct 2022 13:01:44 +0100 Subject: [PATCH] Fix JSDoc comments for jest helpers --- lib/jest-helpers.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/jest-helpers.js b/lib/jest-helpers.js index 33d155ea9d..e3290a3da2 100644 --- a/lib/jest-helpers.js +++ b/lib/jest-helpers.js @@ -20,11 +20,11 @@ const nunjucksEnv = nunjucks.configure([configPaths.src, configPaths.components] /** * Render the raw HTML for a component * - * @param {String} componentName - * @param {Object} options options to pass to the component macro - * @param {String} [callBlock] if provided, the macro is called using the + * @param {string} componentName + * @param {object} options - options to pass to the component macro + * @param {string} [callBlock] - if provided, the macro is called using the * Nunjucks call tag, with the callBlock passed as the contents of the block - * @returns {String} HTML rendered by the macro + * @returns {string} HTML rendered by the macro */ function renderHtml (componentName, options, callBlock = false) { if (typeof options === 'undefined') { @@ -52,12 +52,11 @@ function renderHtml (componentName, options, callBlock = false) { * * Allows us to interrogate the output of the macro using a jQuery-like syntax * - * @param {String} componentName - * @param {Object} options options to pass to the component macro - * @param {String} [callBlock] if provided, the macro is called using the + * @param {string} componentName + * @param {object} options - options to pass to the component macro + * @param {string} [callBlock] - if provided, the macro is called using the * Nunjucks call tag, with the callBlock passed as the contents of the block - * - * @returns {CheerioAPI} a jQuery-like representation of the macro output + * @returns {import('cheerio')} a jQuery-like representation of the macro output */ function render (componentName, options, callBlock = false) { return cheerio.load( @@ -82,6 +81,7 @@ function renderTemplate (params = {}, blocks = {}) { /** * Get examples from a component's metadata file + * * @param {string} componentName * @returns {object} returns object that includes all examples at once */ @@ -100,8 +100,8 @@ async function getExamples (componentName) { /** * Render Sass * - * @param {object} options Options to pass to sass.render - * @return {promise} Result of calling sass.render + * @param {import('node-sass').Options} options - Options to pass to sass.render + * @returns {Promise} Result of calling sass.render */ function renderSass (options) { return sassRender({ @@ -115,9 +115,10 @@ function renderSass (options) { * child elements that do not match the component. * Relies on B.E.M naming ensuring that child components relating to a component * are namespaced. - * @param {function} $ requires an instance of cheerio (jQuery) that includes the + * + * @param {import('cheerio')} $ - requires an instance of cheerio (jQuery) that includes the * rendered component. - * @param {string} className the top level class 'Block' in B.E.M terminology + * @param {string} className - the top level class 'Block' in B.E.M terminology * @returns {string} returns HTML */ function htmlWithClassName ($, className) {