fix(frontend): remove linter workarounds

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-11-01 17:22:35 +01:00
parent 932ecac326
commit 8ce40bc4cd
2 changed files with 11 additions and 5 deletions

View file

@ -74,8 +74,7 @@ export class NodeToReactTransformer {
* @return the created react element
*/
private translateElementToReactElement(element: Element, index: number | string): ValidReactDomElement {
const numericIndex = typeof index === 'number' ? index : Number.parseInt(index)
const elementKey = this.calculateUniqueKey(element).orElseGet(() => (-numericIndex).toString())
const elementKey = this.calculateUniqueKey(element).orElseGet(() => `-${index}`)
const replacement = this.findElementReplacement(element, elementKey)
if (replacement === null) {
return null

View file

@ -57,9 +57,15 @@ const initialConfig: FrontendConfig = {
let currentConfig: FrontendConfig = initialConfig
const handler = (req: NextApiRequest, res: NextApiResponse) => {
// This is shorter than storing the return boolean in a variable and then calling respondToTestRequest with if
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
respondToMatchingRequest<FrontendConfig>(HttpMethod.GET, req, res, currentConfig, 200, false) ||
const responseSuccessful = respondToMatchingRequest<FrontendConfig>(
HttpMethod.GET,
req,
res,
currentConfig,
200,
false
)
if (!responseSuccessful) {
respondToTestRequest<FrontendConfig>(req, res, () => {
currentConfig = {
...initialConfig,
@ -68,5 +74,6 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
return currentConfig
})
}
}
export default handler