Skip to content

Commit e8f5c27

Browse files
authored
fix(joint-react): fix eslint before release joint react (#3380)
1 parent d6aeb85 commit e8f5c27

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

packages/joint-react/src/state/data-mapping/cell-record-merge.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
/* eslint-disable sonarjs/cognitive-complexity */
21
import type { dia } from '@joint/core';
32
import type { ElementJSONInit, LinkJSONInit, AnyCellRecord } from '../../types/cell.types';
43
import type { Container } from '../../store/state-container';
54
import { isShallowEqual, isPositionEqual, isSizeEqual } from '../../utils/selector-utils';
65
import { mapAttributesToElement } from './element-mapper';
76
import { mapAttributesToLink } from './link-mapper';
87

8+
/* eslint-disable sonarjs/cognitive-complexity -- ref-identity fast paths are
9+
intentionally inlined here; splitting them would defeat the optimization. */
910
/**
1011
* Merge a newly-mapped cell record with the previous one, preserving reference
1112
* identity wherever possible.
@@ -65,6 +66,7 @@ export function mergeCellRecord<
6566
size: mergedSize,
6667
} as Element | Link;
6768
}
69+
/* eslint-enable sonarjs/cognitive-complexity */
6870

6971
/**
7072
* Convert a JointJS cell to its CellRecord representation, routing by type.

packages/joint-react/src/store/graph-projection.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable sonarjs/cognitive-complexity */
2-
/* eslint-disable jsdoc/require-jsdoc */
31
import { type dia } from '@joint/core';
42
import type { ElementJSONInit, LinkJSONInit, CellId } from '../types/cell.types';
53
import { graphChanges, type UpdateGraphOptions } from './graph-changes';
@@ -22,6 +20,7 @@ export type OnIncrementalCellsChange<Element extends ElementJSONInit, Link exten
2220
changes: IncrementalCellsChange<Element, Link>
2321
) => void;
2422

23+
/** Configuration for {@link graphProjection}. */
2524
interface GraphProjectionState<
2625
Element extends ElementJSONInit = ElementJSONInit,
2726
Link extends LinkJSONInit = LinkJSONInit,
@@ -31,6 +30,16 @@ interface GraphProjectionState<
3130
readonly onElementsSizeChange?: (id: CellId, size: dia.Size) => void;
3231
}
3332

33+
/* eslint-disable sonarjs/cognitive-complexity -- graph→container projection
34+
keeps add/change/remove plus connected-link sweeps inline for one-pass perf. */
35+
/**
36+
* Project a JointJS graph into a reactive cells container, keeping the two in
37+
* sync. Subscribes to graph changes and mirrors add / change / remove events
38+
* (including connected-link sweeps) into the container, optionally emitting an
39+
* incremental change set after each commit.
40+
* @param options - graph to project plus optional change/size callbacks
41+
* @returns controller exposing the readonly cells container and sync/update/destroy methods
42+
*/
3443
export function graphProjection<
3544
Element extends ElementJSONInit = ElementJSONInit,
3645
Link extends LinkJSONInit = LinkJSONInit,
@@ -168,7 +177,9 @@ export function graphProjection<
168177
},
169178
};
170179
}
180+
/* eslint-enable sonarjs/cognitive-complexity */
171181

182+
/** Controller returned by {@link graphProjection}. */
172183
export type GraphProjection<
173184
Element extends ElementJSONInit = ElementJSONInit,
174185
Link extends LinkJSONInit = LinkJSONInit,

0 commit comments

Comments
 (0)