Skip to content

Commit e1cceb9

Browse files
Fix ESLint warnings
1 parent 368da02 commit e1cceb9

27 files changed

Lines changed: 73 additions & 65 deletions

app/assets/javascripts/components/autocomplete.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ export class Autocomplete extends Component {
7171
/**
7272
* Selected option
7373
*
74-
* @param {*} value - Current value
74+
* @template T
75+
* @param {T} value - Current value
7576
* @param {Array} options - Available options
7677
* @returns {HTMLOptionElement} Selected option
7778
*/
@@ -85,14 +86,17 @@ export class Autocomplete extends Component {
8586
/**
8687
* HTML for suggestion
8788
*
88-
* @param {*} value - Current value
89+
* @template T
90+
* @param {T} value - Current value
8991
* @param {Array} options - Available options
9092
* @returns {string} HTML for suggestion
9193
*/
9294
suggestion(value, options) {
9395
const option = options.find(({ name }) => name === value)
9496
if (option) {
95-
const label = option.append ? `${value}${option.append}` : value
97+
const label = option.append
98+
? `${value}${option.append}`
99+
: String(value)
96100
return option.hint
97101
? `${label}<br><span class="app-autocomplete__option-hint">${option.hint}</span>`
98102
: label

app/filters.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default (env) => {
2222
* Remove border from last summary row
2323
*
2424
* @param {Array} array - Summary rows
25-
* @returns {Array} Summary rows
25+
* @returns {Array|undefined} Summary rows
2626
*/
2727
filters.removeLastSummaryBorder = function (array) {
2828
if (array && Array.isArray(array) && array.length > 0) {
@@ -70,7 +70,7 @@ export default (env) => {
7070
/**
7171
* Ordinal
7272
*
73-
* @param {string} number - Number to get ordinal for
73+
* @param {number} number - Number to get ordinal for
7474
* @returns {string} Ordinal
7575
*/
7676
filters.ordinal = (number) => {
@@ -138,8 +138,9 @@ export default (env) => {
138138
/**
139139
* Push item to array
140140
*
141+
* @template T
141142
* @param {Array} array - Array
142-
* @param {*} item - Item to push
143+
* @param {T} item - Item to push
143144
* @returns {Array} Updated array
144145
*/
145146
filters.push = (array, item) => {
@@ -166,6 +167,7 @@ export default (env) => {
166167
*
167168
* @param {Array} array - Array
168169
* @param {string} value - Value to check
170+
* @returns {boolean} Returns true or false
169171
*/
170172
filters.includes = (array, value) => {
171173
return prototypeFilters.arrayOrStringIncludes(array, value)

app/generators/session.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { getSessionYearGroups } from '../utils/session.js'
99
* Generate fake session
1010
*
1111
* @param {import('../enums.js').SessionPreset} preset - Session preset
12-
* @param {import('../models.js').User} user - User
1312
* @param {number} academicYear - Academic year
13+
* @param {import('../models.js').User} user - User
1414
* @param {object} options - Options
1515
* @param {string} [options.clinic_id] - Clinic ID
1616
* @param {string} [options.school_id] - School URN
17-
* @returns {Session} Session
17+
* @returns {Session|undefined} Session
1818
*/
1919
export function generateSession(preset, academicYear, user, options) {
2020
// Don’t generate sessions for inactive session preset

app/models/audit-event.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
* @property {boolean} [pinned] - Pinned
3636
* @property {object} [messageRecipient] - Message recipient
3737
* @property {string} [messageTemplate] - Message template
38-
* @property {AuditEventType} [type] - Audit event type
38+
* @property {import('../enums.js').AuditEventType} [type] - Audit event type
3939
* @property {string} [outcome] - Outcome for activity type
4040
* @property {Date} [outcomeAt] - Date outcome invalidates
4141
* @property {object} [outcomeAt_] - Date outcome invalidates (from `dateInput`)
@@ -68,7 +68,7 @@ export class AuditEvent {
6868
/**
6969
* Get user who created event
7070
*
71-
* @returns {User} User
71+
* @returns {User|undefined} User
7272
*/
7373
get createdBy() {
7474
try {
@@ -168,7 +168,7 @@ export class AuditEvent {
168168
/**
169169
* Get team
170170
*
171-
* @returns {Team} Team
171+
* @returns {Team|undefined} Team
172172
*/
173173
get team() {
174174
try {

app/models/batch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class Batch {
7878
/**
7979
* Get vaccine this batch belongs to
8080
*
81-
* @returns {Vaccine} Vaccine
81+
* @returns {Vaccine|undefined} Vaccine
8282
*/
8383
get vaccine() {
8484
try {

app/models/child.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { formatList, formatYearGroup, stringToArray } from '../utils/string.js'
3030
* @property {Date} [dob] - Date of birth
3131
* @property {object} [dob_] - Date of birth (from `dateInput`)
3232
* @property {Date} [dod] - Date of death
33-
* @property {import('../enums.js).Gender} gender - Gender
33+
* @property {import('../enums.js').Gender} gender - Gender
3434
* @property {EthnicGroup} [ethnicGroup] - Ethnic group
3535
* @property {string} [ethnicGroupOther] - Other ethnic group
3636
* @property {import('../enums.js).EthnicBackground')} [ethnicBackground] - Ethnic background
@@ -153,7 +153,7 @@ export class Child {
153153
/**
154154
* Get formatted ethnicity (ethnic group and background)
155155
*
156-
* @returns {string} Date of birth and age in years
156+
* @returns {string|undefined} Date of birth and age in years
157157
*/
158158
get ethnicity() {
159159
if (this.ethnicGroup && this.ethnicBackground !== 'false') {

app/models/download.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class Download {
5454
/**
5555
* Get user who created upload
5656
*
57-
* @returns {User} User
57+
* @returns {User|undefined} User
5858
*/
5959
get createdBy() {
6060
try {
@@ -129,7 +129,7 @@ export class Download {
129129
/**
130130
* Get programme
131131
*
132-
* @returns {Programme} Programme
132+
* @returns {Programme|undefined} Programme
133133
*/
134134
get programme() {
135135
try {

app/models/location.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Programme, Team } from '../models.js'
1414
* @property {string} [addressLevel1] - Address level 1
1515
* @property {string} [postalCode] - Postcode
1616
* @property {string} [team_id] - Team ID
17-
* @property {Array<SessionPresetName>} [presetNames] - Session preset names
17+
* @property {Array<import('../enums.js').SessionPresetName>} [presetNames] - Session preset names
1818
*/
1919
export class Location {
2020
constructor(options, context) {
@@ -60,7 +60,7 @@ export class Location {
6060
/**
6161
* Get team
6262
*
63-
* @returns {Team} Team
63+
* @returns {Team|undefined} Team
6464
*/
6565
get team() {
6666
try {

app/models/notice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class Notice {
2727
/**
2828
* Get patient
2929
*
30-
* @returns {Patient} Patient
30+
* @returns {Patient|undefined} Patient
3131
*/
3232
get patient() {
3333
try {

app/models/patient-programme.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class PatientProgramme {
7474
/**
7575
* Year patient is eligible for programme
7676
*
77-
* @returns {number} Year patient becomes eligible for programme
77+
* @returns {number|undefined} Year patient becomes eligible for programme
7878
*/
7979
get year() {
8080
if (!this.programme) {
@@ -119,7 +119,7 @@ export class PatientProgramme {
119119
/**
120120
* Get most recent patient session
121121
*
122-
* @returns {import('./patient-session.js').PatientSession} Patient session
122+
* @returns {import('./patient-session.js').PatientSession|undefined} Patient session
123123
*/
124124
get lastPatientSession() {
125125
if (this.patientSessions?.length > 0) {
@@ -162,7 +162,7 @@ export class PatientProgramme {
162162
/**
163163
* Get last vaccination outcome
164164
*
165-
* @returns {import('./vaccination.js').Vaccination} Vaccination
165+
* @returns {import('./vaccination.js').Vaccination|undefined} Vaccination
166166
*/
167167
get lastVaccinationOutcome() {
168168
if (this.vaccinationOutcomes?.length > 0) {
@@ -204,7 +204,7 @@ export class PatientProgramme {
204204
/**
205205
* Get last vaccination outcome
206206
*
207-
* @returns {import('./vaccination.js').Vaccination} Vaccination
207+
* @returns {import('./vaccination.js').Vaccination|undefined} Vaccination
208208
*/
209209
get lastVaccinationGiven() {
210210
if (this.vaccinationsGiven?.length > 0) {

0 commit comments

Comments
 (0)