Make valid-i18n-keys rule strict and fix most exceptions
This commit is contained in:
parent
18a6da310f
commit
11cfcb4e32
36 changed files with 796 additions and 687 deletions
|
@ -25,45 +25,43 @@ type PropsHousekeeping = {
|
|||
export type Props = PropsData & PropsHousekeeping;
|
||||
|
||||
export class VerificationNotification extends React.Component<Props> {
|
||||
public getStringId(): string {
|
||||
const { isLocal, type } = this.props;
|
||||
public renderContents(): JSX.Element {
|
||||
const { contact, isLocal, type, i18n } = this.props;
|
||||
|
||||
const name = (
|
||||
<ContactName
|
||||
key="external-1"
|
||||
title={contact.title}
|
||||
module="module-verification-notification__contact"
|
||||
/>
|
||||
);
|
||||
|
||||
switch (type) {
|
||||
case 'markVerified':
|
||||
return isLocal
|
||||
? 'youMarkedAsVerified'
|
||||
: 'youMarkedAsVerifiedOtherDevice';
|
||||
return isLocal ? (
|
||||
<Intl id="youMarkedAsVerified" components={{ name }} i18n={i18n} />
|
||||
) : (
|
||||
<Intl
|
||||
id="youMarkedAsVerifiedOtherDevice"
|
||||
components={{ name }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
case 'markNotVerified':
|
||||
return isLocal
|
||||
? 'youMarkedAsNotVerified'
|
||||
: 'youMarkedAsNotVerifiedOtherDevice';
|
||||
return isLocal ? (
|
||||
<Intl id="youMarkedAsNotVerified" components={{ name }} i18n={i18n} />
|
||||
) : (
|
||||
<Intl
|
||||
id="youMarkedAsNotVerifiedOtherDevice"
|
||||
components={{ name }}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
throw missingCaseError(type);
|
||||
}
|
||||
}
|
||||
|
||||
public renderContents(): JSX.Element {
|
||||
const { contact, i18n } = this.props;
|
||||
const id = this.getStringId();
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line local-rules/valid-i18n-keys
|
||||
<Intl
|
||||
id={id}
|
||||
components={{
|
||||
name: (
|
||||
<ContactName
|
||||
key="external-1"
|
||||
title={contact.title}
|
||||
module="module-verification-notification__contact"
|
||||
/>
|
||||
),
|
||||
}}
|
||||
i18n={i18n}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
public override render(): JSX.Element {
|
||||
const { type } = this.props;
|
||||
const icon = type === 'markVerified' ? 'verified' : 'verified-not';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue