0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-04-07 23:01:25 -05:00

refactor(console): apply no-unused-modules (#4010)

This commit is contained in:
Gao Sun 2023-06-09 21:56:20 +08:00 committed by GitHub
parent 2338cb692e
commit 8c5b492381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 36 additions and 32 deletions

View file

@ -142,8 +142,22 @@
"namedComponents": "function-declaration",
"unnamedComponents": "arrow-function"
}
],
"import/no-unused-modules": [
"error",
{ "unusedExports": true }
]
}
},
"overrides": [
{
"files": [
"*.d.ts", "**/mdx-components/*/index.tsx"
],
"rules": {
"import/no-unused-modules": "off"
}
}
]
},
"stylelint": {
"extends": "@silverhand/eslint-config-react/.stylelintrc"

View file

@ -8,7 +8,7 @@ import useTheme from '@/hooks/use-theme';
import * as styles from './index.module.scss';
export type Props = {
type Props = {
title?: string;
size?: 'large' | 'medium' | 'small';
};

View file

@ -4,7 +4,7 @@ import { forwardRef, useRef } from 'react';
import * as styles from './index.module.scss';
export type Props = Omit<HTMLProps<HTMLButtonElement>, 'size' | 'type'> & {
type Props = Omit<HTMLProps<HTMLButtonElement>, 'size' | 'type'> & {
size?: 'small' | 'medium' | 'large';
iconClassName?: string;
};

View file

@ -5,10 +5,7 @@ import { safeParseJson } from '@/utils/json';
import type { MultiTextInputError, MultiTextInputRule } from './types';
import { multiTextInputErrorGuard } from './types';
export const validate = (
value?: string[],
rule?: MultiTextInputRule
): MultiTextInputError | undefined => {
const validate = (value?: string[], rule?: MultiTextInputRule): MultiTextInputError | undefined => {
if (!rule) {
return;
}

View file

@ -5,7 +5,7 @@ import IconButton from '@/components/IconButton';
import * as styles from './index.module.scss';
export type Props = {
type Props = {
scope: ScopeResponse;
onDelete: (scope: ScopeResponse) => void;
};

View file

@ -1,3 +0,0 @@
export { default as FileUploader } from './FileUploader';
export { default as ImageUploader } from './ImageUploader';
export { default as ImageUploaderField } from './ImageUploaderField';

View file

@ -5,7 +5,7 @@ import * as styles from './index.module.scss';
export const defaultLength = 6;
export type Props = {
type Props = {
name: string;
className?: string;
length?: number;

View file

@ -5,7 +5,7 @@ import { useState, useRef, useMemo, createContext, useCallback, useEffect } from
import ConfirmModal from '@/components/ConfirmModal';
import type { ConfirmModalProps } from '@/components/ConfirmModal';
export type ModalContentRenderProps = {
type ModalContentRenderProps = {
confirm: (data?: unknown) => void;
cancel: (data?: unknown) => void;
};

View file

@ -10,7 +10,7 @@ type Props = {
children: ReactNode;
};
export type AppEndpoints = {
type AppEndpoints = {
/**
* The Logto endpoint for the current tenant.
*

View file

@ -11,7 +11,7 @@ type Props = {
children: ReactNode;
};
export type Tenants = {
type Tenants = {
tenants?: TenantInfo[];
isSettle: boolean;
setTenants: (tenants: TenantInfo[]) => void;

View file

@ -2,6 +2,4 @@ import { useContext } from 'react';
import { AppConfirmModalContext } from '@/contexts/AppConfirmModalProvider';
export type { ModalContentRenderProps } from '@/contexts/AppConfirmModalProvider';
export const useConfirmModal = () => useContext(AppConfirmModalContext);

View file

@ -19,7 +19,7 @@ const userPreferencesGuard = z.object({
connectorSieNoticeConfirmed: z.boolean().optional(),
});
export type UserPreferences = z.infer<typeof userPreferencesGuard>;
type UserPreferences = z.infer<typeof userPreferencesGuard>;
type DefaultUserPreference = {
language: (typeof builtInConsoleLanguages)[number];

View file

@ -9,7 +9,6 @@ export const emailUsLink = buildUrl(contactEmailLink, {
subject: 'Cloud pricing and special offer',
}).replace(/\+/g, '%20');
export const logtoBlogLink = 'https://blog.logto.io/?utm_source=console';
export const aboutCloudPreviewLink = 'https://docs.logto.io/about/cloud-preview?utm_source=console';
export const gtagAwTrackingId = 'AW-11124811245';

View file

@ -16,7 +16,7 @@ import FormField from '@/components/FormField';
import OverlayScrollbar from '@/components/OverlayScrollbar';
import PageMeta from '@/components/PageMeta';
import TextInput from '@/components/TextInput';
import { ImageUploaderField } from '@/components/Uploader';
import ImageUploaderField from '@/components/Uploader/ImageUploaderField';
import useApi from '@/hooks/use-api';
import type { RequestError } from '@/hooks/use-api';
import useUserAssetsService from '@/hooks/use-user-assets-service';

View file

@ -48,7 +48,7 @@ export enum Reason {
Others = 'others',
}
export const questionnaireGuard = z.object({
const questionnaireGuard = z.object({
project: z.nativeEnum(Project),
deploymentType: z.nativeEnum(DeploymentType),
titles: z.array(z.nativeEnum(Title)).optional(),

View file

@ -6,7 +6,7 @@ import { parseFormConfig } from '@/pages/Connectors/components/ConnectorForm/uti
import type { ConnectorFormType } from '@/pages/Connectors/types';
import { safeParseJson } from '@/utils/json';
export const useJsonStringConfigParser = () => {
const useJsonStringConfigParser = () => {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
return (config: string) => {

View file

@ -1,4 +1,4 @@
export type CountAndDelta = {
type CountAndDelta = {
count: number;
delta: number;
};

View file

@ -10,7 +10,7 @@ import NotSet from '../NotSet';
import * as styles from './index.module.scss';
export type Action = {
type Action = {
name: AdminConsoleKey;
handler: () => void;
};

View file

@ -8,7 +8,7 @@ import ReactModal from 'react-modal';
import Button from '@/components/Button';
import ModalLayout from '@/components/ModalLayout';
import TextInput from '@/components/TextInput';
import { ImageUploaderField } from '@/components/Uploader';
import ImageUploaderField from '@/components/Uploader/ImageUploaderField';
import { adminTenantEndpoint, meApi } from '@/consts';
import { useStaticApi } from '@/hooks/use-api';
import { useConfirmModal } from '@/hooks/use-confirm-modal';

View file

@ -18,7 +18,7 @@ import { handleError, parseLocationState } from '../../utils';
import * as styles from './index.module.scss';
export const resendTimeout = 59;
const resendTimeout = 59;
const getTimeout = () => {
const now = new Date();

View file

@ -10,7 +10,7 @@ import DangerousRaw from '@/components/DangerousRaw';
import FormField from '@/components/FormField';
import Switch from '@/components/Switch';
import TextInput from '@/components/TextInput';
import { ImageUploaderField } from '@/components/Uploader';
import ImageUploaderField from '@/components/Uploader/ImageUploaderField';
import useUserAssetsService from '@/hooks/use-user-assets-service';
import { uriValidator } from '@/utils/validator';

View file

@ -2,9 +2,9 @@ import type { LanguageTag } from '@logto/language-kit';
import { noop } from '@silverhand/essentials';
import { createContext, useMemo, useState } from 'react';
export type ConfirmationState = 'none' | 'try-close' | 'try-switch-language' | 'try-add-language';
type ConfirmationState = 'none' | 'try-close' | 'try-switch-language' | 'try-add-language';
export type Context = {
type Context = {
selectedLanguage: LanguageTag;
preSelectedLanguage?: LanguageTag;
preAddedLanguage?: LanguageTag;

View file

@ -12,7 +12,7 @@ import { type BasicWebhookFormType } from '../../types';
import * as styles from './index.module.scss';
export const hookEventOptions = Object.values(HookEvent).map((event) => ({
const hookEventOptions = Object.values(HookEvent).map((event) => ({
title: hookEventLabel[event],
value: event,
}));

View file

@ -4,9 +4,8 @@ import { useTranslation, Trans } from 'react-i18next';
import PageContext from '@/Providers/PageContextProvider/PageContext';
import TermsLinks from '@/components/TermsLinks';
import type { ModalContentRenderProps } from '@/hooks/use-confirm-modal';
const TermsAndPrivacyConfirmModalContent = ({ cancel }: ModalContentRenderProps) => {
const TermsAndPrivacyConfirmModalContent = () => {
const { experienceSettings } = useContext(PageContext);
const { termsOfUseUrl, privacyPolicyUrl } = experienceSettings ?? {};