Update eslint to 8.27.0

This commit is contained in:
Fedor Indutny 2022-11-17 16:45:19 -08:00 committed by GitHub
parent c8fb43a846
commit 98ef4c627a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
499 changed files with 8995 additions and 8494 deletions

View file

@ -16,19 +16,19 @@ export default {
title: 'Components/InstallScreen/InstallScreenChoosingDeviceNameStep',
};
export const Default = (): JSX.Element => {
const Wrapper = () => {
const [deviceName, setDeviceName] = useState<string>('Default value');
function Wrapper() {
const [deviceName, setDeviceName] = useState<string>('Default value');
return (
<InstallScreenChoosingDeviceNameStep
i18n={i18n}
deviceName={deviceName}
setDeviceName={setDeviceName}
onSubmit={action('onSubmit')}
/>
);
};
return (
<InstallScreenChoosingDeviceNameStep
i18n={i18n}
deviceName={deviceName}
setDeviceName={setDeviceName}
onSubmit={action('onSubmit')}
/>
);
}
export function Default(): JSX.Element {
return <Wrapper />;
};
}

View file

@ -14,6 +14,6 @@ export default {
title: 'Components/InstallScreen/InstallScreenLinkInProgressStep',
};
export const Default = (): JSX.Element => (
<InstallScreenLinkInProgressStep i18n={i18n} />
);
export function Default(): JSX.Element {
return <InstallScreenLinkInProgressStep i18n={i18n} />;
}

View file

@ -10,16 +10,18 @@ import { Spinner } from '../Spinner';
import { TitlebarDragArea } from '../TitlebarDragArea';
import { InstallScreenSignalLogo } from './InstallScreenSignalLogo';
export const InstallScreenLinkInProgressStep = ({
export function InstallScreenLinkInProgressStep({
i18n,
}: Readonly<{ i18n: LocalizerType }>): ReactElement => (
<div className="module-InstallScreenLinkInProgressStep">
<TitlebarDragArea />
}: Readonly<{ i18n: LocalizerType }>): ReactElement {
return (
<div className="module-InstallScreenLinkInProgressStep">
<TitlebarDragArea />
<InstallScreenSignalLogo />
<InstallScreenSignalLogo />
<Spinner size="50px" svgSize="normal" />
<h1>{i18n('initialSync')}</h1>
<h2>{i18n('initialSync__subtitle')}</h2>
</div>
);
<Spinner size="50px" svgSize="normal" />
<h1>{i18n('initialSync')}</h1>
<h2>{i18n('initialSync__subtitle')}</h2>
</div>
);
}

View file

