Skip to content

Commit 4a831fb

Browse files
authored
chore: fix lint (#229)
1 parent 536f2ad commit 4a831fb

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

src/Dialog/Content/MemoChildren.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
export interface MemoChildrenProps {
3+
export type MemoChildrenProps = {
44
shouldUpdate: boolean;
55
children: React.ReactNode;
66
}

src/Dialog/Content/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import * as React from 'react';
22
import { useRef } from 'react';
33
import classNames from 'classnames';
44
import CSSMotion from 'rc-motion';
5-
import { IDialogChildProps } from '..';
5+
import type { IDialogChildProps } from '..';
66
import { offset } from '../../util';
77
import MemoChildren from './MemoChildren';
88

99
const sentinelStyle = { width: 0, height: 0, overflow: 'hidden', outline: 'none' };
1010

11-
export interface ContentProps extends IDialogChildProps {
11+
export type ContentProps = {
1212
motionName: string;
1313
ariaId: string;
1414
onVisibleChanged: (visible: boolean) => void;
1515
onMouseDown: React.MouseEventHandler;
1616
onMouseUp: React.MouseEventHandler;
17-
}
17+
} & IDialogChildProps
1818

19-
export interface ContentRef {
19+
export type ContentRef = {
2020
focus: () => void;
2121
changeActive: (next: boolean) => void;
2222
}

src/Dialog/Mask.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import classNames from 'classnames';
33
import CSSMotion from 'rc-motion';
44

5-
export interface MaskProps {
5+
export type MaskProps = {
66
prefixCls: string;
77
visible: boolean;
88
motionName?: string;

src/Dialog/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ import { useRef, useEffect } from 'react';
33
import classNames from 'classnames';
44
import KeyCode from 'rc-util/lib/KeyCode';
55
import contains from 'rc-util/lib/Dom/contains';
6-
import ScollLocker from 'rc-util/lib/Dom/scrollLocker';
7-
import { IDialogPropTypes } from '../IDialogPropTypes';
6+
import type ScollLocker from 'rc-util/lib/Dom/scrollLocker';
7+
import type { IDialogPropTypes } from '../IDialogPropTypes';
88
import Mask from './Mask';
99
import { getMotionName, getUUID } from '../util';
10-
import Content, { ContentRef } from './Content';
10+
import type { ContentRef } from './Content';
11+
import Content from './Content';
1112

12-
export interface IDialogChildProps extends IDialogPropTypes {
13+
export type IDialogChildProps = {
1314
// zombieJ: This should be handle on top instead of each Dialog.
1415
// TODO: refactor to remove this.
1516
getOpenCount: () => number;
1617
scrollLocker?: ScollLocker;
17-
}
18+
} & IDialogPropTypes
1819

1920
export default function Dialog(props: IDialogChildProps) {
2021
const {
@@ -154,7 +155,7 @@ export default function Dialog(props: IDialogChildProps) {
154155
return scrollLocker?.unLock;
155156
}
156157
return () => {};
157-
}, [animatedVisible]);
158+
}, [animatedVisible, scrollLocker]);
158159

159160
// ========================= Render =========================
160161
return (

src/DialogWrap.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react';
22
import Portal from 'rc-util/lib/PortalWrapper';
3-
import Dialog, { IDialogChildProps } from './Dialog';
4-
import { IDialogPropTypes } from './IDialogPropTypes';
3+
import type { IDialogChildProps } from './Dialog';
4+
import Dialog from './Dialog';
5+
import type { IDialogPropTypes } from './IDialogPropTypes';
56

67
// fix issue #10656
78
/*

src/IDialogPropTypes.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ReactNode, CSSProperties, SyntheticEvent } from 'react';
2-
import { GetContainer } from 'rc-util/lib/PortalWrapper';
1+
import type { ReactNode, CSSProperties, SyntheticEvent } from 'react';
2+
import type { GetContainer } from 'rc-util/lib/PortalWrapper';
33

4-
export interface IDialogPropTypes {
4+
export type IDialogPropTypes = {
55
className?: string;
66
keyboard?: boolean;
77
style?: CSSProperties;
@@ -23,9 +23,9 @@ export interface IDialogPropTypes {
2323
maskTransitionName?: string;
2424
animation?: any;
2525
maskAnimation?: any;
26-
wrapStyle?: {};
27-
bodyStyle?: {};
28-
maskStyle?: {};
26+
wrapStyle?: Record<string, any>;
27+
bodyStyle?: Record<string, any>;
28+
maskStyle?: Record<string, any>;
2929
prefixCls?: string;
3030
wrapClassName?: string;
3131
width?: number;

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function getScroll(w: Window, top?: boolean): number {
2828
return ret;
2929
}
3030

31-
interface CompatibleDocument extends Document {
31+
type CompatibleDocument = {
3232
parentWindow?: Window;
33-
}
33+
} & Document
3434

3535
export function offset(el: Element) {
3636
const rect = el.getBoundingClientRect();

0 commit comments

Comments
 (0)