Skip to content

Commit cb3fc14

Browse files
committed
Removed TypeChecked from eslint config
Fix remainder of issues
1 parent 6f42239 commit cb3fc14

37 files changed

+322
-333
lines changed

app/deploy-utils.ts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ try {
4141
console.log(`${TITLE} is present and up to date`);
4242
}
4343
}
44-
} catch (err) {
44+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
45+
} catch (error) {
4546
console.log(`An error occured while managing ${TITLE}`);
4647
process.exit(1);
4748
}
@@ -51,8 +52,7 @@ try {
5152
//
5253

5354
/**
54-
* @function buildComponents
55-
* @description Rebuild `nr-permitting-navigator-service-frontend` library
55+
* Rebuild `nr-permitting-navigator-service-frontend` library
5656
*/
5757
function buildComponents() {
5858
if (!existsSync(`${FRONTEND_DIR}/node_modules`)) {
@@ -65,8 +65,7 @@ function buildComponents() {
6565
}
6666

6767
/**
68-
* @function cleanComponents
69-
* @description Clean `nr-permitting-navigator-service-frontend` library directory
68+
* Clean `nr-permitting-navigator-service-frontend` library directory
7069
*/
7170
function cleanComponents() {
7271
console.log(`Cleaning ${TITLE}...`);
@@ -83,8 +82,7 @@ function copyDocs() {
8382
}
8483

8584
/**
86-
* @function deployComponents
87-
* @description Redeploy `nr-permitting-navigator-service-frontend` library
85+
* Redeploy `nr-permitting-navigator-service-frontend` library
8886
*/
8987
function deployComponents() {
9088
console.log(`Redeploying ${TITLE}...`);
@@ -98,14 +96,12 @@ function deployComponents() {
9896
//
9997

10098
/**
101-
* @function runSync
102-
* @description Execute a single shell command where `cmd` is a string
103-
* @param {string} cmd Shell command to run
104-
* @param {string} [cwd] Working directory of the command to run
99+
* Execute a single shell command where `cmd` is a string
100+
* @param cmd Shell command to run
101+
* @param cwd Working directory of the command to run
105102
*/
106103
export function runSync(cmd: string, cwd: string | undefined) {
107-
// eslint-disable-next-line @typescript-eslint/no-var-requires
108-
const { spawnSync } = require('child_process');
104+
const { spawnSync } = require('child_process'); // eslint-disable-line @typescript-eslint/no-require-imports
109105
const parts = cmd.split(/\s+/g);
110106
const opts = {
111107
cwd: cwd || undefined,
@@ -123,10 +119,9 @@ export function runSync(cmd: string, cwd: string | undefined) {
123119
}
124120

125121
/**
126-
* @function copyFileSync
127-
* @description Copies `source` file to `target` file
128-
* @param {string} source Source file location
129-
* @param {string} target Target file location
122+
* Copies `source` file to `target` file
123+
* @param source Source file location
124+
* @param target Target file location
130125
*/
131126
export function copyFileSync(source: string, target: string) {
132127
let targetFile = target;
@@ -142,10 +137,9 @@ export function copyFileSync(source: string, target: string) {
142137
}
143138

144139
/**
145-
* @function copyDirRecursiveSync
146-
* @description Recursively copies `source` directory contents to `target` directory
147-
* @param {string} source Source directory location
148-
* @param {string} target Target directory location
140+
* Recursively copies `source` directory contents to `target` directory
141+
* @param source Source directory location
142+
* @param target Target directory location
149143
*/
150144
export function copyDirRecursiveSync(source: string, target: string) {
151145
let files = [];

app/eslint.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import tseslint from 'typescript-eslint';
66

77
export default tseslint.config(
88
{
9-
ignores: ['coverage/**', 'node_modules/**']
9+
ignores: ['coverage/**', 'dist/**', 'jest.config.js', 'node_modules/**']
1010
},
1111
{
1212
files: ['**/*.{js,ts}'],
1313
extends: [
1414
// Extensions are order dependent - always apply Prettier last
1515
eslint.configs.recommended,
16-
tseslint.configs.recommendedTypeChecked,
17-
tseslint.configs.stylisticTypeChecked,
16+
tseslint.configs.recommended,
17+
tseslint.configs.stylistic,
1818
jsdoc.configs['flat/recommended-typescript'],
1919
eslintPluginPrettierRecommended,
2020
eslintConfigPrettier // Drops conflicting rules

app/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"lint": "eslint",
1616
"lint:fix": "eslint --fix",
1717
"knex": "tsx ./node_modules/knex/bin/cli.js",
18-
"migrate:down": "knex migrate:down",
18+
"migrate:down": "npm run knex migrate:down",
1919
"migrate:latest": "npm run knex migrate:latest",
20-
"migrate:list": "knex migrate:list",
21-
"migrate:rollback:all": "knex migrate:rollback --all",
22-
"migrate:rollback": "knex migrate:rollback",
23-
"migrate:up": "knex migrate:up",
24-
"migrate": "knex migrate:latest --knexfile ./sbin/knexfile.js",
20+
"migrate:list": "npm run knex migrate:list",
21+
"migrate:rollback:all": "npm run knex migrate:rollback --all",
22+
"migrate:rollback": "npm run knex migrate:rollback",
23+
"migrate:up": "npm run knex migrate:up",
24+
"migrate": "npm run knex migrate:latest --knexfile ./sbin/knexfile.js",
2525
"peach:sync": "node sbin/peachSync.js",
2626
"peach:sync:local": "tsx ./peachSync.ts",
2727
"postbuild:all": "npm run build",
@@ -52,9 +52,9 @@
5252
"purge": "rimraf node_modules",
5353
"rebuild": "npm run clean",
5454
"reinstall": "npm run purge",
55-
"seed:make": "knex seed:make",
56-
"seed:dev": "knex seed:run --specific=dev_groups.ts",
57-
"seed": "knex seed:run",
55+
"seed:make": "npm run knex seed:make",
56+
"seed:dev": "npm run knex seed:run --specific=dev_groups.ts",
57+
"seed": "npm run knex seed:run",
5858
"serve": "tsx watch --include \"./config/*\" --include \"./dist/*\" ./server --clear-screen=false",
5959
"start": "tsx ./server",
6060
"test": "jest --verbose --forceExit --detectOpenHandles",
@@ -94,6 +94,7 @@
9494
"@types/jsonwebtoken": "^9.0.10",
9595
"@types/node": "^24.10.4",
9696
"@types/pg": "^8.16.0",
97+
"@types/qs": "^6.14.0",
9798
"@types/supertest": "^6.0.3",
9899
"eslint": "9.39.1",
99100
"eslint-config-prettier": "10.1.8",

app/server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function normalizePort(val: string): string | number | boolean {
6363
* @param error.code Error code
6464
*/
6565
function onError(error: { syscall?: string; code: string }): void {
66-
// eslint-disable-next-line @typescript-eslint/only-throw-error
6766
if (error.syscall !== 'listen') throw error;
6867

6968
// Handle specific listen errors with friendly messages
@@ -78,7 +77,7 @@ function onError(error: { syscall?: string; code: string }): void {
7877
shutdown('SIGABRT');
7978
break;
8079
default:
81-
throw error; // eslint-disable-line @typescript-eslint/only-throw-error
80+
throw error;
8281
}
8382
}
8483

app/src/controllers/activityContact.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
getActivityContact,
99
listActivityContacts,
1010
updateActivityContact
11-
} from '../services/activityContact';
12-
import { searchContacts } from '../services/contact';
13-
import { email } from '../services/email';
14-
import { searchEnquiries } from '../services/enquiry';
15-
import { verifyPrimaryChange } from '../services/helpers/activityContact';
16-
import { getProjectByActivityId } from '../services/project';
17-
import { Initiative } from '../utils/enums/application';
18-
import { ActivityContactRole } from '../utils/enums/projectCommon';
19-
import { teamAdminAddedTemplate, teamMemberAddedTemplate, teamMemberRevokedTemplate } from '../utils/templates';
11+
} from '../services/activityContact.ts';
12+
import { searchContacts } from '../services/contact.ts';
13+
import { email } from '../services/email.ts';
14+
import { searchEnquiries } from '../services/enquiry.ts';
15+
import { verifyPrimaryChange } from '../services/helpers/activityContact.ts';
16+
import { getProjectByActivityId } from '../services/project.ts';
17+
import { Initiative } from '../utils/enums/application.ts';
18+
import { ActivityContactRole } from '../utils/enums/projectCommon.ts';
19+
import { teamAdminAddedTemplate, teamMemberAddedTemplate, teamMemberRevokedTemplate } from '../utils/templates.ts';
2020

2121
import type { Request, Response } from 'express';
2222
import type { PrismaTransactionClient } from '../db/dataConnection.ts';
@@ -46,7 +46,7 @@ const getTeamMemberEmailTemplateData = async (
4646
projectName
4747
};
4848

49-
const navEmail: string = config.get('server.pcns.navEmail');
49+
const navEmail: string = config.get('server.pcns.navEmail');
5050

5151
return { templateParams, navEmail };
5252
} catch (e) {

app/src/db/extensions/filterDeleted.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,11 @@ const excludeOperations: readonly string[] = ['create', 'createMany', 'createMan
1010

1111
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1212
function filterColumn(operation: string, args: any) {
13-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
1413
if (excludeOperations.includes(operation)) return args;
1514

16-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
1715
if (!args.where) args = { ...args, where: {} };
18-
19-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
2016
args.where = { ...args.where, deletedAt: null };
2117

22-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
2318
return args;
2419
}
2520

@@ -32,43 +27,36 @@ const filterDeletedTransform = Prisma.defineExtension({
3227
query: {
3328
activity: {
3429
$allOperations({ operation, args, query }) {
35-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
3630
return query(filterColumn(operation, args));
3731
}
3832
},
3933
enquiry: {
4034
$allOperations({ operation, args, query }) {
41-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
4235
return query(filterColumn(operation, args));
4336
}
4437
},
4538
electrification_project: {
4639
$allOperations({ operation, args, query }) {
47-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
4840
return query(filterColumn(operation, args));
4941
}
5042
},
5143
housing_project: {
5244
$allOperations({ operation, args, query }) {
53-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5445
return query(filterColumn(operation, args));
5546
}
5647
},
5748
note_history: {
5849
$allOperations({ operation, args, query }) {
59-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
6050
return query(filterColumn(operation, args));
6151
}
6252
},
6353
permit: {
6454
$allOperations({ operation, args, query }) {
65-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
6655
return query(filterColumn(operation, args));
6756
}
6857
},
6958
permit_note: {
7059
$allOperations({ operation, args, query }) {
71-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7260
return query(filterColumn(operation, args));
7361
}
7462
}

app/src/db/extensions/permitStatusDates.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,19 @@ function dateToTimeString(value: Date | null | undefined): string | null {
3535
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3636
function normalizePermitWriteData(data: any) {
3737
for (const field of DATE_FIELDS) {
38-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
3938
const value = data[field];
4039
if (typeof value === 'string' && DATE_ONLY_REGEX.test(value)) {
41-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4240
data[field] = dateFromDateString(value);
4341
}
4442
}
4543

4644
for (const field of TIME_FIELDS) {
47-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
4845
const value = data[field];
4946
if (typeof value === 'string' && TIMETZ_REGEX.test(value)) {
50-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5147
data[field] = dateFromTimeString(value);
5248
}
5349
}
5450

55-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
5651
return data;
5752
}
5853

app/src/db/migrations/20250514000000_032-api-realignment.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ export async function up(knex: Knex): Promise<void> {
171171
role_name: string;
172172
}
173173

174-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
175174
const data: SqlResponse[] = await knex
176175
.raw(
177176
`SELECT
@@ -192,7 +191,6 @@ export async function up(knex: Knex): Promise<void> {
192191
resource.name in ('ATS', 'CONTACT', 'REPORTING', 'SSO', 'USER')`
193192
)
194193
.then((res) => {
195-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
196194
return res.rows;
197195
});
198196

@@ -346,7 +344,6 @@ export async function down(knex: Knex): Promise<void> {
346344
role_name: string;
347345
}
348346

349-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
350347
const data: SqlResponse[] = await knex
351348
.raw(
352349
`SELECT
@@ -367,7 +364,6 @@ export async function down(knex: Knex): Promise<void> {
367364
resource.name in ('ATS', 'CONTACT', 'REPORTING', 'SSO', 'USER')`
368365
)
369366
.then((res) => {
370-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
371367
return res.rows;
372368
});
373369

app/src/db/migrations/20250529000000_034-contact-updater.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable */
2-
/* Too confusing */
3-
41
/**
52
* Create CONTACT_UPDATER role (UPDATE only, no DELETE)
63
* Map role to UPDATE policy on CONTACT
@@ -114,4 +111,3 @@ export async function down(knex: Knex): Promise<void> {
114111
)
115112
);
116113
}
117-
/* eslint-enable */

0 commit comments

Comments
 (0)