@ -16,7 +16,7 @@ export default {
title: 'Components/InstallScreen/InstallScreenQrCodeNotScannedStep',
};
const Simulation = ({ finalResult }: { finalResult: Loadable<string> }) => {
function Simulation({ finalResult }: { finalResult: Loadable<string> }) {
const [provisioningUrl, setProvisioningUrl] = useState<Loadable<string>>({
loadingState: LoadingState.Loading,
});
@ -36,72 +36,82 @@ const Simulation = ({ finalResult }: { finalResult: Loadable<string> }) => {
provisioningUrl={provisioningUrl}
/>
);
};
}
export const QrCodeLoading = (): JSX.Element => (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.Loading,
}}
/>
);
export function QrCodeLoading(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.Loading,
}}
/>
);
}
QrCodeLoading.story = {
name: 'QR code loading',
};
export const QrCodeFailedToLoad = (): JSX.Element => (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.LoadFailed,
error: new Error('uh oh'),
}}
/>
);
export function QrCodeFailedToLoad(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.LoadFailed,
error: new Error('uh oh'),
}}
/>
);
}
QrCodeFailedToLoad.story = {
name: 'QR code failed to load',
};
export const QrCodeLoaded = (): JSX.Element => (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.Loaded,
value:
'https://example.com/fake-signal-link?uuid=56cdd548-e595-4962-9a27-3f1e8210a959&pub_key=SW4gdGhlIHZhc3QsIGRlZXAgZm9yZXN0IG9mIEh5cnVsZS4uLg%3D%3D',
}}
/>
);
export function QrCodeLoaded(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
provisioningUrl={{
loadingState: LoadingState.Loaded,
value:
'https://example.com/fake-signal-link?uuid=56cdd548-e595-4962-9a27-3f1e8210a959&pub_key=SW4gdGhlIHZhc3QsIGRlZXAgZm9yZXN0IG9mIEh5cnVsZS4uLg%3D%3D',
}}
/>
);
}
QrCodeLoaded.story = {
name: 'QR code loaded',
};
export const SimulatedLoading = (): JSX.Element => (
<Simulation
finalResult={{
loadingState: LoadingState.Loaded,
value:
'https://example.com/fake-signal-link?uuid=56cdd548-e595-4962-9a27-3f1e8210a959&pub_key=SW4gdGhlIHZhc3QsIGRlZXAgZm9yZXN0IG9mIEh5cnVsZS4uLg%3D%3D',
}}
/>
);
export function SimulatedLoading(): JSX.Element {
return (
<Simulation
finalResult={{
loadingState: LoadingState.Loaded,
value:
'https://example.com/fake-signal-link?uuid=56cdd548-e595-4962-9a27-3f1e8210a959&pub_key=SW4gdGhlIHZhc3QsIGRlZXAgZm9yZXN0IG9mIEh5cnVsZS4uLg%3D%3D',
}}
/>
);
}
SimulatedLoading.story = {
name: 'Simulated loading',
};
export const SimulatedFailure = (): JSX.Element => (
<Simulation
finalResult={{
loadingState: LoadingState.LoadFailed,
error: new Error('uh oh'),
}}
/>
);
export function SimulatedFailure(): JSX.Element {
return (
<Simulation
finalResult={{
loadingState: LoadingState.LoadFailed,
error: new Error('uh oh'),
}}
/>
);
}
SimulatedFailure.story = {
name: 'Simulated failure',

View file

@ -19,7 +19,7 @@ import { getClassNamesFor } from '../../util/getClassNamesFor';
// We can't always use destructuring assignment because of the complexity of this props
// type.
/* eslint-disable react/destructuring-assignment */
type PropsType = {
i18n: LocalizerType;
provisioningUrl: Loadable<string>;
@ -32,56 +32,60 @@ const getQrCodeClassName = getClassNamesFor(
'module-InstallScreenQrCodeNotScannedStep__qr-code'
);
export const InstallScreenQrCodeNotScannedStep = ({
export function InstallScreenQrCodeNotScannedStep({
i18n,
provisioningUrl,
}: Readonly<PropsType>): ReactElement => (
<div className="module-InstallScreenQrCodeNotScannedStep">
<TitlebarDragArea />
}: Readonly<PropsType>): ReactElement {
return (
<div className="module-InstallScreenQrCodeNotScannedStep">
<TitlebarDragArea />
<InstallScreenSignalLogo />
<InstallScreenSignalLogo />
<div className="module-InstallScreenQrCodeNotScannedStep__contents">
<InstallScreenQrCode i18n={i18n} {...provisioningUrl} />
<div className="module-InstallScreenQrCodeNotScannedStep__instructions">
<h1>{i18n('Install__scan-this-code')}</h1>
<ol>
<li>{i18n('Install__instructions__1')}</li>
<li>
<Intl
i18n={i18n}
id="Install__instructions__2"
components={{
settings: (
<strong>{i18n('Install__instructions__2__settings')}</strong>
),
linkedDevices: <strong>{i18n('linkedDevices')}</strong>,
}}
/>
</li>
<li>
<Intl
i18n={i18n}
id="Install__instructions__3"
components={{
plusButton: (
<div
className="module-InstallScreenQrCodeNotScannedStep__android-plus"
aria-label="+"
/>
),
linkNewDevice: <strong>{i18n('linkNewDevice')}</strong>,
}}
/>
</li>
</ol>
<a href="https://support.signal.org/hc/articles/360007320451#desktop_multiple_device">
{i18n('Install__support-link')}
</a>
<div className="module-InstallScreenQrCodeNotScannedStep__contents">
<InstallScreenQrCode i18n={i18n} {...provisioningUrl} />
<div className="module-InstallScreenQrCodeNotScannedStep__instructions">
<h1>{i18n('Install__scan-this-code')}</h1>
<ol>
<li>{i18n('Install__instructions__1')}</li>
<li>
<Intl
i18n={i18n}
id="Install__instructions__2"
components={{
settings: (
<strong>
{i18n('Install__instructions__2__settings')}
</strong>
),
linkedDevices: <strong>{i18n('linkedDevices')}</strong>,
}}
/>
</li>
<li>
<Intl
i18n={i18n}
id="Install__instructions__3"
components={{
plusButton: (
<div
className="module-InstallScreenQrCodeNotScannedStep__android-plus"
aria-label="+"
/>
),
linkNewDevice: <strong>{i18n('linkNewDevice')}</strong>,
}}
/>
</li>
</ol>
<a href="https://support.signal.org/hc/articles/360007320451#desktop_multiple_device">
{i18n('Install__support-link')}
</a>
</div>
</div>
</div>
</div>
);
);
}
function InstallScreenQrCode(
props: Loadable<string> & { i18n: LocalizerType }
@ -100,6 +104,7 @@ function InstallScreenQrCode(
i18n={i18n}
id="icu:Install__qr-failed"
components={{
// eslint-disable-next-line react/no-unstable-nested-components
learnMoreLink: children => (
<a href={QR_CODE_FAILED_LINK}>{children}</a>
),

View file

@ -4,7 +4,6 @@
import type { ReactElement } from 'react';
import React from 'react';
export const InstallScreenSignalLogo = (): ReactElement => (
// Because "Signal" should be the same in every language, this is not localized.
<div className="InstallScreenSignalLogo">Signal</div>
);
export function InstallScreenSignalLogo(): ReactElement {
return <div className="InstallScreenSignalLogo">Signal</div>;
}