fix: code formatting

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-07-16 10:40:39 +02:00
parent ae9ec95a4e
commit 4d70ccafbc
13 changed files with 51 additions and 21 deletions

View file

@ -372,9 +372,9 @@ export class NotesService {
return {
id: note.publicId,
aliases: await Promise.all(
(
await note.aliases
).map((alias) => this.aliasService.toAliasDto(alias, note)),
(await note.aliases).map((alias) =>
this.aliasService.toAliasDto(alias, note),
),
),
primaryAddress: (await getPrimaryAlias(note)) ?? note.publicId,
title: latestRevision.title,

View file

@ -32,7 +32,7 @@ jest.mock(
...jest.requireActual('@hedgedoc/commons'),
// eslint-disable-next-line @typescript-eslint/naming-convention
YDocSyncServerAdapter: jest.fn(() => Mock.of<YDocSyncServerAdapter>({})),
} as Record<string, unknown>),
}) as Record<string, unknown>,
);
describe('websocket connection', () => {

View file

@ -143,9 +143,9 @@ export class RevisionsService {
anonymousAuthorCount: revisionUserInfo.anonymousUserCount,
patch: revision.patch,
edits: await Promise.all(
(
await revision.edits
).map(async (edit) => await this.editService.toEditDto(edit)),
(await revision.edits).map(
async (edit) => await this.editService.toEditDto(edit),
),
),
};
}

View file

@ -61,8 +61,12 @@ export class SessionService {
*/
fetchUsernameForSessionId(sessionId: string): Promise<Username | undefined> {
return new Promise((resolve, reject) => {
this.typeormStore.get(sessionId, (error?: Error, result?: SessionState) =>
error || !result ? reject(error) : resolve(result.username as Username),
this.typeormStore.get(
sessionId,
(error?: Error, result?: SessionState) =>
error || !result
? reject(error)
: resolve(result.username as Username),
);
});
}

View file

@ -11,7 +11,10 @@ import { ApiError } from './api-error'
export class ErrorToI18nKeyMapper {
private foundI18nKey: string | undefined = undefined
constructor(private apiError: Error, private i18nNamespace?: string) {}
constructor(
private apiError: Error,
private i18nNamespace?: string
) {}
public withHttpCode(code: number, i18nKey: string, treatAsAbsoluteKey?: boolean): this {
if (this.foundI18nKey === undefined && this.apiError instanceof ApiError && this.apiError.statusCode === code) {

View file

@ -16,7 +16,11 @@ const syncAnnotation = Annotation.define()
export class YTextSyncViewPlugin implements PluginValue {
private readonly observer: YTextSyncViewPlugin['onYTextUpdate']
constructor(private view: EditorView, private readonly yText: YText, pluginLoaded: () => void) {
constructor(
private view: EditorView,
private readonly yText: YText,
pluginLoaded: () => void
) {
this.observer = this.onYTextUpdate.bind(this)
this.yText.observe(this.observer)
pluginLoaded()

View file

@ -16,7 +16,11 @@ export class SendCursorViewPlugin implements PluginValue {
private lastCursor: SelectionRange | undefined
private listener?: Listener
constructor(private view: EditorView, private messageTransporter: MessageTransporter, private mayEdit: boolean) {
constructor(
private view: EditorView,
private messageTransporter: MessageTransporter,
private mayEdit: boolean
) {
if (mayEdit) {
this.listener = messageTransporter.doAsSoonAsReady(() => {
this.sendCursor(this.lastCursor)

View file

@ -40,10 +40,13 @@ export const useRealtimeConnection = (): MessageTransporter => {
const socket = new WebSocket(websocketUrl.toString())
socket.addEventListener('error', () => {
const timeout = WEBSOCKET_RECONNECT_INTERVAL + reconnectCount.current * 1000 + Math.random() * 1000
setTimeout(() => {
reconnectCount.current += 1
establishWebsocketConnection()
}, Math.max(timeout, WEBSOCKET_RECONNECT_MAX_DURATION))
setTimeout(
() => {
reconnectCount.current += 1
establishWebsocketConnection()
},
Math.max(timeout, WEBSOCKET_RECONNECT_MAX_DURATION)
)
})
socket.addEventListener('open', () => {
messageTransporter.setAdapter(new FrontendWebsocketAdapter(socket))

View file

@ -17,7 +17,10 @@ export interface CodeProps {
* Checks if the given checked node is a code block with a specific language attribute and creates an react-element that receives the code.
*/
export class CodeBlockComponentReplacer extends ComponentReplacer {
constructor(private component: FunctionComponent<CodeProps>, private language: string) {
constructor(
private component: FunctionComponent<CodeProps>,
private language: string
) {
super()
}

View file

@ -17,7 +17,10 @@ export interface IdProps {
* Replaces custom tags that have just an id (<app-something id="something"/>) with react elements.
*/
export class CustomTagWithIdComponentReplacer extends ComponentReplacer {
constructor(private component: FunctionComponent<IdProps>, private tagName: string) {
constructor(
private component: FunctionComponent<IdProps>,
private tagName: string
) {
super()
}

View file

@ -39,7 +39,10 @@ export abstract class WindowPostMessageCommunicator<
private readonly log: Logger
private readonly boundListener: (event: MessageEvent) => void
public constructor(private readonly uuid: string, private readonly targetOrigin: string) {
public constructor(
private readonly uuid: string,
private readonly targetOrigin: string
) {
this.boundListener = this.handleEvent.bind(this)
this.communicationEnabled = false
this.log = this.createLogger()

View file

@ -26,7 +26,10 @@ export interface QuoteExtraTagValues {
export class BlockquoteExtraTagMarkdownItPlugin {
private static readonly BlockquoteExtraTagRuleName = 'blockquote_extra_tag'
constructor(private tagName: string, private icon: BootstrapIconName) {}
constructor(
private tagName: string,
private icon: BootstrapIconName
) {}
/**
* Registers an inline rule that detects blockquote extra tags and replaces them with blockquote tokens.

View file

@ -13,7 +13,7 @@ jest.mock(
({
...jest.requireActual('@hedgedoc/commons'),
generateNoteTitle: () => 'generated title'
} as Record<string, unknown>)
}) as Record<string, unknown>
)
describe('build state from first heading update', () => {