chore: Remove console.log left in code and added eslint rule to prevent it happening again

This commit is contained in:
Tom Moor
2023-04-11 22:15:52 -04:00
parent a9800165c1
commit 49d903d6d4
19 changed files with 59 additions and 47 deletions

View File

@@ -8,6 +8,7 @@ import useComponentSize from "~/hooks/useComponentSize";
import useEventListener from "~/hooks/useEventListener";
import useMediaQuery from "~/hooks/useMediaQuery";
import useViewportHeight from "~/hooks/useViewportHeight";
import Logger from "~/utils/Logger";
import { useEditor } from "./EditorContext";
type Props = {
@@ -63,7 +64,7 @@ function usePosition({
fromPos = view.coordsAtPos(selection.from);
toPos = view.coordsAtPos(selection.to, -1);
} catch (err) {
console.warn(err);
Logger.warn("Unable to calculate selection position", err);
return defaultPosition;
}

View File

@@ -17,6 +17,7 @@ import { ResizingHeightContainer } from "~/components/ResizingHeightContainer";
import Scrollable from "~/components/Scrollable";
import { Dictionary } from "~/hooks/useDictionary";
import { ToastOptions } from "~/types";
import Logger from "~/utils/Logger";
import Input from "./Input";
import LinkSearchResult from "./LinkSearchResult";
import ToolbarButton from "./ToolbarButton";
@@ -223,8 +224,8 @@ class LinkEditor extends React.Component<Props, State> {
},
previousValue: trimmedValue,
}));
} catch (error) {
console.error(error);
} catch (err) {
Logger.error("Error searching for link", err);
}
}
};

View File

@@ -16,6 +16,7 @@ import { Portal } from "~/components/Portal";
import Scrollable from "~/components/Scrollable";
import useDictionary from "~/hooks/useDictionary";
import useToasts from "~/hooks/useToasts";
import Logger from "~/utils/Logger";
import { useEditor } from "./EditorContext";
import Input from "./Input";
@@ -99,7 +100,7 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
fromPos = view.coordsAtPos(selection.from);
toPos = view.coordsAtPos(selection.to, -1);
} catch (err) {
console.warn(err);
Logger.warn("Unable to calculate caret position", err);
return {
top: 0,
bottom: 0,