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-1">{runner.name}</span>
<sup>
{runner.platform === 'TWITCH' && runner.stream.length > 0 ? <a href={runner.stream}>
<FontAwesomeIcon icon={["fab", "twitch"]} className={['mr-1', style.twitch].join(' ')} />
</a> : ''}
{runner.platform === 'FACEBOOK' && runner.stream.length > 0 ? <a href={runner.stream}>
<FontAwesomeIcon icon={["fab", "facebook"]} className={['mr-1', style.facebook].join(' ')} />
</a> : ''}
{runner.platform === 'YOUTUBE' && runner.stream.length > 0 ? <a href={runner.stream}>
<FontAwesomeIcon icon={["fab", "youtube"]} className={['mr-1', style.youtube].join(' ')} />
</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> : ''}
{runner.platform === 'TWITCH' && runner.stream.length > 0 ? (
<a href={runner.stream}>
<FontAwesomeIcon icon={['fab', 'twitch']} className={['mr-1', style.twitch].join(' ')} />
</a>
) : ''}
{runner.platform === 'FACEBOOK' && runner.stream.length > 0 ? (
<a href={runner.stream}>
<FontAwesomeIcon icon={['fab', 'facebook']} className={['mr-1', style.facebook].join(' ')} />
</a>
) : ''}
{runner.platform === 'YOUTUBE' && runner.stream.length > 0 ? (
<a href={runner.stream}>
<FontAwesomeIcon icon={['fab', 'youtube']} className={['mr-1', style.youtube].join(' ')} />
</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>
</span>
)
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,4 +15,4 @@
* 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;