mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-03 08:28:54 -04:00
chore(deps): upgrade dependencies for frontend + lint fixes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
f121ca3458
commit
df6540163c
15 changed files with 681 additions and 357 deletions
|
@ -44,7 +44,7 @@ export interface InitTask {
|
|||
const fetchUserInformation = async (): Promise<void> => {
|
||||
try {
|
||||
await fetchAndSetUser()
|
||||
} catch (error) {
|
||||
} catch {
|
||||
logger.error("Couldn't load user. Probably not logged in.")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('Copy to clipboard button', () => {
|
|||
|
||||
const mockClipboard = (copyIsSuccessful: boolean): jest.Mock => {
|
||||
const writeTextToClipboardSpy = jest.fn(() =>
|
||||
copyIsSuccessful ? Promise.resolve() : Promise.reject('mocked clipboard failed')
|
||||
copyIsSuccessful ? Promise.resolve() : Promise.reject(new Error('mocked clipboard failed'))
|
||||
)
|
||||
Object.assign(global.navigator, {
|
||||
clipboard: {
|
||||
|
|
|
@ -23,7 +23,11 @@ export const Redirect: React.FC<RedirectProps> = ({ to, replace }) => {
|
|||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
replace ? router.replace(to) : router.push(to)
|
||||
if (replace) {
|
||||
router.replace(to)
|
||||
} else {
|
||||
router.push(to)
|
||||
}
|
||||
}, [replace, router, to])
|
||||
|
||||
return (
|
||||
|
|
|
@ -32,6 +32,8 @@ export const UploadInput: React.FC<UploadInputProps> = ({ onLoad, allowedFileTyp
|
|||
}, [])
|
||||
|
||||
const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(
|
||||
// TODO Check and fix this
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
async (event) => {
|
||||
const fileInput = event.currentTarget
|
||||
if (!fileInput.files || fileInput.files.length < 1) {
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('fetch motd', () => {
|
|||
): jest.SpyInstance<Promise<Response>> => {
|
||||
return jest.spyOn(global, 'fetch').mockImplementation((url: RequestInfo | URL) => {
|
||||
if (url !== motdUrl) {
|
||||
return Promise.reject('wrong url')
|
||||
return Promise.reject(new Error('wrong url'))
|
||||
}
|
||||
return Promise.resolve(
|
||||
Mock.of<Response>({
|
||||
|
|
|
@ -39,7 +39,7 @@ export class AnchorNodePreprocessor extends TravelerNodeProcessor {
|
|||
|
||||
try {
|
||||
node.attribs.href = new URL(url, this.baseUrl).toString()
|
||||
} catch (e) {
|
||||
} catch {
|
||||
node.attribs.href = url
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ export class NodeToReactTransformer {
|
|||
* @return the created react element
|
||||
*/
|
||||
private translateElementToReactElement(element: Element, index: number | string): ValidReactDomElement {
|
||||
const elementKey = this.calculateUniqueKey(element).orElseGet(() => (-index).toString())
|
||||
const numericIndex = typeof index === 'number' ? index : Number.parseInt(index)
|
||||
const elementKey = this.calculateUniqueKey(element).orElseGet(() => (-numericIndex).toString())
|
||||
const replacement = this.findElementReplacement(element, elementKey)
|
||||
if (replacement === null) {
|
||||
return null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue