Skip to content

Commit

Permalink
less eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrredo committed May 30, 2024
1 parent ff3577f commit 43721f4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
10 changes: 4 additions & 6 deletions src/lib/blocks/Test Blocks/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { BlockShape, BlockType, DropdownType } from "$lib/enums/BlockTypes";
import DropdownInput from "$lib/utils/BlockGen/Inputs/Dropdown";
import ValueInput from "$lib/utils/BlockGen/Inputs/ValueInput";
import VariableInput from "$lib/utils/BlockGen/Inputs/VariableInput";
// import { xml } from "blockly/core/utils";
// import BaseInput from "$lib/utils/BlockGen/Inputs/BaseInput";
// let variableBlockDef: BaseInput = new BaseInput()

function fixVariableName(variable: string): string {
// Remove non-alphabetic characters from the start and end
let fixedVariable = variable.replace(/^[^a-zA-Z]+|[^a-zA-Z0-9]+$/g, '');
Expand All @@ -35,7 +33,7 @@ const blocks: BlockDefinition[] = [
args: [
new VariableInput("VAR", "")
],
code(args, block) {
code(args) {

const varName = fixVariableName(args.VAR as string)
console.log(varName, args.VAR)
Expand All @@ -56,7 +54,7 @@ const blocks: BlockDefinition[] = [
new VariableInput("VAR", ""),
new ValueInput("INPUT", BlockType.Any)
],
code(args, block) {
code(args) {
const varName = fixVariableName(args.VAR as string)

return `${varName}${args.INPUT !== ""? " =" : ";"} ${args.INPUT !== ""? args.INPUT+";": ""}\n`
Expand All @@ -83,7 +81,7 @@ const blocks: BlockDefinition[] = [
new ValueInput("INPUT", BlockType.Any)

],
code(args, block) {
code(args) {
const varName = fixVariableName(args.VAR as string)
console.log(varName)
return `${varName}${args.INPUT !== ""? " "+ args.DROPDOWN + "=" : ";"} ${args.INPUT !== ""? args.INPUT+";": ""}\n`
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/CategoryDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export type CategoryDefinition = {
hidden?: boolean;
weight?: number;
custom?: string; // add if you want to make dynamic categories
// eslint-disable-next-line no-use-before-define
customFunction?: (workspace: Blockly.WorkspaceSvg) => any[]; // used in pair with custom

Check failure on line 9 in src/lib/types/CategoryDefinition.ts

View workflow job for this annotation

GitHub Actions / Run eslint

Unexpected any. Specify a different type

Check failure on line 9 in src/lib/types/CategoryDefinition.ts

View workflow job for this annotation

GitHub Actions / Run eslint

Unexpected any. Specify a different type
};
19 changes: 0 additions & 19 deletions src/lib/utils/ToolboxGen/CallBacks.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/lib/utils/ToolboxGen/Toolbox.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { BlockDefinition } from "$lib/types/BlockDefinition";
import type { ToolboxDefinition, ToolboxItemInfo } from "blockly/core/utils/toolbox";
import type {FlyoutButton} from "blockly";
import Blockly from "blockly/core";

export default class Toolbox {
private callbackCategory: Record<string, any>;
private callbackOther: Record<string, any>;
// eslint-disable-next-line no-use-before-define
private callbackCategory: Record<string, (workspace: Blockly.WorkspaceSvg) => any[]>;

Check failure on line 7 in src/lib/utils/ToolboxGen/Toolbox.ts

View workflow job for this annotation

GitHub Actions / Run eslint

Unexpected any. Specify a different type

Check failure on line 7 in src/lib/utils/ToolboxGen/Toolbox.ts

View workflow job for this annotation

GitHub Actions / Run eslint

Unexpected any. Specify a different type
private callbackOther: Record<string, (p1: Blockly.FlyoutButton) => void>;

constructor() {
this.callbackCategory = {};
Expand Down

0 comments on commit 43721f4

Please sign in to comment.