Skip to content

Commit b1429d9

Browse files
OrkastratedMatthewPopat-NHSconnoravo-nhs
authored
Fix: [AEA-5719] - Update prescription type mapping (#1336)
## Summary - Routine Change ### Details - Updates mapping for repeat prescriptions - Adds conditional for CF logs resource policy due to AWS limits - Updates components to use explicit react fragment elements as a work around for eslint issue --------- Co-authored-by: MatthewPopat-NHS <95283781+MatthewPopat-NHS@users.noreply.github.com> Co-authored-by: Connor Avery <214469360+connoravo-nhs@users.noreply.github.com>
1 parent c543ac4 commit b1429d9

28 files changed

+264
-203
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
"cSpell.words": ["fhir", "Formik", "pino", "serialisation"],
6868
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
6969

70-
}
70+
},
71+
"eslint.useFlatConfig": true,
72+
"eslint.format.enable": true
7173
}
7274
},
7375
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/eps-prescription-tracker-ui; make install; direnv allow ."

.github/scripts/fix_cdk_json.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ if [ -z "${GITHUB_ACTIONS_RUNNER_IPV6}" ]; then
165165
fi
166166

167167
CFN_DRIFT_DETECTION_GROUP="cpt-ui"
168-
if [[ "$SERVICE_NAME" =~ -pr-[0-9]+$ ]]; then
168+
if [[ "$IS_PULL_REQUEST" = "true" ]]; then
169169
CFN_DRIFT_DETECTION_GROUP="cpt-ui-pull-request"
170170
fi
171171

@@ -176,6 +176,7 @@ fix_string_key COMMIT_ID "${COMMIT_ID}"
176176
fix_string_key logRetentionInDays "${LOG_RETENTION_IN_DAYS}"
177177
fix_string_key logLevel "${LOG_LEVEL}"
178178
fix_string_key cfnDriftDetectionGroup "${CFN_DRIFT_DETECTION_GROUP}"
179+
fix_boolean_number_key isPullRequest "${IS_PULL_REQUEST}"
179180

180181
if [ "$CDK_APP_NAME" == "StatefulResourcesApp" ]; then
181182
fix_string_key primaryOidcClientId "${PRIMARY_OIDC_CLIENT_ID}"

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ jobs:
131131
CREATE_INT_RELEASE_NOTES: true
132132
CREATE_PROD_RELEASE_NOTES: true
133133
MARK_JIRA_RELEASED: false
134-
CREATE_INT_RC_RELEASE_NOTES: false
134+
CREATE_INT_RC_RELEASE_NOTES: false
135+
IS_PULL_REQUEST: false
135136
secrets: inherit
136137

137138
release_qa:
@@ -168,4 +169,5 @@ jobs:
168169
ROUTE53_EXPORT_NAME: EPS
169170
REACT_LOG_LEVEL: "debug"
170171
LOG_RETENTION_IN_DAYS: 30
172+
IS_PULL_REQUEST: false
171173
secrets: inherit

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ jobs:
182182
ROUTE53_EXPORT_NAME: EPS
183183
REACT_LOG_LEVEL: "debug"
184184
LOG_RETENTION_IN_DAYS: 30
185+
IS_PULL_REQUEST: true
185186
secrets: inherit
186187
report_deployed_url:
187188
needs: [release_code, get_issue_number]

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ jobs:
150150
CREATE_INT_RELEASE_NOTES: true
151151
CREATE_PROD_RELEASE_NOTES: true
152152
MARK_JIRA_RELEASED: false
153-
CREATE_INT_RC_RELEASE_NOTES: false
153+
CREATE_INT_RC_RELEASE_NOTES: false
154+
IS_PULL_REQUEST: false
154155
secrets: inherit
155156

156157
release_ref:
@@ -187,6 +188,7 @@ jobs:
187188
ROUTE53_EXPORT_NAME: EPS
188189
REACT_LOG_LEVEL: "debug"
189190
LOG_RETENTION_IN_DAYS: 30
191+
IS_PULL_REQUEST: false
190192
secrets: inherit
191193

