86646[TASK] Feed `@typo3/backend/form-engine-review` from events
Commit message
Review
-
Code review CR +2 Done
- Andreas Kienast +2
- Oli Bartsch +1
- Ayke Halder +1
-
Verified V +2 Done
- Andreas Kienast +2
- Oli Bartsch +1
- Ayke Halder +1
- core-ci +1 CI
Issues 1
Files 4
Review log 1419
-
Andreas Kienast uploaded patch set 1 10/18/24, 10:05
-
core-ci voted on patch set 1 V -1 10/18/24, 10:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67949
-
Andreas Kienast uploaded patch set 2
V -110/18/24, 10:30 -
core-ci voted on patch set 2 V +1 10/18/24, 10:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67950
-
Andreas Kienast updated the commit message in patch set 3
V +110/21/24, 05:41 -
core-ci voted on patch set 3 V +1 10/21/24, 05:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68278
-
Andreas Kienast uploaded patch set 4
V +110/21/24, 09:07 -
core-ci voted on patch set 4 V +1 10/21/24, 09:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68290
-
Oli Bartsch voted on patch set 4 CR +1 V +1 10/21/24, 09:15
-
Ayke Halder commented on patch set 4 10/21/24, 13:59
How about starting with keeping `strictNullChecks` in mind?form-engine-review.ts:96`querySelector(…)` might actually return `null` on run-time if no element is found. Whereas the code right now tells TypeScript that there is always an object of type `HTMLElement` to be found. ``` const relatedInputField = fieldContainer.querySelector(…) as HTMLElement; ``` Better use the following code, as this tells TypeScript that the returned object is of type `HTMLElement|null` - so might also be null: ``` const relatedInputField = fieldContainer.querySelector<HTMLElement>(…); ``` ---- You can temporarily activate `strictNullChecks` in `Build/tsconfig.json`: ```json { "compilerOptions": { "strictNullChecks": true, … }, … } ``` -
Andreas Kienast commented on patch set 4 10/21/24, 14:08
Reply
There's a pending patch from Benjamin Franzke that's WIP right now.form-engine-review.ts:96ReplyI get the intention of your comment and I appreciate it. However, if this code breaks, something is heavily broken in FormEngine which I explicitly want to fail. -
Ayke Halder commented on patch set 4 10/21/24, 14:28
form-engine-review.ts:96ReplyI get your point. And in case you deliberately want the code to break on run-time if anything is unexpectedly `null`, use the "non-null assertion operator": https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator Syntax is like `someObject!`: * `fieldContainer!.querySelector(…)` * `this.switchToField(e, relatedInputField!)` E.g. the code could be like this: ``` for (const invalidField of this.invalidFields) { const fieldContainer = invalidField.closest('.t3js-formengine-validation-marker'); const relatedInputField = fieldContainer!.querySelector<HTMLElement>('[data-formengine-validation-rules]'); const link = document.createElement('a'); link.classList.add('list-group-item'); link.href = '#'; link.textContent = fieldContainer!.querySelector(this.labelSelector)?.textContent || ''; link.addEventListener('click', (e: Event) => this.switchToField(e, relatedInputField!)); erroneousListGroup.append(link); } ``` -
Andreas Kienast uploaded patch set 5
CR +1V +110/21/24, 14:44 -
core-ci voted on patch set 5 V +1 10/21/24, 14:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68319
-
Andreas Kienast commented on patch set 5 10/21/24, 14:52
form-engine-review.ts:96ReplyDone -
Oli Bartsch voted on patch set 5 CR +1 V +1 10/21/24, 14:55
-
Ayke Halder voted on patch set 5 CR +1 V +1 10/21/24, 15:12
-
Andreas Kienast voted on patch set 5 CR +2 V +2 10/21/24, 20:00
-
Andreas Kienast merged patch set 6 10/21/24, 20:00