Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jun 27, 2024
1 parent 1ca3ea0 commit 84f0090
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 113 deletions.
25 changes: 15 additions & 10 deletions public-typescript/adminFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

import type { LOS } from '../types/globalTypes.js'
import type * as recordTypes from '../types/recordTypes.js'
import type {
Fee,
FeeCategory,
LotType,
OccupancyType
} from '../types/recordTypes.js'

declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
Expand All @@ -18,13 +23,13 @@ declare const exports: Record<string, unknown>
'#container--feeCategories'
) as HTMLElement

let feeCategories = exports.feeCategories as recordTypes.FeeCategory[]
let feeCategories = exports.feeCategories as FeeCategory[]
delete exports.feeCategories

type ResponseJSON =
| {
success: true
feeCategories: recordTypes.FeeCategory[]
feeCategories: FeeCategory[]
}
| {
success: false
Expand Down Expand Up @@ -305,7 +310,7 @@ declare const exports: Record<string, unknown>

const feeCategory = feeCategories.find((currentFeeCategory) => {
return currentFeeCategory.feeCategoryId === feeCategoryId
}) as recordTypes.FeeCategory
}) as FeeCategory

let editCloseModalFunction: () => void

Expand Down Expand Up @@ -506,7 +511,7 @@ declare const exports: Record<string, unknown>
'#feeAdd--occupancyTypeId'
) as HTMLSelectElement

for (const occupancyType of exports.occupancyTypes as recordTypes.OccupancyType[]) {
for (const occupancyType of exports.occupancyTypes as OccupancyType[]) {
const optionElement = document.createElement('option')
optionElement.value = occupancyType.occupancyTypeId.toString()
optionElement.textContent = occupancyType.occupancyType
Expand All @@ -517,7 +522,7 @@ declare const exports: Record<string, unknown>
'#feeAdd--lotTypeId'
) as HTMLSelectElement

for (const lotType of exports.lotTypes as recordTypes.LotType[]) {
for (const lotType of exports.lotTypes as LotType[]) {
const optionElement = document.createElement('option')
optionElement.value = lotType.lotTypeId.toString()
optionElement.textContent = lotType.lotType
Expand Down Expand Up @@ -627,11 +632,11 @@ declare const exports: Record<string, unknown>

const feeCategory = feeCategories.find((currentFeeCategory) => {
return currentFeeCategory.feeCategoryId === feeCategoryId
}) as recordTypes.FeeCategory
}) as FeeCategory

const fee = feeCategory.fees.find((currentFee) => {
return currentFee.feeId === feeId
}) as recordTypes.Fee
}) as Fee

let editCloseModalFunction: () => void
let editModalElement: HTMLElement
Expand Down Expand Up @@ -795,7 +800,7 @@ declare const exports: Record<string, unknown>
'#feeEdit--occupancyTypeId'
) as HTMLSelectElement

for (const occupancyType of exports.occupancyTypes as recordTypes.OccupancyType[]) {
for (const occupancyType of exports.occupancyTypes as OccupancyType[]) {
const optionElement = document.createElement('option')
optionElement.value = occupancyType.occupancyTypeId.toString()
optionElement.textContent = occupancyType.occupancyType
Expand All @@ -811,7 +816,7 @@ declare const exports: Record<string, unknown>
'#feeEdit--lotTypeId'
) as HTMLSelectElement

for (const lotType of exports.lotTypes as recordTypes.LotType[]) {
for (const lotType of exports.lotTypes as LotType[]) {
const optionElement = document.createElement('option')
optionElement.value = lotType.lotTypeId.toString()
optionElement.textContent = lotType.lotType
Expand Down
14 changes: 7 additions & 7 deletions public-typescript/adminLotTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

import type { LOS } from '../types/globalTypes.js'
import type * as recordTypes from '../types/recordTypes.js'
import type { LotType, LotTypeField } from '../types/recordTypes.js'

declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
Expand All @@ -15,7 +15,7 @@ declare const exports: Record<string, unknown>
type ResponseJSON =
| {
success: true
lotTypes: recordTypes.LotType[]
lotTypes: LotType[]
lotTypeFieldId?: number
}
| {
Expand All @@ -29,7 +29,7 @@ type ResponseJSON =
'#container--lotTypes'
) as HTMLElement

let lotTypes = exports.lotTypes as recordTypes.LotType[]
let lotTypes = exports.lotTypes as LotType[]
delete exports.lotTypes

const expandedLotTypes = new Set<number>()
Expand Down Expand Up @@ -121,7 +121,7 @@ type ResponseJSON =

const lotType = lotTypes.find((currentLotType) => {
return lotTypeId === currentLotType.lotTypeId
}) as recordTypes.LotType
}) as LotType

let editCloseModalFunction: () => void

Expand Down Expand Up @@ -266,13 +266,13 @@ type ResponseJSON =
): void {
const lotType = lotTypes.find((currentLotType) => {
return currentLotType.lotTypeId === lotTypeId
}) as recordTypes.LotType
}) as LotType