192194
release_qa:
@@ -223,6 +225,7 @@ jobs:
223225
ROUTE53_EXPORT_NAME: EPS
224226
REACT_LOG_LEVEL: "debug"
225227
LOG_RETENTION_IN_DAYS: 30
228+
IS_PULL_REQUEST: false
226229
secrets: inherit
227230
release_int:
228231
needs: [tag_release, package_code, get_commit_id, release_qa]
@@ -257,7 +260,8 @@ jobs:
257260
CREATE_INT_RELEASE_NOTES: true
258261
CREATE_PROD_RELEASE_NOTES: true
259262
MARK_JIRA_RELEASED: false
260-
CREATE_INT_RC_RELEASE_NOTES: true
263+
CREATE_INT_RC_RELEASE_NOTES: true
264+
IS_PULL_REQUEST: false
261265
secrets: inherit
262266
release_prod:
263267
needs: [tag_release, package_code, get_commit_id, release_int]
@@ -292,5 +296,6 @@ jobs:
292296
CREATE_INT_RELEASE_NOTES: true
293297
CREATE_PROD_RELEASE_NOTES: true
294298
MARK_JIRA_RELEASED: false
295-
CREATE_INT_RC_RELEASE_NOTES: false
299+
CREATE_INT_RC_RELEASE_NOTES: false
300+
IS_PULL_REQUEST: false
296301
secrets: inherit

.github/workflows/release_all_stacks.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ on:
8787
CREATE_INT_RC_RELEASE_NOTES:
8888
type: boolean
8989
default: false
90+
IS_PULL_REQUEST:
91+
type: boolean
92+
required: true
9093
jobs:
9194
release_all_code:
9295
runs-on: ubuntu-22.04
@@ -241,6 +244,7 @@ jobs:
241244
ROUTE53_EXPORT_NAME: ${{ inputs.ROUTE53_EXPORT_NAME }}
242245
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
243246
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
247+
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
244248

245249
- name: Show diff for stateful stack
246250
run: |
@@ -375,6 +379,7 @@ jobs:
375379
ROUTE53_EXPORT_NAME: ${{ inputs.ROUTE53_EXPORT_NAME }}
376380
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
377381
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
382+
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
378383

379384
- name: Show diff for stateless stack
380385
run: |
@@ -501,6 +506,7 @@ jobs:
501506
ROUTE53_EXPORT_NAME: ${{ inputs.ROUTE53_EXPORT_NAME }}
502507
WAF_ALLOW_GA_RUNNER_CONNECTIVITY: ${{ inputs.WAF_ALLOW_GA_RUNNER_CONNECTIVITY }}
503508
CLOUDFRONT_ORIGIN_CUSTOM_HEADER: ${{secrets.CLOUDFRONT_ORIGIN_CUSTOM_HEADER }}
509+
IS_PULL_REQUEST: ${{inputs.IS_PULL_REQUEST}}
504510

505511
- name: Show diff for stateful stack redeployment
506512
if: ${{ steps.check_redeploy_stateful_stack.outputs.REDEPLOY_STATEFUL_STACK == 'true' }}
@@ -573,14 +579,14 @@ jobs:
573579
contents: write
574580
steps:
575581
- name: Checkout gh-pages
576-
if: ${{ !startsWith(inputs.SERVICE_NAME, 'cpt-ui-pr-') }}
582+
if: ${{ inputs.IS_PULL_REQUEST == false }}
577583
uses: actions/checkout@v5
578584
with:
579585
ref: gh-pages
580586
path: gh-pages
581587

