Fix a few linter warnings.

new-frontend
Icedream 2023-01-09 02:33:50 +01:00
parent 9cc30c6ac4
commit eb34381d2f
Signed by: icedream
GPG Key ID: 468BBEEBB9EC6AEA
13 changed files with 66 additions and 52 deletions

View File

@ -9,22 +9,32 @@ export default function Runner({ runner }: { runner: RunnerInformation }) {
<span className="mr-3 text-nowrap"> <span className="mr-3 text-nowrap">
<span className="mr-1">{runner.name}</span> <span className="mr-1">{runner.name}</span>
<sup> <sup>
{runner.platform === 'TWITCH' && runner.stream.length > 0 ? <a href={runner.stream}> {runner.platform === 'TWITCH' && runner.stream.length > 0 ? (
<FontAwesomeIcon icon={["fab", "twitch"]} className={['mr-1', style.twitch].join(' ')} /> <a href={runner.stream}>
</a> : ''} <FontAwesomeIcon icon={['fab', 'twitch']} className={['mr-1', style.twitch].join(' ')} />
{runner.platform === 'FACEBOOK' && runner.stream.length > 0 ? <a href={runner.stream}> </a>
<FontAwesomeIcon icon={["fab", "facebook"]} className={['mr-1', style.facebook].join(' ')} /> ) : ''}
</a> : ''} {runner.platform === 'FACEBOOK' && runner.stream.length > 0 ? (
{runner.platform === 'YOUTUBE' && runner.stream.length > 0 ? <a href={runner.stream}> <a href={runner.stream}>
<FontAwesomeIcon icon={["fab", "youtube"]} className={['mr-1', style.youtube].join(' ')} /> <FontAwesomeIcon icon={['fab', 'facebook']} className={['mr-1', style.facebook].join(' ')} />
</a> : ''} </a>
{runner.twitter && runner.twitter.length > 0 ? <a href={`https://twitter.com/${runner.twitter}`}> ) : ''}
<FontAwesomeIcon icon={["fab", "twitter"]} className={['mr-1', style.twitter].join(' ')} /> {runner.platform === 'YOUTUBE' && runner.stream.length > 0 ? (
</a> : ''} <a href={runner.stream}>
{runner.youtube && runner.youtube.length > 0 ? <a href={`https://youtube.com/${runner.youtube}`}> <FontAwesomeIcon icon={['fab', 'youtube']} className={['mr-1', style.youtube].join(' ')} />
<FontAwesomeIcon icon={["fab", "youtube"]} className={['mr-1', style.youtube].join(' ')} /> </a>
</a> : ''} ) : ''}
{runner.twitter && runner.twitter.length > 0 ? (
<a href={`https://twitter.com/${runner.twitter}`}>
<FontAwesomeIcon icon={['fab', 'twitter']} className={['mr-1', style.twitter].join(' ')} />
</a>
) : ''}
{runner.youtube && runner.youtube.length > 0 ? (
<a href={`https://youtube.com/${runner.youtube}`}>
<FontAwesomeIcon icon={['fab', 'youtube']} className={['mr-1', style.youtube].join(' ')} />
</a>
) : ''}
</sup> </sup>
</span> </span>
) );
} }

View File

@ -20,7 +20,7 @@ import { Spinner } from 'react-bootstrap';
import { isPolyfillPhaseDone } from 'util/localization'; import { isPolyfillPhaseDone } from 'util/localization';
export default function WrapReactIntl<P>(Component: React.ComponentType<P>) { export default function WrapReactIntl<P>(Component: React.ComponentType<P>) {
return (props: P) => { return function (props: P) {
if (!isPolyfillPhaseDone()) { if (!isPolyfillPhaseDone()) {
return ( return (
<Spinner <Spinner

View File

@ -16,9 +16,9 @@
*/ */
import * as React from 'react'; import * as React from 'react';
import Error from "./_error"; import Error from './_error';
const Error404Page = () => ( function Error404Page() {
<Error statusCode={404} /> return <Error statusCode={404} />;
) }
export default Error404Page; export default Error404Page;

View File

@ -43,7 +43,9 @@ interface VideoListPageProps {
runners?: RunnerList, runners?: RunnerList,
} }
export const getServerSideProps: GetServerSideProps<VideoListPageProps> = async ({ params: { id } }) => { export const getServerSideProps: GetServerSideProps<VideoListPageProps> = async ({
params: { id },
}) => {
// Fetch URL to thumbnails server // Fetch URL to thumbnails server
const { const {
ids, ids,
@ -94,14 +96,14 @@ export const getServerSideProps: GetServerSideProps<VideoListPageProps> = async
}; };
}; };
const VideoListPage: NextPage<VideoListPageProps> = ({ const VideoListPage: NextPage<VideoListPageProps> = function VideoListPage({
id, id,
lastUpdatedAt, lastUpdatedAt,
thumbnailServerURL, thumbnailServerURL,
title, title,
videos, videos,
runners, runners,
}) => { }) {
if (!id) { if (!id) {
return notFound(); return notFound();
} }

View File

@ -21,10 +21,10 @@ import Head from 'next/head';
import * as React from 'react'; import * as React from 'react';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
const Error: NextPage<ErrorProps> = ({ const Error: NextPage<ErrorProps> = function Error({
statusCode, statusCode,
title, title,
}) => { }) {
const intl = useIntl(); const intl = useIntl();
return ( return (
<div> <div>
@ -46,14 +46,16 @@ const Error: NextPage<ErrorProps> = ({
<h1>{statusCode} {title}</h1> <h1>{statusCode} {title}</h1>
</p> </p>
</div> </div>
) );
} };
Error.getInitialProps = (ctx) => { Error.getInitialProps = (ctx) => {
const { res, err } = ctx; const { res, err } = ctx;
const statusCode = res ? res.statusCode : err ? err.statusCode : 404; // eslint-disable-next-line no-nested-ternary
const title = res ? res.statusMessage : err ? err.message : "Page not found"; const statusCode = res ? res.statusCode : (err ? err.statusCode : 404);
return { statusCode, title } // eslint-disable-next-line no-nested-ternary
} const title = res ? res.statusMessage : (err ? err.message : 'Page not found');
return { statusCode, title };
};
export default Error export default Error;

View File

@ -37,7 +37,7 @@ export const getServerSideProps: GetServerSideProps<HomeProps> = async () => ({
index: await getIndex(), index: await getIndex(),
}, },
}); });
const Home: NextPage<HomeProps> = ({ index: { announcements, ids } }) => { const Home: NextPage<HomeProps> = function Home({ index: { announcements, ids } }) {
const intl = useIntl(); const intl = useIntl();
return ( return (
<div> <div>

View File

@ -5,12 +5,12 @@ export type UrlSlugTransformer = (
separator: UrlSlugSeparator separator: UrlSlugSeparator
) => string; ) => string;
export type UrlSlugSeparator = '-'|'.'|'_'|'~'|''; export type UrlSlugSeparator = '-' | '.' | '_' | '~' | '';
export interface UrlSlugOptions { export interface UrlSlugOptions {
camelCase?: boolean = true; camelCase?: boolean = true;
separator?: UrlSlugSeparator = '-'; separator?: UrlSlugSeparator = '-';
transformer: false|UrlSlugTransformer = false; transformer: false | UrlSlugTransformer = false;
} }
declare function urlSlug( declare function urlSlug(

View File

@ -15,4 +15,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
export type UnboxPromise<T extends Promise<any>> = T extends Promise<infer U> ? U: never; export type UnboxPromise<T extends Promise<any>> = T extends Promise<infer U> ? U : never;