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
499 changed files with 8995 additions and 8494 deletions
@@ -31,11 +31,11 @@ export type Props = {
group: GroupListItemConversationType;
};
export const GroupListItem = ({
export function GroupListItem({
group,
i18n,
onSelectGroup,
}: Props): JSX.Element => {
}: Props): JSX.Element {
let messageText: string;
switch (group.disabledReason) {
case DisabledReason.AlreadyMember:
@@ -66,4 +66,4 @@ export const GroupListItem = ({
messageText={messageText}
/>
);
};
}
@@ -21,31 +21,31 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
text: text('text', overrideProps.text || ''),
});
export const Basic = (): JSX.Element => {
export function Basic(): JSX.Element {
const props = createProps({
text: 'This is before <<left>>Inside<<right>> This is after.',
});
return <MessageBodyHighlight {...props} />;
};
}
export const NoReplacement = (): JSX.Element => {
export function NoReplacement(): JSX.Element {
const props = createProps({
text: 'All\nplain\ntext 🔥 http://somewhere.com',
});
return <MessageBodyHighlight {...props} />;
};
}
export const TwoReplacements = (): JSX.Element => {
export function TwoReplacements(): JSX.Element {
const props = createProps({
text: 'Begin <<left>>Inside #1<<right>> This is between the two <<left>>Inside #2<<right>> End.',
});
return <MessageBodyHighlight {...props} />;
};
}
export const TwoReplacementsWithAnMention = (): JSX.Element => {
export function TwoReplacementsWithAnMention(): JSX.Element {
const props = createProps({
bodyRanges: [
{
@@ -60,28 +60,28 @@ export const TwoReplacementsWithAnMention = (): JSX.Element => {
});
return <MessageBodyHighlight {...props} />;
};
}
TwoReplacementsWithAnMention.story = {
name: 'Two Replacements with an @mention',
};
export const EmojiNewlinesUrLs = (): JSX.Element => {
export function EmojiNewlinesUrLs(): JSX.Element {
const props = createProps({
text: '\nhttp://somewhere.com\n\n🔥 Before -- <<left>>A 🔥 inside<<right>> -- After 🔥',
});
return <MessageBodyHighlight {...props} />;
};
}
EmojiNewlinesUrLs.story = {
name: 'Emoji + Newlines + URLs',
};
export const NoJumbomoji = (): JSX.Element => {
export function NoJumbomoji(): JSX.Element {
const props = createProps({
text: '🔥',
});
return <MessageBodyHighlight {...props} />;
};
}
@@ -61,16 +61,16 @@ const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
theme: React.useContext(StorybookThemeContext),
});
export const Default = (): JSX.Element => {
export function Default(): JSX.Element {
const props = useProps({
from: someone,
to: me,
});
return <MessageSearchResult {...props} />;
};
}
export const SenderHasABadge = (): JSX.Element => {
export function SenderHasABadge(): JSX.Element {
const props = useProps({
from: { ...someone, badges: [{ id: 'sender badge' }] },
to: me,
@@ -84,13 +84,13 @@ export const SenderHasABadge = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
SenderHasABadge.story = {
name: 'Sender has a badge',
};
export const Selected = (): JSX.Element => {
export function Selected(): JSX.Element {
const props = useProps({
from: someone,
to: me,
@@ -98,18 +98,18 @@ export const Selected = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
export const FromYou = (): JSX.Element => {
export function FromYou(): JSX.Element {
const props = useProps({
from: me,
to: someone,
});
return <MessageSearchResult {...props} />;
};
}
export const SearchingInConversation = (): JSX.Element => {
export function SearchingInConversation(): JSX.Element {
const props = useProps({
from: me,
to: someone,
@@ -117,52 +117,52 @@ export const SearchingInConversation = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
SearchingInConversation.story = {
name: 'Searching in Conversation',
};
export const FromYouToYourself = (): JSX.Element => {
export function FromYouToYourself(): JSX.Element {
const props = useProps({
from: me,
to: me,
});
return <MessageSearchResult {...props} />;
};
}
FromYouToYourself.story = {
name: 'From You to Yourself',
};
export const FromYouToGroup = (): JSX.Element => {
export function FromYouToGroup(): JSX.Element {
const props = useProps({
from: me,
to: group,
});
return <MessageSearchResult {...props} />;
};
}
FromYouToGroup.story = {
name: 'From You to Group',
};
export const FromSomeoneToGroup = (): JSX.Element => {
export function FromSomeoneToGroup(): JSX.Element {
const props = useProps({
from: someone,
to: group,
});
return <MessageSearchResult {...props} />;
};
}
FromSomeoneToGroup.story = {
name: 'From Someone to Group',
};
export const LongSearchResult = (): JSX.Element => {
export function LongSearchResult(): JSX.Element {
const snippets = [
'This is a really <<left>>detail<<right>>ed long line which will wrap and only be cut off after it gets to three lines. So maybe this will make it in as well?',
"Okay, here are the <<left>>detail<<right>>s:\n\n1355 Ridge Way\nCode: 234\n\nI'm excited!",
@@ -186,19 +186,19 @@ export const LongSearchResult = (): JSX.Element => {
<MessageSearchResult {...props2} />
</>
);
};
}
export const EmptyShouldBeInvalid = (): JSX.Element => {
export function EmptyShouldBeInvalid(): JSX.Element {
const props = useProps();
return <MessageSearchResult {...props} />;
};
}
EmptyShouldBeInvalid.story = {
name: 'Empty (should be invalid)',
};
export const Mention = (): JSX.Element => {
export function Mention(): JSX.Element {
const props = useProps({
body: 'moss banana twine sound lake zoo brain count vacuum work stairs try power forget hair dry diary years no results \uFFFC elephant sorry umbrella potato igloo kangaroo home Georgia bayonet vector orange forge diary zebra turtle rise front \uFFFC',
bodyRanges: [
@@ -224,13 +224,13 @@ export const Mention = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
Mention.story = {
name: '@mention',
};
export const MentionRegexp = (): JSX.Element => {
export function MentionRegexp(): JSX.Element {
const props = useProps({
body: '\uFFFC This is a (long) /text/ ^$ that is ... specially **crafted** to (test) our regexp escaping mechanism! Making sure that the code we write works in all sorts of scenarios',
bodyRanges: [
@@ -249,13 +249,13 @@ export const MentionRegexp = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
MentionRegexp.story = {
name: '@mention regexp',
};
export const MentionNoMatches = (): JSX.Element => {
export function MentionNoMatches(): JSX.Element {
const props = useProps({
body: '\uFFFC hello',
bodyRanges: [
@@ -273,7 +273,7 @@ export const MentionNoMatches = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
MentionNoMatches.story = {
name: '@mention no-matches',
@@ -311,7 +311,7 @@ _MentionNoMatches.story = {
name: '@mention no-matches',
};
export const DoubleMention = (): JSX.Element => {
export function DoubleMention(): JSX.Element {
const props = useProps({
body: 'Hey \uFFFC \uFFFC test',
bodyRanges: [
@@ -336,7 +336,7 @@ export const DoubleMention = (): JSX.Element => {
});
return <MessageSearchResult {...props} />;
};
}
DoubleMention.story = {
name: 'Double @mention',
@@ -1,11 +1,10 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FunctionComponent } from 'react';
import React from 'react';
type PropsType = Record<string, never>;
export const SearchResultsLoadingFakeHeader: FunctionComponent<
PropsType
> = () => <div className="module-SearchResultsLoadingFakeHeader" />;
export function SearchResultsLoadingFakeHeader(_: PropsType): JSX.Element {
return <div className="module-SearchResultsLoadingFakeHeader" />;
}
@@ -1,18 +1,19 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FunctionComponent } from 'react';
import React from 'react';
type PropsType = Record<string, never>;
export const SearchResultsLoadingFakeRow: FunctionComponent<PropsType> = () => (
<div className="module-SearchResultsLoadingFakeRow">
<div className="module-SearchResultsLoadingFakeRow__avatar" />
<div className="module-SearchResultsLoadingFakeRow__content">
<div className="module-SearchResultsLoadingFakeRow__content__line" />
<div className="module-SearchResultsLoadingFakeRow__content__line" />
<div className="module-SearchResultsLoadingFakeRow__content__line" />
export function SearchResultsLoadingFakeRow(_: PropsType): JSX.Element {
return (
<div className="module-SearchResultsLoadingFakeRow">
<div className="module-SearchResultsLoadingFakeRow__avatar" />
<div className="module-SearchResultsLoadingFakeRow__content">
<div className="module-SearchResultsLoadingFakeRow__content__line" />
<div className="module-SearchResultsLoadingFakeRow__content__line" />
<div className="module-SearchResultsLoadingFakeRow__content__line" />
</div>
</div>
</div>
);
);
}
@@ -1,7 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FunctionComponent } from 'react';
import React, { useCallback } from 'react';
import { BaseConversationListItem } from './BaseConversationListItem';
@@ -22,7 +21,7 @@ type PropsHousekeeping = {
export type Props = PropsData & PropsHousekeeping;
export const UsernameSearchResultListItem: FunctionComponent<Props> = ({
export function UsernameSearchResultListItem({
i18n,
isFetchingUsername,
lookupConversationWithoutUuid,
@@ -30,7 +29,7 @@ export const UsernameSearchResultListItem: FunctionComponent<Props> = ({
showUserNotFoundModal,
setIsFetchingUUID,
showConversation,
}) => {
}: Props): JSX.Element {
const usernameText = i18n('at-username', { username });
const boundOnClick = useCallback(async () => {
if (isFetchingUsername) {
@@ -71,4 +70,4 @@ export const UsernameSearchResultListItem: FunctionComponent<Props> = ({
title={usernameText}
/>
);
};
}