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:
Rachel Fenichel
2021-11-17 08:39:00 -08:00
committed by GitHub
parent 335ff199d7
commit 5deed5a194
17 changed files with 164 additions and 73 deletions

View File

@@ -382,7 +382,7 @@ exports.getMainWorkspace = common.getMainWorkspace;
* of jsonDef.
*/
const jsonInitFactory = function(jsonDef) {
return function() {
return /** @this {Block} */ function() {
this.jsonInit(jsonDef);
};
};

View File

@@ -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;
});

View File

@@ -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);

View File

@@ -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;

View File

@@ -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];

View File

@@ -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.

View File

@@ -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;

View File

@@ -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.

View File

@@ -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.

View File

@@ -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;

View File

@@ -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 */) {