fix: enable missingRequire in build_tasks (#5510)

This commit is contained in:
Rachel Fenichel
2021-09-21 13:19:55 -07:00
committed by GitHub
parent 953e3b67b1
commit d83eb1364b
6 changed files with 30 additions and 22 deletions

View File

@@ -17,7 +17,11 @@ goog.module.declareLegacyNamespace();
/* eslint-disable-next-line no-unused-vars */
const Connection = goog.requireType('Blockly.Connection');
/* eslint-disable-next-line no-unused-vars */
const ICopyable = goog.requireType('Blockly.ICopyable');
/* eslint-disable-next-line no-unused-vars */
const Workspace = goog.requireType('Blockly.Workspace');
/* eslint-disable-next-line no-unused-vars */
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
/**
@@ -49,13 +53,13 @@ exports.setMainWorkspace = setMainWorkspace;
/**
* Currently selected block.
* @type {?Blockly.ICopyable}
* @type {?ICopyable}
*/
let selected = null;
/**
* Returns the currently selected block.
* @return {?Blockly.ICopyable} The currently selected block.
* @return {?ICopyable} The currently selected block.
*/
const getSelected = function() {
return selected;
@@ -64,7 +68,7 @@ exports.getSelected = getSelected;
/**
* Sets the currently selected block.
* @param {?Blockly.ICopyable} newSelection The newly selected block.
* @param {?ICopyable} newSelection The newly selected block.
*/
const setSelected = function(newSelection) {
selected = newSelection;
@@ -105,9 +109,9 @@ exports.setParentContainer = setParentContainer;
* See Blockly.resizeSvgContents to resize the workspace when the contents
* change (e.g. when a block is added or removed).
* Record the height/width of the SVG image.
* @param {!Blockly.WorkspaceSvg} workspace Any workspace in the SVG.
* @param {!WorkspaceSvg} workspace Any workspace in the SVG.
*/
const svgResize = function(workspace) {
const svgResize = function(workspace) {
let mainWorkspace = workspace;
while (mainWorkspace.options.parentWorkspace) {
mainWorkspace = mainWorkspace.options.parentWorkspace;

View File

@@ -14,14 +14,16 @@
goog.module('Blockly.ISelectable');
goog.module.declareLegacyNamespace();
goog.requireType('Blockly.IDeletable');
goog.requireType('Blockly.IMovable');
// eslint-disable-next-line no-unused-vars
const IDeletable = goog.requireType('Blockly.IDeletable');
// eslint-disable-next-line no-unused-vars
const IMovable = goog.requireType('Blockly.IMovable');
/**
* The interface for an object that is selectable.
* @extends {Blockly.IDeletable}
* @extends {Blockly.IMovable}
* @extends {IDeletable}
* @extends {IMovable}
* @interface
*/
const ISelectable = function() {};

View File

@@ -13,11 +13,12 @@
goog.module('Blockly.serialization.exceptions');
goog.module.declareLegacyNamespace();
// eslint-disable-next-line no-unused-vars
const Block = goog.requireType('Blockly.Block');
// eslint-disable-next-line no-unused-vars
const {State} = goog.requireType('Blockly.serialization.blocks');
class DeserializationError extends Error { }
class DeserializationError extends Error {}
exports.DeserializationError = DeserializationError;
/**
@@ -49,7 +50,7 @@ class MissingConnection extends DeserializationError {
/**
* @param {string} connection The name of the connection that is missing. E.g.
* 'IF0', or 'next'.
* @param {!Blockly.Block} block The block missing the connection.
* @param {!Block} block The block missing the connection.
* @param {!State} state The state object containing the bad connection.
* @package
*/
@@ -59,7 +60,7 @@ connection`);
/**
* The block missing the connection.
* @type {!Blockly.Block}
* @type {!Block}
*/
this.block = block;
@@ -81,7 +82,7 @@ class BadConnectionCheck extends DeserializationError {
* @param {string} reason The reason the connections were not compatible.
* @param {string} childConnection The name of the incompatible child
* connection. E.g. 'output' or 'previous'.
* @param {!Blockly.Block} childBlock The child block that could not connect
* @param {!Block} childBlock The child block that could not connect
* to its parent.
* @param {!State} childState The state object representing the child block.
* @package
@@ -92,7 +93,7 @@ ${childConnection} to its parent, because: ${reason}`);
/**
* The block that could not connect to its parent.
* @type {!Blockly.Block}
* @type {!Block}
*/
this.childBlock = childBlock;

View File

@@ -206,7 +206,7 @@ ToolboxCategory.prototype.parseContents_ = function(categoryDef) {
for (let i = 0; i < contents.length; i++) {
const itemDef = contents[i];
const flyoutItem =
/** @type {Blockly.utils.toolbox.FlyoutItemInfo} */ (itemDef);
/** @type {toolbox.FlyoutItemInfo} */ (itemDef);
this.flyoutItems_.push(flyoutItem);
}
}

View File

@@ -18,6 +18,8 @@ const Css = goog.require('Blockly.Css');
const Events = goog.require('Blockly.Events');
/* eslint-disable-next-line no-unused-vars */
const IPositionable = goog.requireType('Blockly.IPositionable');
/* eslint-disable-next-line no-unused-vars */
const MetricsManager = goog.requireType('Blockly.MetricsManager');
const Rect = goog.require('Blockly.utils.Rect');
const Size = goog.require('Blockly.utils.Size');
const Svg = goog.require('Blockly.utils.Svg');
@@ -247,7 +249,7 @@ ZoomControls.prototype.getBoundingRectangle = function() {
* Positions the zoom controls.
* It is positioned in the opposite corner to the corner the
* categories/toolbox starts at.
* @param {!Blockly.MetricsManager.UiMetrics} metrics The workspace metrics.
* @param {!MetricsManager.UiMetrics} metrics The workspace metrics.
* @param {!Array<!Rect>} savedPositions List of rectangles that
* are already on the workspace.
*/
@@ -264,8 +266,8 @@ ZoomControls.prototype.position = function(metrics, savedPositions) {
height += this.LARGE_SPACING_ + this.HEIGHT_;
}
const startRect = uiPosition.getStartPositionRect(
cornerPosition, new Size(this.WIDTH_, height),
this.MARGIN_HORIZONTAL_, this.MARGIN_VERTICAL_, metrics, this.workspace_);
cornerPosition, new Size(this.WIDTH_, height), this.MARGIN_HORIZONTAL_,
this.MARGIN_VERTICAL_, metrics, this.workspace_);
const verticalPosition = cornerPosition.vertical;
const bumpDirection = verticalPosition === uiPosition.verticalPosition.TOP ?

View File

@@ -77,8 +77,7 @@ var JSCOMP_ERROR = [
'missingPolyfill',
'missingProperties',
'missingProvide',
// 'missingRequire', As of Jan 8 2021, this enables the strict require check.
// Disabling this until we have fixed all the require issues.
'missingRequire',
'missingReturn',
// 'missingSourcesWarnings',
'moduleLoad',
@@ -397,7 +396,7 @@ function buildLangfiles(done) {
// Create output directory.
const outputDir = path.join(BUILD_DIR, 'msg', 'js');
fs.mkdirSync(outputDir, {recursive: true});
// Run create_messages.py.
let json_files = fs.readdirSync(path.join('msg', 'json'));
json_files = json_files.filter(file => file.endsWith('json') &&