Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSDOC's lint required params and returns #1279

Merged
merged 10 commits into from
Aug 22, 2024
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ module.exports = {
'arrow-body-style': ['error', 'always'],
'import/extensions': ['error', 'always'],
strict: ['error', 'global'],
'jsdoc/require-jsdoc': ['warn', {
jonathangoulding marked this conversation as resolved.
Show resolved Hide resolved
publicOnly: true
}],
'jsdoc/require-description': 'warn',
'jsdoc/require-param': 'warn',
'jsdoc/require-returns': 'warn',
'jsdoc/require-param': ['warn', {
exemptedBy: ['private']
}],
'jsdoc/require-returns': ['warn', {
publicOnly: true
}],
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-alignment': 'warn',
'jsdoc/newline-after-description': 'off', // does not work with 'use strict'
Expand Down
9 changes: 5 additions & 4 deletions app/controllers/import.controller.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use strict'

/**
* Controller for /import
* @module ImportController
*/

const Boom = require('@hapi/boom')

const FeatureFlags = require('../../config/feature-flags.config.js')
const LegacyImportLicenceService = require('../services/import/legacy-licence.service.js')

/**
* Controller for /import
* @module ImportController
*/
async function licence (request, h) {
try {
const { licenceRef } = request.payload
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/jobs.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const ProcessTimeLimitedLicencesService = require('../services/jobs/time-limited
* Triggers export of all relevant tables to CSV and then uploads them to S3
*
* > Has to be called something other than 'export' because export is a reserved word
*
* @returns {Promise<object>} - A promise that resolves to an HTTP response object with a 204 status code
*/
async function exportDb (_request, h) {
ExportService.go()
Expand Down
2 changes: 2 additions & 0 deletions app/services/health/create-redis-client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const redisConfig = require('../../../config/redis.config.js')

/**
* Connect to Redis and return a client
*
* @returns {Promise<Redis>} - a new redis instance
*/
async function go () {
return new Redis({
Expand Down
2 changes: 2 additions & 0 deletions app/services/health/fetch-import-jobs.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const { db } = require('../../../db/db.js')

/**
* Returns data required to populate the Import tasks of our `/health/info` page.
*
* @returns {object} - query response
*/
async function go () {
const PGBOSS_JOBS_ARRAY = [
Expand Down
2 changes: 2 additions & 0 deletions app/services/plugins/payload-cleaning.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const Sanitizer = require('sanitizer')
* So we created this service which is used by the `PayLoadCleanerPlugin` to 'clean' incoming requests.
*
* * @module ObjectCleaningService
*
* @returns {object} - returns a 'clean' payload object
*/
function go (payload) {
return _cleanObject(payload)
Expand Down
2 changes: 2 additions & 0 deletions app/validators/custom/date.validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
/**
* Validates a string is in the format yyyy-mm-dd
*
* @returns {string} - returns the string value if the date is a valid ISO date YYYY-MM-DD
* @throws {Error} - throws an error if the date is not in the correct format or is not a valid date
*/
const isValidISODate = (value) => {
const regex = /^\d{4}-\d{2}-\d{2}$/
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/address.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/bill-licence.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/bill-run-charge-version-year.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/bill-run-volume.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/bill-run.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/bill.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/billing-account-address.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/billing-account.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/charge-category.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/charge-element.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/charge-reference.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/charge-version-note.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/charge-version.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/company-address.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/company-contact.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/company.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/contact.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/event.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const timestamp = timestampForPostgres()
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/gauging-station.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const timestamp = timestampForPostgres()
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-agreement.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-document-header.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-document-role.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-document.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-entity-role.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-entity.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-gauging-station.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-role.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-supplementary-year.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here in the database
*
* @returns {object} - Returns data from the query
*/
function defaults (data = {}) {
const defaults = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const timestamp = timestampForPostgres()
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-version-purpose.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const timestamp = timestampForPostgres()
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence-version.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const timestamp = timestampForPostgres()
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/licence.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions test/support/helpers/mod-log.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const regionCode = randomInteger(1, 9)
Expand Down
3 changes: 3 additions & 0 deletions test/support/helpers/permit-licence.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ async function add (data = {}) {
* for use in tests to avoid having to duplicate values.
*
* @param {object} [data] - Any data you want to use instead of the defaults used here or in the database
*
* @returns {object} - Returns the set defaults with the override data spread
*/
function defaults (data = {}) {
const licenceRef = data.licenceRef ? data.licenceRef : generateLicenceRef()
Expand Down Expand Up @@ -70,6 +72,7 @@ function defaults (data = {}) {
* This was the NALD dump the legacy acceptance test data loading solution used. It doesn't matter that the data
* included doesn't match with the related licence and other records. The critical factor is the structure must align
* with what the legacy apps expect.
* @param licenceRef
*/
function _licenceDataValue (licenceRef) {
return {
Expand Down
Loading
Loading