chore: Enable eslint to enforce curly (#3060)

This commit is contained in:
Tom Moor
2022-02-05 10:15:40 -08:00
committed by GitHub
parent c7df74fcc4
commit c5a11fe17b
103 changed files with 1175 additions and 397 deletions

View File

@@ -6,14 +6,20 @@ export default function backspaceToParagraph(type: NodeType) {
const { $from, from, to, empty } = state.selection;
// if the selection has anything in it then use standard delete behavior
if (!empty) return null;
if (!empty) {
return null;
}
// check we're in a matching node
if ($from.parent.type !== type) return null;
if ($from.parent.type !== type) {
return null;
}
// check if we're at the beginning of the heading
const $pos = state.doc.resolve(from - 1);
if ($pos.parent === $from.parent) return null;
if ($pos.parent === $from.parent) {
return null;
}
// okay, replace it with a paragraph
dispatch(

View File

@@ -48,7 +48,9 @@ const createAndInsertLink = async function (
const url = await onCreateLink(title);
const result = findPlaceholderLink(view.state.doc, href);
if (!result) return;
if (!result) {
return;
}
dispatch(
view.state.tr
@@ -65,7 +67,9 @@ const createAndInsertLink = async function (
);
} catch (err) {
const result = findPlaceholderLink(view.state.doc, href);
if (!result) return;
if (!result) {
return;
}
dispatch(
view.state.tr.removeMark(

View File

@@ -25,7 +25,9 @@ const insertFiles = function (
): void {
// filter to only include image files
const images = files.filter((file) => /image/i.test(file.type));
if (images.length === 0) return;
if (images.length === 0) {
return;
}
const {
dictionary,
@@ -47,7 +49,9 @@ const insertFiles = function (
event.preventDefault();
// let the user know we're starting to process the images
if (onImageUploadStart) onImageUploadStart();
if (onImageUploadStart) {
onImageUploadStart();
}
const { schema } = view.state;

View File

@@ -8,15 +8,21 @@ export default function splitHeading(type: NodeType) {
const { $from, from, $to, to } = state.selection;
// check we're in a matching heading node
if ($from.parent.type !== type) return false;
if ($from.parent.type !== type) {
return false;
}
// check that the caret is at the end of the content, if it isn't then
// standard node splitting behaviour applies
const endPos = $to.after() - 1;
if (endPos !== to) return false;
if (endPos !== to) {
return false;
}
// If the node isn't collapsed standard behavior applies
if (!$from.parent.attrs.collapsed) return false;
if (!$from.parent.attrs.collapsed) {
return false;
}
// Find the next visible block after this one. It takes into account nested
// collapsed headings and reaching the end of the document