582588
- name: update release tag in github pages
583-
if: ${{ !startsWith(inputs.SERVICE_NAME, 'cpt-ui-pr-') }}
589+
if: ${{ inputs.IS_PULL_REQUEST == false }}
584590
run: |
585591
cd gh-pages
586592
NOW=$(date +'%Y-%m-%dT%H:%M:%S')

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ cdk-synth-stateful-resources-no-mock:
216216
SPLUNK_DELIVERY_STREAM=foo \
217217
SPLUNK_SUBSCRIPTION_FILTER_ROLE=foo \
218218
DO_NOT_GET_AWS_EXPORT=true \
219+
IS_PULL_REQUEST=false \
219220
USE_ZONE_APEX=false \
220221
./.github/scripts/fix_cdk_json.sh .local_config/stateful_app.config.json
221222
CONFIG_FILE_NAME=.local_config/stateful_app.config.json npx cdk synth \
@@ -264,6 +265,7 @@ cdk-synth-stateless-resources-no-mock:
264265
CLOUDFRONT_CERT_ARN=arn:aws:acm:us-east-1:444455556666:certificate/certificate_ID \
265266
DO_NOT_GET_AWS_EXPORT=true \
266267
CLOUDFRONT_ORIGIN_CUSTOM_HEADER=foo \
268+
IS_PULL_REQUEST=false \
267269
USE_ZONE_APEX=false \
268270
./.github/scripts/fix_cdk_json.sh .local_config/stateless_app.config.json
269271
CONFIG_FILE_NAME=.local_config/stateless_app.config.json npx cdk synth \
@@ -309,6 +311,7 @@ cdk-synth-stateful-resources-mock:
309311
SPLUNK_DELIVERY_STREAM=foo \
310312
SPLUNK_SUBSCRIPTION_FILTER_ROLE=foo \
311313
DO_NOT_GET_AWS_EXPORT=true \
314+
IS_PULL_REQUEST=false \
312315
USE_ZONE_APEX=false \
313316
./.github/scripts/fix_cdk_json.sh .local_config/stateful_app.config.json
314317
CONFIG_FILE_NAME=.local_config/stateful_app.config.json npx cdk synth \
@@ -363,6 +366,7 @@ cdk-synth-stateless-resources-mock:
363366
GITHUB_ACTIONS_RUNNER_IPV6='["::1"]' \
364367
DO_NOT_GET_AWS_EXPORT=true \
365368
CLOUDFRONT_ORIGIN_CUSTOM_HEADER=foo \
369+
IS_PULL_REQUEST=false \
366370
USE_ZONE_APEX=false \
367371
./.github/scripts/fix_cdk_json.sh .local_config/stateless_app.config.json
368372
CONFIG_FILE_NAME=.local_config/stateless_app.config.json npx cdk synth \

eslint.config.mjs

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import globals from "globals";
2-
import tsPlugin from "@typescript-eslint/eslint-plugin";
3-
import eslintJsPlugin from "@eslint/js";
4-
import importNewlines from "eslint-plugin-import-newlines";
5-
import typescriptParser from "@typescript-eslint/parser";
1+
import globals from "globals"
2+
import tsPlugin from "@typescript-eslint/eslint-plugin"
3+
import eslintJsPlugin from "@eslint/js"
4+
import importNewlines from "eslint-plugin-import-newlines"
5+
import typescriptParser from "@typescript-eslint/parser"
66
import react from "eslint-plugin-react"
77

88
const commonConfig = {
@@ -17,16 +17,16 @@ const commonConfig = {
1717
"@typescript-eslint/array-type": [
1818
"error",
1919
{
20-
default: "generic",
21-
},
20+
default: "generic"
21+
}
2222
],
2323

2424
"@typescript-eslint/consistent-type-assertions": [
2525
"error",
2626
{
2727
assertionStyle: "as",
28-
objectLiteralTypeAssertions: "never",
29-
},
28+
objectLiteralTypeAssertions: "never"
29+
}
3030
],
3131

3232
"block-spacing": "error",
@@ -37,8 +37,8 @@ const commonConfig = {
3737
"error",
3838
{
3939
before: false,
40-
after: true,
41-
},
40+
after: true
41+
}
4242
],
4343

4444
"dot-location": ["error", "property"],
@@ -50,37 +50,39 @@ const commonConfig = {
5050
"error",
5151
"declaration",
5252
{
53-
allowArrowFunctions: true,
54-
},
53+
allowArrowFunctions: true
54+
}
5555
],
5656

