mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
chore: fix or ignore remaining lint (#5709)
* chore: fix or ignore remaining lint * chore: fix bad annotations * chore: use push for array concatenation * chore: revert use of spread for array operations
This commit is contained in:
@@ -382,7 +382,7 @@ exports.getMainWorkspace = common.getMainWorkspace;
|
||||
* of jsonDef.
|
||||
*/
|
||||
const jsonInitFactory = function(jsonDef) {
|
||||
return function() {
|
||||
return /** @this {Block} */ function() {
|
||||
this.jsonInit(jsonDef);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -181,16 +181,26 @@ Comment.prototype.createEditor_ = function() {
|
||||
browserEvents.conditionalBind(textarea, 'wheel', this, function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
this.onChangeWrapper_ =
|
||||
browserEvents.conditionalBind(textarea, 'change', this, function(_e) {
|
||||
this.onChangeWrapper_ = browserEvents.conditionalBind(
|
||||
textarea, 'change', this,
|
||||
/**
|
||||
* @this {Comment}
|
||||
* @param {Event} _e Unused event parameter.
|
||||
*/
|
||||
function(_e) {
|
||||
if (this.cachedText_ !== this.model_.text) {
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
|
||||
this.block_, 'comment', null, this.cachedText_,
|
||||
this.model_.text));
|
||||
}
|
||||
});
|
||||
this.onInputWrapper_ =
|
||||
browserEvents.conditionalBind(textarea, 'input', this, function(_e) {
|
||||
this.onInputWrapper_ = browserEvents.conditionalBind(
|
||||
textarea, 'input', this,
|
||||
/**
|
||||
* @this {Comment}
|
||||
* @param {Event} _e Unused event parameter.
|
||||
*/
|
||||
function(_e) {
|
||||
this.model_.text = textarea.value;
|
||||
});
|
||||
|
||||
|
||||
@@ -149,6 +149,8 @@ const populate_ = function(options, rtl) {
|
||||
menuItem.setEnabled(option.enabled);
|
||||
if (option.enabled) {
|
||||
const actionHandler = function(_menuItem) {
|
||||
// TODO: Create a type for option that can be used in an @this tag.
|
||||
/* eslint-disable-next-line no-invalid-this */
|
||||
const option = this;
|
||||
hide();
|
||||
option.callback(option.scope);
|
||||
|
||||
@@ -71,9 +71,12 @@ const registerMixin = function(name, mixinObj) {
|
||||
if (!mixinObj || typeof mixinObj !== 'object') {
|
||||
throw Error('Error: Mixin "' + name + '" must be a object');
|
||||
}
|
||||
register(name, function() {
|
||||
this.mixin(mixinObj);
|
||||
});
|
||||
register(
|
||||
name,
|
||||
/** @this {Block} */
|
||||
function() {
|
||||
this.mixin(mixinObj);
|
||||
});
|
||||
};
|
||||
exports.registerMixin = registerMixin;
|
||||
|
||||
@@ -102,21 +105,24 @@ const registerMutator = function(name, mixinObj, opt_helperFn, opt_blockList) {
|
||||
}
|
||||
|
||||
// Sanity checks passed.
|
||||
register(name, function() {
|
||||
if (hasMutatorDialog) {
|
||||
const {Mutator} = goog.module.get('Blockly.Mutator');
|
||||
if (!Mutator) {
|
||||
throw Error(errorPrefix + 'Missing require for Blockly.Mutator');
|
||||
}
|
||||
this.setMutator(new Mutator(opt_blockList || []));
|
||||
}
|
||||
// Mixin the object.
|
||||
this.mixin(mixinObj);
|
||||
register(
|
||||
name,
|
||||
/** @this {Block} */
|
||||
function() {
|
||||
if (hasMutatorDialog) {
|
||||
const {Mutator} = goog.module.get('Blockly.Mutator');
|
||||
if (!Mutator) {
|
||||
throw Error(errorPrefix + 'Missing require for Blockly.Mutator');
|
||||
}
|
||||
this.setMutator(new Mutator(opt_blockList || []));
|
||||
}
|
||||
// Mixin the object.
|
||||
this.mixin(mixinObj);
|
||||
|
||||
if (opt_helperFn) {
|
||||
opt_helperFn.apply(this);
|
||||
}
|
||||
});
|
||||
if (opt_helperFn) {
|
||||
opt_helperFn.apply(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.registerMutator = registerMutator;
|
||||
|
||||
|
||||
@@ -547,12 +547,14 @@ Flyout.prototype.show = function(flyoutDef) {
|
||||
|
||||
// IE 11 is an incompetent browser that fails to fire mouseout events.
|
||||
// When the mouse is over the background, deselect all blocks.
|
||||
const deselectAll = function() {
|
||||
const topBlocks = this.workspace_.getTopBlocks(false);
|
||||
for (let i = 0, block; (block = topBlocks[i]); i++) {
|
||||
block.removeSelect();
|
||||
}
|
||||
};
|
||||
const deselectAll =
|
||||
/** @this {Flyout} */
|
||||
function() {
|
||||
const topBlocks = this.workspace_.getTopBlocks(false);
|
||||
for (let i = 0, block; (block = topBlocks[i]); i++) {
|
||||
block.removeSelect();
|
||||
}
|
||||
};
|
||||
|
||||
this.listeners_.push(browserEvents.conditionalBind(
|
||||
this.svgBackground_, 'mouseover', this, deselectAll));
|
||||
@@ -597,6 +599,7 @@ Flyout.prototype.createFlyoutInfo_ = function(parsedContent) {
|
||||
const flyoutDef = this.getDynamicCategoryContents_(categoryName);
|
||||
const parsedDynamicContent = /** @type {!toolbox.FlyoutItemInfoArray} */
|
||||
(toolbox.convertFlyoutDefToJsonArray(flyoutDef));
|
||||
// Replace the element at i with the dynamic content it represents.
|
||||
parsedContent.splice.apply(
|
||||
parsedContent, [i, 1].concat(parsedDynamicContent));
|
||||
contentInfo = parsedContent[i];
|
||||
|
||||
@@ -29,6 +29,7 @@ const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
* @alias Blockly.serialization.ISerializer.ISerializer
|
||||
*/
|
||||
class ISerializer {
|
||||
/* eslint-disable-next-line require-jsdoc */
|
||||
constructor() {
|
||||
/**
|
||||
* A priority value used to determine the order of deserializing state.
|
||||
|
||||
@@ -399,7 +399,7 @@ RenderedConnection.prototype.startTrackingAll = function() {
|
||||
// rendering takes place, since rendering requires knowing the dimensions
|
||||
// of lower blocks. Also, since rendering a block renders all its parents,
|
||||
// we only need to render the leaf nodes.
|
||||
const renderList = [];
|
||||
let renderList = [];
|
||||
if (this.type !== ConnectionType.INPUT_VALUE &&
|
||||
this.type !== ConnectionType.NEXT_STATEMENT) {
|
||||
// Only spider down.
|
||||
@@ -423,7 +423,7 @@ RenderedConnection.prototype.startTrackingAll = function() {
|
||||
}
|
||||
if (!renderList.length) {
|
||||
// Leaf block.
|
||||
renderList[0] = block;
|
||||
renderList = [block];
|
||||
}
|
||||
}
|
||||
return renderList;
|
||||
|
||||
@@ -628,6 +628,7 @@ const saveBlock = save;
|
||||
* @alias Blockly.serialization.blocks.BlockSerializer
|
||||
*/
|
||||
class BlockSerializer {
|
||||
/* eslint-disable-next-line require-jsdoc */
|
||||
constructor() {
|
||||
/**
|
||||
* The priority for deserializing blocks.
|
||||
|
||||
@@ -44,6 +44,7 @@ exports.State = State;
|
||||
* @alias Blockly.serialization.variables.VariableSerializer
|
||||
*/
|
||||
class VariableSerializer {
|
||||
/* eslint-disable-next-line require-jsdoc */
|
||||
constructor() {
|
||||
/**
|
||||
* The priority for deserializing variables.
|
||||
|
||||
@@ -704,6 +704,10 @@ Trashcan.prototype.cleanBlockJson_ = function(json) {
|
||||
// Create a deep copy.
|
||||
json = /** @type {!blocks.State} */ (JSON.parse(JSON.stringify(json)));
|
||||
|
||||
/**
|
||||
* Reshape JSON into a nicer format.
|
||||
* @param {!blocks.State} json The JSON to clean.
|
||||
*/
|
||||
function cleanRec(json) {
|
||||
if (!json) {
|
||||
return;
|
||||
|
||||
@@ -781,6 +781,10 @@ WorkspaceCommentSvg.prototype.createEditor_ = function() {
|
||||
});
|
||||
browserEvents.conditionalBind(
|
||||
textarea, 'change', this,
|
||||
/**
|
||||
* @this {WorkspaceCommentSvg}
|
||||
* @param {Event} e Unused event parameter
|
||||
*/
|
||||
function(
|
||||
/* eslint-disable no-unused-vars */ e
|
||||
/* eslint-enable no-unused-vars */) {
|
||||
|
||||
Reference in New Issue
Block a user