Add prettier for codestyle and re-format everything (#1294)

This commit is contained in:
Erik Michelson 2021-06-06 23:14:00 +02:00 committed by GitHub
parent 8b78154075
commit 0aae1f70d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
319 changed files with 4809 additions and 3936 deletions

View file

@ -52,7 +52,10 @@ export const initialState: NoteDetails = {
}
}
export const NoteDetailsReducer: Reducer<NoteDetails, NoteDetailsAction> = (state: NoteDetails = initialState, action: NoteDetailsAction) => {
export const NoteDetailsReducer: Reducer<NoteDetails, NoteDetailsAction> = (
state: NoteDetails = initialState,
action: NoteDetailsAction
) => {
switch (action.type) {
case NoteDetailsActionType.SET_DOCUMENT_CONTENT:
return {
@ -94,7 +97,7 @@ const setCheckboxInMarkdownContent = (markdownContent: string, lineInMarkdown: n
if (results) {
const before = results[1]
const after = results[3]
lines[lineInMarkdown] = `${ before }[${ checked ? 'x' : ' ' }]${ after }`
lines[lineInMarkdown] = `${before}[${checked ? 'x' : ' '}]${after}`
return lines.join('\n')
}
return markdownContent
@ -103,11 +106,13 @@ const setCheckboxInMarkdownContent = (markdownContent: string, lineInMarkdown: n
const generateNoteTitle = (frontmatter: NoteFrontmatter, firstHeading?: string) => {
if (frontmatter?.title && frontmatter?.title !== '') {
return frontmatter.title.trim()
} else if (frontmatter?.opengraph && frontmatter?.opengraph.get('title') && frontmatter?.opengraph.get('title') !== '') {
} else if (
frontmatter?.opengraph &&
frontmatter?.opengraph.get('title') &&
frontmatter?.opengraph.get('title') !== ''
) {
return (frontmatter?.opengraph.get('title') ?? firstHeading ?? '').trim()
} else {
return (firstHeading ?? firstHeading ?? '').trim()
}
}