5757
"import-newlines/enforce": [
5858
"error",
5959
{
6060
items: 3,
6161
"max-len": 120,
62-
semi: false,
63-
},
62+
semi: false
63+
}
6464
],
6565

6666
// TEMPORARY: Disabled due to ESLint indent rule stack overflow bug with Layout.tsx
6767
// Issue tracked across ESLint 8.x and 9.x versions - re-enable when fixed upstream
68-
// "indent": [
69-
// "error",
70-
// 2,
71-
// {
72-
// SwitchCase: 1,
73-
// },
74-
// ],
68+
//see: https://github.com/eslint-stylistic/eslint-stylistic/issues/915
69+
// Re-enabled for now, issue is still present but can be avoided by using explicit react <Fragment> elements
70+
"indent": [
71+
"error",
72+
2,
73+
{
74+
SwitchCase: 1
75+
}
76+
],
7577

7678
"max-len": ["error", 120],
7779
"no-multi-spaces": "error",
7880

7981
"no-multiple-empty-lines": [
8082
"error",
8183
{
82-
max: 1,
83-
},
84+
max: 1
85+
}
8486
],
8587

8688
"no-trailing-spaces": "error",
@@ -91,13 +93,13 @@ const commonConfig = {
9193
"double",
9294
{
9395
allowTemplateLiterals: true,
94-
avoidEscape: true,
95-
},
96+
avoidEscape: true
97+
}
9698
],
9799

98-
semi: ["error", "never"],
99-
},
100-
};
100+
semi: ["error", "never"]
101+
}
102+
}
101103

102104
export default [
103105
{
@@ -109,31 +111,31 @@ export default [
109111
"**/node_modules/**",
110112
"**/.next/**",
111113
"**/.tsconfig.tsbuildinfo/**"
112-
],
114+
]
113115
},
114116
{
115-
rules: eslintJsPlugin.configs.recommended.rules,
117+
rules: eslintJsPlugin.configs.recommended.rules
116118
},
117119
{
118120
files: ["**/*.ts"],
119121

120122
languageOptions: {
121123
parser: typescriptParser,
122124
globals: {
123-
...globals.node,
124-
},
125+
...globals.node
126+
}
125127
},
126-
...commonConfig,
128+
...commonConfig
127129
},
128130
{
129-
files: ["**/*.js",],
131+
files: ["**/*.js"],
130132

131133
languageOptions: {
132134
globals: {
133-
...globals.node,
134-
},
135+
...globals.node
136+
}
135137
},
136-
...commonConfig,
138+
...commonConfig
137139
},
138140
{
139141
files: [ "**/*.{jsx,mjs,cjs,ts,tsx}" ],
@@ -144,14 +146,14 @@ export default [
144146
parser: typescriptParser,
145147
parserOptions: {
146148
ecmaFeatures: {
147-
jsx: true,
148-
},
149-
},
150-
globals: {
151-
...globals.browser,
149+
jsx: true
150+
}
152151
},
152+
globals: {
153+
...globals.browser
154+
}
153155
},
154-
...commonConfig,
156+
...commonConfig
155157
},
156158
{
157159
files: [ "**/__tests__/*.{jsx,mjs,cjs,ts,tsx}" ],
@@ -162,15 +164,15 @@ export default [
162164
parser: typescriptParser,
163165
parserOptions: {
164166
ecmaFeatures: {
165-
jsx: true,
166-
},
167-
},
168-
globals: {
167+
jsx: true
168+
}
169+
},
170+
globals: {
169171
...globals.browser,
170172
...globals.jest
171-
},
173+
}
172174
},
173-
...commonConfig,
175+
...commonConfig
174176
},
175177
{
176178
files: ["**/tests/**/*.ts"],
@@ -179,9 +181,9 @@ export default [
179181
parser: typescriptParser,
180182
globals: {
181183
...globals.jest,
182-
...globals.node,
183-
},
184+
...globals.node
185+
}
184186
},
185-
...commonConfig,
186-
},
187-
];
187+
...commonConfig
188+
}
189+
]

0 commit comments

Comments
 (0)