Skip to content

Commit 07cdf48

Browse files
chrore: suppress lint errors for createXXXNode
1 parent 1ba01f1 commit 07cdf48

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

src/actions/clipboard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ export class Clipboard {
379379
this.navigation.tryToConnectNodes(
380380
pasteWorkspace,
381381
targetNode,
382+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
382383
ASTNode.createBlockNode(block)!,
383384
);
384385
}

src/actions/disconnect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export class DisconnectAction {
145145
rootBlock.bringToFront();
146146

147147
if (wasVisitingConnection) {
148+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
148149
const connectionNode = ASTNode.createConnectionNode(superiorConnection)!;
149150
workspace.getCursor()?.setCurNode(connectionNode);
150151
}

src/actions/enter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export class EnterAction {
134134
!this.navigation.tryToConnectNodes(
135135
workspace,
136136
stationaryNode,
137+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
137138
ASTNode.createBlockNode(newBlock)!,
138139
)
139140
) {
@@ -144,6 +145,7 @@ export class EnterAction {
144145
}
145146

146147
this.navigation.focusWorkspace(workspace);
148+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
147149
workspace.getCursor()?.setCurNode(ASTNode.createBlockNode(newBlock)!);
148150
}
149151

src/actions/ws_movement.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export class WorkspaceMovement {
115115
const newY = yDirection * WS_MOVE_DISTANCE + wsCoord.y;
116116

117117
cursor.setCurNode(
118+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
118119
ASTNode.createWorkspaceNode(
119120
workspace,
120121
new BlocklyUtils.Coordinate(newX, newY),

src/line_cursor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ export class LineCursor extends Marker {
744744
block = block.getParent();
745745
}
746746
if (block) {
747+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
747748
this.setCurNode(Blockly.ASTNode.createBlockNode(block)!, true);
748749
}
749750
}

src/navigation.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ export class Navigation {
320320
const curNode = cursor.getCurNode();
321321
const block = curNode ? curNode.getSourceBlock() : null;
322322
if (block && block.id === mutatedBlockId) {
323+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
323324
cursor.setCurNode(Blockly.ASTNode.createBlockNode(block)!);
324325
}
325326
}
@@ -347,6 +348,7 @@ export class Navigation {
347348

348349
if (sourceBlock.id === deletedBlockId || ids.includes(sourceBlock.id)) {
349350
cursor.setCurNode(
351+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
350352
Blockly.ASTNode.createWorkspaceNode(
351353
workspace,
352354
WS_COORDINATE_ON_DELETE,
@@ -372,6 +374,7 @@ export class Navigation {
372374
const curNodeBlock = block.isShadow() ? block : block.getParent();
373375
if (curNodeBlock) {
374376
this.getFlyoutCursor(mainWorkspace)?.setCurNode(
377+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
375378
Blockly.ASTNode.createStackNode(curNodeBlock)!,
376379
);
377380
}
@@ -600,12 +603,14 @@ export class Navigation {
600603
if (!defaultFlyoutItem) return;
601604
const defaultFlyoutItemElement = defaultFlyoutItem.getElement();
602605
if (defaultFlyoutItemElement instanceof Blockly.FlyoutButton) {
606+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
603607
const astNode = Blockly.ASTNode.createButtonNode(
604608
defaultFlyoutItemElement as Blockly.FlyoutButton,
605609
)!;
606610
flyoutCursor.setCurNode(astNode);
607611
return true;
608612
} else if (defaultFlyoutItemElement instanceof Blockly.BlockSvg) {
613+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
609614
const astNode = Blockly.ASTNode.createStackNode(
610615
defaultFlyoutItemElement as Blockly.BlockSvg,
611616
)!;
@@ -647,16 +652,18 @@ export class Navigation {
647652
);
648653
if (topBlocks.length > 0) {
649654
cursor.setCurNode(
655+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
650656
Blockly.ASTNode.createTopNode(
651657
topBlocks[prefer === 'first' ? 0 : topBlocks.length - 1],
652658
)!,
653659
);
654660
} else {
661+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
655662
const wsNode = Blockly.ASTNode.createWorkspaceNode(
656663
workspace,
657664
wsCoordinates,
658-
);
659-
cursor.setCurNode(wsNode!);
665+
)!;
666+
cursor.setCurNode(wsNode);
660667
}
661668
return true;
662669
}
@@ -1150,6 +1157,7 @@ export class Navigation {
11501157
this.tryToConnectNodes(
11511158
workspace,
11521159
targetNode,
1160+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11531161
Blockly.ASTNode.createBlockNode(block)!,
11541162
);
11551163
}

0 commit comments

Comments
 (0)