Skip to content

Commit

Permalink
Merge pull request #4928 from mozilla/dependabot/npm_and_yarn/eslint-…
Browse files Browse the repository at this point in the history
…cc3139cf36

Bump the eslint group with 2 updates
  • Loading branch information
groovecoder authored Aug 5, 2024
2 parents 1f29e6e + 3e69b65 commit 85bb47d
Show file tree
Hide file tree
Showing 11 changed files with 450 additions and 212 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
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@testing-library/user-event": "^14.5.2",
"@types/jest-axe": "^3.5.9",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^7.17.0",
"babel-jest": "^29.7.0",
"eslint": "^8.57.0",
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
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ const CustomMaskCreator = (props: CustomMaskCreatorProps) => {
event.preventDefault();

const isValid = isAddressValid(address);
isValid
? onPick(address.toLowerCase(), errorExplainerState.setOpen)
: errorExplainerState.setOpen(!isValid);
if (isValid) {
onPick(address.toLowerCase(), errorExplainerState.setOpen);
} else {
errorExplainerState.setOpen(!isValid);
}
};
const onChange: ChangeEventHandler<HTMLInputElement> = (event) => {
setAddress(event.target.value);
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
15 changes: 8 additions & 7 deletions frontend/src/pages/accounts/profile.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ const Profile: NextPage = () => {
setAliasGeneratedState(true);
}
addonData.sendEvent("aliasListUpdate");
} catch (error) {
} catch (_error) {
// TODO: Refactor CustomAddressGenerationModal to remove the setAliasGeneratedState callback, and instead use a try catch block.
setAliasGeneratedState
? setAliasGeneratedState(false)
: toast(l10n.getString("error-mask-create-failed"), { type: "error" });

if (setAliasGeneratedState) {
setAliasGeneratedState(false);
} else {
toast(l10n.getString("error-mask-create-failed"), { type: "error" });
}
// This is so we can catch the error when calling createAlias asynchronously and apply
// more logic to handle when generating a mask fails.
return Promise.reject("Mask generation failed");
Expand All @@ -209,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 @@ -228,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
Loading

0 comments on commit 85bb47d

Please sign in to comment.