Skip to content

Commit fd5efdf

Browse files
Fix various param/return types
1 parent 4aaf183 commit fd5efdf

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

lib/file-helper.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { readFile } = require('fs/promises')
2-
const { join, parse, ParsedPath, relative } = require('path')
2+
const { join, parse, relative } = require('path')
33
const { promisify } = require('util')
44
const glob = promisify(require('glob'))
55
const yaml = require('js-yaml')
@@ -26,7 +26,6 @@ const cache = global.cache || {}
2626
*/
2727
const getListing = async (directoryPath, pattern = '**/*', options = {}) => {
2828
const listing = await glob(pattern, {
29-
allowEmpty: true,
3029
cwd: directoryPath,
3130
matchBase: true,
3231
nodir: true,
@@ -176,7 +175,7 @@ module.exports = {
176175
* Directory entry path mapper callback
177176
*
178177
* @callback mapPathToCallback
179-
* @param {ParsedPath} file - Parsed file
178+
* @param {import('path').ParsedPath} file - Parsed file
180179
* @returns {string[]} Returns path (or array of paths)
181180
*/
182181

lib/puppeteer-helpers.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ async function goTo (page, path) {
7575
*
7676
* @param {import('puppeteer').Page} page - Puppeteer page object
7777
* @param {string} exampleName - Example name
78-
* @param {import('puppeteer').WaitForOptions} [options] - Navigation options (optional)
7978
* @returns {Promise<import('puppeteer').Page>} Puppeteer page object
8079
*/
81-
function goToExample (page, exampleName, options) {
82-
return goTo(page, `/examples/${exampleName}`, options)
80+
function goToExample (page, exampleName) {
81+
return goTo(page, `/examples/${exampleName}`)
8382
}
8483

8584
/**
@@ -126,7 +125,7 @@ function getAttribute ($element, attributeName) {
126125
* Gets the accessible name of the given element, if it exists in the accessibility tree
127126
*
128127
* @param {import('puppeteer').ElementHandle} $element - Puppeteer element handle
129-
* @returns {string} The element's accessible name
128+
* @returns {Promise<string>} The element's accessible name
130129
* @throws {TypeError} If the element has no corresponding node in the accessibility tree
131130
*/
132131
async function getAccessibleName ($element) {

src/govuk/common/index.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
1717
* @param {nodeListIterator} callback - Callback function to run for each node
18-
* @returns {undefined}
18+
* @returns {void}
1919
*/
2020
export function nodeListForEach (nodes, callback) {
2121
if (window.NodeList.prototype.forEach) {
@@ -155,5 +155,5 @@ export function extractConfigByNamespace (configObject, namespace) {
155155
* @param {Element} value - The current node being iterated on
156156
* @param {number} index - The current index in the iteration
157157
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
158-
* @returns {undefined}
158+
* @returns {void}
159159
*/

src/govuk/components/button/button.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('/components/button', () => {
6161
* Examples don't do this and we need it to have something to submit
6262
*
6363
* @param {import('puppeteer').Page} page - Puppeteer page object
64-
* @returns {undefined}
64+
* @returns {Promise<void>}
6565
*/
6666
function trackClicks (page) {
6767
return page.evaluate(() => {

0 commit comments

Comments
 (0)