diff --git a/frontend/app/__stubs__/store.ts b/frontend/app/__stubs__/store.ts index cd97280daa..ccb6da2784 100644 --- a/frontend/app/__stubs__/store.ts +++ b/frontend/app/__stubs__/store.ts @@ -2,6 +2,4 @@ import createMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; // eslint-disable-next-line @typescript-eslint/no-explicit-any -const mockStore = createMockStore([thunk]); - -export default mockStore; +export const mockStore = createMockStore([thunk]); diff --git a/frontend/app/common/api.getLastComments.ts b/frontend/app/common/api.getLastComments.ts index 305619a7f6..4ec377cf71 100644 --- a/frontend/app/common/api.getLastComments.ts +++ b/frontend/app/common/api.getLastComments.ts @@ -1,6 +1,6 @@ import { Comment } from './types'; import { apiFetcher } from './fetcher'; -export default function getLastComments(siteId: string, max: number): Promise { +export function getLastComments(siteId: string, max: number): Promise { return apiFetcher.get(`/last/${max}`, { site: siteId }); } diff --git a/frontend/app/common/copy.ts b/frontend/app/common/copy.ts index 7ad3cda77f..188a603e4d 100644 --- a/frontend/app/common/copy.ts +++ b/frontend/app/common/copy.ts @@ -1,5 +1,5 @@ // based on https://github.com/sindresorhus/copy-text-to-clipboard, but improved to copy text styles too -export default function copy(input: string): boolean { +export function copy(input: string): boolean { const element = document.createElement('textarea') as HTMLTextAreaElement; const previouslyFocusedElement = document.activeElement as HTMLElement; diff --git a/frontend/app/common/settings.ts b/frontend/app/common/settings.ts index 0b20e1b202..d7dfa51f91 100644 --- a/frontend/app/common/settings.ts +++ b/frontend/app/common/settings.ts @@ -1,4 +1,4 @@ -import parseQuery from 'utils/parseQuery'; +import { parseQuery } from 'utils/parseQuery'; import type { Theme } from './types'; import { THEMES, MAX_SHOWN_ROOT_COMMENTS } from './constants'; diff --git a/frontend/app/common/user-info-settings.ts b/frontend/app/common/user-info-settings.ts index b352baaccf..7940021565 100644 --- a/frontend/app/common/user-info-settings.ts +++ b/frontend/app/common/user-info-settings.ts @@ -1,4 +1,4 @@ -import parseQuery from 'utils/parseQuery'; +import { parseQuery } from 'utils/parseQuery'; import type { UserInfo } from './types'; diff --git a/frontend/app/components/auth-panel/auth-panel.test.tsx b/frontend/app/components/auth-panel/auth-panel.test.tsx index 6fc42597d5..63d16544e0 100644 --- a/frontend/app/components/auth-panel/auth-panel.test.tsx +++ b/frontend/app/components/auth-panel/auth-panel.test.tsx @@ -8,7 +8,7 @@ import { IntlProvider } from 'react-intl'; import type { User } from 'common/types'; import enMessages from 'locales/en.json'; -import AuthPanel, { Props } from './auth-panel'; +import { AuthPanel, Props } from './auth-panel'; const DefaultProps = { postInfo: { diff --git a/frontend/app/components/auth-panel/auth-panel.tsx b/frontend/app/components/auth-panel/auth-panel.tsx index 3970ec13f3..19134f8780 100644 --- a/frontend/app/components/auth-panel/auth-panel.tsx +++ b/frontend/app/components/auth-panel/auth-panel.tsx @@ -6,16 +6,15 @@ import b from 'bem-react-helper'; import { User, Sorting, Theme, PostInfo } from 'common/types'; import { IS_STORAGE_AVAILABLE, IS_THIRD_PARTY } from 'common/constants'; import { requestDeletion } from 'utils/email'; -import postMessage from 'utils/postMessage'; +import { postMessage } from 'utils/postMessage'; import { getHandleClickProps } from 'common/accessibility'; import { StoreState } from 'store'; import { Dropdown, DropdownItem } from 'components/dropdown'; import { Button } from 'components/button'; -import Auth from 'components/auth'; +import { Auth } from 'components/auth'; +import { useTheme } from 'hooks/useTheme'; -import useTheme from 'hooks/useTheme'; - -export interface OwnProps { +interface OwnProps { user: User | null; hiddenUsers: StoreState['hiddenUsers']; isCommentsDisabled: boolean; @@ -40,7 +39,7 @@ interface State { sortSelectFocused: boolean; } -export class AuthPanel extends Component { +class AuthPanelComponent extends Component { state = { isBlockedVisible: false, anonymousUsernameInputValue: 'anon', @@ -319,10 +318,10 @@ function getSortArray(currentSort: Sorting, intl: IntlShape) { }); } -export default function AuthPanelConnected(props: OwnProps) { +export function AuthPanel(props: OwnProps) { const intl = useIntl(); const theme = useTheme(); const sort = useSelector((state) => state.comments.sort); - return ; + return ; } diff --git a/frontend/app/components/auth-panel/index.ts b/frontend/app/components/auth-panel/index.ts index f4ce12a63a..ed33afe274 100644 --- a/frontend/app/components/auth-panel/index.ts +++ b/frontend/app/components/auth-panel/index.ts @@ -15,4 +15,4 @@ import './_theme/_light/auth-panel_theme_light.css'; import './_logged-in/auth-panel_logged-in.css'; -export { default } from './auth-panel'; +export * from './auth-panel'; diff --git a/frontend/app/components/auth/auth.messsages.ts b/frontend/app/components/auth/auth.messsages.ts index ff48198c79..faa98cd519 100644 --- a/frontend/app/components/auth/auth.messsages.ts +++ b/frontend/app/components/auth/auth.messsages.ts @@ -1,6 +1,6 @@ import { defineMessages } from 'react-intl'; -const messages = defineMessages({ +export const messages = defineMessages({ signin: { id: 'auth.signin', defaultMessage: 'Sign In', @@ -58,5 +58,3 @@ const messages = defineMessages({ defaultMessage: 'Submit', }, }); - -export default messages; diff --git a/frontend/app/components/auth/auth.spec.tsx b/frontend/app/components/auth/auth.spec.tsx index f5db67b808..a4ce0bca3b 100644 --- a/frontend/app/components/auth/auth.spec.tsx +++ b/frontend/app/components/auth/auth.spec.tsx @@ -5,7 +5,7 @@ import { fireEvent, render, waitFor } from '@testing-library/preact'; import { OAuthProvider, User } from 'common/types'; import { StaticStore } from 'common/static-store'; -import Auth from './auth'; +import { Auth } from './auth'; import * as utils from './auth.utils'; import * as api from './auth.api'; import { getProviderData } from './components/oauth.utils'; @@ -14,7 +14,9 @@ jest.mock('react-redux', () => ({ useDispatch: () => jest.fn(), })); -jest.mock('hooks/useTheme', () => () => 'light'); +jest.mock('hooks/useTheme', () => ({ + useTheme: () => 'light', +})); describe('', () => { let defaultProviders = StaticStore.config.auth_providers; diff --git a/frontend/app/components/auth/auth.tsx b/frontend/app/components/auth/auth.tsx index 1e4f7e1bf8..8ca79359e1 100644 --- a/frontend/app/components/auth/auth.tsx +++ b/frontend/app/components/auth/auth.tsx @@ -6,18 +6,18 @@ import { useDispatch } from 'react-redux'; import { setUser } from 'store/user/actions'; import { Input } from 'components/input'; -import TextareaAutosize from 'components/textarea-autosize'; +import { TextareaAutosize } from 'components/textarea-autosize'; -import Button from './components/button'; -import OAuthProviders from './components/oauth'; -import messages from './auth.messsages'; +import { Button } from './components/button'; +import { OAuth } from './components/oauth'; +import { messages } from './auth.messsages'; import { useDropdown } from './auth.hooks'; import { getProviders, getTokenInvalidReason } from './auth.utils'; import { emailSignin, verifyEmailSignin, anonymousSignin } from './auth.api'; import styles from './auth.module.css'; -export default function Auth() { +export function Auth() { const intl = useIntl(); const dispath = useDispatch(); const [oauthProviders, formProviders] = getProviders(); @@ -199,7 +199,7 @@ export default function Auth() {
{intl.formatMessage(messages.oauthSource)}
- + )} {hasOAuthProviders && hasFormProviders && ( diff --git a/frontend/app/components/auth/auth.utils.ts b/frontend/app/components/auth/auth.utils.ts index acdbb628fd..1e3c7dbd84 100644 --- a/frontend/app/components/auth/auth.utils.ts +++ b/frontend/app/components/auth/auth.utils.ts @@ -3,7 +3,7 @@ import { StaticStore } from 'common/static-store'; import type { FormProvider, OAuthProvider } from 'common/types'; import { OAUTH_PROVIDERS } from './components/oauth.consts'; -import messages from './auth.messsages'; +import { messages } from './auth.messsages'; export function getProviders(): [OAuthProvider[], FormProvider[]] { const oauthProviders: OAuthProvider[] = []; diff --git a/frontend/app/components/auth/components/button.tsx b/frontend/app/components/auth/components/button.tsx index d5b41c5623..00a6146936 100644 --- a/frontend/app/components/auth/components/button.tsx +++ b/frontend/app/components/auth/components/button.tsx @@ -11,7 +11,7 @@ type Props = Omit, 'size'> & { selected?: boolean; }; -export default function Button({ children, size, kind, suffix, selected, className, ...props }: Props) { +export function Button({ children, size, kind, suffix, selected, className, ...props }: Props) { return (