Skip to content

Commit

Permalink
chore: use import type where possible (google#6279)
Browse files Browse the repository at this point in the history
* chore: automatically change imports to import types

* chore: revert changes that actually need to be imports

* chore: format

* chore: add more import type statements based on importsNotUsedAsValues

* chore: fix tsconfig

* chore: add link to compiler issue
  • Loading branch information
BeksOmega committed Aug 2, 2022
1 parent 33ab822 commit 8fc1acd
Show file tree
Hide file tree
Showing 187 changed files with 598 additions and 1,127 deletions.
27 changes: 9 additions & 18 deletions core/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,31 @@ import './events/events_block_create.js';
import './events/events_block_delete.js';

import {Blocks} from './blocks.js';
/* eslint-disable-next-line no-unused-vars */
import {Comment} from './comment.js';
import type {Comment} from './comment.js';
import * as common from './common.js';
import {Connection} from './connection.js';
import {ConnectionType} from './connection_type.js';
import * as constants from './constants.js';
/* eslint-disable-next-line no-unused-vars */
import {Abstract} from './events/events_abstract.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockMove} from './events/events_block_move.js';
import type {Abstract} from './events/events_abstract.js';
import type {BlockMove} from './events/events_block_move.js';
import * as eventUtils from './events/utils.js';
import * as Extensions from './extensions.js';
/* eslint-disable-next-line no-unused-vars */
import {Field} from './field.js';
import type {Field} from './field.js';
import * as fieldRegistry from './field_registry.js';
import {Align, Input} from './input.js';
import {inputTypes} from './input_types.js';
/* eslint-disable-next-line no-unused-vars */
import {IASTNodeLocation} from './interfaces/i_ast_node_location.js';
/* eslint-disable-next-line no-unused-vars */
import {IDeletable} from './interfaces/i_deletable.js';
import type {IASTNodeLocation} from './interfaces/i_ast_node_location.js';
import type {IDeletable} from './interfaces/i_deletable.js';
import {ASTNode} from './keyboard_nav/ast_node.js';
/* eslint-disable-next-line no-unused-vars */
import {Mutator} from './mutator.js';
import type {Mutator} from './mutator.js';
import * as Tooltip from './tooltip.js';
import * as arrayUtils from './utils/array.js';
import {Coordinate} from './utils/coordinate.js';
import * as idGenerator from './utils/idgenerator.js';
import * as parsing from './utils/parsing.js';
import {Size} from './utils/size.js';
/* eslint-disable-next-line no-unused-vars */
import {VariableModel} from './variable_model.js';
/* eslint-disable-next-line no-unused-vars */
import {Workspace} from './workspace.js';
import type {VariableModel} from './variable_model.js';
import type {Workspace} from './workspace.js';


/**
Expand Down
3 changes: 1 addition & 2 deletions core/block_animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.blockAnimations');

/* eslint-disable-next-line no-unused-vars */
import {BlockSvg} from './block_svg.js';
import type {BlockSvg} from './block_svg.js';
import * as dom from './utils/dom.js';
import {Svg} from './utils/svg.js';

Expand Down
18 changes: 6 additions & 12 deletions core/block_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,19 @@ goog.declareModuleId('Blockly.BlockDragger');
import './events/events_block_drag.js';

import * as blockAnimation from './block_animations.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockSvg} from './block_svg.js';
import type {BlockSvg} from './block_svg.js';
import * as bumpObjects from './bump_objects.js';
import * as common from './common.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockMove} from './events/events_block_move.js';
import type {BlockMove} from './events/events_block_move.js';
import * as eventUtils from './events/utils.js';
/* eslint-disable-next-line no-unused-vars */
import {Icon} from './icon.js';
import type {Icon} from './icon.js';
import {InsertionMarkerManager} from './insertion_marker_manager.js';
/* eslint-disable-next-line no-unused-vars */
import {IBlockDragger} from './interfaces/i_block_dragger.js';
/* eslint-disable-next-line no-unused-vars */
import {IDragTarget} from './interfaces/i_drag_target.js';
import type {IBlockDragger} from './interfaces/i_block_dragger.js';
import type {IDragTarget} from './interfaces/i_drag_target.js';
import * as registry from './registry.js';
import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
44 changes: 15 additions & 29 deletions core/block_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,58 +26,44 @@ import './touch.js';
import {Block} from './block.js';
import * as blockAnimations from './block_animations.js';
import * as browserEvents from './browser_events.js';
/* eslint-disable-next-line no-unused-vars */
import {Comment} from './comment.js';
import * as common from './common.js';
import {config} from './config.js';
/* eslint-disable-next-line no-unused-vars */
import {Connection} from './connection.js';
import type {Connection} from './connection.js';
import {ConnectionType} from './connection_type.js';
import * as constants from './constants.js';
import * as ContextMenu from './contextmenu.js';
import {ContextMenuOption, ContextMenuRegistry, LegacyContextMenuOption} from './contextmenu_registry.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockMove} from './events/events_block_move.js';
import type {BlockMove} from './events/events_block_move.js';
import * as eventUtils from './events/utils.js';
/* eslint-disable-next-line no-unused-vars */
import {Field} from './field.js';
import type {Field} from './field.js';
import {FieldLabel} from './field_label.js';
/* eslint-disable-next-line no-unused-vars */
import {Icon} from './icon.js';
/* eslint-disable-next-line no-unused-vars */
import {Input} from './input.js';
/* eslint-disable-next-line no-unused-vars */
import {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
/* eslint-disable-next-line no-unused-vars */
import {IBoundedElement} from './interfaces/i_bounded_element.js';
import {CopyData, ICopyable} from './interfaces/i_copyable.js';
/* eslint-disable-next-line no-unused-vars */
import {IDraggable} from './interfaces/i_draggable.js';
import type {Icon} from './icon.js';
import type {Input} from './input.js';
import type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
import type {CopyData, ICopyable} from './interfaces/i_copyable.js';
import type {IDraggable} from './interfaces/i_draggable.js';
import * as internalConstants from './internal_constants.js';
import {ASTNode} from './keyboard_nav/ast_node.js';
import {TabNavigateCursor} from './keyboard_nav/tab_navigate_cursor.js';
import {MarkerManager} from './marker_manager.js';
import {Msg} from './msg.js';
/* eslint-disable-next-line no-unused-vars */
import {Mutator} from './mutator.js';
import type {Mutator} from './mutator.js';
import {RenderedConnection} from './rendered_connection.js';
/* eslint-disable-next-line no-unused-vars */
import {Debug as BlockRenderingDebug} from './renderers/common/debugger.js';
/* eslint-disable-next-line no-unused-vars */
import {IPathObject} from './renderers/common/i_path_object.js';
import type {Debug as BlockRenderingDebug} from './renderers/common/debugger.js';
import type {IPathObject} from './renderers/common/i_path_object.js';
import * as blocks from './serialization/blocks.js';
import {BlockStyle} from './theme.js';
import type {BlockStyle} from './theme.js';
import * as Tooltip from './tooltip.js';
import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
import {Rect} from './utils/rect.js';
import {Svg} from './utils/svg.js';
import * as svgMath from './utils/svg_math.js';
/* eslint-disable-next-line no-unused-vars */
import {Warning} from './warning.js';
import {Workspace} from './workspace.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {Workspace} from './workspace.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
14 changes: 5 additions & 9 deletions core/bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ import './metrics_manager.js';
// Unused import preserved for side-effects. Remove if unneeded.
import './workspace.js';

/* eslint-disable-next-line no-unused-vars */
import {BlockDragSurfaceSvg} from './block_drag_surface.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockSvg} from './block_svg.js';
import type {BlockDragSurfaceSvg} from './block_drag_surface.js';
import type {BlockSvg} from './block_svg.js';
import * as browserEvents from './browser_events.js';
/* eslint-disable-next-line no-unused-vars */
import {IBubble} from './interfaces/i_bubble.js';
import {ContainerRegion} from './metrics_manager.js';
import type {IBubble} from './interfaces/i_bubble.js';
import type {ContainerRegion} from './metrics_manager.js';
import {Scrollbar} from './scrollbar.js';
import * as Touch from './touch.js';
import {Coordinate} from './utils/coordinate.js';
Expand All @@ -37,8 +34,7 @@ import * as math from './utils/math.js';
import {Size} from './utils/size.js';
import {Svg} from './utils/svg.js';
import * as userAgent from './utils/useragent.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
18 changes: 6 additions & 12 deletions core/bubble_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,17 @@ import './bubble.js';
// Unused import preserved for side-effects. Remove if unneeded.
import './constants.js';

/* eslint-disable-next-line no-unused-vars */
import {BlockDragSurfaceSvg} from './block_drag_surface.js';
import type {BlockDragSurfaceSvg} from './block_drag_surface.js';
import {ComponentManager} from './component_manager.js';
/* eslint-disable-next-line no-unused-vars */
import {CommentMove} from './events/events_comment_move.js';
import type {CommentMove} from './events/events_comment_move.js';
import * as eventUtils from './events/utils.js';
/* eslint-disable-next-line no-unused-vars */
import {IBubble} from './interfaces/i_bubble.js';
/* eslint-disable-next-line no-unused-vars */
import {IDeleteArea} from './interfaces/i_delete_area.js';
/* eslint-disable-next-line no-unused-vars */
import {IDragTarget} from './interfaces/i_drag_target.js';
import type {IBubble} from './interfaces/i_bubble.js';
import type {IDeleteArea} from './interfaces/i_delete_area.js';
import type {IDragTarget} from './interfaces/i_drag_target.js';
import {Coordinate} from './utils/coordinate.js';
import * as svgMath from './utils/svg_math.js';
import {WorkspaceCommentSvg} from './workspace_comment_svg.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
28 changes: 11 additions & 17 deletions core/bump_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,19 @@
import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.bumpObjects');

/* eslint-disable-next-line no-unused-vars */
import {BlockSvg} from './block_svg.js';
/* eslint-disable-next-line no-unused-vars */
import {Abstract} from './events/events_abstract.js';
import {BlockCreate} from './events/events_block_create.js';
import {BlockMove} from './events/events_block_move.js';
import {CommentCreate} from './events/events_comment_create.js';
import {CommentMove} from './events/events_comment_move.js';
/* eslint-disable-next-line no-unused-vars */
import {ViewportChange} from './events/events_viewport.js';
import type {BlockSvg} from './block_svg.js';
import type {Abstract} from './events/events_abstract.js';
import type {BlockCreate} from './events/events_block_create.js';
import type {BlockMove} from './events/events_block_move.js';
import type {CommentCreate} from './events/events_comment_create.js';
import type {CommentMove} from './events/events_comment_move.js';
import type {ViewportChange} from './events/events_viewport.js';
import * as eventUtils from './events/utils.js';
/* eslint-disable-next-line no-unused-vars */
import {IBoundedElement} from './interfaces/i_bounded_element.js';
import {ContainerRegion, MetricsManager} from './metrics_manager.js';
import type {IBoundedElement} from './interfaces/i_bounded_element.js';
import type {ContainerRegion, MetricsManager} from './metrics_manager.js';
import * as mathUtils from './utils/math.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceCommentSvg} from './workspace_comment_svg.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {WorkspaceCommentSvg} from './workspace_comment_svg.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
2 changes: 1 addition & 1 deletion core/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.clipboard');

import {CopyData, ICopyable} from './interfaces/i_copyable.js';
import type {CopyData, ICopyable} from './interfaces/i_copyable.js';


/** Metadata about the object that is currently on the clipboard. */
Expand Down
11 changes: 4 additions & 7 deletions core/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@ import './events/events_bubble_open.js';
// Unused import preserved for side-effects. Remove if unneeded.
import './warning.js';

import {CommentModel} from './block.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockSvg} from './block_svg.js';
import type {CommentModel} from './block.js';
import type {BlockSvg} from './block_svg.js';
import * as browserEvents from './browser_events.js';
import {Bubble} from './bubble.js';
import * as Css from './css.js';
import * as eventUtils from './events/utils.js';
import {Icon} from './icon.js';
/* eslint-disable-next-line no-unused-vars */
import {Coordinate} from './utils/coordinate.js';
import type {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
/* eslint-disable-next-line no-unused-vars */
import {Size} from './utils/size.js';
import type {Size} from './utils/size.js';
import {Svg} from './utils/svg.js';
import * as userAgent from './utils/useragent.js';

Expand Down
15 changes: 5 additions & 10 deletions core/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.common');

/* eslint-disable-next-line no-unused-vars */
/* eslint-disable-next-line no-unused-vars */
import {Block} from './block.js';
import type {Block} from './block.js';
import {BlockDefinition, Blocks} from './blocks.js';
/* eslint-disable-next-line no-unused-vars */
import {Connection} from './connection.js';
/* eslint-disable-next-line no-unused-vars */
import {ICopyable} from './interfaces/i_copyable.js';
/* eslint-disable-next-line no-unused-vars */
import {Workspace} from './workspace.js';
/* eslint-disable-next-line no-unused-vars */
import {WorkspaceSvg} from './workspace_svg.js';
import type {Connection} from './connection.js';
import type {ICopyable} from './interfaces/i_copyable.js';
import type {Workspace} from './workspace.js';
import type {WorkspaceSvg} from './workspace_svg.js';


/**
Expand Down
15 changes: 5 additions & 10 deletions core/component_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@
import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.ComponentManager');

/* eslint-disable-next-line no-unused-vars */
import {IAutoHideable} from './interfaces/i_autohideable.js';
/* eslint-disable-next-line no-unused-vars */
import {IComponent} from './interfaces/i_component.js';
/* eslint-disable-next-line no-unused-vars */
import {IDeleteArea} from './interfaces/i_delete_area.js';
/* eslint-disable-next-line no-unused-vars */
import {IDragTarget} from './interfaces/i_drag_target.js';
/* eslint-disable-next-line no-unused-vars */
import {IPositionable} from './interfaces/i_positionable.js';
import type {IAutoHideable} from './interfaces/i_autohideable.js';
import type {IComponent} from './interfaces/i_component.js';
import type {IDeleteArea} from './interfaces/i_delete_area.js';
import type {IDragTarget} from './interfaces/i_drag_target.js';
import type {IPositionable} from './interfaces/i_positionable.js';
import * as arrayUtils from './utils/array.js';


Expand Down
15 changes: 5 additions & 10 deletions core/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ goog.declareModuleId('Blockly.Connection');
// Unused import preserved for side-effects. Remove if unneeded.
import './constants.js';

/* eslint-disable-next-line no-unused-vars */
import {Block} from './block.js';
import type {Block} from './block.js';
import {ConnectionType} from './connection_type.js';
/* eslint-disable-next-line no-unused-vars */
import {BlockMove} from './events/events_block_move.js';
import type {BlockMove} from './events/events_block_move.js';
import * as eventUtils from './events/utils.js';
/* eslint-disable-next-line no-unused-vars */
import {Input} from './input.js';
/* eslint-disable-next-line no-unused-vars */
import {IASTNodeLocationWithBlock} from './interfaces/i_ast_node_location_with_block.js';
/* eslint-disable-next-line no-unused-vars */
import {IConnectionChecker} from './interfaces/i_connection_checker.js';
import type {Input} from './input.js';
import type {IASTNodeLocationWithBlock} from './interfaces/i_ast_node_location_with_block.js';
import type {IConnectionChecker} from './interfaces/i_connection_checker.js';
import * as blocks from './serialization/blocks.js';
import * as Xml from './xml.js';

Expand Down
6 changes: 2 additions & 4 deletions core/connection_checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ goog.declareModuleId('Blockly.ConnectionChecker');
import * as common from './common.js';
import {Connection} from './connection.js';
import {ConnectionType} from './connection_type.js';
/* eslint-disable-next-line no-unused-vars */
import {IConnectionChecker} from './interfaces/i_connection_checker.js';
import type {IConnectionChecker} from './interfaces/i_connection_checker.js';
import * as internalConstants from './internal_constants.js';
import * as registry from './registry.js';
/* eslint-disable-next-line no-unused-vars */
import {RenderedConnection} from './rendered_connection.js';
import type {RenderedConnection} from './rendered_connection.js';


/**
Expand Down
9 changes: 3 additions & 6 deletions core/connection_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ goog.declareModuleId('Blockly.ConnectionDB');
import './constants.js';

import {ConnectionType} from './connection_type.js';
/* eslint-disable-next-line no-unused-vars */
import {IConnectionChecker} from './interfaces/i_connection_checker.js';
/* eslint-disable-next-line no-unused-vars */
import {RenderedConnection} from './rendered_connection.js';
/* eslint-disable-next-line no-unused-vars */
import {Coordinate} from './utils/coordinate.js';
import type {IConnectionChecker} from './interfaces/i_connection_checker.js';
import type {RenderedConnection} from './rendered_connection.js';
import type {Coordinate} from './utils/coordinate.js';


/**
Expand Down
Loading

0 comments on commit 8fc1acd

Please sign in to comment.