From 7011ab1adc7513c78b9ccc03561a6dcacd7ad104 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 29 Oct 2024 13:59:16 -0400 Subject: [PATCH] linting --- bin/www.js | 9 +- bin/www.ts | 9 +- bin/wwwProcess.js | 3 +- bin/wwwProcess.ts | 3 +- cypress/support/index.js | 1 - cypress/support/index.ts | 2 - data/config.cemetery.d.ts | 3 +- data/config.cemetery.js | 2 +- data/config.cemetery.ssm.d.ts | 3 +- data/config.cemetery.ssm.js | 2 +- data/config.cemetery.ssm.ts | 4 +- data/config.cemetery.ts | 4 +- data/config.defaultValues.js | 5 +- data/config.defaultValues.ts | 15 +++- data/config.testing.d.ts | 3 +- data/config.testing.js | 2 +- data/config.testing.ts | 4 +- database/getFeeCategories.d.ts | 2 +- database/getFeeCategories.ts | 2 +- database/getLotOccupancyComments.js | 2 +- database/getLotOccupancyComments.ts | 2 +- database/getNextMapId.ts | 8 +- database/getNextWorkOrderNumber.js | 6 +- database/getNextWorkOrderNumber.ts | 14 +-- database/getPastLotOccupancyOccupants.js | 27 +++--- database/getPastLotOccupancyOccupants.ts | 27 +++--- database/getPreviousLotId.ts | 8 +- database/getPreviousMapId.ts | 8 +- database/getReportData.js | 4 +- database/getReportData.ts | 5 +- database/moveRecord.js | 8 +- database/moveRecord.ts | 8 +- eslint.config.js | 12 ++- eslint.config.ts | 12 ++- package-lock.json | 106 +++++++++++------------ package.json | 2 +- 36 files changed, 184 insertions(+), 153 deletions(-) diff --git a/bin/www.js b/bin/www.js index e6bb7457..f2714086 100644 --- a/bin/www.js +++ b/bin/www.js @@ -1,13 +1,14 @@ import cluster from 'node:cluster'; import os from 'node:os'; -import { dirname } from 'node:path'; +import path from 'node:path'; import { fileURLToPath } from 'node:url'; import ntfyPublish from '@cityssm/ntfy-publish'; +import { secondsToMillis } from '@cityssm/to-millis'; import Debug from 'debug'; import exitHook from 'exit-hook'; import { getConfigProperty } from '../helpers/functions.config.js'; const debug = Debug(`lot-occupancy-system:www:${process.pid}`); -const directoryName = dirname(fileURLToPath(import.meta.url)); +const directoryName = path.dirname(fileURLToPath(import.meta.url)); const processCount = Math.min(getConfigProperty('application.maximumProcesses'), os.cpus().length); process.title = `${getConfigProperty('application.applicationName')} (Primary)`; debug(`Primary pid: ${process.pid}`); @@ -68,7 +69,7 @@ if (process.env.STARTUP_TEST === 'true') { debug(`Killing processes in ${killSeconds} seconds...`); setTimeout(() => { debug('Killing processes'); - // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit + // eslint-disable-next-line unicorn/no-process-exit process.exit(0); - }, 10_000); + }, secondsToMillis(killSeconds)); } diff --git a/bin/www.ts b/bin/www.ts index e0a6eed9..ea8752ee 100644 --- a/bin/www.ts +++ b/bin/www.ts @@ -1,9 +1,10 @@ import cluster, { type Worker } from 'node:cluster' import os from 'node:os' -import { dirname } from 'node:path' +import path from 'node:path' import { fileURLToPath } from 'node:url' import ntfyPublish, { type NtfyMessageOptions } from '@cityssm/ntfy-publish' +import { secondsToMillis } from '@cityssm/to-millis' import Debug from 'debug' import exitHook from 'exit-hook' @@ -12,7 +13,7 @@ import type { WorkerMessage } from '../types/applicationTypes.js' const debug = Debug(`lot-occupancy-system:www:${process.pid}`) -const directoryName = dirname(fileURLToPath(import.meta.url)) +const directoryName = path.dirname(fileURLToPath(import.meta.url)) const processCount = Math.min( getConfigProperty('application.maximumProcesses'), @@ -98,7 +99,7 @@ if (process.env.STARTUP_TEST === 'true') { setTimeout(() => { debug('Killing processes') - // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit + // eslint-disable-next-line unicorn/no-process-exit process.exit(0) - }, 10_000) + }, secondsToMillis(killSeconds)) } diff --git a/bin/wwwProcess.js b/bin/wwwProcess.js index fbb41fb2..51dd0c23 100644 --- a/bin/wwwProcess.js +++ b/bin/wwwProcess.js @@ -1,5 +1,5 @@ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -/* eslint-disable n/no-process-exit, unicorn/no-process-exit */ +/* eslint-disable unicorn/no-process-exit */ import http from 'node:http'; import Debug from 'debug'; import exitHook from 'exit-hook'; @@ -12,7 +12,6 @@ function onError(error) { } // handle specific listen errors with friendly messages switch (error.code) { - // eslint-disable-next-line no-fallthrough case 'EACCES': { debug('Requires elevated privileges'); process.exit(1); diff --git a/bin/wwwProcess.ts b/bin/wwwProcess.ts index 196e91fa..395f56a5 100644 --- a/bin/wwwProcess.ts +++ b/bin/wwwProcess.ts @@ -1,5 +1,5 @@ // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -/* eslint-disable n/no-process-exit, unicorn/no-process-exit */ +/* eslint-disable unicorn/no-process-exit */ import http from 'node:http' @@ -23,7 +23,6 @@ function onError(error: ServerError): void { // handle specific listen errors with friendly messages switch (error.code) { - // eslint-disable-next-line no-fallthrough case 'EACCES': { debug('Requires elevated privileges') process.exit(1) diff --git a/cypress/support/index.js b/cypress/support/index.js index dbd4e2c9..1848b5dd 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,4 +1,3 @@ -/* eslint-disable node/no-unpublished-import */ import 'cypress-axe'; export const logout = () => { cy.visit('/logout'); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 5b79c395..d228cede 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -1,5 +1,3 @@ -/* eslint-disable node/no-unpublished-import */ - import 'cypress-axe' export const logout = (): void => { diff --git a/data/config.cemetery.d.ts b/data/config.cemetery.d.ts index 4cc10144..7a20dd7a 100644 --- a/data/config.cemetery.d.ts +++ b/data/config.cemetery.d.ts @@ -1,2 +1,3 @@ -export declare const config: import("../types/configTypes.js").Config; +import type { Config } from '../types/configTypes.js'; +export declare const config: Config; export default config; diff --git a/data/config.cemetery.js b/data/config.cemetery.js index 20a7cf05..4111fbe6 100644 --- a/data/config.cemetery.js +++ b/data/config.cemetery.js @@ -1,5 +1,5 @@ import { config as baseConfig } from './config.base.js'; -export const config = Object.assign({}, baseConfig); +export const config = { ...baseConfig }; config.application = { applicationName: 'Cemetery Management System', backgroundURL: '/images/cemetery-background.jpg', diff --git a/data/config.cemetery.ssm.d.ts b/data/config.cemetery.ssm.d.ts index e51fe65b..f4b7dd5f 100644 --- a/data/config.cemetery.ssm.d.ts +++ b/data/config.cemetery.ssm.d.ts @@ -1,3 +1,4 @@ -export declare const config: import("../types/configTypes.js").Config; +import type { Config } from '../types/configTypes.js'; +export declare const config: Config; export declare function lotNameSortNameFunction(lotName: string): string; export default config; diff --git a/data/config.cemetery.ssm.js b/data/config.cemetery.ssm.js index 0e8e8c16..e0fa7845 100644 --- a/data/config.cemetery.ssm.js +++ b/data/config.cemetery.ssm.js @@ -1,6 +1,6 @@ import NodeCache from 'node-cache'; import { config as cemeteryConfig } from './config.cemetery.ontario.js'; -export const config = Object.assign({}, cemeteryConfig); +export const config = { ...cemeteryConfig }; config.aliases.occupancyStartDate = 'Purchase Date'; config.aliases.externalReceiptNumber = 'GP Receipt Number'; config.settings.lot.lotNamePattern = diff --git a/data/config.cemetery.ssm.ts b/data/config.cemetery.ssm.ts index 24b39a8e..63ef6cf4 100644 --- a/data/config.cemetery.ssm.ts +++ b/data/config.cemetery.ssm.ts @@ -1,8 +1,10 @@ import NodeCache from 'node-cache' +import type { Config } from '../types/configTypes.js' + import { config as cemeteryConfig } from './config.cemetery.ontario.js' -export const config = Object.assign({}, cemeteryConfig) +export const config: Config = { ...cemeteryConfig} config.aliases.occupancyStartDate = 'Purchase Date' config.aliases.externalReceiptNumber = 'GP Receipt Number' diff --git a/data/config.cemetery.ts b/data/config.cemetery.ts index 86b020d5..024baaff 100644 --- a/data/config.cemetery.ts +++ b/data/config.cemetery.ts @@ -1,6 +1,8 @@ +import type { Config } from '../types/configTypes.js' + import { config as baseConfig } from './config.base.js' -export const config = Object.assign({}, baseConfig) +export const config: Config = { ...baseConfig } config.application = { applicationName: 'Cemetery Management System', diff --git a/data/config.defaultValues.js b/data/config.defaultValues.js index ad1feac6..889a9599 100644 --- a/data/config.defaultValues.js +++ b/data/config.defaultValues.js @@ -1,5 +1,6 @@ +import { hoursToMillis } from '@cityssm/to-millis'; export const configDefaultValues = { - 'activeDirectory': undefined, + activeDirectory: undefined, 'application.applicationName': 'Lot Occupancy System', 'application.backgroundURL': '/images/cemetery-background.jpg', 'application.logoURL': '/images/cemetery-logo.png', @@ -13,7 +14,7 @@ export const configDefaultValues = { 'reverseProxy.urlPrefix': '', 'session.cookieName': 'lot-occupancy-system-user-sid', 'session.secret': 'cityssm/lot-occupancy-system', - 'session.maxAgeMillis': 60 * 60 * 1000, + 'session.maxAgeMillis': hoursToMillis(1), 'session.doKeepAlive': false, 'users.testing': [], 'users.canLogin': ['administrator'], diff --git a/data/config.defaultValues.ts b/data/config.defaultValues.ts index 99bf4048..8b34ff96 100644 --- a/data/config.defaultValues.ts +++ b/data/config.defaultValues.ts @@ -1,9 +1,14 @@ +import { hoursToMillis } from '@cityssm/to-millis' import type { config as MSSQLConfig } from 'mssql' -import type { ConfigActiveDirectory, ConfigNtfyStartup, DynamicsGPLookup } from '../types/configTypes.js' +import type { + ConfigActiveDirectory, + ConfigNtfyStartup, + DynamicsGPLookup +} from '../types/configTypes.js' export const configDefaultValues = { - 'activeDirectory': undefined as unknown as ConfigActiveDirectory, + activeDirectory: undefined as unknown as ConfigActiveDirectory, 'application.applicationName': 'Lot Occupancy System', 'application.backgroundURL': '/images/cemetery-background.jpg', @@ -21,7 +26,7 @@ export const configDefaultValues = { 'session.cookieName': 'lot-occupancy-system-user-sid', 'session.secret': 'cityssm/lot-occupancy-system', - 'session.maxAgeMillis': 60 * 60 * 1000, + 'session.maxAgeMillis': hoursToMillis(1), 'session.doKeepAlive': false, 'users.testing': [] as string[], @@ -66,7 +71,9 @@ export const configDefaultValues = { 'settings.adminCleanup.recordDeleteAgeDays': 60, - 'settings.printPdf.contentDisposition': 'attachment' as 'attachment' | 'inline', + 'settings.printPdf.contentDisposition': 'attachment' as + | 'attachment' + | 'inline', 'settings.dynamicsGP.integrationIsEnabled': false, 'settings.dynamicsGP.mssqlConfig': undefined as unknown as MSSQLConfig, diff --git a/data/config.testing.d.ts b/data/config.testing.d.ts index 4cc10144..7a20dd7a 100644 --- a/data/config.testing.d.ts +++ b/data/config.testing.d.ts @@ -1,2 +1,3 @@ -export declare const config: import("../types/configTypes.js").Config; +import type { Config } from '../types/configTypes.js'; +export declare const config: Config; export default config; diff --git a/data/config.testing.js b/data/config.testing.js index 9126a729..d7923bd7 100644 --- a/data/config.testing.js +++ b/data/config.testing.js @@ -1,5 +1,5 @@ import { config as cemeteryConfig } from './config.cemetery.ssm.js'; -export const config = Object.assign({}, cemeteryConfig); +export const config = { ...cemeteryConfig }; config.application.useTestDatabases = true; config.session.doKeepAlive = true; config.users = { diff --git a/data/config.testing.ts b/data/config.testing.ts index 6f58404e..7e908edd 100644 --- a/data/config.testing.ts +++ b/data/config.testing.ts @@ -1,6 +1,8 @@ +import type { Config } from '../types/configTypes.js' + import { config as cemeteryConfig } from './config.cemetery.ssm.js' -export const config = Object.assign({}, cemeteryConfig) +export const config: Config = { ...cemeteryConfig } config.application.useTestDatabases = true diff --git a/database/getFeeCategories.d.ts b/database/getFeeCategories.d.ts index 4bd94dfe..bf967192 100644 --- a/database/getFeeCategories.d.ts +++ b/database/getFeeCategories.d.ts @@ -1,4 +1,4 @@ -import { type PoolConnection } from 'better-sqlite-pool'; +import type { PoolConnection } from 'better-sqlite-pool'; import type { FeeCategory } from '../types/recordTypes.js'; interface GetFeeCategoriesFilters { occupancyTypeId?: number | string; diff --git a/database/getFeeCategories.ts b/database/getFeeCategories.ts index 738eb7e4..30f16593 100644 --- a/database/getFeeCategories.ts +++ b/database/getFeeCategories.ts @@ -1,4 +1,4 @@ -import { type PoolConnection } from 'better-sqlite-pool' +import type { PoolConnection } from 'better-sqlite-pool' import type { FeeCategory } from '../types/recordTypes.js' diff --git a/database/getLotOccupancyComments.js b/database/getLotOccupancyComments.js index 5e228b6d..11c50c9e 100644 --- a/database/getLotOccupancyComments.js +++ b/database/getLotOccupancyComments.js @@ -20,7 +20,7 @@ export default async function getLotOccupancyComments(lotOccupancyId, connectedD and lotOccupancyId = ? order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`) .all(lotOccupancyId); - if (connectedDatabase === null) { + if (connectedDatabase === undefined) { database.release(); } return lotComments; diff --git a/database/getLotOccupancyComments.ts b/database/getLotOccupancyComments.ts index fba0edaa..c2022dbb 100644 --- a/database/getLotOccupancyComments.ts +++ b/database/getLotOccupancyComments.ts @@ -39,7 +39,7 @@ export default async function getLotOccupancyComments( ) .all(lotOccupancyId) as LotOccupancyComment[] - if (connectedDatabase === null) { + if (connectedDatabase === undefined) { database.release() } diff --git a/database/getNextMapId.ts b/database/getNextMapId.ts index 27ea1886..6fd8c536 100644 --- a/database/getNextMapId.ts +++ b/database/getNextMapId.ts @@ -14,9 +14,11 @@ export default async function getNextMapId( order by mapName limit 1` ) - .get(mapId) as { - mapId: number - } + .get(mapId) as + | { + mapId: number + } + | undefined database.release() diff --git a/database/getNextWorkOrderNumber.js b/database/getNextWorkOrderNumber.js index c680450d..ab9420ab 100644 --- a/database/getNextWorkOrderNumber.js +++ b/database/getNextWorkOrderNumber.js @@ -7,9 +7,7 @@ export default async function getNextWorkOrderNumber(connectedDatabase) { const regex = new RegExp(`^${currentYearString}-\\d+$`); database.function( // eslint-disable-next-line no-secrets/no-secrets - 'userFn_matchesWorkOrderNumberSyntax', (workOrderNumber) => { - return regex.test(workOrderNumber) ? 1 : 0; - }); + 'userFn_matchesWorkOrderNumberSyntax', (workOrderNumber) => (regex.test(workOrderNumber) ? 1 : 0)); const workOrderNumberRecord = database .prepare( // eslint-disable-next-line no-secrets/no-secrets @@ -21,7 +19,7 @@ export default async function getNextWorkOrderNumber(connectedDatabase) { database.release(); } let workOrderNumberIndex = 0; - if (workOrderNumberRecord) { + if (workOrderNumberRecord !== undefined) { workOrderNumberIndex = Number.parseInt(workOrderNumberRecord.workOrderNumber.split('-')[1], 10); } workOrderNumberIndex += 1; diff --git a/database/getNextWorkOrderNumber.ts b/database/getNextWorkOrderNumber.ts index 3aa833b7..3944aa9d 100644 --- a/database/getNextWorkOrderNumber.ts +++ b/database/getNextWorkOrderNumber.ts @@ -19,9 +19,7 @@ export default async function getNextWorkOrderNumber( database.function( // eslint-disable-next-line no-secrets/no-secrets 'userFn_matchesWorkOrderNumberSyntax', - (workOrderNumber: string) => { - return regex.test(workOrderNumber) ? 1 : 0 - } + (workOrderNumber: string) => (regex.test(workOrderNumber) ? 1 : 0) ) const workOrderNumberRecord = database @@ -31,9 +29,11 @@ export default async function getNextWorkOrderNumber( where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1 order by cast(substr(workOrderNumber, instr(workOrderNumber, '-') + 1) as integer) desc` ) - .get() as { - workOrderNumber: string - } + .get() as + | { + workOrderNumber: string + } + | undefined if (connectedDatabase === undefined) { database.release() @@ -41,7 +41,7 @@ export default async function getNextWorkOrderNumber( let workOrderNumberIndex = 0 - if (workOrderNumberRecord) { + if (workOrderNumberRecord !== undefined) { workOrderNumberIndex = Number.parseInt( workOrderNumberRecord.workOrderNumber.split('-')[1], 10 diff --git a/database/getPastLotOccupancyOccupants.js b/database/getPastLotOccupancyOccupants.js index 81a66bc2..cbc92d4a 100644 --- a/database/getPastLotOccupancyOccupants.js +++ b/database/getPastLotOccupancyOccupants.js @@ -9,12 +9,11 @@ export default async function getPastLotOccupancyOccupants(filters, options) { if (searchFilterPiece === '') { continue; } - sqlWhereClause += - " and (o.occupantName like '%' || ? || '%'" + - " or o.occupantFamilyName like '%' || ? || '%'" + - " or o.occupantAddress1 like '%' || ? || '%'" + - " or o.occupantAddress2 like '%' || ? || '%'" + - " or o.occupantCity like '%' || ? || '%')"; + sqlWhereClause += ` and (o.occupantName like '%' || ? || '%' + or o.occupantFamilyName like '%' || ? || '%' + or o.occupantAddress1 like '%' || ? || '%' + or o.occupantAddress2 like '%' || ? || '%' + or o.occupantCity like '%' || ? || '%')`; sqlParameters.push(searchFilterPiece, searchFilterPiece, searchFilterPiece, searchFilterPiece, searchFilterPiece); } } @@ -24,14 +23,14 @@ export default async function getPastLotOccupancyOccupants(filters, options) { o.occupantPhoneNumber, o.occupantEmailAddress, count(*) as lotOccupancyIdCount, max(o.recordUpdate_timeMillis) as recordUpdate_timeMillisMax - from LotOccupancyOccupants o - left join LotOccupancies l on o.lotOccupancyId = l.lotOccupancyId - ${sqlWhereClause} - group by occupantName, occupantAddress1, occupantAddress2, - occupantCity, occupantProvince, occupantPostalCode, - occupantPhoneNumber, occupantEmailAddress - order by lotOccupancyIdCount desc, recordUpdate_timeMillisMax desc - limit ${options.limit}`; + from LotOccupancyOccupants o + left join LotOccupancies l on o.lotOccupancyId = l.lotOccupancyId + ${sqlWhereClause} + group by occupantName, occupantAddress1, occupantAddress2, + occupantCity, occupantProvince, occupantPostalCode, + occupantPhoneNumber, occupantEmailAddress + order by lotOccupancyIdCount desc, recordUpdate_timeMillisMax desc + limit ${options.limit}`; const lotOccupancyOccupants = database .prepare(sql) .all(sqlParameters); diff --git a/database/getPastLotOccupancyOccupants.ts b/database/getPastLotOccupancyOccupants.ts index 11e5227d..fcd4b785 100644 --- a/database/getPastLotOccupancyOccupants.ts +++ b/database/getPastLotOccupancyOccupants.ts @@ -29,12 +29,11 @@ export default async function getPastLotOccupancyOccupants( continue } - sqlWhereClause += - " and (o.occupantName like '%' || ? || '%'" + - " or o.occupantFamilyName like '%' || ? || '%'" + - " or o.occupantAddress1 like '%' || ? || '%'" + - " or o.occupantAddress2 like '%' || ? || '%'" + - " or o.occupantCity like '%' || ? || '%')" + sqlWhereClause += ` and (o.occupantName like '%' || ? || '%' + or o.occupantFamilyName like '%' || ? || '%' + or o.occupantAddress1 like '%' || ? || '%' + or o.occupantAddress2 like '%' || ? || '%' + or o.occupantCity like '%' || ? || '%')` sqlParameters.push( searchFilterPiece, @@ -52,14 +51,14 @@ export default async function getPastLotOccupancyOccupants( o.occupantPhoneNumber, o.occupantEmailAddress, count(*) as lotOccupancyIdCount, max(o.recordUpdate_timeMillis) as recordUpdate_timeMillisMax - from LotOccupancyOccupants o - left join LotOccupancies l on o.lotOccupancyId = l.lotOccupancyId - ${sqlWhereClause} - group by occupantName, occupantAddress1, occupantAddress2, - occupantCity, occupantProvince, occupantPostalCode, - occupantPhoneNumber, occupantEmailAddress - order by lotOccupancyIdCount desc, recordUpdate_timeMillisMax desc - limit ${options.limit}` + from LotOccupancyOccupants o + left join LotOccupancies l on o.lotOccupancyId = l.lotOccupancyId + ${sqlWhereClause} + group by occupantName, occupantAddress1, occupantAddress2, + occupantCity, occupantProvince, occupantPostalCode, + occupantPhoneNumber, occupantEmailAddress + order by lotOccupancyIdCount desc, recordUpdate_timeMillisMax desc + limit ${options.limit}` const lotOccupancyOccupants = database .prepare(sql) diff --git a/database/getPreviousLotId.ts b/database/getPreviousLotId.ts index c4cebb74..7fdefabd 100644 --- a/database/getPreviousLotId.ts +++ b/database/getPreviousLotId.ts @@ -20,9 +20,11 @@ export default async function getPreviousLotId( order by userFn_lotNameSortName(lotName) desc limit 1` ) - .get(lotId) as { - lotId: number - } + .get(lotId) as + | { + lotId: number + } + | undefined database.release() diff --git a/database/getPreviousMapId.ts b/database/getPreviousMapId.ts index 5225d8ef..f1118808 100644 --- a/database/getPreviousMapId.ts +++ b/database/getPreviousMapId.ts @@ -13,9 +13,11 @@ export default async function getPreviousMapId( order by mapName desc limit 1` ) - .get(mapId) as { - mapId: number - } + .get(mapId) as + | { + mapId: number + } + | undefined database.release() diff --git a/database/getReportData.js b/database/getReportData.js index ddf0f3ce..51a0b580 100644 --- a/database/getReportData.js +++ b/database/getReportData.js @@ -1,5 +1,3 @@ -// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -/* eslint-disable no-case-declarations */ import { dateIntegerToString, dateStringToInteger, dateToInteger, timeIntegerToString } from '@cityssm/utils-datetime'; import camelCase from 'camelcase'; import { getConfigProperty } from '../helpers/functions.config.js'; @@ -38,7 +36,7 @@ const occupantEmailAddressAlias = `${occupantCamelCase}EmailAddress`; const occupantCommentTitleAlias = `${occupantCamelCase}CommentTitle`; const occupantCommentAlias = `${occupantCamelCase}Comment`; export default async function getReportData(reportName, reportParameters = {}) { - let sql; + let sql = ''; const sqlParameters = []; // eslint-disable-next-line sonarjs/max-switch-cases switch (reportName) { diff --git a/database/getReportData.ts b/database/getReportData.ts index 87b5850a..61f5767b 100644 --- a/database/getReportData.ts +++ b/database/getReportData.ts @@ -1,6 +1,3 @@ -// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -/* eslint-disable no-case-declarations */ - import { type DateString, dateIntegerToString, @@ -57,7 +54,7 @@ export default async function getReportData( reportName: string, reportParameters: ReportParameters = {} ): Promise { - let sql: string + let sql = '' const sqlParameters: unknown[] = [] // eslint-disable-next-line sonarjs/max-switch-cases diff --git a/database/moveRecord.js b/database/moveRecord.js index 3ecd40a0..564d6e07 100644 --- a/database/moveRecord.js +++ b/database/moveRecord.js @@ -12,8 +12,8 @@ recordIdColumns.set('WorkOrderTypes', 'workOrderTypeId'); function getCurrentOrderNumber(recordTable, recordId, database) { const currentOrderNumber = database .prepare(`select orderNumber - from ${recordTable} - where ${recordIdColumns.get(recordTable)} = ?`) + from ${recordTable} + where ${recordIdColumns.get(recordTable)} = ?`) .get(recordId).orderNumber; return currentOrderNumber; } @@ -36,8 +36,8 @@ export async function moveRecordDownToBottom(recordTable, recordId) { const currentOrderNumber = getCurrentOrderNumber(recordTable, recordId, database); const maxOrderNumber = database .prepare(`select max(orderNumber) as maxOrderNumber - from ${recordTable} - where recordDelete_timeMillis is null`) + from ${recordTable} + where recordDelete_timeMillis is null`) .get().maxOrderNumber; if (currentOrderNumber !== maxOrderNumber) { updateRecordOrderNumber(recordTable, recordId, maxOrderNumber + 1, database); diff --git a/database/moveRecord.ts b/database/moveRecord.ts index 2ee03a23..731231df 100644 --- a/database/moveRecord.ts +++ b/database/moveRecord.ts @@ -32,8 +32,8 @@ function getCurrentOrderNumber( database .prepare( `select orderNumber - from ${recordTable} - where ${recordIdColumns.get(recordTable)!} = ?` + from ${recordTable} + where ${recordIdColumns.get(recordTable)!} = ?` ) .get(recordId) as { orderNumber: number } ).orderNumber @@ -92,8 +92,8 @@ export async function moveRecordDownToBottom( database .prepare( `select max(orderNumber) as maxOrderNumber - from ${recordTable} - where recordDelete_timeMillis is null` + from ${recordTable} + where recordDelete_timeMillis is null` ) .get() as { maxOrderNumber: number } ).maxOrderNumber diff --git a/eslint.config.js b/eslint.config.js index 7808669c..1622f975 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,10 +1,20 @@ -import { configWebApp, tseslint } from 'eslint-config-cityssm'; +import { configWebApp, cspellWords, tseslint } from 'eslint-config-cityssm'; export const config = tseslint.config(...configWebApp, { languageOptions: { parserOptions: { // eslint-disable-next-line @cspell/spellchecker project: ['./tsconfig.json', './public/javascripts/tsconfig.json'] } + }, + rules: { + '@cspell/spellchecker': [ + 'warn', + { + cspell: { + words: [...cspellWords, 'ical', 'ntfy'] + } + } + ] } }); export default config; diff --git a/eslint.config.ts b/eslint.config.ts index a7c6394a..e9aef58c 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,4 +1,4 @@ -import { configWebApp, tseslint } from 'eslint-config-cityssm' +import { configWebApp, cspellWords, tseslint } from 'eslint-config-cityssm' export const config = tseslint.config(...configWebApp, { languageOptions: { @@ -6,6 +6,16 @@ export const config = tseslint.config(...configWebApp, { // eslint-disable-next-line @cspell/spellchecker project: ['./tsconfig.json', './public/javascripts/tsconfig.json'] } + }, + rules: { + '@cspell/spellchecker': [ + 'warn', + { + cspell: { + words: [...cspellWords, 'ical', 'ntfy'] + } + } + ] } }) diff --git a/package-lock.json b/package-lock.json index e4e09791..3c09f968 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "bulma-tooltip": "^3.0.2", "cypress": "^13.15.1", "cypress-axe": "^1.5.0", - "eslint-config-cityssm": "^14.0.2", + "eslint-config-cityssm": "^14.1.0", "gulp": "^5.0.0", "gulp-sass": "^5.1.0", "nodemon": "^3.1.7", @@ -4877,14 +4877,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.11.0.tgz", - "integrity": "sha512-Uholz7tWhXmA4r6epo+vaeV7yjdKy5QFCERMjs1kMVsLRKIrSdM6o21W2He9ftp5PP6aWOVpD5zvrvuHZC0bMQ==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.12.2.tgz", + "integrity": "sha512-gPLpLtrj9aMHOvxJkSbDBmbRuYdtiEbnvO25bCMza3DhMjTQw0u7Y1M+YR5JPbMsXXnSPuCf5hfq0nEkQDL/JQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0" + "@typescript-eslint/types": "8.12.2", + "@typescript-eslint/visitor-keys": "8.12.2" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5051,9 +5051,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.11.0.tgz", - "integrity": "sha512-tn6sNMHf6EBAYMvmPUaKaVeYvhUsrE6x+bXQTxjQRp360h1giATU0WvgeEys1spbvb5R+VpNOZ+XJmjD8wOUHw==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.12.2.tgz", + "integrity": "sha512-VwDwMF1SZ7wPBUZwmMdnDJ6sIFk4K4s+ALKLP6aIQsISkPv8jhiw65sAK6SuWODN/ix+m+HgbYDkH+zLjrzvOA==", "dev": true, "license": "MIT", "engines": { @@ -5065,14 +5065,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.11.0.tgz", - "integrity": "sha512-yHC3s1z1RCHoCz5t06gf7jH24rr3vns08XXhfEqzYpd6Hll3z/3g23JRi0jM8A47UFKNc3u/y5KIMx8Ynbjohg==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.12.2.tgz", + "integrity": "sha512-mME5MDwGe30Pq9zKPvyduyU86PH7aixwqYR2grTglAdB+AN8xXQ1vFGpYaUSJ5o5P/5znsSBeNcs5g5/2aQwow==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0", + "@typescript-eslint/types": "8.12.2", + "@typescript-eslint/visitor-keys": "8.12.2", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -5120,16 +5120,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.11.0.tgz", - "integrity": "sha512-CYiX6WZcbXNJV7UNB4PLDIBtSdRmRI/nb0FMyqHPTQD1rMjA0foPLaPUV39C/MxkTd/QKSeX+Gb34PPsDVC35g==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.12.2.tgz", + "integrity": "sha512-UTTuDIX3fkfAz6iSVa5rTuSfWIYZ6ATtEocQ/umkRSyC9O919lbZ8dcH7mysshrCdrAM03skJOEYaBugxN+M6A==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.11.0", - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/typescript-estree": "8.11.0" + "@typescript-eslint/scope-manager": "8.12.2", + "@typescript-eslint/types": "8.12.2", + "@typescript-eslint/typescript-estree": "8.12.2" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5143,13 +5143,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.11.0.tgz", - "integrity": "sha512-EaewX6lxSjRJnc+99+dqzTeoDZUfyrA52d2/HRrkI830kgovWsmIiTfmr0NZorzqic7ga+1bS60lRBUgR3n/Bw==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.12.2.tgz", + "integrity": "sha512-PChz8UaKQAVNHghsHcPyx1OMHoFRUEA7rJSK/mDhdq85bk+PLsUHUBqTQTFt18VJZbmxBovM65fezlheQRsSDA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.11.0", + "@typescript-eslint/types": "8.12.2", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -8128,9 +8128,9 @@ } }, "node_modules/eslint-config-cityssm": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-cityssm/-/eslint-config-cityssm-14.0.2.tgz", - "integrity": "sha512-eCQHo5VoJGXvuhSYaJ6erZ7NS/KwDP+D9pkB0GtJMdk8NNBuN0NJyvJojJJwdwYTVFzG+Jhcc9LJvd05mpoufA==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-cityssm/-/eslint-config-cityssm-14.1.0.tgz", + "integrity": "sha512-tBu9pX9xnPtyp0dJBiv4MYgKQKgHN7pGwGkrQf8+9KTtwFhgXr+gDqNzkzxPbTcBjdVfKbtqp4BrYAGBJNusiQ==", "dev": true, "license": "Unlicense", "dependencies": { @@ -8151,7 +8151,7 @@ "eslint-plugin-unicorn": "^56.0.0", "eslint-plugin-woke": "github:cityssm/eslint-plugin-woke", "eslint-plugin-write-good-comments": "^0.2.0", - "typescript-eslint": "^8.11.0" + "typescript-eslint": "^8.12.2" } }, "node_modules/eslint-config-cityssm/node_modules/@eslint/eslintrc": { @@ -16023,15 +16023,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.11.0.tgz", - "integrity": "sha512-cBRGnW3FSlxaYwU8KfAewxFK5uzeOAp0l2KebIlPDOT5olVi65KDG/yjBooPBG0kGW/HLkoz1c/iuBFehcS3IA==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.12.2.tgz", + "integrity": "sha512-UbuVUWSrHVR03q9CWx+JDHeO6B/Hr9p4U5lRH++5tq/EbFq1faYZe50ZSBePptgfIKLEti0aPQ3hFgnPVcd8ZQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.11.0", - "@typescript-eslint/parser": "8.11.0", - "@typescript-eslint/utils": "8.11.0" + "@typescript-eslint/eslint-plugin": "8.12.2", + "@typescript-eslint/parser": "8.12.2", + "@typescript-eslint/utils": "8.12.2" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -16047,17 +16047,17 @@ } }, "node_modules/typescript-eslint/node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.11.0.tgz", - "integrity": "sha512-KhGn2LjW1PJT2A/GfDpiyOfS4a8xHQv2myUagTM5+zsormOmBlYsnQ6pobJ8XxJmh6hnHwa2Mbe3fPrDJoDhbA==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.12.2.tgz", + "integrity": "sha512-gQxbxM8mcxBwaEmWdtLCIGLfixBMHhQjBqR8sVWNTPpcj45WlYL2IObS/DNMLH1DBP0n8qz+aiiLTGfopPEebw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.11.0", - "@typescript-eslint/type-utils": "8.11.0", - "@typescript-eslint/utils": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0", + "@typescript-eslint/scope-manager": "8.12.2", + "@typescript-eslint/type-utils": "8.12.2", + "@typescript-eslint/utils": "8.12.2", + "@typescript-eslint/visitor-keys": "8.12.2", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -16081,16 +16081,16 @@ } }, "node_modules/typescript-eslint/node_modules/@typescript-eslint/parser": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.11.0.tgz", - "integrity": "sha512-lmt73NeHdy1Q/2ul295Qy3uninSqi6wQI18XwSpm8w0ZbQXUpjCAWP1Vlv/obudoBiIjJVjlztjQ+d/Md98Yxg==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.12.2.tgz", + "integrity": "sha512-MrvlXNfGPLH3Z+r7Tk+Z5moZAc0dzdVjTgUgwsdGweH7lydysQsnSww3nAmsq8blFuRD5VRlAr9YdEFw3e6PBw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.11.0", - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/typescript-estree": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0", + "@typescript-eslint/scope-manager": "8.12.2", + "@typescript-eslint/types": "8.12.2", + "@typescript-eslint/typescript-estree": "8.12.2", + "@typescript-eslint/visitor-keys": "8.12.2", "debug": "^4.3.4" }, "engines": { @@ -16110,14 +16110,14 @@ } }, "node_modules/typescript-eslint/node_modules/@typescript-eslint/type-utils": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.11.0.tgz", - "integrity": "sha512-ItiMfJS6pQU0NIKAaybBKkuVzo6IdnAhPFZA/2Mba/uBjuPQPet/8+zh5GtLHwmuFRShZx+8lhIs7/QeDHflOg==", + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.12.2.tgz", + "integrity": "sha512-bwuU4TAogPI+1q/IJSKuD4shBLc/d2vGcRT588q+jzayQyjVK2X6v/fbR4InY2U2sgf8MEvVCqEWUzYzgBNcGQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.11.0", - "@typescript-eslint/utils": "8.11.0", + "@typescript-eslint/typescript-estree": "8.12.2", + "@typescript-eslint/utils": "8.12.2", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, diff --git a/package.json b/package.json index 515e2e22..ba2e1c87 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "bulma-tooltip": "^3.0.2", "cypress": "^13.15.1", "cypress-axe": "^1.5.0", - "eslint-config-cityssm": "^14.0.2", + "eslint-config-cityssm": "^14.1.0", "gulp": "^5.0.0", "gulp-sass": "^5.1.0", "nodemon": "^3.1.7",