Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return annotations #7118

Merged
merged 5 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,18 @@ function buildTSOverride({files, tsconfig}) {
'publicOnly': true,
},
],
// Disable because of false alarms with Closure-supported tags.
// Re-enable after Closure is removed.
'jsdoc/check-tag-names': ['off'],
'jsdoc/check-tag-names': [
'error',
{
'definedTags': [
'sealed',
'typeParam',
'remarks',
'define',
'nocollapse',
],
},
],
// Re-enable after Closure is removed. There shouldn't even be
// types in the TsDoc.
// These are "types" because of Closure's @suppress {warningName}
Expand Down
4 changes: 0 additions & 4 deletions blocks/colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Colour blocks for Blockly.
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.colour');

Expand Down
31 changes: 13 additions & 18 deletions blocks/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview List blocks for Blockly.
* @suppress {checkTypes}
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.lists');

Expand Down Expand Up @@ -163,7 +158,7 @@ const LISTS_CREATE_WITH = {
/**
* Returns the state of this block as a JSON serializable object.
*
* @return The state of this block, ie the item count.
* @returns The state of this block, ie the item count.
*/
saveExtraState: function (this: CreateWithBlock): {itemCount: number} {
return {
Expand All @@ -183,7 +178,7 @@ const LISTS_CREATE_WITH = {
* Populate the mutator's dialog with this block's components.
*
* @param workspace Mutator's workspace.
* @return Root block in mutator.
* @returns Root block in mutator.
*/
decompose: function (
this: CreateWithBlock,
Expand Down Expand Up @@ -482,7 +477,7 @@ const LISTS_GETINDEX = {
* Create XML to represent whether the block is a statement or a value.
* Also represent whether there is an 'AT' input.
*
* @return XML storage element.
* @returns XML storage element.
*/
mutationToDom: function (this: GetIndexBlock): Element {
const container = xmlUtils.createElement('mutation');
Expand All @@ -509,7 +504,7 @@ const LISTS_GETINDEX = {
* Returns the state of this block as a JSON serializable object.
* Returns null for efficiency if no state is needed (not a statement)
*
* @return The state of this block, ie whether it's a statement.
* @returns The state of this block, ie whether it's a statement.
*/
saveExtraState: function (this: GetIndexBlock): {
isStatement: boolean;
Expand Down Expand Up @@ -586,7 +581,7 @@ const LISTS_GETINDEX = {
menu.setValidator(
/**
* @param value The input value.
* @return Null if the field has been replaced; otherwise undefined.
* @returns Null if the field has been replaced; otherwise undefined.
*/
function (this: FieldDropdown, value: string) {
const newAt = value === 'FROM_START' || value === 'FROM_END';
Expand Down Expand Up @@ -699,7 +694,7 @@ const LISTS_SETINDEX = {
/**
* Create XML to represent whether there is an 'AT' input.
*
* @return XML storage element.
* @returns XML storage element.
*/
mutationToDom: function (this: SetIndexBlock): Element {
const container = xmlUtils.createElement('mutation');
Expand All @@ -725,7 +720,7 @@ const LISTS_SETINDEX = {
* encoded in the dropdown values, but must have an implementation to avoid
* the backward compatible XML mutations being serialized.
*
* @return The state of this block.
* @returns The state of this block.
*/
saveExtraState: function (this: SetIndexBlock): null {
return null;
Expand Down Expand Up @@ -765,7 +760,7 @@ const LISTS_SETINDEX = {
menu.setValidator(
/**
* @param value The input value.
* @return Null if the field has been replaced; otherwise undefined.
* @returns Null if the field has been replaced; otherwise undefined.
*/
function (this: FieldDropdown, value: string) {
const newAt = value === 'FROM_START' || value === 'FROM_END';
Expand Down Expand Up @@ -834,7 +829,7 @@ const LISTS_GETSUBLIST = {
/**
* Create XML to represent whether there are 'AT' inputs.
*
* @return XML storage element.
* @returns XML storage element.
*/
mutationToDom: function (this: GetSublistBlock): Element {
const container = xmlUtils.createElement('mutation');
Expand Down Expand Up @@ -862,7 +857,7 @@ const LISTS_GETSUBLIST = {
* encoded in the dropdown values, but must have an implementation to avoid
* the backward compatible XML mutations being serialized.
*
* @return The state of this block.
* @returns The state of this block.
*/
saveExtraState: function (this: GetSublistBlock): null {
return null;
Expand Down Expand Up @@ -906,7 +901,7 @@ const LISTS_GETSUBLIST = {
menu.setValidator(
/**
* @param value The input value.
* @return Null if the field has been replaced; otherwise undefined.
* @returns Null if the field has been replaced; otherwise undefined.
*/
function (this: FieldDropdown, value: string) {
const newAt = value === 'FROM_START' || value === 'FROM_END';
Expand Down Expand Up @@ -1047,7 +1042,7 @@ blocks['lists_split'] = {
/**
* Create XML to represent the input and output types.
*
* @return XML storage element.
* @returns XML storage element.
*/
mutationToDom: function (this: SplitBlock): Element {
const container = xmlUtils.createElement('mutation');
Expand All @@ -1069,7 +1064,7 @@ blocks['lists_split'] = {
* encoded in the dropdown values, but must have an implementation to avoid
* the backward compatible XML mutations being serialized.
*
* @return The state of this block.
* @returns The state of this block.
*/
saveExtraState: function (this: SplitBlock): null {
return null;
Expand Down
4 changes: 0 additions & 4 deletions blocks/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Loop blocks for Blockly.
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.loops');

Expand Down
4 changes: 0 additions & 4 deletions blocks/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Math blocks for Blockly.
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.math');

Expand Down
6 changes: 1 addition & 5 deletions blocks/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Text blocks for Blockly.
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.texts');

Expand Down Expand Up @@ -333,7 +329,7 @@ const GET_SUBSTRING_BLOCK = {
menu.setValidator(
/**
* @param value The input value.
* @return Null if the field has been replaced; otherwise undefined.
* @returns Null if the field has been replaced; otherwise undefined.
*/
function (this: FieldDropdown, value: any): null | undefined {
const newAt = value === 'FROM_START' || value === 'FROM_END';
Expand Down
5 changes: 0 additions & 5 deletions blocks/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Variable blocks for Blockly.
* @suppress {checkTypes}
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.variables');

Expand Down
5 changes: 0 additions & 5 deletions blocks/variables_dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Variable blocks for Blockly.
* @suppress {checkTypes}
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks.variablesDynamic');

Expand Down
9 changes: 4 additions & 5 deletions core/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ export class Block implements IASTNodeLocation, IDeletable {
* @param healStack If true, then try to heal any gap by connecting the next
* statement with the previous statement. Otherwise, dispose of all
* children of this block.
* @suppress {checkTypes}
*/
dispose(healStack: boolean) {
if (this.isDeadOrDying()) return;
Expand Down Expand Up @@ -2246,7 +2245,7 @@ export class Block implements IASTNodeLocation, IDeletable {
* block.
*
* @param type The type of the icon to remove from the block.
* @return True if an icon with the given type was found, false otherwise.
* @returns True if an icon with the given type was found, false otherwise.
*/
removeIcon(type: string): boolean {
if (!this.hasIcon(type)) return false;
Expand All @@ -2255,22 +2254,22 @@ export class Block implements IASTNodeLocation, IDeletable {
}

/**
* @return True if an icon with the given type exists on the block,
* @returns True if an icon with the given type exists on the block,
* false otherwise.
*/
hasIcon(type: string): boolean {
return this.icons.some((icon) => icon.getType() === type);
}

/**
* @return The icon with the given type if it exists on the block, undefined
* @returns The icon with the given type if it exists on the block, undefined
* otherwise.
*/
getIcon(type: string): IIcon | undefined {
return this.icons.find((icon) => icon.getType() === type);
}

/** @return An array of the icons attached to this block. */
/** @returns An array of the icons attached to this block. */
getIcons(): IIcon[] {
return [...this.icons];
}
Expand Down
1 change: 0 additions & 1 deletion core/block_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ export class BlockSvg
* statement with the previous statement. Otherwise, dispose of all
* children of this block.
* @param animate If true, show a disposal animation and sound.
* @suppress {checkTypes}
*/
override dispose(healStack?: boolean, animate?: boolean) {
if (this.isDeadOrDying()) return;
Expand Down
6 changes: 3 additions & 3 deletions core/bubbles/bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export abstract class Bubble implements IBubble {
this.renderTail();
}

/** @return the size of this bubble. */
/** @returns the size of this bubble. */
protected getSize() {
return this.size;
}
Expand Down Expand Up @@ -417,7 +417,7 @@ export abstract class Bubble implements IBubble {
}

/**
* @return a rect defining the bounds of the workspace's view in workspace
* @returns a rect defining the bounds of the workspace's view in workspace
* coordinates.
*/
private getWorkspaceViewRect(viewMetrics: ContainerRegion): Rect {
Expand All @@ -436,7 +436,7 @@ export abstract class Bubble implements IBubble {
return new Rect(top, bottom, left, right);
}

/** @return the scrollbar thickness in workspace units. */
/** @returns the scrollbar thickness in workspace units. */
private getScrollbarThickness() {
return Scrollbar.scrollbarThickness / this.workspace.scale;
}
Expand Down
2 changes: 1 addition & 1 deletion core/bubbles/text_bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class TextBubble extends Bubble {
this.updateBubbleSize();
}

/** @return the current text of this text bubble. */
/** @returns the current text of this text bubble. */
getText(): string {
return this.text;
}
Expand Down
1 change: 0 additions & 1 deletion core/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ export function commentDuplicateOption(
* originated.
* @param e The right-click mouse event.
* @returns A menu option, containing text, enabled, and a callback.
* @suppress {strictModuleDepCheck,checkTypes} Suppress checks while workspace
* comments are not bundled in.
* @internal
*/
Expand Down
2 changes: 0 additions & 2 deletions core/flyout_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@ export abstract class Flyout extends DeleteArea implements IFlyout {
/**
* Dispose of this flyout.
* Unlink from all DOM elements to prevent memory leaks.
*
* @suppress {checkTypes}
*/
dispose() {
this.hide();
Expand Down
2 changes: 0 additions & 2 deletions core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import type {Workspace} from './workspace.js';

/**
* Class for a code generator that translates the blocks into a language.
*
* @unrestricted
*/
export class CodeGenerator {
name_: string;
Expand Down
2 changes: 1 addition & 1 deletion core/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ export class Gesture {
);
}

/** @return Whether this gesture is a click on an icon. */
/** @returns Whether this gesture is a click on an icon. */
private isIconClick(): boolean {
return !!this.startIcon && !this.hasExceededDragRadius;
}
Expand Down
2 changes: 0 additions & 2 deletions core/inputs/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ export class Input {

/**
* Sever all links to this input.
*
* @suppress {checkTypes}
*/
dispose() {
for (let i = 0, field; (field = this.fieldRow[i]); i++) {
Expand Down
2 changes: 1 addition & 1 deletion core/interfaces/i_has_bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

export interface IHasBubble {
/** @return True if the bubble is currently open, false otherwise. */
/** @returns True if the bubble is currently open, false otherwise. */
bubbleIsVisible(): boolean;

/** Sets whether the bubble is open or not. */
Expand Down
Loading