From 4152542c2fcb35a20a17366b604ca1299f6c481e Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 3 Feb 2017 14:01:18 -0800 Subject: [PATCH] Fix some lint errors --- blocks/loops.js | 2 +- blocks/math.js | 2 +- blocks/procedures.js | 5 +++-- blocks/text.js | 4 ++-- core/block.js | 4 ++-- core/blocks.js | 2 +- core/events.js | 2 +- core/field_number.js | 6 +++--- core/field_variable.js | 3 +-- core/procedures.js | 2 +- core/scrollbar.js | 8 ++++---- core/toolbox.js | 5 ++--- core/utils.js | 4 ++-- core/workspace_svg.js | 6 +++--- 14 files changed, 27 insertions(+), 28 deletions(-) diff --git a/blocks/loops.js b/blocks/loops.js index f89a528d7..84c6e9d31 100644 --- a/blocks/loops.js +++ b/blocks/loops.js @@ -256,7 +256,7 @@ Blockly.Blocks['controls_flow_statements'] = { * @param {!Blockly.Events.Abstract} e Change event. * @this Blockly.Block */ - onchange: function(e) { + onchange: function(/* e */) { if (!this.workspace.isDragging || this.workspace.isDragging()) { return; // Don't change state at the start of a drag. } diff --git a/blocks/math.js b/blocks/math.js index 9fbdde134..7cd858061 100644 --- a/blocks/math.js +++ b/blocks/math.js @@ -412,7 +412,7 @@ Blockly.Blocks.math.TOOLTIPS_BY_OP_ = { 'MEDIAN': '%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}', 'MODE': '%{BKY_MATH_ONLIST_TOOLTIP_MODE}', 'STD_DEV': '%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}', - 'RANDOM': '%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}', + 'RANDOM': '%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}' }; Blockly.Extensions.register("math_op_tooltip", Blockly.Extensions.buildTooltipForDropdown( diff --git a/blocks/procedures.js b/blocks/procedures.js index 52c3cdfef..d545a1437 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -120,7 +120,7 @@ Blockly.Blocks['procedures_defnoreturn'] = { }, /** * Create XML to represent the argument inputs. - * @param {=boolean} opt_paramIds If true include the IDs of the parameter + * @param {boolean=} opt_paramIds If true include the IDs of the parameter * quarks. Used by Blockly.Procedures.mutateCallers for reconnection. * @return {!Element} XML storage element. * @this Blockly.Block @@ -679,6 +679,7 @@ Blockly.Blocks['procedures_callnoreturn'] = { /** * Procedure calls cannot exist without the corresponding procedure * definition. Enforce this link whenever an event is fired. + * @param {!Blockly.Events.Abstract} event Change event. * @this Blockly.Block */ onchange: function(event) { @@ -840,7 +841,7 @@ Blockly.Blocks['procedures_ifreturn'] = { * @param {!Blockly.Events.Abstract} e Change event. * @this Blockly.Block */ - onchange: function(e) { + onchange: function(/* e */) { if (!this.workspace.isDragging || this.workspace.isDragging()) { return; // Don't change state at the start of a drag. } diff --git a/blocks/text.js b/blocks/text.js index afe8f253b..f122afde6 100644 --- a/blocks/text.js +++ b/blocks/text.js @@ -742,7 +742,7 @@ Blockly.Blocks['text_replace'] = { "type": "input_value", "name": "TEXT", "check": "String" - }, + } ], "output": "String", "inputsInline": true, @@ -766,7 +766,7 @@ Blockly.Blocks['text_reverse'] = { "type": "input_value", "name": "TEXT", "check": "String" - }, + } ], "output": "String", "inputsInline": true, diff --git a/core/block.js b/core/block.js index 42cfaa74e..4fd925563 100644 --- a/core/block.js +++ b/core/block.js @@ -1338,7 +1338,7 @@ Blockly.Block.prototype.setCommentText = function(text) { * Set this block's warning text. * @param {?string} text The text, or null to delete. */ -Blockly.Block.prototype.setWarningText = function(text) { +Blockly.Block.prototype.setWarningText = function(/* text */) { // NOP. }; @@ -1346,7 +1346,7 @@ Blockly.Block.prototype.setWarningText = function(text) { * Give this block a mutator dialog. * @param {Blockly.Mutator} mutator A mutator dialog instance or null to remove. */ -Blockly.Block.prototype.setMutator = function(mutator) { +Blockly.Block.prototype.setMutator = function(/* mutator */) { // NOP. }; diff --git a/core/blocks.js b/core/blocks.js index 9bd09a7dd..66ea2257a 100644 --- a/core/blocks.js +++ b/core/blocks.js @@ -27,6 +27,6 @@ /** * A mapping of block type names to block prototype objects. * @name Blockly.Blocks - * @type {!Object} + * @type {!Object} */ goog.provide('Blockly.Blocks'); diff --git a/core/events.js b/core/events.js index ddd5ca2ae..a5f5b71e0 100644 --- a/core/events.js +++ b/core/events.js @@ -307,7 +307,7 @@ Blockly.Events.Abstract = function(block) { */ Blockly.Events.Abstract.prototype.toJson = function() { var json = { - 'type': this.type, + 'type': this.type }; if (this.blockId) { json['blockId'] = this.blockId; diff --git a/core/field_number.js b/core/field_number.js index 55daa477b..722b0eefa 100644 --- a/core/field_number.js +++ b/core/field_number.js @@ -31,7 +31,7 @@ goog.require('goog.math'); /** * Class for an editable number field. - * @param {(string|number)=} value The initial content of the field. The value + * @param {(string|number)=} opt_value The initial content of the field. The value * should cast to a number, and if it does not, '0' will be used. * @param {(string|number)=} opt_min Minimum value. * @param {(string|number)=} opt_max Maximum value. @@ -43,8 +43,8 @@ goog.require('goog.math'); * @extends {Blockly.FieldTextInput} * @constructor */ -Blockly.FieldNumber = - function(opt_value, opt_min, opt_max, opt_precision, opt_validator) { +Blockly.FieldNumber = function(opt_value, opt_min, opt_max, opt_precision, + opt_validator) { opt_value = (opt_value && !isNaN(opt_value)) ? String(opt_value) : '0'; Blockly.FieldNumber.superClass_.constructor.call( this, opt_value, opt_validator); diff --git a/core/field_variable.js b/core/field_variable.js index ee621613a..be8a68033 100644 --- a/core/field_variable.js +++ b/core/field_variable.js @@ -125,7 +125,7 @@ Blockly.FieldVariable.prototype.setValue = function(newValue) { * Return a sorted list of variable names for variable dropdown menus. * Include a special option at the end for creating a new variable name. * @return {!Array.} Array of variable names. - * @this {!Blockly.FieldVariable} + * @this {Blockly.FieldVariable} */ Blockly.FieldVariable.dropdownCreate = function() { if (this.sourceBlock_ && this.sourceBlock_.workspace) { @@ -164,7 +164,6 @@ Blockly.FieldVariable.dropdownCreate = function() { * @param {!goog.ui.MenuItem} menuItem The MenuItem selected within menu. */ Blockly.FieldVariable.prototype.onItemSelected = function(menu, menuItem) { - var menuLength = menu.getChildCount(); var itemText = menuItem.getValue(); if (this.sourceBlock_) { var workspace = this.sourceBlock_.workspace; diff --git a/core/procedures.js b/core/procedures.js index 543d46823..aa8f1faa5 100644 --- a/core/procedures.js +++ b/core/procedures.js @@ -132,7 +132,7 @@ Blockly.Procedures.isLegalName_ = function(name, workspace, opt_exclude) { * Rename a procedure. Called by the editable field. * @param {string} name The proposed new name. * @return {string} The accepted name. - * @this {!Blockly.Field} + * @this {Blockly.Field} */ Blockly.Procedures.rename = function(name) { // Strip leading and trailing whitespace. Beyond this, all names are legal. diff --git a/core/scrollbar.js b/core/scrollbar.js index ee461085a..3103f14f0 100644 --- a/core/scrollbar.js +++ b/core/scrollbar.js @@ -364,9 +364,9 @@ Blockly.Scrollbar.prototype.setScrollViewSize_ = function(newSize) { }; /** -+ * Set whether this scrollbar's container is visible. -+ * @param {boolean} visible Whether the container is visible. -+ */ + * Set whether this scrollbar's container is visible. + * @param {boolean} visible Whether the container is visible. + */ Blockly.ScrollbarPair.prototype.setContainerVisible = function(visible) { this.hScroll.setContainerVisible(visible); this.vScroll.setContainerVisible(visible); @@ -646,7 +646,7 @@ Blockly.Scrollbar.prototype.setVisible = function(visible) { * We cannot rely on the containing workspace being hidden to hide us * because it is not necessarily our parent in the dom. */ - Blockly.Scrollbar.prototype.updateDisplay_ = function() { +Blockly.Scrollbar.prototype.updateDisplay_ = function() { var show = true; // Check whether our parent/container is visible. if (!this.containerVisible_) { diff --git a/core/toolbox.js b/core/toolbox.js index 03a1e0654..4f9819942 100644 --- a/core/toolbox.js +++ b/core/toolbox.js @@ -241,7 +241,6 @@ Blockly.Toolbox.prototype.position = function() { return; } var svg = this.workspace_.getParentSvg(); - var svgPosition = goog.style.getPageOffset(svg); var svgSize = Blockly.svgSize(svg); if (this.horizontalLayout_) { treeDiv.style.left = '0'; @@ -633,8 +632,8 @@ Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function(e) { Blockly.Toolbox.TreeNode.prototype.onKeyDown = function(e) { if (this.tree.toolbox_.horizontalLayout_) { var map = {}; - var next = goog.events.KeyCodes.DOWN - var prev = goog.events.KeyCodes.UP + var next = goog.events.KeyCodes.DOWN; + var prev = goog.events.KeyCodes.UP; map[goog.events.KeyCodes.RIGHT] = this.rightToLeft_ ? prev : next; map[goog.events.KeyCodes.LEFT] = this.rightToLeft_ ? next : prev; map[goog.events.KeyCodes.UP] = goog.events.KeyCodes.LEFT; diff --git a/core/utils.js b/core/utils.js index 2287d09e1..8ce6306cb 100644 --- a/core/utils.js +++ b/core/utils.js @@ -854,8 +854,8 @@ Blockly.utils.runAfterPageLoad = function(fn) { // Poll readyState. var readyStateCheckInterval = setInterval(function() { if (document.readyState === 'complete') { - clearInterval(readyStateCheckInterval); - fn(); + clearInterval(readyStateCheckInterval); + fn(); } }, 10); } diff --git a/core/workspace_svg.js b/core/workspace_svg.js index ab9260c12..1b22af9a2 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -211,7 +211,7 @@ Blockly.WorkspaceSvg.prototype.workspaceDragSurface_ = null; * @type {boolean} * @private */ - Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_ = false; +Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_ = false; /** * Whether the drag surface is actively in use. When true, calls to @@ -688,8 +688,8 @@ Blockly.WorkspaceSvg.prototype.setupDragSurface = function() { // Figure out where we want to put the canvas back. The order // in the is important because things are layered. var previousElement = this.svgBlockCanvas_.previousSibling; - var width = this.getParentSvg().getAttribute("width") - var height = this.getParentSvg().getAttribute("height") + var width = this.getParentSvg().getAttribute("width"); + var height = this.getParentSvg().getAttribute("height"); var coord = Blockly.utils.getRelativeXY(this.svgBlockCanvas_); this.workspaceDragSurface_.setContentsAndShow(this.svgBlockCanvas_, this.svgBubbleCanvas_, previousElement, width, height, this.scale);