Skip to content

Commit

Permalink
fix: eslint issue by using eslint-disable (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline authored Oct 31, 2023
2 parents fd6f447 + 566eb55 commit bc285a2
Show file tree
Hide file tree
Showing 38 changed files with 50 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{
"groups": ["builtin", "external", "internal", "object", "type", "index", "parent", "sibling"]
}
]
],
"no-console": "error"
}
}
1 change: 1 addition & 0 deletions components/ListHeader/list-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ListHeader = ({ name, isPublic, listId, isOwner, numberOfContributors }: L
await navigator.clipboard.writeText(url);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down
1 change: 1 addition & 0 deletions components/atoms/Avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Avatar = (props: AvatarProps): JSX.Element => {
? cachedImage(props.avatarURL as string, process.env.NEXT_PUBLIC_CLOUD_NAME)
: props.avatarURL;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TopContributorCard = ({ login, refreshLoggedInUser }: TopContributorCardPr
await unFollow();
refreshLoggedInUser();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ const ContributorHighlightCard = ({
await navigator.clipboard.writeText(url);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down Expand Up @@ -366,6 +367,7 @@ const ContributorHighlightCard = ({
document.body.setAttribute("style", "pointer-events:auto !important");
}, 1);
} else {
// eslint-disable-next-line no-console
console.error(res);
setAlertOpen(false);
toast({ description: "An error occured!", variant: "danger" });
Expand Down Expand Up @@ -409,6 +411,7 @@ const ContributorHighlightCard = ({
setTaggedRepoList(newTaggedRepoList);
toast({ description: "Repo tag added!", title: "Success", variant: "success" });
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
setError("An error occured!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const ContributorProfileHeader = ({
await navigator.clipboard.writeText(url);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E
setHighlightSuggestions(pages);
setLoadingSuggestions(false);
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
}
};
Expand Down
1 change: 1 addition & 0 deletions components/molecules/InsightHeader/insight-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const InsightHeader = ({ insight, repositories, insightId, isOwner }: InsightHea
await navigator.clipboard.writeText(url);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down
1 change: 1 addition & 0 deletions components/molecules/NewsletterForm/newsletter-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const NewsletterForm = () => {
setIsSubscribed(true);
}
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
} finally {
setLoading(false);
Expand Down
1 change: 1 addition & 0 deletions components/molecules/StackedAvatar/stacked-avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const StackedAvatar = ({ contributors, visibleQuantity = 5, classNames }: Stacke
const repositories = insight ? insight.repos.map((repo) => repo.repo_id) : [];

if (isError) {
// eslint-disable-next-line no-console
console.log("Error fetching insight", isError);
return <div>-</div>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const StripeCheckoutButton = ({ children, ...props }: StripeCheckoutButtonProps)
stripe?.redirectToCheckout({ sessionId });
} else {
// display error to user
// eslint-disable-next-line no-console
console.error(response.statusText);
}
} catch (e) {
Expand Down
2 changes: 2 additions & 0 deletions generate-netlify-env.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */

const fs = require("fs");

// check if script is running in netlify CI
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/deleteHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const deleteHighlight = async (id: string) => {
throw error;
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
return false;
}
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/fetchDevToBlogInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const fetchDevToBlogInfo = async (blogLink: string) => {
isError: null,
};
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);

return {
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/fetchGithubIssueInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const fetchGithubIssueInfo = async (orgName: string | null, repoName: string | n
isError: null,
};
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);

return {
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/fetchGithubOrgTeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const fetchGithubOrgTeams = async (orgName: string | null) => {
isError: null,
};
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);

return {
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/fetchGithubPRInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const fetchGithubPRInfo = async (orgName: string | null, repoName: string | null
isError: null,
};
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);

return {
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/fetchGithubTeamMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const fetchGithubOrgTeamMembers = async (orgName: string, teamSlug: string) => {
isError: null,
};
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);

return {
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/updateHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const updateHighlights = async (data: CreateHighlightsProps, id: string) => {
}
return res.json();
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/hooks/useFollowUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const useFollowUser = (username: string) => {
headers: {
Authorization: `Bearer ${sessionToken}`,
},
// eslint-disable-next-line no-console
}).catch((err) => console.log(err));

if (req && req.ok) {
Expand All @@ -34,6 +35,7 @@ const useFollowUser = (username: string) => {
headers: {
Authorization: `Bearer ${sessionToken}`,
},
// eslint-disable-next-line no-console
}).catch((err) => console.log(err));

if (req && req.ok) {
Expand Down
2 changes: 2 additions & 0 deletions lib/hooks/useInsightMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const useInsightMembers = (insightId: number) => {
});

if (!req.ok) {
// eslint-disable-next-line no-console
console.log(req.status, req.statusText);
return undefined;
} else {
Expand All @@ -45,6 +46,7 @@ const useInsightMembers = (insightId: number) => {
});

if (!req.ok) {
// eslint-disable-next-line no-console
console.log(req.status, req.statusText);

return undefined;
Expand Down
1 change: 1 addition & 0 deletions lib/hooks/useList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const addListContributor = async (listId: string, contributors: number[]) => {
};
}
} catch (error: any) {
// eslint-disable-next-line no-console
console.log(error);
return {
data: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/useUserConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const useUserConnections = () => {
} else {
toast({ description: response.message, title: "Error", variant: "danger" });
}

// eslint-disable-next-line no-console
console.log(response.message);
}
}
Expand Down
2 changes: 2 additions & 0 deletions lib/hooks/useUserHighlightReactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const useUserHighlightReactions = (id: string) => {
headers: {
Authorization: `Bearer ${sessionToken}`,
},
// eslint-disable-next-line no-console
}).catch((err) => console.log(err));
if (req && req.ok) {
mutate();
Expand All @@ -28,6 +29,7 @@ const useUserHighlightReactions = (id: string) => {
headers: {
Authorization: `Bearer ${sessionToken}`,
},
// eslint-disable-next-line no-console
}).catch((err) => console.log(err));
if (req && req.ok) {
mutate();
Expand Down
1 change: 1 addition & 0 deletions lib/utils/copy-to-clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const copyToClipboard = async (content: string) => {
try {
await navigator.clipboard.writeText(content);
} catch (error) {
// eslint-disable-next-line no-console
console.log("This browser does not support the clipboard.", error);
}
};
1 change: 1 addition & 0 deletions lib/utils/fetch-social-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const fetchSocialCard = async (endpoint: string) => {
return ogReq.headers.get("x-amz-meta-location");
} catch (e) {
// This is to prevent the page from crashing if the social card is not generated for some reasons.
// eslint-disable-next-line no-console
console.error(e);
return "";
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/generate-blog-highlight-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const generateBlogHighlightSummary = async (blogTitle: string, blogMarkdown: str
return null;
}
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
return null;
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/generate-issue-highlight-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const generateIssueHighlightSummary = async (issueTitle: string, issueBody: stri
return null;
}
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
return null;
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/generate-pr-highlight-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const generatePrHighlightSummaryByCommitMsg = async (commitMessages: stri
return null;
}
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const getPullRequestCommitMessageFromUrl = async (url: string): Promise<string[]
},
});
const data = await response.json();

// eslint-disable-next-line no-console
console.log(sessionResponse);

if (Array.isArray(data?.commits)) {
Expand Down
1 change: 1 addition & 0 deletions lib/utils/public-api-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const publicApiFetcher: Fetcher = async (apiUrl: string) => {

error.message = `${res.status} ${res.statusText}`;
error.stack = JSON.stringify(await res.json());
// eslint-disable-next-line no-console
console.error(error);

throw error;
Expand Down
4 changes: 4 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if (typeof window !== "undefined" && "serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
if (registration.active) {
// eslint-disable-next-line no-console
console.log(`Clearing service worker ${registration.scope}`);
registration.unregister();
document.location.reload();
Expand Down Expand Up @@ -98,6 +99,7 @@ function MyApp({ Component, pageProps }: ComponentWithPageLayout) {

function localStorageProvider() {
if (typeof window !== "undefined") {
// eslint-disable-next-line no-console
console.log("You are on the browser");

// When initializing, we restore the data from `localStorage` into a map.
Expand All @@ -110,6 +112,7 @@ function MyApp({ Component, pageProps }: ComponentWithPageLayout) {
localStorage.setItem("app-cache", appCache);
} catch (error) {
if (error instanceof Error && error.name === "QuotaExceededError")
// eslint-disable-next-line no-console
return console.warn("⚠ local storage limit exceeded ⚠");

throw error;
Expand All @@ -119,6 +122,7 @@ function MyApp({ Component, pageProps }: ComponentWithPageLayout) {
// We still use the map for write & read for performance.
return map;
} else {
// eslint-disable-next-line no-console
console.log("You are on the server");
// 👉️ can't use localStorage

Expand Down
1 change: 1 addition & 0 deletions pages/api/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)

res.json({ access: orgInfo.usage });
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
res.status(401).json({ error: "No Access" });
}
Expand Down
2 changes: 2 additions & 0 deletions pages/hub/lists/find.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const NewListCreationPage = ({ initialData, timezoneOption }: NewListCreationPag
setIsSuccess(true);
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
setCreateLoading(false);
Expand Down Expand Up @@ -211,6 +212,7 @@ const NewListCreationPage = ({ initialData, timezoneOption }: NewListCreationPag
await navigator.clipboard.writeText(url);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
Expand Down
1 change: 1 addition & 0 deletions pages/hub/lists/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const ListsHub: WithPageLayout = () => {
}
} catch (err) {
setIsDeleteOpen(false);
// eslint-disable-next-line no-console
console.log(err);
toast({ description: "An error occurred while deleting the list", variant: "danger" });
} finally {
Expand Down
1 change: 1 addition & 0 deletions pages/hub/lists/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const CreateListPage = () => {
return data;
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions pages/start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@ const LoginStep3: React.FC<LoginStep3Props> = ({ interests, user }) => {
router.push(`/user/${user?.user_metadata.user_name}`);
} else {
setLoading(false);
// eslint-disable-next-line no-console
console.error("Error onboarding user");
}
} catch (e) {
setLoading(false);
// eslint-disable-next-line no-console
console.error(e);
}
};
Expand Down
1 change: 1 addition & 0 deletions pages/user/[username]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export async function handleUserSSR({ params }: GetServerSidePropsContext<{ user

return (await req.json()) as DbUser;
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
return null;
}
Expand Down

0 comments on commit bc285a2

Please sign in to comment.