diff --git a/.eslintrc b/.eslintrc index 0d67347a8..7624840ff 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,8 @@ "max-len": [2, 80, 4], "semi": [2, "always"], "strict": [2, "never"], - "no-console": [2, {"allow": ["log", "warn", "error"]}] + "no-console": [2, {"allow": ["log", "warn", "error"]}], + "valid-jsdoc": ["error", {"requireReturn": false}] }, "env": { "node": true, diff --git a/src/blocks/wedo2.js b/src/blocks/wedo2.js index 86c73de07..52f2c372d 100644 --- a/src/blocks/wedo2.js +++ b/src/blocks/wedo2.js @@ -41,9 +41,9 @@ WeDo2Blocks.prototype.getPrimitives = function() { /** * Clamp a value between a minimum and maximum value. * @todo move this to a common utility class. - * @param val The value to clamp. - * @param min The minimum return value. - * @param max The maximum return value. + * @param {number} val The value to clamp. + * @param {number} min The minimum return value. + * @param {number} max The maximum return value. * @returns {number} The clamped value. * @private */ @@ -53,9 +53,9 @@ WeDo2Blocks.prototype._clamp = function(val, min, max) { /** * Common implementation for motor blocks. - * @param direction The direction to turn ('left' or 'right'). - * @param durationSeconds The number of seconds to run. - * @param util The util instance to use for yielding and finishing. + * @param {string} direction The direction to turn ('left' or 'right'). + * @param {number} durationSeconds The number of seconds to run. + * @param {Object} util The util instance to use for yielding and finishing. * @private */ WeDo2Blocks.prototype._motorOnFor = function(direction, durationSeconds, util) { @@ -108,7 +108,7 @@ WeDo2Blocks.prototype.motorSpeed = function(argValues) { /** * Convert a color name to a WeDo color index. * Supports 'mystery' for a random hue. - * @param colorName The color to retrieve. + * @param {string} colorName The color to retrieve. * @returns {number} The WeDo color index. * @private */ diff --git a/src/engine/adapter.js b/src/engine/adapter.js index 48613ec5d..73b69b084 100644 --- a/src/engine/adapter.js +++ b/src/engine/adapter.js @@ -52,8 +52,8 @@ function domToBlocks (blocksDOM) { * Convert and an individual block DOM to the representation tree. * Based on Blockly's `domToBlockHeadless_`. * @param {Element} blockDOM DOM tree for an individual block. - * @param {Boolean} isTopBlock Whether blocks at this level are "top blocks." * @param {Object} blocks Collection of blocks to add to. + * @param {Boolean} isTopBlock Whether blocks at this level are "top blocks." */ function domToBlock (blockDOM, blocks, isTopBlock) { // Block skeleton. diff --git a/src/engine/blocks.js b/src/engine/blocks.js index bb4505352..b1da172a9 100644 --- a/src/engine/blocks.js +++ b/src/engine/blocks.js @@ -83,6 +83,7 @@ Blocks.prototype.getOpcode = function (id) { /** * Block management: create blocks and stacks from a `create` event * @param {!Object} block Blockly create event to be processed + * @param {boolean} opt_isFlyoutBlock Whether the block is in the flyout. */ Blocks.prototype.createBlock = function (block, opt_isFlyoutBlock) { // Create new block diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 9531eadc7..5e72eb7d2 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -10,7 +10,7 @@ var defaultBlockPackages = { /** * Manages blocks, stacks, and the sequencer. - * @param blocks Blocks instance for this runtime. + * @param {!Blocks} blocks Blocks instance for this runtime. */ function Runtime (blocks) { // Bind event emitter diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index 95a28f7bf..1d9f3a214 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -26,6 +26,7 @@ Sequencer.WORK_TIME = 10; /** * Step through all threads in `this.threads`, running them in order. + * @param {Array.<Thread>} threads List of which threads to step. * @return {Array.<Thread>} All threads which have finished in this iteration. */ Sequencer.prototype.stepThreads = function (threads) { @@ -139,6 +140,9 @@ Sequencer.prototype.stepThread = function (thread) { /** * A callback for the primitive to start hats. * @todo very hacked... + * Provide a callback that is passed in a block and returns true + * if it is a hat that should be triggered. + * @param {Function} callback Provided callback. */ var startHats = function(callback) { var stacks = instance.runtime.blocks.getStacks(); diff --git a/src/index.js b/src/index.js index 9f3917a54..3bb6bb52f 100644 --- a/src/index.js +++ b/src/index.js @@ -23,7 +23,7 @@ function VirtualMachine () { * Event listener for blocks. Handles validation and serves as a generic * adapter between the blocks and the runtime interface. * - * @param {Object} Blockly "block" event + * @param {Object} e Blockly "block" event */ instance.blockListener = function (e) { // Validate event