Skip to content

Commit 398651c

Browse files
committed
style: fix lint errors reported after update
1 parent 74c4d3b commit 398651c

11 files changed

Lines changed: 18 additions & 17 deletions

src/fields/scratch_field_variable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ScratchFieldVariable extends Blockly.FieldVariable {
4747
// dropdownCreate returns MenuOption[] rather than Blockly.MenuGenerator's
4848
// MenuOption[][] variant; the cast is needed to satisfy FieldVariable's
4949
// menuGenerator_ type while the actual runtime shape is compatible.
50-
this.menuGenerator_ = ScratchFieldVariable.dropdownCreate.bind(this) as unknown as Blockly.MenuGenerator
50+
this.menuGenerator_ = ScratchFieldVariable.dropdownCreate.bind(this)
5151
}
5252

5353
initModel() {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export function isContentNodeFocused(): boolean {
159159
return Blockly.getFocusManager().getFocusedNode() !== null
160160
}
161161

162-
;(registerContinuousToolbox as () => void)()
162+
registerContinuousToolbox()
163163
Blockly.Scrollbar.scrollbarThickness = Blockly.Touch.TOUCH_ENABLED ? 14 : 11
164164
Blockly.FlyoutButton.TEXT_MARGIN_X = 40
165165
Blockly.FlyoutButton.TEXT_MARGIN_Y = 10

src/renderer/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class ConstantProvider extends Blockly.zelos.ConstantProvider {
5252
* @returns The shape object for the given connection.
5353
*/
5454
override shapeFor(connection: Blockly.RenderedConnection): ReturnType<Blockly.zelos.ConstantProvider['shapeFor']> {
55-
const connectionType = connection.type as Blockly.ConnectionType
55+
const connectionType: Blockly.ConnectionType = connection.type
5656
let checks = connection.getCheck()
5757
const hexagonal = this.HEXAGONAL
5858
const rounded = this.ROUNDED

src/renderer/drawer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class Drawer extends Blockly.zelos.Drawer {
6464
*/
6565
override drawConnectionHighlightPath(measurable: Blockly.blockRendering.Connection) {
6666
const conn = measurable.connectionModel
67-
const connectionType = conn.type as Blockly.ConnectionType
67+
const connectionType: Blockly.ConnectionType = conn.type
6868
if (connectionType === Blockly.ConnectionType.INPUT_VALUE && measurable.isDynamicShape) {
6969
const input = measurable as Blockly.blockRendering.InlineInput
7070
const EXPAND_X = 0.5

src/renderer/renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export class ScratchRenderer extends Blockly.zelos.Renderer {
6565
* @returns True if we should highlight the connection.
6666
*/
6767
override shouldHighlightConnection(connection: Blockly.RenderedConnection): boolean {
68-
return (connection.type as Blockly.ConnectionType) === Blockly.ConnectionType.INPUT_VALUE
68+
const connectionType: Blockly.ConnectionType = connection.type
69+
return connectionType === Blockly.ConnectionType.INPUT_VALUE
6970
}
7071
}
7172

src/scratch_c_block_wrap.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Blockly.Connection.getConnectionForOrphanedConnection = function (
2828
// Apply the wrapping logic when the orphaned connection is a statement
2929
// connection (PREVIOUS_STATEMENT). Value connections (OUTPUT_VALUE) are
3030
// already handled by the original implementation.
31-
if ((orphanConnection.type as Blockly.ConnectionType) === Blockly.ConnectionType.PREVIOUS_STATEMENT) {
31+
const orphanType: Blockly.ConnectionType = orphanConnection.type
32+
if (orphanType === Blockly.ConnectionType.PREVIOUS_STATEMENT) {
3233
const checker = orphanConnection.getConnectionChecker()
3334
for (const input of startBlock.inputList) {
3435
const conn = input.connection
@@ -87,7 +88,7 @@ Reflect.set(
8788
if (markerPreviousConnection?.isConnected() && !markerNextConnection?.isConnected()) {
8889
for (const input of marker.inputList) {
8990
const conn = input.connection
90-
const connType = conn?.type as Blockly.ConnectionType | undefined
91+
const connType = conn?.type
9192
if (connType !== Blockly.ConnectionType.NEXT_STATEMENT || !conn?.isConnected()) {
9293
continue
9394
}

src/scratch_comment_bubble.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class ScratchCommentBubble
6969
if (gesture) {
7070
// ScratchCommentBubble implements IBubble structurally but TypeScript
7171
// cannot verify it because IBubble.drag has a different signature here.
72-
gesture.handleBubbleStart(e, this as unknown as Blockly.IBubble)
72+
gesture.handleBubbleStart(e, this)
7373
Blockly.common.setSelected(this)
7474
}
7575
}

src/scratch_connection_checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ class ScratchConnectionChecker extends Blockly.ConnectionChecker {
5050
// getConnectionForOrphanedConnection patch routes displaced blocks into
5151
// statement inputs, so we allow the connection when a suitable statement
5252
// input exists on the dragging block.
53+
const bType: Blockly.ConnectionType = b.type
5354
if (
54-
(b.type as Blockly.ConnectionType) === Blockly.ConnectionType.NEXT_STATEMENT &&
55+
bType === Blockly.ConnectionType.NEXT_STATEMENT &&
5556
b.isConnected() &&
5657
!(a.getSourceBlock() as Blockly.Block).nextConnection
5758
) {

tests/browser/scratch_field_dropdown.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import { registerScratchFieldDropdown } from '../../src/fields/scratch_field_dro
2525
let originalFieldDropdown: (new (...args: unknown[]) => Blockly.Field) | null = null
2626

2727
beforeAll(() => {
28-
originalFieldDropdown = Blockly.registry.getClass(Blockly.registry.Type.FIELD, 'field_dropdown') as
29-
| (new (...args: unknown[]) => Blockly.Field)
30-
| null
28+
originalFieldDropdown = Blockly.registry.getClass(Blockly.registry.Type.FIELD, 'field_dropdown')
3129
registerScratchFieldDropdown()
3230
Blockly.Blocks.test_target_menu = {
3331
init(this: Blockly.Block) {

tests/unit/block_input_serialization.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('block input serialization round-trip', () => {
319319
const dom = Blockly.Xml.blockToDom(block, true)
320320
expect(dom).toBeInstanceOf(Element)
321321

322-
const xmlStr = new XMLSerializer().serializeToString(dom as Element)
322+
const xmlStr = new XMLSerializer().serializeToString(dom)
323323
expect(xmlStr).toContain('name="VALUE"')
324324
expect(xmlStr).toContain('shadow')
325325
// With opt_noId, no element should have an id attribute

0 commit comments

Comments
 (0)