chore: Remove console.log left in code and added eslint rule to prevent it happening again
This commit is contained in:
@@ -25,6 +25,7 @@ import Item, { Actions } from "~/components/List/Item";
|
||||
import Time from "~/components/Time";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import RevisionMenu from "~/menus/RevisionMenu";
|
||||
import Logger from "~/utils/Logger";
|
||||
import { documentHistoryUrl } from "~/utils/routeHelpers";
|
||||
|
||||
type Props = {
|
||||
@@ -109,7 +110,7 @@ const EventListItem = ({ event, latest, document, ...rest }: Props) => {
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn("Unhandled event: ", event.name);
|
||||
Logger.warn("Unhandled event", { event });
|
||||
}
|
||||
|
||||
if (!meta) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { pick } from "lodash";
|
||||
import { set, observable } from "mobx";
|
||||
import Logger from "~/utils/Logger";
|
||||
import { getFieldsForModel } from "./decorators/Field";
|
||||
|
||||
export default abstract class BaseModel {
|
||||
@@ -126,7 +127,7 @@ export default abstract class BaseModel {
|
||||
const attributes = this.toAPI();
|
||||
|
||||
if (Object.keys(attributes).length === 0) {
|
||||
console.warn("Checking dirty on model with no @Field decorators");
|
||||
Logger.warn("Checking dirty on model with no @Field decorators");
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -78,7 +78,6 @@ function AddGroupsToCollection(props: Props) {
|
||||
toasts.showToast(t("Could not add user"), {
|
||||
type: "error",
|
||||
});
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import * as Sentry from "@sentry/react";
|
||||
import env from "~/env";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user