diff --git a/.eslintignore b/.eslintignore index 45e036d9c..26e22adb5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -17,3 +17,4 @@ /externs/* /closure/* /scripts/gulpfiles/* +/typings/* diff --git a/.eslintrc.json b/.eslintrc.json index 77c488785..d6919d2fd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,7 +39,7 @@ "strict": ["off"], // Closure style allows redeclarations. "no-redeclare": ["off"], - "valid-jsdoc": ["error", {"requireReturn": false}], + "valid-jsdoc": ["error"], "no-console": ["off"], "no-multi-spaces": ["error", { "ignoreEOLComments": true }], "operator-linebreak": ["error", "after"], @@ -83,5 +83,54 @@ }, "extends": [ "eslint:recommended", "google" - ] + ], + // TypeScript-specific config. Uses above rules plus these. + "overrides": [{ + "files": ["**/*.ts", "**/*.tsx"], + "plugins": [ + "@typescript-eslint/eslint-plugin" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.json", + "tsconfigRootDir": ".", + "ecmaVersion": 2020, + "sourceType": "module" + }, + "extends": ["plugin:@typescript-eslint/recommended"], + "rules": { + // TS rules + // Disable JsDoc validation, since we use TsDoc. + "valid-jsdoc": ["off"], + // Blockly uses namespaces to do declaration merging in some cases. + "@typescript-eslint/no-namespace": ["off"], + // Use the updated TypeScript-specific rule. + "no-invalid-this": ["off"], + "@typescript-eslint/no-invalid-this": ["error"], + // Needs decision. 601 problems. + "@typescript-eslint/no-non-null-assertion": ["off"], + // Use TS-specific rule. + "no-unused-vars": ["off"], + "@typescript-eslint/no-unused-vars": ["warn", { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_" + }], + // Temporarily disable. 23 problems. + "@typescript-eslint/no-explicit-any": ["off"], + // Temporarily disable. 128 problems. + "require-jsdoc": ["off"], + // Temporarily disable. 55 problems. + "@typescript-eslint/ban-types": ["off"], + // Temporarily disable. 18 problems. Autofixable? + "@typescript-eslint/no-inferrable-types": ["off"], + // Temporarily disable. 33 problems. + "@typescript-eslint/no-empty-function": ["off"], + // Temporarily disable. 17 problems. + "@typescript-eslint/no-this-alias": ["off"], + // Temporarily disable. 3 problems. + "@typescript-eslint/no-empty-interface": ["off"], + // Temporarily disable. 34 problems. + "func-call-spacing": ["off"] + } + }] } diff --git a/blocks/lists.js b/blocks/lists.js index 5acd7925f..6807cdb00 100644 --- a/blocks/lists.js +++ b/blocks/lists.js @@ -531,7 +531,7 @@ blocks['lists_getIndex'] = { /** * @param {*} value The input value. * @this {FieldDropdown} - * @returns {null|undefined} Null if the field has been replaced; + * @return {null|undefined} Null if the field has been replaced; * otherwise undefined. */ function(value) { @@ -694,7 +694,7 @@ blocks['lists_setIndex'] = { /** * @param {*} value The input value. * @this {FieldDropdown} - * @returns {null|undefined} Null if the field has been replaced; + * @return {null|undefined} Null if the field has been replaced; * otherwise undefined. */ function(value) { @@ -822,7 +822,7 @@ blocks['lists_getSublist'] = { /** * @param {*} value The input value. * @this {FieldDropdown} - * @returns {null|undefined} Null if the field has been replaced; + * @return {null|undefined} Null if the field has been replaced; * otherwise undefined. */ function(value) { diff --git a/blocks/text.js b/blocks/text.js index 786fb432b..90a932d3a 100644 --- a/blocks/text.js +++ b/blocks/text.js @@ -343,7 +343,7 @@ blocks['text_getSubstring'] = { /** * @param {*} value The input value. * @this {FieldDropdown} - * @returns {null|undefined} Null if the field has been replaced; + * @return {null|undefined} Null if the field has been replaced; * otherwise undefined. */ function(value) { diff --git a/core/any_aliases.ts b/core/any_aliases.ts index 39298b3d7..6b3c413cb 100644 --- a/core/any_aliases.ts +++ b/core/any_aliases.ts @@ -1 +1,2 @@ -type AnyDuringMigration = any; \ No newline at end of file +// eslint-disable-next-line +type AnyDuringMigration = any; diff --git a/core/block.ts b/core/block.ts index 9e345e1d8..0339d18e3 100644 --- a/core/block.ts +++ b/core/block.ts @@ -743,8 +743,7 @@ export class Block implements IASTNodeLocation, IDeletable { for (let child, i = 0; child = childBlocks[i]; i++) { // AnyDuringMigration because: Argument of type 'Block[]' is not // assignable to parameter of type 'this[]'. - blocks.push.apply( - blocks, child.getDescendants(ordered) as AnyDuringMigration); + blocks.push(...child.getDescendants(ordered) as AnyDuringMigration); } return blocks; } diff --git a/core/block_svg.ts b/core/block_svg.ts index 7f49efa93..c5ac9034e 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -527,7 +527,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, return; // Deleted block. } if (this.workspace.isDragging()) { - return // Don't bump blocks during a drag.; + return; // Don't bump blocks during a drag.; } if (this.getParent()) { @@ -1053,7 +1053,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, if (this.workspace.isDragging()) { // Don't change the warning text during a drag. // Wait until the drag finishes. - const thisBlock = this; this.warningTextDb.set( id, setTimeout(() => { if (!this.disposed) { // Check block wasn't deleted. diff --git a/core/blockly.ts b/core/blockly.ts index 769974695..08afa5a34 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -550,16 +550,16 @@ export const PROCEDURE_CATEGORY_NAME: string = Procedures.CATEGORY_NAME; Workspace.prototype.newBlock = function(prototypeName: string, opt_id?: string): Block { return new Block(this, prototypeName, opt_id); - } + }; WorkspaceSvg.prototype.newBlock = function(prototypeName: string, opt_id?: string): BlockSvg { return new BlockSvg(this, prototypeName, opt_id); - } + }; WorkspaceSvg.newTrashcan = function(workspace: WorkspaceSvg): Trashcan { return new Trashcan(workspace); -} +}; WorkspaceCommentSvg.prototype.showContextMenu = function(this: WorkspaceCommentSvg, e: Event) { @@ -576,23 +576,23 @@ WorkspaceCommentSvg.prototype.showContextMenu = } ContextMenu.show(e, menuOptions, this.RTL); - } + }; Mutator.prototype.newWorkspaceSvg = function(options: Options): WorkspaceSvg { return new WorkspaceSvg(options); - } + }; Names.prototype.populateProcedures = function(this: Names, workspace: Workspace) { - let procedures = Procedures.allProcedures(workspace); + const procedures = Procedures.allProcedures(workspace); // Flatten the return vs no-return procedure lists. - let flattenedProcedures: AnyDuringMigration[][] = + const flattenedProcedures: AnyDuringMigration[][] = procedures[0].concat(procedures[1]); for (let i = 0; i < flattenedProcedures.length; i++) { this.getName(flattenedProcedures[i][0], Names.NameType.PROCEDURE); } - } + }; // clang-format on @@ -746,4 +746,4 @@ export namespace serialization { export const variables = serializationVariables; export const workspaces = serializationWorkspaces; export type ISerializer = SerializerInterface; -}; +} diff --git a/core/browser_events.ts b/core/browser_events.ts index eb798d03e..fb449e012 100644 --- a/core/browser_events.ts +++ b/core/browser_events.ts @@ -188,7 +188,7 @@ export function unbind(bindData: Data): (e: Event) => void { // Accessing an element of the last property of the array is unsafe if the // bindData is an empty array. But that should never happen because developers // should only pass Data from bind or conditionalBind. - let callback = bindData[bindData.length - 1][2]; + const callback = bindData[bindData.length - 1][2]; while (bindData.length) { const bindDatum = bindData.pop(); const node = bindDatum![0]; diff --git a/core/bump_objects.ts b/core/bump_objects.ts index d14e92004..ea247bf76 100644 --- a/core/bump_objects.ts +++ b/core/bump_objects.ts @@ -24,7 +24,7 @@ import type {CommentMove} from './events/events_comment_move.js'; import type {ViewportChange} from './events/events_viewport.js'; import * as eventUtils from './events/utils.js'; import type {IBoundedElement} from './interfaces/i_bounded_element.js'; -import type {ContainerRegion, MetricsManager} from './metrics_manager.js'; +import type {ContainerRegion} from './metrics_manager.js'; import * as mathUtils from './utils/math.js'; import type {WorkspaceCommentSvg} from './workspace_comment_svg.js'; import type {WorkspaceSvg} from './workspace_svg.js'; diff --git a/core/clipboard.ts b/core/clipboard.ts index af95c9677..e217af81c 100644 --- a/core/clipboard.ts +++ b/core/clipboard.ts @@ -88,4 +88,4 @@ function duplicateInternal(toDuplicate: ICopyable): ICopyable|null { export const TEST_ONLY = { duplicateInternal, copyInternal, -} +}; diff --git a/core/component_manager.ts b/core/component_manager.ts index 36f6e1d29..12a934087 100644 --- a/core/component_manager.ts +++ b/core/component_manager.ts @@ -23,7 +23,7 @@ import type {IPositionable} from './interfaces/i_positionable.js'; import * as arrayUtils from './utils/array.js'; -class Capability { +class Capability<_T> { static POSITIONABLE = new Capability('positionable'); static DRAG_TARGET = new Capability('drag_target'); static DELETE_AREA = new Capability('delete_area'); @@ -208,4 +208,4 @@ export namespace ComponentManager { } } -export type ComponentDatum = ComponentManager.ComponentDatum; \ No newline at end of file +export type ComponentDatum = ComponentManager.ComponentDatum; diff --git a/core/contextmenu.ts b/core/contextmenu.ts index f8ff95ac8..9c16ae4f2 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -20,15 +20,13 @@ import type {BlockSvg} from './block_svg.js'; import * as browserEvents from './browser_events.js'; import * as clipboard from './clipboard.js'; import {config} from './config.js'; -import type {ContextMenuOption, ContextMenuRegistry, LegacyContextMenuOption} from './contextmenu_registry.js'; -import * as BlockCreate from './events/events_block_create.js'; +import type {ContextMenuOption, LegacyContextMenuOption} from './contextmenu_registry.js'; import * as eventUtils from './events/utils.js'; import {Menu} from './menu.js'; import {MenuItem} from './menuitem.js'; import {Msg} from './msg.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; -import * as deprecation from './utils/deprecation.js'; import * as dom from './utils/dom.js'; import {Rect} from './utils/rect.js'; import * as svgMath from './utils/svg_math.js'; @@ -44,7 +42,7 @@ import * as Xml from './xml.js'; */ let currentBlock: Block|null = null; -let dummyOwner = {}; +const dummyOwner = {}; /** * Gets the block the context menu is currently attached to. diff --git a/core/dialog.ts b/core/dialog.ts index 237f6d832..c19ab5cc1 100644 --- a/core/dialog.ts +++ b/core/dialog.ts @@ -124,4 +124,4 @@ export function setPrompt( export const TEST_ONLY = { confirmInternal, -} +}; diff --git a/core/events/events.ts b/core/events/events.ts index 671d8672e..25d16b946 100644 --- a/core/events/events.ts +++ b/core/events/events.ts @@ -15,7 +15,6 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events'); -import * as deprecation from '../utils/deprecation.js'; import {Abstract as AbstractEvent} from './events_abstract.js'; import {BlockBase} from './events_block_base.js'; diff --git a/core/field_registry.ts b/core/field_registry.ts index 3dd7aaf10..2cf98a32b 100644 --- a/core/field_registry.ts +++ b/core/field_registry.ts @@ -84,4 +84,4 @@ function fromJsonInternal(options: AnyDuringMigration): Field|null { export const TEST_ONLY = { fromJsonInternal, -} +}; diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 94657ade3..5a882aaaa 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -21,23 +21,17 @@ import * as browserEvents from './browser_events.js'; import * as common from './common.js'; import {ComponentManager} from './component_manager.js'; import {DeleteArea} from './delete_area.js'; -import * as BlockCreate from './events/events_block_create.js'; -import * as VarCreate from './events/events_var_create.js'; import * as eventUtils from './events/utils.js'; import {FlyoutButton} from './flyout_button.js'; import {FlyoutMetricsManager} from './flyout_metrics_manager.js'; -import * as Gesture from './gesture.js'; import type {IFlyout} from './interfaces/i_flyout.js'; import type {Options} from './options.js'; -import * as blockRendering from './renderers/common/block_rendering.js'; import {ScrollbarPair} from './scrollbar_pair.js'; import * as blocks from './serialization/blocks.js'; import * as Tooltip from './tooltip.js'; -import * as Touch from './touch.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; import * as idGenerator from './utils/idgenerator.js'; -import type {Rect} from './utils/rect.js'; import {Svg} from './utils/svg.js'; import * as toolbox from './utils/toolbox.js'; import * as Variables from './variables.js'; diff --git a/core/inject.ts b/core/inject.ts index 090d9cb00..89c23efcc 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -34,7 +34,6 @@ import * as dom from './utils/dom.js'; import {Svg} from './utils/svg.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; -import {Workspace} from './workspace.js'; import {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js'; import {WorkspaceSvg} from './workspace_svg.js'; diff --git a/core/interfaces/i_toolbox_item.ts b/core/interfaces/i_toolbox_item.ts index 7827444ab..1b661707d 100644 --- a/core/interfaces/i_toolbox_item.ts +++ b/core/interfaces/i_toolbox_item.ts @@ -81,4 +81,4 @@ export interface IToolboxItem { * @param isVisible True if category should be visible. */ setVisible_(isVisible: boolean): void; -} \ No newline at end of file +} diff --git a/core/mutator.ts b/core/mutator.ts index 1d0ad364b..f0554ba1d 100644 --- a/core/mutator.ts +++ b/core/mutator.ts @@ -217,6 +217,7 @@ export class Mutator extends Icon { /** * @internal */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars newWorkspaceSvg(options: Options): WorkspaceSvg { throw new Error( 'The implementation of newWorkspaceSvg should be ' + diff --git a/core/names.ts b/core/names.ts index b6faf8abd..d138ec39a 100644 --- a/core/names.ts +++ b/core/names.ts @@ -120,6 +120,7 @@ export class Names { * Generate names for procedures. * @param workspace Workspace to generate procedures from. */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars populateProcedures(workspace: Workspace) { throw new Error( 'The implementation of populateProcedures should be ' + diff --git a/core/options.ts b/core/options.ts index bf366ceda..b36021a40 100644 --- a/core/options.ts +++ b/core/options.ts @@ -150,9 +150,9 @@ export class Options { deprecation.warn('path', 'Nov 2014', 'Jul 2023', 'media'); pathToMedia = (options as any)['path'] + 'media/'; } - let oneBasedIndex; const rawOneBasedIndex = options['oneBasedIndex']; - oneBasedIndex = rawOneBasedIndex === undefined ? true : rawOneBasedIndex; + const oneBasedIndex = + rawOneBasedIndex === undefined ? true : rawOneBasedIndex; const renderer = options['renderer'] || 'geras'; const plugins = options['plugins'] || {}; diff --git a/core/registry.ts b/core/registry.ts index 65bdca972..358014a7a 100644 --- a/core/registry.ts +++ b/core/registry.ts @@ -60,7 +60,7 @@ export const DEFAULT = 'default'; * A name with the type of the element stored in the generic. * @alias Blockly.registry.Type */ -export class Type { +export class Type<_T> { /** @param name The name of the registry type. */ constructor(private readonly name: string) {} diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 430bc89e0..5b92e5ee4 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -400,7 +400,7 @@ export class RenderedConnection extends Connection { connections = block.getConnections_(true); } for (let i = 0; i < connections.length; i++) { - renderList.push.apply(renderList, connections[i].startTrackingAll()); + renderList.push(...connections[i].startTrackingAll()); } if (!renderList.length) { // Leaf block. diff --git a/core/renderers/common/constants.ts b/core/renderers/common/constants.ts index 51158cfae..1257fdedc 100644 --- a/core/renderers/common/constants.ts +++ b/core/renderers/common/constants.ts @@ -1117,7 +1117,7 @@ export class ConstantProvider { selector + ' .blocklyReplaceable .blocklyPath {', 'fill-opacity: .5;', '}', selector + ' .blocklyReplaceable .blocklyPathLight,', selector + ' .blocklyReplaceable .blocklyPathDark {', 'display: none;', '}', // Insertion marker. - selector + ' .blocklyInsertionMarker>.blocklyPath {', 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;', '}',]; + selector + ' .blocklyInsertionMarker>.blocklyPath {', 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;', '}']; } } /* clang-format on */ diff --git a/core/renderers/geras/geras.ts b/core/renderers/geras/geras.ts index 3840f534f..cbeaba916 100644 --- a/core/renderers/geras/geras.ts +++ b/core/renderers/geras/geras.ts @@ -33,5 +33,5 @@ export { PathObject, Renderer, RenderInfo, - StatementInput + StatementInput, }; diff --git a/core/renderers/measurables/base.ts b/core/renderers/measurables/base.ts index f06c66968..c57cf76f6 100644 --- a/core/renderers/measurables/base.ts +++ b/core/renderers/measurables/base.ts @@ -37,7 +37,7 @@ export class Measurable { notchOffset: number; /** The renderer's constant provider. */ - protected readonly constants_: ConstantProvider + protected readonly constants_: ConstantProvider; /** * @param constants The rendering constants provider. diff --git a/core/renderers/measurables/types.ts b/core/renderers/measurables/types.ts index ca6b36422..1faffd329 100644 --- a/core/renderers/measurables/types.ts +++ b/core/renderers/measurables/types.ts @@ -329,4 +329,4 @@ class TypesContainer { } } -export const Types = new TypesContainer(); \ No newline at end of file +export const Types = new TypesContainer(); diff --git a/core/renderers/zelos/path_object.ts b/core/renderers/zelos/path_object.ts index da2b9964f..b87a99a47 100644 --- a/core/renderers/zelos/path_object.ts +++ b/core/renderers/zelos/path_object.ts @@ -147,7 +147,7 @@ export class PathObject extends BasePathObject { * @internal */ beginDrawing() { - this.remainingOutlines.clear() + this.remainingOutlines.clear(); for (const key of this.outlines.keys()) { this.remainingOutlines.add(key); } diff --git a/core/renderers/zelos/zelos.ts b/core/renderers/zelos/zelos.ts index 4158d3f5a..d297f0d52 100644 --- a/core/renderers/zelos/zelos.ts +++ b/core/renderers/zelos/zelos.ts @@ -35,5 +35,5 @@ export { RenderInfo, RightConnectionShape, StatementInput, - TopRow + TopRow, }; diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index 7c27848ca..8d1045963 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -84,7 +84,7 @@ export function save(block: Block, { addCoordinates = false, addInputBlocks = true, addNextBlocks = true, - doFullSerialization = true + doFullSerialization = true, }: { addCoordinates?: boolean, addInputBlocks?: boolean, diff --git a/core/theme.ts b/core/theme.ts index 857a1666c..ed594f0df 100644 --- a/core/theme.ts +++ b/core/theme.ts @@ -218,4 +218,4 @@ export namespace Theme { export type BlockStyle = Theme.BlockStyle; export type CategoryStyle = Theme.CategoryStyle; export type ComponentStyle = Theme.ComponentStyle; -export type FontStyle = Theme.FontStyle; \ No newline at end of file +export type FontStyle = Theme.FontStyle; diff --git a/core/touch_gesture.ts b/core/touch_gesture.ts index b2c07ece9..191fbbcb2 100644 --- a/core/touch_gesture.ts +++ b/core/touch_gesture.ts @@ -21,8 +21,6 @@ import * as browserEvents from './browser_events.js'; import {Gesture} from './gesture.js'; import * as Touch from './touch.js'; import {Coordinate} from './utils/coordinate.js'; -import type {WorkspaceSvg} from './workspace_svg.js'; - /* * Note: In this file "start" refers to touchstart, mousedown, and pointerstart diff --git a/core/trashcan.ts b/core/trashcan.ts index e764784ae..a034c8a00 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -217,8 +217,8 @@ export class Trashcan extends DeleteArea implements IAutoHideable, init() { if (this.workspace.options.maxTrashcanContents > 0) { dom.insertAfter( - this.flyout?.createDom(Svg.SVG)!, this.workspace.getParentSvg()); - this.flyout?.init(this.workspace); + this.flyout!.createDom(Svg.SVG)!, this.workspace.getParentSvg()); + this.flyout!.init(this.workspace); } this.workspace.getComponentManager().addComponent({ component: this, diff --git a/core/utils.ts b/core/utils.ts index 6069bd2be..c09834b76 100644 --- a/core/utils.ts +++ b/core/utils.ts @@ -68,7 +68,7 @@ export { svgPaths, toolbox, userAgent, - xml + xml, }; /** diff --git a/core/utils/string.ts b/core/utils/string.ts index 2d919ce24..4df1acbda 100644 --- a/core/utils/string.ts +++ b/core/utils/string.ts @@ -217,7 +217,7 @@ function wrapScore( lineLengths[lineLengths.length - 1]++; } } - const maxLength = Math.max.apply(Math, lineLengths); + const maxLength = Math.max(...lineLengths); let score = 0; for (let i = 0; i < lineLengths.length; i++) { diff --git a/core/utils/style.ts b/core/utils/style.ts index 88d913486..909415979 100644 --- a/core/utils/style.ts +++ b/core/utils/style.ts @@ -303,4 +303,4 @@ export function getContainerOffsetToScrollInto( export const TEST_ONLY = { getSizeInternal, -} +}; diff --git a/core/utils/svg.ts b/core/utils/svg.ts index aa7ae7eb6..02972f1ad 100644 --- a/core/utils/svg.ts +++ b/core/utils/svg.ts @@ -22,7 +22,7 @@ goog.declareModuleId('Blockly.utils.Svg'); * A name with the type of the SVG element stored in the generic. * @alias Blockly.utils.Svg */ -export class Svg { +export class Svg<_T> { /** @internal */ static ANIMATE = new Svg('animate'); /** @internal */ diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index f9c9fe1fa..abd8286dd 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -430,4 +430,4 @@ export function parseToolboxTree(toolboxDef: Element|null|string): Element| export const TEST_ONLY = { hasCategoriesInternal, -} +}; diff --git a/core/variable_map.ts b/core/variable_map.ts index b8644bb76..d72163b76 100644 --- a/core/variable_map.ts +++ b/core/variable_map.ts @@ -298,7 +298,7 @@ export class VariableMap { * @return The variable with the given ID. */ getVariableById(id: string): VariableModel|null { - for (const [key, variables] of this.variableMap) { + for (const [_key, variables] of this.variableMap) { for (const variable of variables) { if (variable.getId() === id) { return variable; @@ -365,7 +365,7 @@ export class VariableMap { getAllVariableNames(): string[] { return Array.from(this.variableMap.values()) .flat() - .map(variable => variable.name); + .map((variable) => variable.name); } /** diff --git a/core/variables.ts b/core/variables.ts index a2df3bcd4..5b9c7db18 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -593,4 +593,4 @@ export function getAddedVariables( export const TEST_ONLY = { generateUniqueNameInternal, -} +}; diff --git a/core/variables_dynamic.ts b/core/variables_dynamic.ts index 3ae038cb9..59884a612 100644 --- a/core/variables_dynamic.ts +++ b/core/variables_dynamic.ts @@ -39,17 +39,20 @@ function stringButtonClickHandler(button: AnyDuringMigration) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, 'String'); } +// eslint-disable-next-line camelcase export const onCreateVariableButtonClick_String = stringButtonClickHandler; function numberButtonClickHandler(button: AnyDuringMigration) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, 'Number'); } +// eslint-disable-next-line camelcase export const onCreateVariableButtonClick_Number = numberButtonClickHandler; function colourButtonClickHandler(button: AnyDuringMigration) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, 'Colour'); } +// eslint-disable-next-line camelcase export const onCreateVariableButtonClick_Colour = colourButtonClickHandler; /** diff --git a/core/workspace.ts b/core/workspace.ts index ca614dcb5..9e1c7306a 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -353,13 +353,13 @@ export class Workspace implements IASTNodeLocation { const topBlocks = this.getTopBlocks(true); blocks = []; for (let i = 0; i < topBlocks.length; i++) { - blocks.push.apply(blocks, topBlocks[i].getDescendants(true)); + blocks.push(...topBlocks[i].getDescendants(true)); } } else { // Fast, but in no particular order. blocks = this.getTopBlocks(false); for (let i = 0; i < blocks.length; i++) { - blocks.push.apply(blocks, blocks[i].getChildren(false)); + blocks.push(...blocks[i].getChildren(false)); } } @@ -518,6 +518,7 @@ export class Workspace implements IASTNodeLocation { * ID. * @return The created block. */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars newBlock(prototypeName: string, opt_id?: string): Block { throw new Error( 'The implementation of newBlock should be ' + diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index bae97f5cd..528dc88fe 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -209,6 +209,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements * @param e Mouse event. * @internal */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars showContextMenu(e: Event) { throw new Error( 'The implementation of showContextMenu should be ' + @@ -714,11 +715,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements }); browserEvents.conditionalBind( textarea, 'change', this, - /** @param e Unused event parameter */ - /* eslint-enable no-unused-vars */ - function( - this: WorkspaceCommentSvg, - /* eslint-disable no-unused-vars */ e: Event) { + function(this: WorkspaceCommentSvg, _e: Event) { this.setContent(textarea.value); }); // AnyDuringMigration because: Type 'SVGForeignObjectElement | null' is not diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 6b567377c..731994362 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -961,7 +961,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** * @internal */ - static newTrashcan(workspace: WorkspaceSvg): Trashcan { + static newTrashcan(_workspace: WorkspaceSvg): Trashcan { throw new Error( 'The implementation of newTrashcan should be ' + 'monkey-patched in by blockly.ts'); @@ -1670,6 +1670,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * ID. * @return The created block. */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars override newBlock(prototypeName: string, opt_id?: string): BlockSvg { throw new Error( 'The implementation of newBlock should be ' + diff --git a/core/xml.ts b/core/xml.ts index 677b9edf6..725f4cf71 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -667,7 +667,7 @@ function mapSupportedXmlTags(xmlBlock: Element): childNodeTagMap { data: new Array(), field: new Array(), input: new Array(), - next: new Array() + next: new Array(), }; for (let i = 0; i < xmlBlock.children.length; i++) { const xmlChild = xmlBlock.children[i]; diff --git a/package-lock.json b/package-lock.json index a8e001f29..28585576f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@blockly/dev-tools": "^4.0.2", "@blockly/theme-modern": "^2.1.1", "@hyperjump/json-schema": "^0.18.4", + "@typescript-eslint/eslint-plugin": "^5.33.1", "@wdio/selenium-standalone-service": "^7.10.1", "chai": "^4.2.0", "clang-format": "^1.6.0", @@ -23,6 +24,7 @@ "concurrently": "^7.0.0", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", + "eslint-plugin-tsdoc": "^0.2.16", "google-closure-compiler": "^20220601.0.0", "google-closure-deps": "^20220502.0.0", "gulp": "^4.0.2", @@ -457,6 +459,37 @@ "url": "https://github.com/sponsors/jdesrosiers" } }, + "node_modules/@microsoft/tsdoc": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", + "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", + "dev": true + }, + "node_modules/@microsoft/tsdoc-config": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", + "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.14.1", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, + "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -608,6 +641,12 @@ "rxjs": "^7.2.0" } }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "node_modules/@types/keyv": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", @@ -742,6 +781,204 @@ "@types/node": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.1.tgz", + "integrity": "sha512-S1iZIxrTvKkU3+m63YUOxYPKaP+yWDQrdhxTglVDVEVBf+aCSw85+BmJnyUaQQsk5TXFG/LpBu9fa+LrAQ91fQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/type-utils": "5.33.1", + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.33.1.tgz", + "integrity": "sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz", + "integrity": "sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.33.1.tgz", + "integrity": "sha512-X3pGsJsD8OiqhNa5fim41YtlnyiWMF/eKsEZGsHID2HcDqeSC5yr/uLOeph8rNF2/utwuI0IQoAK3fpoxcLl2g==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.33.1.tgz", + "integrity": "sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz", + "integrity": "sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.33.1.tgz", + "integrity": "sha512-uphZjkMaZ4fE8CR4dU7BquOV6u0doeQAr8n6cQenl/poMaIyJtBu8eys5uk6u5HiDH01Mj5lzbJ5SfeDz7oqMQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz", + "integrity": "sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.33.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -4001,6 +4238,16 @@ "eslint": ">=5.16.0" } }, + "node_modules/eslint-plugin-tsdoc": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz", + "integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc-config": "0.16.1" + } + }, "node_modules/eslint-scope": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -7189,6 +7436,12 @@ "node": ">=4" } }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", + "dev": true + }, "node_modules/js-green-licenses": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-3.0.1.tgz", @@ -10602,9 +10855,9 @@ } }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -11768,6 +12021,21 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -13300,6 +13568,36 @@ "just-curry-it": "^3.1.0" } }, + "@microsoft/tsdoc": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", + "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", + "dev": true + }, + "@microsoft/tsdoc-config": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", + "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.14.1", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + }, + "dependencies": { + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -13433,6 +13731,12 @@ "rxjs": "^7.2.0" } }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "@types/keyv": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", @@ -13567,6 +13871,114 @@ "@types/node": "*" } }, + "@typescript-eslint/eslint-plugin": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.1.tgz", + "integrity": "sha512-S1iZIxrTvKkU3+m63YUOxYPKaP+yWDQrdhxTglVDVEVBf+aCSw85+BmJnyUaQQsk5TXFG/LpBu9fa+LrAQ91fQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/type-utils": "5.33.1", + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.33.1.tgz", + "integrity": "sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==", + "dev": true, + "peer": true, + "requires": { + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz", + "integrity": "sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.33.1.tgz", + "integrity": "sha512-X3pGsJsD8OiqhNa5fim41YtlnyiWMF/eKsEZGsHID2HcDqeSC5yr/uLOeph8rNF2/utwuI0IQoAK3fpoxcLl2g==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.33.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.33.1.tgz", + "integrity": "sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz", + "integrity": "sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/visitor-keys": "5.33.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.33.1.tgz", + "integrity": "sha512-uphZjkMaZ4fE8CR4dU7BquOV6u0doeQAr8n6cQenl/poMaIyJtBu8eys5uk6u5HiDH01Mj5lzbJ5SfeDz7oqMQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.33.1", + "@typescript-eslint/types": "5.33.1", + "@typescript-eslint/typescript-estree": "5.33.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.33.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz", + "integrity": "sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.33.1", + "eslint-visitor-keys": "^3.3.0" + } + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -16168,6 +16580,16 @@ "dev": true, "requires": {} }, + "eslint-plugin-tsdoc": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz", + "integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc-config": "0.16.1" + } + }, "eslint-scope": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", @@ -18681,6 +19103,12 @@ } } }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", + "dev": true + }, "js-green-licenses": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-3.0.1.tgz", @@ -21410,9 +21838,9 @@ } }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -22387,6 +22815,15 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index 51a5340ea..e4ef03ef2 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "generate:langfiles": "gulp generateLangfiles", "license": "gulp checkLicenses", "lint": "eslint .", + "lint:fix": "eslint . --fix", "package": "gulp package", "prepare": "gulp prepare", "prepareDemos": "gulp prepareDemos", @@ -69,6 +70,7 @@ "@blockly/dev-tools": "^4.0.2", "@blockly/theme-modern": "^2.1.1", "@hyperjump/json-schema": "^0.18.4", + "@typescript-eslint/eslint-plugin": "^5.33.1", "@wdio/selenium-standalone-service": "^7.10.1", "chai": "^4.2.0", "clang-format": "^1.6.0", @@ -76,6 +78,7 @@ "concurrently": "^7.0.0", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", + "eslint-plugin-tsdoc": "^0.2.16", "google-closure-compiler": "^20220601.0.0", "google-closure-deps": "^20220502.0.0", "gulp": "^4.0.2",