Skip to content

Commit

Permalink
fix(projects): fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeng889 committed Sep 9, 2024
1 parent 084bf89 commit fec80a1
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions build/plugins/router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ElegantReactRouter from '@ohh-889/react-auto-route/vite';
import type { RouteKey } from '@elegant-router/types';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface RouteMeta extends Record<string | number, unknown> {}

export function setupElegantRouter() {
Expand Down
6 changes: 2 additions & 4 deletions packages/materials/src/libs/page-tab/SvgClose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import type { FC, TouchEvent } from 'react';
import React, { useState } from 'react';
import classNames from 'classnames';

interface SvgCloseProps extends React.ComponentProps<'div'> {}

const SvgClose: FC<SvgCloseProps> = ({ className, onClick, ...props }) => {
const SvgClose: FC<React.ComponentProps<'div'>> = ({ className, onClick, ...props }) => {
const [touchStart, setTouchStart] = useState(false);

// 处理触摸开始事件
Expand All @@ -15,7 +13,7 @@ const SvgClose: FC<SvgCloseProps> = ({ className, onClick, ...props }) => {
// 处理触摸结束事件
const handleTouchEnd = (event: TouchEvent) => {
if (touchStart) {
onClick && onClick(event as any);
if (onClick) onClick(event as any);
}

// 重置触摸状态
Expand Down
4 changes: 2 additions & 2 deletions packages/materials/src/libs/page-tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ const PageTab: FC<PageTabProps> = ({

function closeTab(event: React.MouseEvent | TouchEvent) {
event.stopPropagation();
handleClose && handleClose();
if (handleClose) handleClose();
}

function handleMouseup(e: React.MouseEvent<HTMLDivElement>) {
// close tab by mouse wheel button click
if (e.button === 1) {
handleClose && handleClose();
if (handleClose) handleClose();
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/layouts/modules/global-breadcrumb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function BreadcrumbContent({ label, icon }: { label: JSX.Element; icon: JSX.Elem
);
}

const GlobalBreadcrumb: FC<Omit<BreadcrumbProps, 'items'>> = memo(props => {
const GlobalBreadcrumb: FC<Omit<BreadcrumbProps, 'items'>> = props => {
const { allMenus: menus, route } = useMixMenuContext();

const routerPush = useRouterPush();
Expand Down Expand Up @@ -52,8 +52,8 @@ const GlobalBreadcrumb: FC<Omit<BreadcrumbProps, 'items'>> = memo(props => {
<Breadcrumb
{...props}
items={items}
></Breadcrumb>
/>
);
});
};

export default GlobalBreadcrumb;
export default memo(GlobalBreadcrumb);
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function MixMenuItem(Props: MixMenuItemProps) {
setActiveFirstLevelMenuKey(key);

if (children?.length) {
onClick && onClick();
if (onClick) onClick();
} else {
router.routerPushByKeyWithMetaQuery(key as RouteKey);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function transformVersionData(tuple: [string, string]): PkgVersionInfo {
const pkgJson: PkgJson = {
name,
version,
dependencies: Object.entries(dependencies).map(item => transformVersionData(item)),
devDependencies: Object.entries(devDependencies).map(item => transformVersionData(item))
dependencies: Object.entries(dependencies).map(transformVersionData),
devDependencies: Object.entries(devDependencies).map(transformVersionData)
};

export function Component() {
Expand Down
1 change: 1 addition & 0 deletions src/pages/function/request/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, Card, Space } from 'antd';
import { fetchCustomBackendError } from '@/service/api';

export function Component() {
const { t } = useTranslation();
async function logout() {
Expand Down
1 change: 1 addition & 0 deletions src/pages/function/tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function Component() {
const { t } = useTranslation();

const dispatch = useAppDispatch();

function changeTabLabel(value: string) {
dispatch(setTabLabel(value));
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function createServiceConfig(env: Env.ImportMeta) {
let other = {} as Record<App.Service.OtherBaseURLKey, string>;
try {
other = json5.parse(VITE_OTHER_SERVICE_BASE_URL);
} catch (error) {
} catch {
// eslint-disable-next-line no-console
console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid json5 string');
}
Expand Down

0 comments on commit fec80a1

Please sign in to comment.