const lotTypeField = (lotType.lotTypeFields ?? []).find(
(currentLotTypeField) => {
return currentLotTypeField.lotTypeFieldId === lotTypeFieldId
}
) as recordTypes.LotTypeField
) as LotTypeField

let minimumLengthElement: HTMLInputElement
let maximumLengthElement: HTMLInputElement
Expand Down Expand Up @@ -464,7 +464,7 @@ type ResponseJSON =
function renderLotTypeFields(
panelElement: HTMLElement,
lotTypeId: number,
lotTypeFields: recordTypes.LotTypeField[]
lotTypeFields: LotTypeField[]
): void {
if (lotTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/method
Expand Down
22 changes: 11 additions & 11 deletions public-typescript/adminOccupancyTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

import type { LOS } from '../types/globalTypes.js'
import type * as recordTypes from '../types/recordTypes.js'
import type { OccupancyType, OccupancyTypeField } from '../types/recordTypes.js'

declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
Expand All @@ -15,8 +15,8 @@ declare const exports: Record<string, unknown>
type ResponseJSON =
| {
success: true
occupancyTypes: recordTypes.OccupancyType[]
allOccupancyTypeFields: recordTypes.OccupancyTypeField[]
occupancyTypes: OccupancyType[]
allOccupancyTypeFields: OccupancyTypeField[]
occupancyTypeFieldId?: number
}
| {
Expand All @@ -34,11 +34,11 @@ type ResponseJSON =
'#container--occupancyTypePrints'
) as HTMLElement

let occupancyTypes = exports.occupancyTypes as recordTypes.OccupancyType[]
let occupancyTypes = exports.occupancyTypes as OccupancyType[]
delete exports.occupancyTypes

let allOccupancyTypeFields =
exports.allOccupancyTypeFields as recordTypes.OccupancyTypeField[]
exports.allOccupancyTypeFields as OccupancyTypeField[]
delete exports.allOccupancyTypeFields

const expandedOccupancyTypes = new Set<number>()
Expand Down Expand Up @@ -78,8 +78,8 @@ type ResponseJSON =
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
occupancyTypes: recordTypes.OccupancyType[]
allOccupancyTypeFields: recordTypes.OccupancyTypeField[]
occupancyTypes: OccupancyType[]
allOccupancyTypeFields: OccupancyTypeField[]
}

if (responseJSON.success) {
Expand Down Expand Up @@ -138,7 +138,7 @@ type ResponseJSON =

const occupancyType = occupancyTypes.find((currentOccupancyType) => {
return occupancyTypeId === currentOccupancyType.occupancyTypeId
}) as recordTypes.OccupancyType
}) as OccupancyType

let editCloseModalFunction: () => void

Expand Down Expand Up @@ -283,7 +283,7 @@ type ResponseJSON =
occupancyTypeId: number,
occupancyTypeFieldId: number
): void {
let occupancyType: recordTypes.OccupancyType | undefined
let occupancyType: OccupancyType | undefined

if (occupancyTypeId) {
occupancyType = occupancyTypes.find((currentOccupancyType) => {
Expand All @@ -299,7 +299,7 @@ type ResponseJSON =
return (
currentOccupancyTypeField.occupancyTypeFieldId === occupancyTypeFieldId
)
}) as recordTypes.OccupancyTypeField
}) as OccupancyTypeField

