Skip to content

Commit 5bdeed2

Browse files
committed
Fix all the lints
1 parent de95d88 commit 5bdeed2

31 files changed

+83
-77
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module.exports = {
4848
"@typescript-eslint/no-unused-vars": "off",
4949
"@typescript-eslint/no-var-requires": "off",
5050
"unused-imports/no-unused-imports-ts": "error",
51+
"@typescript-eslint/no-non-null-assertion": "off",
5152
"@typescript-eslint/ban-types": [
5253
"error",
5354
{

components/Layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface LayoutProps extends LayoutStaticProps {
3131
origin?: string;
3232
}
3333

34-
const DEFAULT_DESCRIPTION: string =
34+
const DEFAULT_DESCRIPTION =
3535
"Mission Bit is a 501(c)3 non-profit offering coding education and industry experiences to equip, empower and inspire public school youth to build products they dream up and broaden the opportunity horizon they envision for themselves.";
3636

3737
function updateDocumentSize() {
@@ -61,7 +61,7 @@ export const Layout: React.FC<LayoutProps> = ({
6161
// Remove the server-side injected CSS.
6262
const jssStyles = document.querySelector("#jss-server-side");
6363
if (jssStyles) {
64-
jssStyles.parentElement!.removeChild(jssStyles);
64+
jssStyles.parentElement?.removeChild(jssStyles);
6565
}
6666
}, []);
6767
useEffect(() => {

components/bridge/BridgeDates.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const BridgeCalendarEvent: CalendarEvent = {
1010
url: absoluteUrl("/bridge"),
1111
};
1212

13-
export function bridgeStartEnd() {
13+
export function bridgeStartEnd(): ReturnType<typeof hourStartEndParts> {
1414
const start = Date.parse(BridgeCalendarEvent.start);
1515
const end = Date.parse(BridgeCalendarEvent.end!);
1616
return hourStartEndParts(start, end);

components/donate/SectionHeading.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ const Typography = withStyles((theme) => ({
1414
},
1515
}))(BaseTypography);
1616

17-
export const SectionHeading: React.FC<Omit<
18-
TypographyProps<"h2">,
19-
"component" | "variant"
20-
>> = (props) => <Typography {...props} variant="h2" />;
17+
export const SectionHeading: React.FC<
18+
Omit<TypographyProps<"h2">, "component" | "variant">
19+
> = (props) => <Typography {...props} variant="h2" />;
2120

2221
export default SectionHeading;

components/gala/GalaDates.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const GalaCalendarEvent: CalendarEvent = {
1010
url: absoluteUrl("/gala"),
1111
};
1212

13-
export function galaStartEnd() {
13+
export function galaStartEnd(): ReturnType<typeof hourStartEndParts> {
1414
const start = Date.parse(GalaCalendarEvent.start);
1515
const end = Date.parse(GalaCalendarEvent.end!);
1616
return hourStartEndParts(start, end);

components/gala/brands/AdobePdfLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const AdobePdfLogo = (props: SvgIconProps) => (
4+
const AdobePdfLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 384 512" {...props}>
66
<path d="M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16zm-22-171.2c-13.5-13.3-55-9.2-73.7-6.7-21.2-12.8-35.2-30.4-45.1-56.6 4.3-18 12-47.2 6.4-64.9-4.4-28.1-39.7-24.7-44.6-6.8-5 18.3-.3 44.4 8.4 77.8-11.9 28.4-29.7 66.9-42.1 88.6-20.8 10.7-54.1 29.3-58.8 52.4-3.5 16.8 22.9 39.4 53.1 6.4 9.1-9.9 19.3-24.8 31.3-45.5 26.7-8.8 56.1-19.8 82-24 21.9 12 47.6 19.9 64.6 19.9 27.7.1 28.9-30.2 18.5-40.6zm-229.2 89c5.9-15.9 28.6-34.4 35.5-40.8-22.1 35.3-35.5 41.5-35.5 40.8zM180 175.5c8.7 0 7.8 37.5 2.1 47.6-5.2-16.3-5-47.6-2.1-47.6zm-28.4 159.3c11.3-19.8 21-43.2 28.8-63.7 9.7 17.7 22.1 31.7 35.1 41.5-24.3 4.7-45.4 15.1-63.9 22.2zm153.4-5.9s-5.8 7-43.5-9.1c41-3 47.7 6.4 43.5 9.1z" />
77
</SvgIcon>

components/gala/brands/AppleLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const AppleLogo = (props: SvgIconProps) => (
4+
const AppleLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 384 512" {...props}>
66
<path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z" />
77
</SvgIcon>

components/gala/brands/GoogleLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const GoogleLogo = (props: SvgIconProps) => (
4+
const GoogleLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 488 512" {...props}>
66
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
77
</SvgIcon>

components/gala/brands/OutlookLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const OutlookLogo = (props: SvgIconProps) => (
4+
const OutlookLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 103.17322 104.31332" {...props}>
66
<path d="m 64.566509,22.116383 v 20.404273 l 7.130526,4.489881 c 0.188058,0.05485 0.595516,0.05877 0.783574,0 L 103.16929,26.320259 c 0,-2.44867 -2.28412,-4.203876 -3.573094,-4.203876 H 64.566509 z" />
77
<path d="m 64.566509,50.13308 6.507584,4.470291 c 0.916782,0.673874 2.021622,0 2.021622,0 -1.100922,0.673874 30.077495,-20.035993 30.077495,-20.035993 v 37.501863 c 0,4.082422 -2.61322,5.794531 -5.551621,5.794531 H 64.562591 V 50.13308 z" />

components/gala/brands/WindowsLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const WindowsLogo = (props: SvgIconProps) => (
4+
const WindowsLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 448 512" {...props}>
66
<path d="M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z" />
77
</SvgIcon>

components/gala/brands/YahooLogo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const YahooLogo = (props: SvgIconProps) => (
4+
const YahooLogo = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 2000 1333" {...props}>
66
<g transform="translate(0,1333) scale(0.1,-0.1)">
77
<path

components/icons/ArrowRightIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const points = [
2323
p(xMid, yMax),
2424
].join(" ");
2525

26-
const ArrowRightIcon = (props: SvgIconProps) => (
26+
const ArrowRightIcon = (props: SvgIconProps): JSX.Element => (
2727
<SvgIcon viewBox="-50 -50 100 100" {...props}>
2828
<polyline
2929
points={points}

components/icons/Asterisk.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Scale = 100;
77
const IconScale = Scale / Math.max(IconWidth, IconHeight);
88
const viewBox = `${-0.5 * Scale} ${-0.5 * Scale} ${Scale} ${Scale}`;
99

10-
const AsteriskIcon = (props: SvgIconProps) => (
10+
const AsteriskIcon = (props: SvgIconProps): JSX.Element => (
1111
<SvgIcon viewBox={viewBox} {...props}>
1212
<InlineAsteriskIcon />
1313
</SvgIcon>
@@ -18,7 +18,9 @@ const AsteriskTransform = [
1818
`translate(${-0.5 * IconWidth} ${-0.5 * IconHeight})`,
1919
].join(" ");
2020

21-
export const InlineAsteriskIcon = (props: React.SVGProps<SVGGElement>) => {
21+
export const InlineAsteriskIcon = (
22+
props: React.SVGProps<SVGGElement>
23+
): JSX.Element => {
2224
const transform = [props.transform, AsteriskTransform]
2325
.filter((x) => x !== undefined)
2426
.join(" ");

components/icons/CarouselLeft.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const CarouselLeftIcon = (props: SvgIconProps) => (
4+
const CarouselLeftIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="-50 -50 100 100" {...props}>
66
<polyline
77
stroke="currentColor"

components/icons/CarouselRight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const CarouselRightIcon = (props: SvgIconProps) => (
4+
const CarouselRightIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="-50 -50 100 100" {...props}>
66
<polyline
77
stroke="currentColor"

components/icons/Check.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const CheckIcon = (props: SvgIconProps) => (
4+
const CheckIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 100 100" {...props}>
66
<g transform="translate(0,-952.36218)">
77
<path

components/icons/ExpandMore.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const ExpandMoreIcon = (props: SvgIconProps) => (
4+
const ExpandMoreIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="-50 -50 100 100" {...props}>
66
<polyline
77
stroke="currentColor"

components/icons/FormatQuote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const FormatQuoteIcon = (props: SvgIconProps) => (
4+
const FormatQuoteIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 18 18" {...props}>
66
<path d="M9.66,7.45A2.55,2.55,0,0,1,11,4.13c2.17-.74,3.47,0,3.82,1.22.8,2.66-1.09,7.6-2.59,8.82l-1.54-.77L12.5,8.78S10.15,9.17,9.66,7.45Zm-6.5,0A2.54,2.54,0,0,1,4.49,4.13c2.17-.74,3.46,0,3.85,1.22C9.11,8,7.22,13,5.71,14.17L4.17,13.4,6,8.78S3.65,9.17,3.16,7.45Z" />
77
</SvgIcon>

components/icons/Pin.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import SvgIcon, { SvgIconProps } from "@material-ui/core/SvgIcon";
33

4-
const PinIcon = (props: SvgIconProps) => (
4+
const PinIcon = (props: SvgIconProps): JSX.Element => (
55
<SvgIcon viewBox="0 0 100 100" {...props}>
66
<path
77
d="M50,2.5c-18.1,0-32.8,14-32.8,31.2c0,7.1,2.5,13.9,7.1,19.3L50,83.8L75.8,53c4.6-5.4,7.1-12.3,7.1-19.3

pages/_document.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import IEWarning from "components/IEWarning";
66
// This is required to set up the stylesheets for Material-UI
77

88
export default class MyDocument extends Document {
9-
render() {
9+
render(): JSX.Element {
1010
return (
1111
<Html lang="en">
1212
<Head />

pages/api/balance-transactions.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next";
1+
import { NextApiHandler } from "next";
22
import getBalanceModifications from "src/googleBalanceModifications";
33
import getBalanceTransactions from "src/stripeBalanceTransactions";
44

@@ -11,10 +11,7 @@ function parseCreated(
1111
return parseInt(created, 10);
1212
}
1313

14-
export default async function handler(
15-
req: NextApiRequest,
16-
res: NextApiResponse
17-
) {
14+
const handler: NextApiHandler = async (req, res) => {
1815
if (req.method === "GET") {
1916
const created = parseCreated(req.query.created);
2017
if (created === undefined) {
@@ -35,4 +32,6 @@ export default async function handler(
3532
res.setHeader("Allow", "POST");
3633
res.status(405).end("Method Not Allowed");
3734
}
38-
}
35+
};
36+
37+
export default handler;

pages/api/cancel-subscription.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next";
1+
import { NextApiHandler } from "next";
22
import getStripe from "src/getStripe";
33

44
const stripe = getStripe();
@@ -15,10 +15,7 @@ function parseBody(body: unknown): PostBody | undefined {
1515
return typeof id === "string" ? { id } : undefined;
1616
}
1717

18-
export default async function handler(
19-
req: NextApiRequest,
20-
res: NextApiResponse
21-
) {
18+
const handler: NextApiHandler = async (req, res) => {
2219
if (req.method === "POST") {
2320
try {
2421
const body = parseBody(req.body);
@@ -36,4 +33,6 @@ export default async function handler(
3633
res.setHeader("Allow", "POST");
3734
res.status(405).end("Method Not Allowed");
3835
}
39-
}
36+
};
37+
38+
export default handler;

pages/api/checkout-sessions.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next";
1+
import { NextApiHandler } from "next";
22
import Stripe from "stripe";
33
import getStripe from "src/getStripe";
44
import { Frequency, FREQUENCIES } from "src/stripeHelpers";
@@ -90,10 +90,7 @@ function session_args(
9090
}
9191
}
9292

93-
export default async function handler(
94-
req: NextApiRequest,
95-
res: NextApiResponse
96-
) {
93+
const handler: NextApiHandler = async (req, res) => {
9794
if (req.method === "POST") {
9895
try {
9996
const body = parseBody(req.body);
@@ -121,4 +118,6 @@ export default async function handler(
121118
res.setHeader("Allow", "POST");
122119
res.status(405).end("Method Not Allowed");
123120
}
124-
}
121+
};
122+
123+
export default handler;

pages/api/webhook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next";
1+
import { NextApiHandler } from "next";
22
import Stripe from "stripe";
33
import getStripe from "src/getStripe";
44
import getStripeKey from "src/getStripeKey";
@@ -63,7 +63,7 @@ export const config = {
6363
},
6464
};
6565

66-
export async function handler(req: NextApiRequest, res: NextApiResponse) {
66+
const handler: NextApiHandler = async (req, res) => {
6767
let event: Stripe.Event;
6868
try {
6969
const sig = req.headers["stripe-signature"];
@@ -83,7 +83,7 @@ export async function handler(req: NextApiRequest, res: NextApiResponse) {
8383
const handleEvent = HANDLERS[event.type] ?? defaultHandler;
8484
await handleEvent(event);
8585
res.status(200).json({ received: true });
86-
}
86+
};
8787

8888
export default Cors({
8989
allowMethods: ["POST", "HEAD"],

src/absoluteUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function getOrigin(origin?: string): string {
1212
return process.env.URL?.replace(/\/$/, "") ?? defaultOrigin;
1313
}
1414

15-
export function absoluteUrl(pathOrUrl: string, origin?: string) {
15+
export function absoluteUrl(pathOrUrl: string, origin?: string): string {
1616
return pathOrUrl.startsWith("/")
1717
? `${getOrigin(origin)}${pathOrUrl}`
1818
: pathOrUrl;

src/buttonStyles.tsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
import { Theme, darken } from "@material-ui/core/styles";
22

3-
export const buttonStyles = (color: string) => (theme: Theme) => ({
4-
outlined: {
5-
color,
6-
border: `2px solid ${color}`,
7-
"&:hover": {
3+
export const buttonStyles = (color: string) => (theme: Theme) =>
4+
({
5+
outlined: {
6+
color,
87
border: `2px solid ${color}`,
9-
backgroundColor: color,
10-
color: theme.palette.common.white,
11-
},
12-
},
13-
contained: {
14-
color: theme.palette.common.white,
15-
backgroundColor: color,
16-
"&:hover": {
17-
backgroundColor: darken(color, 0.2),
18-
// Reset on touch devices, it doesn't add specificity
19-
"@media (hover: none)": {
8+
"&:hover": {
9+
border: `2px solid ${color}`,
2010
backgroundColor: color,
11+
color: theme.palette.common.white,
12+
},
13+
},
14+
contained: {
15+
color: theme.palette.common.white,
16+
backgroundColor: color,
17+
"&:hover": {
18+
backgroundColor: darken(color, 0.2),
19+
// Reset on touch devices, it doesn't add specificity
20+
"@media (hover: none)": {
21+
backgroundColor: color,
22+
},
2123
},
2224
},
23-
},
24-
});
25+
} as const);
2526

2627
export default buttonStyles;

src/oneLine.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
function oneLine(strs: TemplateStringsArray, ...placeholders: unknown[]) {
1+
function oneLine(
2+
strs: TemplateStringsArray,
3+
...placeholders: unknown[]
4+
): string {
25
// Build the string as normal, combining all the strings and placeholders:
36
let result = "";
47
let i = 0;

0 commit comments

Comments
 (0)