Skip to content

Commit 1c001ff

Browse files
nhsd-david-wassstevebuxmasl2
authored
CCM-13194 Implement linting rules and typecheck (#343)
* letter test data utility auto fixes * letter test data utility manual fixes * gitleaksignore * supplier data utility auto fixes * supplier data utility manual fixes * lambda fixes * test auto fixes * tests manual fixes * CI typecheck and lint * events fix --------- Co-authored-by: Steve Buxton <steve.buxton@nhs.net> Co-authored-by: Mark Slowey <mark.slowey1@nhs.net>
1 parent 2518a47 commit 1c001ff

40 files changed

Lines changed: 364 additions & 484 deletions

.github/workflows/stage-1-commit.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: "Commit stage"
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_call:
58
inputs:

.gitleaksignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ e12407e09151898bfd8d049d57eee9db9977d56b:.github/copilot-instructions.md:generic
2222
82f6be3e657b46d8447e77cdc1894fba0b855c26:tests/component-tests/testCases/create-letter-request.spec.ts:generic-api-key:10
2323
debc75a97cfe551a69fd1e8694be483213322a9d:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10
2424
777eb4047ad06b9e939a292ee18664a0ffee4f29:tests/resources/prepared-letter.json:generic-api-key:4
25+
4fa1923947bbff2387218d698d766cbb7c121a0f:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build": "JEKYLL_ENV=production bundle exec jekyll build --trace --config _config.yml,_config.version.yml",
1515
"debug": "JEKYLL_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec jekyll serve --config _config.yml,_config.dev.yml,_config.version.yml --limit_posts 100 --trace",
1616
"generate-includes": "./generate-includes.sh",
17+
"lint": "echo \"Documentation module has no code to lint\"",
1718
"test:unit": "echo \"Documentation module has no unit tests\"",
1819
"typecheck": "echo \"Documentation module has no typescript to typecheck\""
1920
},

internal/events/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@
5050
"typecheck": "tsc --noEmit"
5151
},
5252
"types": "dist/index.d.ts",
53-
"version": "1.0.7"
53+
"version": "1.0.8"
5454
}

internal/events/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"isolatedModules": true,
55
"module": "commonjs",
66
"outDir": "dist",
7-
"resolveJsonModule": true,
8-
"rootDir": "src"
7+
"resolveJsonModule": true
98
},
109
"exclude": [
1110
"node_modules",
@@ -14,6 +13,7 @@
1413
"extends": "../../tsconfig.base.json",
1514
"include": [
1615
"src/**/*",
17-
"package.json"
16+
"package.json",
17+
"jest.config.ts"
1818
]
1919
}

lambdas/api-handler/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@aws-sdk/s3-request-presigner": "^3.925.0",
88
"@internal/datastore": "*",
99
"@internal/helpers": "*",
10+
"aws-lambda": "^1.0.7",
1011
"esbuild": "^0.25.11",
1112
"pino": "^9.7.0",
1213
"zod": "^4.1.11"

lambdas/api-handler/src/mappers/letter-mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function mapToUpdateCommands(
5959
request: PostLettersRequest,
6060
supplierId: string,
6161
): UpdateLetterCommand[] {
62-
return request.data.map( (letterToUpdate: PostLettersRequestResource) => ({
62+
return request.data.map((letterToUpdate: PostLettersRequestResource) => ({
6363
id: letterToUpdate.id,
6464
supplierId,
6565
status: LetterStatus.parse(letterToUpdate.attributes.status),

lambdas/authorizer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@aws-sdk/client-dynamodb": "^3.858.0",
44
"@aws-sdk/lib-dynamodb": "^3.858.0",
55
"@internal/datastore": "*",
6+
"aws-lambda": "^1.0.7",
67
"esbuild": "^0.25.11",
78
"pino": "^9.7.0",
89
"zod": "^4.1.11"

lambdas/letter-updates-transformer/src/mappers/__tests__/letter-mapper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ describe("letter-mapper", () => {
2323
$LetterEvent.parse(event);
2424
expect(event.type).toBe("uk.nhs.notify.supplier-api.letter.PRINTED.v1");
2525
expect(event.dataschema).toBe(
26-
`https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.PRINTED.${event.dataschemaversion}.schema.json`
26+
`https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.PRINTED.${event.dataschemaversion}.schema.json`,
2727
);
28-
expect(event.dataschemaversion).toBe("1.0.7");
28+
expect(event.dataschemaversion).toBe("1.0.8");
2929
expect(event.subject).toBe("letter-origin/supplier-api/letter/id1");
3030
expect(event.time).toBe("2025-11-24T15:55:18.000Z");
3131
expect(event.recordedtime).toBe("2025-11-24T15:55:18.000Z");

lambdas/upsert-letter/src/handler/upsert-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function getOperationFromType(type: string): UpsertOperation {
4747
preparedRequest,
4848
supplierSpec.supplierId,
4949
supplierSpec.specId,
50-
supplierSpec.specId, //use specId for now
50+
supplierSpec.specId, // use specId for now
5151
);
5252
await deps.letterRepo.putLetter(letterToInsert);
5353
},
@@ -86,7 +86,7 @@ function mapToInsertLetter(
8686
subject: upsertRequest.subject,
8787
createdAt: now,
8888
updatedAt: now,
89-
billingRef: billingRef,
89+
billingRef,
9090
};
9191
}
9292

0 commit comments

Comments
 (0)