Skip to content

Commit

Permalink
fix(style):fix eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Jan 21, 2021
1 parent e686afa commit 5e1debf
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/graphin-components/src/ContextMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const ContextMenu: React.FunctionComponent<ContextMenuProps> & { Menu: typeof Me
const id = (item && !item.destroyed && item.getModel && item.getModel().id) || '';

return (
<React.Fragment>
<>
<div
ref={(node) => {
containerRef = node;
Expand All @@ -151,7 +151,7 @@ const ContextMenu: React.FunctionComponent<ContextMenuProps> & { Menu: typeof Me
>
{visible && children}
</div>
</React.Fragment>
</>
);
};

Expand Down
15 changes: 9 additions & 6 deletions packages/graphin-components/src/CreateEdge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @ts-nocheck
import React from 'react';

import { GraphinContext } from '@antv/graphin';

interface Props {
onChange: {
onChange?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(value: any): void;
};
}
const CreateEdge: React.FunctionComponent<Props> = props => {
const CreateEdge: React.FunctionComponent<Props> = (props) => {
const { children } = props;
const [state, setState] = React.useState({
active: false,
Expand All @@ -19,15 +19,17 @@ const CreateEdge: React.FunctionComponent<Props> = props => {
const graphin = React.useContext(GraphinContext);
// @ts-ignore
const { graph } = graphin;
graph.on('aftercreateedge', e => {
graph.on('aftercreateedge', (e) => {
const { edges } = graph.save();
// TODO:边的处理,等G6拆包之后
// G6.Util.processParallelEdges(edges);
const newEdges = graph.getEdges();
newEdges.forEach((edge, i) => {
graph.updateItem(edge, (edges as any)[i]);
});
props.onChange && props.onChange(newEdges);
if (props.onChange) {
props.onChange(newEdges);
}
});
}, []);

Expand Down Expand Up @@ -58,7 +60,8 @@ const CreateEdge: React.FunctionComponent<Props> = props => {
};

return (
<div className="graphin-create-edge-container" onClick={handleToggle}>
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div className="graphin-create-edge-container" onClick={handleToggle} onKeyDown={handleToggle} aria-hidden="false">
<div className="graphin-create-edge-icon">{children}</div>
</div>
);
Expand Down
8 changes: 2 additions & 6 deletions packages/graphin-components/src/Hull/demos/Simple.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Graphin, { Utils, GraphinContext } from '@antv/graphin';
import Graphin, { Utils } from '@antv/graphin';
import Hull, { HullCfg } from '../index';
// Do not forget to import CSS
import '@antv/graphin/dist/index.css';
Expand All @@ -21,11 +21,7 @@ const Demo = () => {
];
return (
<div className="App">
<Graphin
data={Utils.mock(10)
.circle()
.graphin()}
>
<Graphin data={Utils.mock(10).circle().graphin()}>
<Hull options={hullOptions} />
</Graphin>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin-components/src/Hull/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ const Hull: React.FunctionComponent<IHullProps> = (props) => {
};
}, []);

return <div className="graphin-hull-container"></div>;
return <div className="graphin-hull-container" />;
};
export default Hull;
2 changes: 1 addition & 1 deletion packages/graphin-components/src/Legend/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React from 'react';
import {
GraphinContext,
Graph,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin-components/src/MiniMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const MiniMap: React.FunctionComponent<MiniMapProps> = (props) => {
containerRef = node;
}}
style={mergedStyle}
></div>
/>
);
};

Expand Down
4 changes: 1 addition & 3 deletions packages/graphin-components/src/Toolbar/demos/Antd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Graphin, { GraphinContext, Utils } from '@antv/graphin';
import { ZoomOutOutlined, ZoomInOutlined } from '@ant-design/icons';
import { Tooltip, Button } from 'antd';

interface AntdDemoProps {}

const CustomContent = () => {
const { apis } = React.useContext(GraphinContext);
const { handleZoomIn, handleZoomOut } = apis;
Expand Down Expand Up @@ -39,7 +37,7 @@ const CustomContent = () => {
</div>
);
};
const AntdDemo: React.FunctionComponent<AntdDemoProps> = (props) => {
const AntdDemo = () => {
return (
<Graphin data={Utils.mock(5).circle().graphin()}>
<Toolbar>
Expand Down
4 changes: 2 additions & 2 deletions packages/graphin-components/src/Tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const Tooltip: React.FunctionComponent<TooltipProps> & { Node: typeof Node } & {
},
};
return (
<React.Fragment>
<>
<div
ref={(node) => {
containerRef = node;
Expand All @@ -147,7 +147,7 @@ const Tooltip: React.FunctionComponent<TooltipProps> & { Node: typeof Node } & {
>
{visible && children}
</div>
</React.Fragment>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Radio, Input, InputNumber } from 'antd';
import { Radio, InputNumber } from 'antd';
import Item from './Item';
import GraphinColorPick from './ColorPicker';
import { NodeStyle } from '@antv/graphin';
Expand All @@ -16,7 +16,7 @@ const LabelSetting: React.FunctionComponent<LabelSettingProps> = (props) => {
const { handleChange, fill, fontSize, position } = props;

return (
<React.Fragment>
<>
<Item title="位置">
<Radio.Group
defaultValue={position}
Expand Down Expand Up @@ -82,7 +82,7 @@ const LabelSetting: React.FunctionComponent<LabelSettingProps> = (props) => {
}}
/>
</Item>
</React.Fragment>
</>
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/src/layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LayoutController {
type: 'concentric',
};
const { width, height, props } = this.graphin;
const { data, layout = DEFAULT_LAYOUT } = props;
const { layout = DEFAULT_LAYOUT } = props;
/** 如果数据为空,不进行布局 */

const { type = 'concentric', preset } = layout;
Expand Down
1 change: 1 addition & 0 deletions packages/graphin/src/layout/utils/options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* TODO 内置最佳的布局参数
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const options: { [key: string]: any } = {
circular: {},
concentric: {
Expand Down
1 change: 1 addition & 0 deletions packages/graphin/src/typings/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export interface ComboStyle {
export interface Layout {
/** 布局名称,必选 */
type: string;
reset?: Layout;
/** 布局配置,可选 */
[key: string]: any; // eslint-disable-line
}
Expand Down

0 comments on commit 5e1debf

Please sign in to comment.