Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Oct 28, 2024
1 parent e849f59 commit 80c60d1
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 75 deletions.
2 changes: 1 addition & 1 deletion database/addLot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default async function addLot(lotForm, user) {
await addOrUpdateLotField({
lotId,
lotTypeFieldId,
lotFieldValue
lotFieldValue: lotFieldValue ?? ''
}, user, database);
}
}
Expand Down
4 changes: 2 additions & 2 deletions database/addLot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ export default async function addLot(
const lotTypeFieldIds = (lotForm.lotTypeFieldIds ?? '').split(',')

for (const lotTypeFieldId of lotTypeFieldIds) {
const lotFieldValue = lotForm[`lotFieldValue_${lotTypeFieldId}`] as string
const lotFieldValue = lotForm[`lotFieldValue_${lotTypeFieldId}`] as string | undefined

if ((lotFieldValue ?? '') !== '') {
await addOrUpdateLotField(
{
lotId,
lotTypeFieldId,
lotFieldValue
lotFieldValue: lotFieldValue ?? ''
},
user,
database
Expand Down
24 changes: 12 additions & 12 deletions database/addLotOccupancy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ export default async function addLotOccupancy(lotOccupancyForm, user, connectedD
await addOrUpdateLotOccupancyField({
lotOccupancyId,
occupancyTypeFieldId,
lotOccupancyFieldValue
lotOccupancyFieldValue: lotOccupancyFieldValue ?? ''
}, user, database);
}
}
if ((lotOccupancyForm.lotOccupantTypeId ?? '') !== '') {
await addLotOccupancyOccupant({
lotOccupancyId,
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId,
occupantName: lotOccupancyForm.occupantName,
occupantFamilyName: lotOccupancyForm.occupantFamilyName,
occupantAddress1: lotOccupancyForm.occupantAddress1,
occupantAddress2: lotOccupancyForm.occupantAddress2,
occupantCity: lotOccupancyForm.occupantCity,
occupantProvince: lotOccupancyForm.occupantProvince,
occupantPostalCode: lotOccupancyForm.occupantPostalCode,
occupantPhoneNumber: lotOccupancyForm.occupantPhoneNumber,
occupantEmailAddress: lotOccupancyForm.occupantEmailAddress,
occupantComment: lotOccupancyForm.occupantComment
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId ?? '',
occupantName: lotOccupancyForm.occupantName ?? '',
occupantFamilyName: lotOccupancyForm.occupantFamilyName ?? '',
occupantAddress1: lotOccupancyForm.occupantAddress1 ?? '',
occupantAddress2: lotOccupancyForm.occupantAddress2 ?? '',
occupantCity: lotOccupancyForm.occupantCity ?? '',
occupantProvince: lotOccupancyForm.occupantProvince ?? '',
occupantPostalCode: lotOccupancyForm.occupantPostalCode ?? '',
occupantPhoneNumber: lotOccupancyForm.occupantPhoneNumber ?? '',
occupantEmailAddress: lotOccupancyForm.occupantEmailAddress ?? '',
occupantComment: lotOccupancyForm.occupantComment ?? ''
}, user, database);
}
if (connectedDatabase === undefined) {
Expand Down
26 changes: 13 additions & 13 deletions database/addLotOccupancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ export default async function addLotOccupancy(
for (const occupancyTypeFieldId of occupancyTypeFieldIds) {
const lotOccupancyFieldValue = lotOccupancyForm[
`lotOccupancyFieldValue_${occupancyTypeFieldId}`
] as string
] as string | undefined

if ((lotOccupancyFieldValue ?? '') !== '') {
await addOrUpdateLotOccupancyField(
{
lotOccupancyId,
occupancyTypeFieldId,
lotOccupancyFieldValue
lotOccupancyFieldValue: lotOccupancyFieldValue ?? ''
},
user,
database
Expand All @@ -97,17 +97,17 @@ export default async function addLotOccupancy(
await addLotOccupancyOccupant(
{
lotOccupancyId,
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId!,
occupantName: lotOccupancyForm.occupantName!,
occupantFamilyName: lotOccupancyForm.occupantFamilyName!,
occupantAddress1: lotOccupancyForm.occupantAddress1!,
occupantAddress2: lotOccupancyForm.occupantAddress2!,
occupantCity: lotOccupancyForm.occupantCity!,
occupantProvince: lotOccupancyForm.occupantProvince!,
occupantPostalCode: lotOccupancyForm.occupantPostalCode!,
occupantPhoneNumber: lotOccupancyForm.occupantPhoneNumber!,
occupantEmailAddress: lotOccupancyForm.occupantEmailAddress!,
occupantComment: lotOccupancyForm.occupantComment!
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId ?? '',
occupantName: lotOccupancyForm.occupantName ?? '',
occupantFamilyName: lotOccupancyForm.occupantFamilyName ?? '',
occupantAddress1: lotOccupancyForm.occupantAddress1 ?? '',
occupantAddress2: lotOccupancyForm.occupantAddress2 ?? '',
occupantCity: lotOccupancyForm.occupantCity ?? '',
occupantProvince: lotOccupancyForm.occupantProvince ?? '',
occupantPostalCode: lotOccupancyForm.occupantPostalCode ?? '',
occupantPhoneNumber: lotOccupancyForm.occupantPhoneNumber ?? '',
occupantEmailAddress: lotOccupancyForm.occupantEmailAddress ?? '',
occupantComment: lotOccupancyForm.occupantComment ?? ''
},
user,
database
Expand Down
2 changes: 1 addition & 1 deletion database/addLotOccupancyFee.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PoolConnection } from 'better-sqlite-pool';
import type { PoolConnection } from 'better-sqlite-pool';
export interface AddLotOccupancyFeeForm {
lotOccupancyId: number | string;
feeId: number | string;
Expand Down
4 changes: 2 additions & 2 deletions database/addLotOccupancyFee.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default async function addLotOccupancyFee(lotOccupancyFeeForm, user, conn
where lotOccupancyId = ?
and feeId = ?`)
.get(lotOccupancyFeeForm.lotOccupancyId, lotOccupancyFeeForm.feeId);
if (record) {
if (record.recordDelete_timeMillis) {
if (record !== undefined) {
if (record.recordDelete_timeMillis !== null) {
database
.prepare(`delete from LotOccupancyFees
where recordDelete_timeMillis is not null
Expand Down
20 changes: 11 additions & 9 deletions database/addLotOccupancyFee.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PoolConnection } from 'better-sqlite-pool'
import type { PoolConnection } from 'better-sqlite-pool'

import {
calculateFeeAmount,
Expand Down Expand Up @@ -60,14 +60,16 @@ export default async function addLotOccupancyFee(
where lotOccupancyId = ?
and feeId = ?`
)
.get(lotOccupancyFeeForm.lotOccupancyId, lotOccupancyFeeForm.feeId) as {
feeAmount?: number
taxAmount?: number
recordDelete_timeMillis?: number
}

if (record) {
if (record.recordDelete_timeMillis) {
.get(lotOccupancyFeeForm.lotOccupancyId, lotOccupancyFeeForm.feeId) as
| {
feeAmount: number | null
taxAmount: number | null
recordDelete_timeMillis: number | null
}
| undefined

if (record !== undefined) {
if (record.recordDelete_timeMillis !== null) {
database
.prepare(
`delete from LotOccupancyFees
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"bulma-tooltip": "^3.0.2",
"cypress": "^13.15.1",
"cypress-axe": "^1.5.0",
"eslint-config-cityssm": "^14.0.1",
"eslint-config-cityssm": "^14.0.2",
"gulp": "^5.0.0",
"gulp-sass": "^5.1.0",
"nodemon": "^3.1.7",
Expand Down
1 change: 0 additions & 1 deletion public/javascripts/adminDatabase.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use strict";
/* @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
const los = exports.los;
Expand Down
6 changes: 2 additions & 4 deletions public/javascripts/adminDatabase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */

import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

Expand All @@ -24,7 +22,7 @@ declare const exports: Record<string, unknown>
}
| {
success: false
errorMessage: string
errorMessage?: string
}

if (responseJSON.success) {
Expand Down Expand Up @@ -59,7 +57,7 @@ declare const exports: Record<string, unknown>
}
| {
success: false
errorMessage: string
errorMessage?: string
}

if (responseJSON.success) {
Expand Down
14 changes: 4 additions & 10 deletions public/javascripts/adminFees.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
"use strict";
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
const los = exports.los;
const feeCategoriesContainerElement = document.querySelector('#container--feeCategories');
let feeCategories = exports.feeCategories;
delete exports.feeCategories;
function getFeeCategory(feeCategoryId) {
return feeCategories.find((currentFeeCategory) => {
return currentFeeCategory.feeCategoryId === feeCategoryId;
});
return feeCategories.find((currentFeeCategory) => currentFeeCategory.feeCategoryId === feeCategoryId);
}
function getFee(feeCategory, feeId) {
return feeCategory.fees.find((currentFee) => {
return currentFee.feeId === feeId;
});
return feeCategory.fees.find((currentFee) => currentFee.feeId === feeId);
}
function renderFeeCategories() {
if (feeCategories.length === 0) {
Expand Down Expand Up @@ -551,8 +545,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
}
function toggleQuantityFields() {
const includeQuanitityValue = editModalElement.querySelector('#feeEdit--includeQuantity').value;
editModalElement.querySelector('#feeEdit--quantityUnit').disabled = includeQuanitityValue === '';
const includeQuantityValue = editModalElement.querySelector('#feeEdit--includeQuantity').value;
editModalElement.querySelector('#feeEdit--quantityUnit').disabled = includeQuantityValue === '';
}
cityssm.openHtmlModal('adminFees-editFee', {
onshow(modalElement) {
Expand Down
21 changes: 9 additions & 12 deletions public/javascripts/adminFees.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable unicorn/prefer-module */

import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

Expand Down Expand Up @@ -33,19 +30,19 @@ declare const exports: Record<string, unknown>
}
| {
success: false
errorMessage: string
errorMessage?: string
}

function getFeeCategory(feeCategoryId: number): FeeCategory {
return feeCategories.find((currentFeeCategory) => {
return currentFeeCategory.feeCategoryId === feeCategoryId
}) as FeeCategory
return feeCategories.find(
(currentFeeCategory) => currentFeeCategory.feeCategoryId === feeCategoryId
) as FeeCategory
}

function getFee(feeCategory: FeeCategory, feeId: number): Fee {
return feeCategory.fees.find((currentFee) => {
return currentFee.feeId === feeId
}) as Fee
return feeCategory.fees.find(
(currentFee) => currentFee.feeId === feeId
) as Fee
}

function renderFeeCategories(): void {
Expand Down Expand Up @@ -861,7 +858,7 @@ declare const exports: Record<string, unknown>
}

function toggleQuantityFields(): void {
const includeQuanitityValue = (
const includeQuantityValue = (
editModalElement.querySelector(
'#feeEdit--includeQuantity'
) as HTMLSelectElement
Expand All @@ -871,7 +868,7 @@ declare const exports: Record<string, unknown>
editModalElement.querySelector(
'#feeEdit--quantityUnit'
) as HTMLInputElement
).disabled = includeQuanitityValue === ''
).disabled = includeQuantityValue === ''
}

cityssm.openHtmlModal('adminFees-editFee', {
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/adminLotTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ResponseJSON =
}
| {
success: false
errorMessage: string
errorMessage?: string
}
;(() => {
const los = exports.los as LOS
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/workOrderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, (rawResponseJSON) => {
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
window.location.href = los.getWorkOrderURL(workOrderId, true, true);
globalThis.location.href = los.getWorkOrderURL(workOrderId, true, true);
}
else {
bulmaJS.alert({
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/workOrderView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare const exports: Record<string, unknown>
}

if (responseJSON.success) {
window.location.href = los.getWorkOrderURL(
globalThis.location.href = los.getWorkOrderURL(
workOrderId,
true,
true
Expand Down
1 change: 1 addition & 0 deletions test/0_initializeDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Initialize Database', () => {
if (!useTestDatabases) {
assert.fail('Test database must be used!');
}
// eslint-disable-next-line security/detect-non-literal-fs-filename
await fs.unlink(databasePath);
const success = await initializeCemeteryDatabase();
assert.ok(success);
Expand Down
1 change: 1 addition & 0 deletions test/0_initializeDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('Initialize Database', () => {
assert.fail('Test database must be used!')
}

// eslint-disable-next-line security/detect-non-literal-fs-filename
await fs.unlink(databasePath)

const success = await initializeCemeteryDatabase()
Expand Down

0 comments on commit 80c60d1

Please sign in to comment.