mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
fix(frontend): remove linter workarounds
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
932ecac326
commit
8ce40bc4cd
2 changed files with 11 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
@ -67,6 +73,7 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
|||
}
|
||||
return currentConfig
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
|
Loading…
Reference in a new issue