Skip to content

Commit 741050a

Browse files
authored
chore: fix or turn-off eslint warnings (#143)
1 parent ce7afbc commit 741050a

File tree

21 files changed

+98
-76
lines changed

21 files changed

+98
-76
lines changed

.eslintrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@
4545
}
4646
]
4747
}
48+
},
49+
{
50+
"files": [
51+
"src/stories/**/*.tsx"
52+
],
53+
"rules": {
54+
"no-console": "off"
55+
}
56+
},
57+
{
58+
"files": [
59+
"**/*.test.ts",
60+
"**/*.test.tsx"
61+
],
62+
"rules": {
63+
"@typescript-eslint/no-explicit-any": "off"
64+
}
4865
}
4966
],
5067
"rules": {
@@ -54,6 +71,8 @@
5471
"guard-for-in": "off",
5572
"no-return-assign": "off",
5673
"@typescript-eslint/member-ordering": "off",
74+
"@typescript-eslint/no-shadow": "off",
75+
"valid-jsdoc": "off",
5776
"import/consistent-type-specifier-style": [
5877
"error",
5978
"prefer-top-level"

src/components/canvas/EventedComponent/EventedComponent.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ export class EventedComponent<
7878

7979
handlers?.forEach((cb) => {
8080
if (typeof cb === "function") {
81-
cb(event);
81+
return cb(event);
8282
} else if (cb instanceof Component && "handleEvent" in cb && typeof cb.handleEvent === "function") {
83-
cb.handleEvent?.(event);
83+
return cb.handleEvent?.(event);
8484
}
85+
return undefined;
8586
});
8687
}
8788

src/components/canvas/GraphComponent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class GraphComponent<
5757
if (!this.ports.has(id)) {
5858
return this.createPort(id);
5959
}
60-
return this.ports.get(id)!;
60+
return this.ports.get(id);
6161
}
6262

6363
protected setAffectsUsableRect(affectsUsableRect: boolean) {

src/components/canvas/blocks/Blocks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component } from "../../../lib/Component";
2+
import { CoreComponent } from "../../../lib/CoreComponent";
23
import { BlockState } from "../../../store/block/Block";
34
import { TGraphLayerContext } from "../layers/graphLayer/GraphLayer";
45

@@ -14,7 +15,7 @@ export class Blocks extends Component {
1415

1516
private font: string;
1617

17-
constructor(props: {}, context: any) {
18+
constructor(props: {}, context: CoreComponent) {
1819
super(props, context);
1920

2021
this.unsubscribe = this.subscribe();

src/components/canvas/groups/BlockGroups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class BlockGroups<P extends BlockGroupsProps = BlockGroupsProps> extends
9090
constants: this.props.graph.graphConstants,
9191
colors: this.props.graph.graphColors,
9292
graph: this.props.graph,
93-
ownerDocument: this.props.root!,
93+
ownerDocument: this.props.root,
9494
});
9595
}
9696

src/graph.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { TGraphColors, TGraphConstants, initGraphColors, initGraphConstants } fr
1111
import { GraphEventParams, GraphEventsDefinitions } from "./graphEvents";
1212
import { scheduler } from "./lib/Scheduler";
1313
import { HitTest } from "./services/HitTest";
14-
import { Layer } from "./services/Layer";
14+
import { Layer, LayerPublicProps } from "./services/Layer";
1515
import { Layers } from "./services/LayersService";
1616
import { CameraService } from "./services/camera/CameraService";
1717
import { RootStore } from "./store";
@@ -23,12 +23,7 @@ import { clearTextCache } from "./utils/renderers/text";
2323
import { RecursivePartial } from "./utils/types/helpers";
2424
import { IPoint, IRect, Point, TPoint, TRect, isTRect } from "./utils/types/shapes";
2525

26-
export type LayerConfig<T extends Constructor<Layer> = Constructor<Layer>> = [
27-
T,
28-
T extends Constructor<Layer<infer Props>>
29-
? Omit<Props, "root" | "camera" | "graph"> & { root?: Props["root"] }
30-
: never,
31-
];
26+
export type LayerConfig<T extends Constructor<Layer> = Constructor<Layer>> = [T, LayerPublicProps<T>];
3227
export type TGraphConfig<Block extends TBlock = TBlock, Connection extends TConnection = TConnection> = {
3328
configurationName?: string;
3429
blocks?: Block[];
@@ -306,9 +301,7 @@ export class Graph {
306301

307302
public addLayer<T extends Constructor<Layer> = Constructor<Layer>>(
308303
layerCtor: T,
309-
props: T extends Constructor<Layer<infer Props>>
310-
? Omit<Props, "root" | "camera" | "graph" | "emitter"> & { root?: Props["root"] }
311-
: never
304+
props: LayerPublicProps<T>
312305
): InstanceType<T> {
313306
// TODO: These types are too complicated, try to simplify them
314307
return this.layers.createLayer(layerCtor as Constructor<Layer>, {

src/lib/CoreComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ITree, Tree } from "./Tree";
44

55
type TOptions = {
66
readonly key?: string;
7-
readonly ref?: ((inst: any) => void) | string;
7+
readonly ref?: ((inst: unknown) => void) | string;
88
};
99

1010
export type TCoreComponent = CoreComponent<CoreComponentProps, CoreComponentContext>;

src/lib/tshelpers.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/plugins/minimap/layer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class MiniMapLayer extends Layer<MiniMapLayerProps, MiniMapLayerContext>
127127
this.relativeY = yPos + height / 2 - this.minimapHeight / this.scale / 2;
128128
}
129129

130+
// eslint-disable-next-line complexity
130131
private drawCameraBorderFrame() {
131132
const cameraState = this.props.camera.getCameraState();
132133

src/react-components/Block.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const GraphBlock = <T extends TBlock>({
6666
}
6767
});
6868
}
69+
return undefined;
6970
}, [viewState]);
7071

7172
useEffect(() => {

0 commit comments

Comments
 (0)