let minimumLengthElement: HTMLInputElement
let maximumLengthElement: HTMLInputElement
Expand Down Expand Up @@ -498,7 +498,7 @@ type ResponseJSON =
function renderOccupancyTypeFields(
panelElement: HTMLElement,
occupancyTypeId: number | undefined,
occupancyTypeFields: recordTypes.OccupancyTypeField[]
occupancyTypeFields: OccupancyTypeField[]
): void {
if (occupancyTypeFields.length === 0) {
// eslint-disable-next-line no-unsanitized/method
Expand Down
14 changes: 7 additions & 7 deletions public-typescript/lotEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'

import type { LOS } from '../types/globalTypes.js'
import type * as recordTypes from '../types/recordTypes.js'
import type { LotComment, LotTypeField } from '../types/recordTypes.js'

declare const cityssm: cityssmGlobal
declare const bulmaJS: BulmaJS
Expand Down Expand Up @@ -153,7 +153,7 @@ declare const exports: Record<string, unknown>
},
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
lotTypeFields: recordTypes.LotTypeField[]
lotTypeFields: LotTypeField[]
}

if (responseJSON.lotTypeFields.length === 0) {
Expand Down Expand Up @@ -274,7 +274,7 @@ declare const exports: Record<string, unknown>

// Comments

let lotComments = exports.lotComments as recordTypes.LotComment[]
let lotComments = exports.lotComments as LotComment[]
delete exports.lotComments

function openEditLotComment(clickEvent: Event): void {
Expand All @@ -286,7 +286,7 @@ declare const exports: Record<string, unknown>

const lotComment = lotComments.find((currentLotComment) => {
return currentLotComment.lotCommentId === lotCommentId
}) as recordTypes.LotComment
}) as LotComment

let editFormElement: HTMLFormElement
let editCloseModalFunction: () => void
Expand All @@ -301,7 +301,7 @@ declare const exports: Record<string, unknown>
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
lotComments: recordTypes.LotComment[]
lotComments: LotComment[]
}

if (responseJSON.success) {
Expand Down Expand Up @@ -397,7 +397,7 @@ declare const exports: Record<string, unknown>
const responseJSON = rawResponseJSON as {
success: boolean
errorMessage?: string
lotComments: recordTypes.LotComment[]
lotComments: LotComment[]
}

if (responseJSON.success) {
Expand Down Expand Up @@ -502,7 +502,7 @@ declare const exports: Record<string, unknown>
(rawResponseJSON) => {
const responseJSON = rawResponseJSON as {
success: boolean
lotComments: recordTypes.LotComment[]
lotComments: LotComment[]
}

if (responseJSON.success) {
Expand Down
6 changes: 3 additions & 3 deletions public-typescript/lotOccupancyEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
submitEvent.preventDefault();
const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value;
cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
renderSelectedLotAndClose(responseJSON.lotId, lotName);
renderSelectedLotAndClose((_a = responseJSON.lotId) !== null && _a !== void 0 ? _a : '', lotName);
}
else {
bulmaJS.alert({
title: `Error Creating ${los.escapedAliases.Lot}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}
Expand Down
6 changes: 3 additions & 3 deletions public-typescript/lotOccupancyEdit/lotOccupancyEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
submitEvent.preventDefault();
const lotName = lotSelectModalElement.querySelector('#lotCreate--lotName').value;
cityssm.postJSON(`${los.urlPrefix}/lots/doCreateLot`, submitEvent.currentTarget, (rawResponseJSON) => {
var _a;
var _a, _b;
const responseJSON = rawResponseJSON;
if (responseJSON.success) {
renderSelectedLotAndClose(responseJSON.lotId, lotName);
renderSelectedLotAndClose((_a = responseJSON.lotId) !== null && _a !== void 0 ? _a : '', lotName);
}
else {
bulmaJS.alert({
title: `Error Creating ${los.escapedAliases.Lot}`,
message: (_a = responseJSON.errorMessage) !== null && _a !== void 0 ? _a : '',
message: (_b = responseJSON.errorMessage) !== null && _b !== void 0 ? _b : '',
contextualColorName: 'danger'
});
}
Expand Down
Loading

0 comments on commit 84f0090

Please sign in to comment.