mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36: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
|
* @return the created react element
|
||||||
*/
|
*/
|
||||||
private translateElementToReactElement(element: Element, index: number | string): ValidReactDomElement {
|
private translateElementToReactElement(element: Element, index: number | string): ValidReactDomElement {
|
||||||
const numericIndex = typeof index === 'number' ? index : Number.parseInt(index)
|
const elementKey = this.calculateUniqueKey(element).orElseGet(() => `-${index}`)
|
||||||
const elementKey = this.calculateUniqueKey(element).orElseGet(() => (-numericIndex).toString())
|
|
||||||
const replacement = this.findElementReplacement(element, elementKey)
|
const replacement = this.findElementReplacement(element, elementKey)
|
||||||
if (replacement === null) {
|
if (replacement === null) {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -57,9 +57,15 @@ const initialConfig: FrontendConfig = {
|
||||||
let currentConfig: FrontendConfig = initialConfig
|
let currentConfig: FrontendConfig = initialConfig
|
||||||
|
|
||||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
// This is shorter than storing the return boolean in a variable and then calling respondToTestRequest with if
|
const responseSuccessful = respondToMatchingRequest<FrontendConfig>(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
HttpMethod.GET,
|
||||||
respondToMatchingRequest<FrontendConfig>(HttpMethod.GET, req, res, currentConfig, 200, false) ||
|
req,
|
||||||
|
res,
|
||||||
|
currentConfig,
|
||||||
|
200,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
if (!responseSuccessful) {
|
||||||
respondToTestRequest<FrontendConfig>(req, res, () => {
|
respondToTestRequest<FrontendConfig>(req, res, () => {
|
||||||
currentConfig = {
|
currentConfig = {
|
||||||
...initialConfig,
|
...initialConfig,
|
||||||
|
@ -67,6 +73,7 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
}
|
}
|
||||||
return currentConfig
|
return currentConfig
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default handler
|
export default handler
|
||||||
|
|
Loading…
Reference in a new issue