Skip to content

Commit

Permalink
Fix various param/return types
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Nov 9, 2022
1 parent f2aee4c commit 6f2261d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions lib/file-helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { readFile } = require('fs/promises')
const { join, parse, ParsedPath, relative } = require('path')
const { join, parse, relative } = require('path')
const { promisify } = require('util')
const glob = promisify(require('glob'))
const yaml = require('js-yaml')
Expand All @@ -26,7 +26,6 @@ const cache = global.cache || {}
*/
const getListing = async (directoryPath, pattern = '**/*', options = {}) => {
const listing = await glob(pattern, {
allowEmpty: true,
cwd: directoryPath,
matchBase: true,
nodir: true,
Expand Down Expand Up @@ -176,7 +175,7 @@ module.exports = {
* Directory entry path mapper callback
*
* @callback mapPathToCallback
* @param {ParsedPath} file - Parsed file
* @param {import('path').ParsedPath} file - Parsed file
* @returns {string[]} Returns path (or array of paths)
*/

Expand Down
7 changes: 3 additions & 4 deletions lib/puppeteer-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ async function goTo (page, path) {
*
* @param {import('puppeteer').Page} page - Puppeteer page object
* @param {string} exampleName - Example name
* @param {import('puppeteer').WaitForOptions} [options] - Navigation options (optional)
* @returns {Promise<import('puppeteer').Page>} Puppeteer page object
*/
function goToExample (page, exampleName, options) {
return goTo(page, `/examples/${exampleName}`, options)
function goToExample (page, exampleName) {
return goTo(page, `/examples/${exampleName}`)
}

/**
Expand Down Expand Up @@ -126,7 +125,7 @@ function getAttribute ($element, attributeName) {
* Gets the accessible name of the given element, if it exists in the accessibility tree
*
* @param {import('puppeteer').ElementHandle} $element - Puppeteer element handle
* @returns {string} The element's accessible name
* @returns {Promise<string>} The element's accessible name
* @throws {TypeError} If the element has no corresponding node in the accessibility tree
*/
async function getAccessibleName ($element) {
Expand Down
4 changes: 2 additions & 2 deletions src/govuk/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
* @param {nodeListIterator} callback - Callback function to run for each node
* @returns {undefined}
* @returns {void}
*/
export function nodeListForEach (nodes, callback) {
if (window.NodeList.prototype.forEach) {
Expand Down Expand Up @@ -155,5 +155,5 @@ export function extractConfigByNamespace (configObject, namespace) {
* @param {Element} value - The current node being iterated on
* @param {number} index - The current index in the iteration
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
* @returns {undefined}
* @returns {void}
*/
2 changes: 1 addition & 1 deletion src/govuk/components/button/button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('/components/button', () => {
* Examples don't do this and we need it to have something to submit
*
* @param {import('puppeteer').Page} page - Puppeteer page object
* @returns {undefined}
* @returns {Promise<void>}
*/
function trackClicks (page) {
return page.evaluate(() => {
Expand Down

0 comments on commit 6f2261d

Please sign in to comment.