Skip to content

Commit

Permalink
use caughtErrorsIgnorePattern option for unused error vars
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Aug 5, 2024
1 parent 9d9c44f commit 3e69b65
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
6 changes: 5 additions & 1 deletion frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ module.exports = {
// Unused vars that start with an understore are allowed to be unused:
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
// Weirdly this rule does not get set by ESLint's recommended ruleset,
// but we try to avoid implicitly casting values (see e.g. reviews of
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// with
// import Image from next/image;

import NextImage, { getImageProps } from "next/image";
import _NextImage, { getImageProps } from "next/image";
import { ComponentProps } from "react";
import styles from "./Image.module.scss";

export default function Image(props: ComponentProps<typeof NextImage>) {
export default function Image(props: ComponentProps<typeof _NextImage>) {
const altText = props.alt;
const { props: nextProps } = getImageProps({ ...props });
const { style, className: origClassName, ...delegated } = nextProps;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dashboard/FreeOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const FreeOnboarding = (props: Props) => {

try {
await props.generateNewMask({ mask_type: "random" });
} catch (e) {
} catch (_e) {
// On error, we can only move to the next step if the user has atleast 1 mask.
if (!props.hasAtleastOneMask) {
moveToNextStep = false;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/waitlist/WaitlistPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const WaitlistPage = (props: Props) => {
type: "error",
});
}
} catch (error) {
} catch (_error) {
toast(l10n.getString("waitlist-subscribe-error-connection"), {
type: "error",
});
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/accounts/profile.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const Profile: NextPage = () => {
setAliasGeneratedState(true);
}
addonData.sendEvent("aliasListUpdate");
} catch {
} catch (_error) {
// TODO: Refactor CustomAddressGenerationModal to remove the setAliasGeneratedState callback, and instead use a try catch block.
if (setAliasGeneratedState) {
setAliasGeneratedState(false);
Expand All @@ -210,7 +210,7 @@ const Profile: NextPage = () => {
"Immediately caught to land in the same code path as failed requests.",
);
}
} catch (error) {
} catch (_error) {
toast(
l10n.getString("error-mask-update-failed", {
alias: getFullAddress(alias),
Expand All @@ -229,7 +229,7 @@ const Profile: NextPage = () => {
);
}
addonData.sendEvent("aliasListUpdate");
} catch (error: unknown) {
} catch (_error: unknown) {
toast(
l10n.getString("error-mask-delete-failed", {
alias: getFullAddress(alias),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/accounts/settings.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const Settings: NextPage = () => {
// notify the add-on about it:
addonData.sendEvent("serverStorageChange");
}
} catch (e) {
} catch (_e) {
toast(l10n.getString("error-settings-update"), { type: "error" });
}
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/contains-tracker-warning.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function parseHash(hash: string): TrackerWarningData | null {
received_at: data.received_at,
original_link: data.original_link,
};
} catch (e) {
} catch (_e) {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/tracker-report.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function parseHash(hash: string): ReportData | null {
received_at: data.received_at,
trackers: data.trackers,
};
} catch (e) {
} catch (_e) {
return null;
}
}
Expand Down

0 comments on commit 3e69b65

Please sign in to comment.