Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Dec 20, 2024
1 parent 8fca084 commit aca74fe
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 32 deletions.
29 changes: 28 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,39 @@ export const config = tseslint.config(...configCityssm, {
cspell: {
words: [
...cspellWords,
'worktech',
'rtrim',
// Column name abbreviations
'accomp',
'actv',
'wmitm'
'defaul',
'enddatetime',
'sched',
'scheddatetime',
'srisysid',
'srqi',
'srqisysid',
'unitprice',
'wonos',
'workdesc',
// Table names
'amsri',
'amsrqi',
'wmabca',
'wmacd',
'wmbac',
'wmiln',
'wmitm',
'wmjaca',
'wmjoca',
'wmjom',
'wmocd',
'wmtsi'
]
}
}
],
'@typescript-eslint/no-unsafe-type-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'unicorn/no-null': 'warn'
}
Expand Down
32 changes: 31 additions & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,42 @@ export const config = tseslint.config(...configCityssm, {
cspell: {
words: [
...cspellWords,
'worktech',

'rtrim',

// Column name abbreviations
'accomp',
'actv',
'wmitm'
'defaul',
'enddatetime',
'sched',
'scheddatetime',
'srisysid',
'srqi',
'srqisysid',
'unitprice',
'wonos',
'workdesc',

// Table names
'amsri',
'amsrqi',
'wmabca',
'wmacd',
'wmbac',
'wmiln',
'wmitm',
'wmjaca',
'wmjoca',
'wmjom',
'wmocd',
'wmtsi'
]
}
}
],
'@typescript-eslint/no-unsafe-type-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'unicorn/no-null': 'warn'
}
Expand Down
1 change: 0 additions & 1 deletion queries/equipment/getEquipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export async function getEquipmentByEquipmentId(mssqlConfig, equipmentId) {
return equipment;
}
const pool = await connect(mssqlConfig);
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const equipmentResult = (await pool
.request()
.input('equipmentId', equipmentId)
Expand Down
1 change: 0 additions & 1 deletion queries/equipment/getEquipment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export async function getEquipmentByEquipmentId(

const pool = await connect(mssqlConfig)

// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const equipmentResult = (await pool
.request()
.input('equipmentId', equipmentId)
Expand Down
3 changes: 2 additions & 1 deletion queries/items/addResourceItem.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @cspell/spellchecker */
import { connect } from '@cityssm/mssql-multi-pool';
import { getLastSystemId, incrementLastSystemId } from '../systemId.js';
/**
Expand All @@ -19,7 +21,6 @@ export async function addResourceItem(mssqlConfig, resourceItem) {
throw new Error('Last used system id is unavailable.');
}
const itemSystemId = (Number.parseInt(lastSystemId, 10) + 1).toString();
// eslint-disable-next-line no-secrets/no-secrets
await transaction
.request()
.input('itemSystemId', itemSystemId)
Expand Down
4 changes: 3 additions & 1 deletion queries/items/addResourceItem.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @cspell/spellchecker */

import { connect, type mssql } from '@cityssm/mssql-multi-pool'

import { getLastSystemId, incrementLastSystemId } from '../systemId.js'
Expand Down Expand Up @@ -44,7 +47,6 @@ export async function addResourceItem(
Number.parseInt(lastSystemId, 10) + 1
).toString() as BigIntString

// eslint-disable-next-line no-secrets/no-secrets
await transaction
.request()
.input('itemSystemId', itemSystemId)
Expand Down
1 change: 0 additions & 1 deletion queries/jobs/getJobActivityObjectCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const sql = `SELECT [Job_ID] as jobId,
* @returns - The job - activity - object code combination if available.
*/
export async function getJobActivityObjectCodeByKeys(mssqlConfig, keys) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const result = (await pool
.request()
Expand Down
1 change: 0 additions & 1 deletion queries/jobs/getJobActivityObjectCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export async function getJobActivityObjectCodeByKeys(
fiscalYear: number | string
}
): Promise<JobActivityObjectCode | undefined> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const result = (await pool
Expand Down
1 change: 0 additions & 1 deletion queries/jobs/getJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export async function getJobByJobId(mssqlConfig, jobId) {
if (jobObject !== undefined) {
return jobObject;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const jobResult = await pool
.request()
Expand Down
1 change: 0 additions & 1 deletion queries/jobs/getJobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export async function getJobByJobId(
return jobObject
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const jobResult = await pool
Expand Down
3 changes: 0 additions & 3 deletions queries/jobs/getObjectCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export async function getObjectCodeByObjectCode(mssqlConfig, objectCode) {
if (objectCodeObject !== undefined) {
return objectCodeObject;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const result = (await pool
.request()
Expand Down Expand Up @@ -48,7 +47,6 @@ const jobAssignedSql = `SELECT o.[OCSysID] as objectCodeSystemId,
* @returns - An array of object codes assigned to a given job.
*/
export async function getObjectCodesAssignedToJobByFiscalYear(mssqlConfig, jobId, fiscalYear) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const result = (await pool
.request()
Expand All @@ -66,7 +64,6 @@ export async function getObjectCodesAssignedToJobByFiscalYear(mssqlConfig, jobId
* @returns - The object code, if available.
*/
export async function getObjectCodeAssignedToJobByObjectCodeAndFiscalYear(mssqlConfig, jobId, objectCode, fiscalYear) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const result = (await pool
.request()
Expand Down
7 changes: 1 addition & 6 deletions queries/jobs/getObjectCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ export async function getObjectCodeByObjectCode(
return objectCodeObject
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const result = (await pool
.request()
.input('objectCode', objectCode)
.query(
`${sql} where CodeID = @objectCode`
)) as mssql.IResult<ObjectCode>
.query(`${sql} where CodeID = @objectCode`)) as mssql.IResult<ObjectCode>

if (result.recordset.length === 0) {
return undefined
Expand Down Expand Up @@ -72,7 +69,6 @@ export async function getObjectCodesAssignedToJobByFiscalYear(
jobId: string,
fiscalYear: number | string
): Promise<JobAssignedObjectCode[]> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const result = (await pool
Expand Down Expand Up @@ -100,7 +96,6 @@ export async function getObjectCodeAssignedToJobByObjectCodeAndFiscalYear(
objectCode: string,
fiscalYear: number | string
): Promise<JobAssignedObjectCode | undefined> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const result = (await pool
Expand Down
2 changes: 0 additions & 2 deletions queries/systemId.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const tableId = 'SRISYSID';
/**
* Returns the last used system id.
Expand Down
3 changes: 0 additions & 3 deletions queries/systemId.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 @typescript-eslint/no-unsafe-assignment */

import type { mssql } from '@cityssm/mssql-multi-pool'

const tableId = 'SRISYSID'
Expand Down
2 changes: 2 additions & 0 deletions queries/workOrders/addWorkOrderResource.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @cspell/spellchecker */
import { connect } from '@cityssm/mssql-multi-pool';
import { dateToString, dateToTimeString } from '@cityssm/utils-datetime';
import { getItemByItemId } from '../items/getItems.js';
Expand Down
3 changes: 3 additions & 0 deletions queries/workOrders/addWorkOrderResource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @cspell/spellchecker */

import { connect, type mssql } from '@cityssm/mssql-multi-pool'
import { dateToString, dateToTimeString } from '@cityssm/utils-datetime'

Expand Down
2 changes: 0 additions & 2 deletions queries/workOrders/getWorkOrderResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const sql = `SELECT [SRISysID] as serviceRequestItemSystemId,
* @returns - An array of resources associated with a work order.
*/
export async function getWorkOrderResourcesByWorkOrderNumber(mssqlConfig, workOrderNumber) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const resourcesResult = (await pool
.request()
Expand All @@ -44,7 +43,6 @@ export async function getWorkOrderResourcesByStartDateTimeRange(mssqlConfig, sta
const startDateToString = typeof startDateTimeTo === 'string'
? startDateTimeTo
: `${dateToString(startDateTimeTo)} ${dateToTimeString(startDateTimeTo)}`;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig);
const resourcesResult = (await pool
.request()
Expand Down
7 changes: 1 addition & 6 deletions queries/workOrders/getWorkOrderResources.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
connect,
type mssql
} from '@cityssm/mssql-multi-pool'
import { connect, type mssql } from '@cityssm/mssql-multi-pool'
import {
type DateString,
dateToString,
Expand Down Expand Up @@ -36,7 +33,6 @@ export async function getWorkOrderResourcesByWorkOrderNumber(
mssqlConfig: mssql.config,
workOrderNumber: string
): Promise<WorkOrderResource[]> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const resourcesResult = (await pool
Expand Down Expand Up @@ -73,7 +69,6 @@ export async function getWorkOrderResourcesByStartDateTimeRange(
? startDateTimeTo
: `${dateToString(startDateTimeTo)} ${dateToTimeString(startDateTimeTo)}`

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const pool = await connect(mssqlConfig)

const resourcesResult = (await pool
Expand Down

0 comments on commit aca74fe

Please sign in to comment.