Skip to content

Commit

Permalink
fixing ESLint workflow issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ricknjacky committed Jan 30, 2021
1 parent 70226eb commit 37809b6
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 324 deletions.
81 changes: 42 additions & 39 deletions js/blocks/WidgetBlocks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
function setupWidgetBlocks() {
class EnvelopeBlock extends FlowBlock {
constructor() {
Expand All @@ -23,7 +24,7 @@ function setupWidgetBlocks() {
}

flow(args, logo, turtle, blk) {
let tur = logo.turtles.ithTurtle(turtle);
const tur = logo.turtles.ithTurtle(turtle);

if (args.length === 4 && typeof args[0] === "number") {
if (args[0] < 0 || args[0] > 100) {
Expand Down Expand Up @@ -101,7 +102,7 @@ function setupWidgetBlocks() {
let rollOff;

if (args.length === 3 && typeof args[1] === "number") {
for (let ftype in FILTERTYPES) {
for (const ftype in FILTERTYPES) {
if (FILTERTYPES[ftype][0] === args[0]) {
filtertype = FILTERTYPES[ftype][1];
} else if (FILTERTYPES[ftype][1] === args[0]) {
Expand Down Expand Up @@ -185,31 +186,31 @@ function setupWidgetBlocks() {

logo.insideTemperament = true;
logo.temperament.inTemperament = args[0];
let scale = [];
const scale = [];

if (
logo.blocks.blockList[logo.blocks.blockList[blk].connections[2]]
.name === "pitch"
) {
let pitchBlock =
const pitchBlock =
logo.blocks.blockList[
logo.blocks.blockList[blk].connections[2]
];
let note =
const note =
logo.blocks.blockList[pitchBlock.connections[1]].value;
let octave =
const octave =
logo.blocks.blockList[pitchBlock.connections[2]].value;
let setKey = logo.blocks.blockList[pitchBlock.connections[3]];
const setKey = logo.blocks.blockList[pitchBlock.connections[3]];
scale[0] = logo.blocks.blockList[setKey.connections[1]].value;
scale[1] = logo.blocks.blockList[setKey.connections[2]].value;
logo.synth.startingPitch = note + octave;
logo.temperament.scale = scale;
}

let listenerName = "_temperament_" + turtle;
const listenerName = "_temperament_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.temperament.init();
};

Expand Down Expand Up @@ -322,10 +323,10 @@ function setupWidgetBlocks() {
logo.timbre.duoSynthParams = [];
logo.timbre.notesToPlay = [];

let listenerName = "_timbre_" + turtle;
const listenerName = "_timbre_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.timbre.init();
};

Expand Down Expand Up @@ -363,10 +364,10 @@ function setupWidgetBlocks() {
flow(args, logo, turtle, blk) {
logo.insideMeterWidget = true;

let listenerName = "_meterwidget_" + turtle;
const listenerName = "_meterwidget_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.meterWidget = new MeterWidget(blk);

logo.insideMeterWidget = false;
Expand All @@ -391,18 +392,19 @@ function setupWidgetBlocks() {
"oscilloscope"
]);
this.formBlock({ name: _("oscilloscope"), canCollapse: true });
let addPrintTurtle = (blocks,turtle,prev,last) => {
let len = blocks.length;
let next = last ? null : len+2
const addPrintTurtle = (blocks,turtle,prev,last) => {
const len = blocks.length;
const next = last ? null : len+2;
blocks.push([len, "print", 0, 0, [prev, len + 1, next]]);
blocks.push([len + 1, ["text", { value: turtle.name}], 0, 0, [len, null]]);
return blocks;
}
};

this.makeMacro((x, y) => {
let blocks = [[0,"oscilloscope", x, y, [null, 1, null]]];
for (let turtle of turtles.turtleList) {
for (const turtle of turtles.turtleList) {
if (!turtle.inTrash)
// eslint-disable-next-line max-len
blocks = addPrintTurtle(blocks, turtle, Math.max(0, blocks.length - 2), turtle == last(turtles.turtleList));
}
blocks[0][4][2]=blocks.length;
Expand All @@ -415,10 +417,10 @@ function setupWidgetBlocks() {
logo.oscilloscopeTurtles = [];
logo.inOscilloscope = true;

let listenerName = "_oscilloscope_" + turtle;
const listenerName = "_oscilloscope_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.Oscilloscope = new Oscilloscope(logo);
logo.inOscilloscope = false;
};
Expand Down Expand Up @@ -457,10 +459,10 @@ function setupWidgetBlocks() {
flow(args, logo, turtle, blk) {
logo.insideModeWidget = true;

let listenerName = "_modewidget_" + turtle;
const listenerName = "_modewidget_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.modeWidget = new ModeWidget();
logo.insideModeWidget = false;
};
Expand Down Expand Up @@ -507,10 +509,10 @@ function setupWidgetBlocks() {
logo.tempo.BPMBlocks = [];
logo.tempo.BPMs = [];

let listenerName = "_tempo_" + turtle;
const listenerName = "_tempo_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.tempo.init();
};

Expand Down Expand Up @@ -565,10 +567,10 @@ function setupWidgetBlocks() {
logo.pitchDrumMatrix.drums = [];
logo.pitchDrumMatrix.clearBlocks();

let listenerName = "_pitchdrummatrix_" + turtle;
const listenerName = "_pitchdrummatrix_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
if (
logo.pitchDrumMatrix.drums.length === 0 ||
logo.pitchDrumMatrix.rowLabels.length === 0
Expand Down Expand Up @@ -622,10 +624,10 @@ function setupWidgetBlocks() {
logo.inPitchSlider = true;
logo.pitchSlider.frequencies = [];

let listenerName = "_pitchslider_" + turtle;
const listenerName = "_pitchslider_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.pitchSlider.init(logo);
logo.inPitchSlider = false;
};
Expand Down Expand Up @@ -754,10 +756,10 @@ function setupWidgetBlocks() {
logo.musicKeyboard.octaves = [];
logo.musicKeyboard._rowBlocks = [];

let listenerName = "_musickeyboard_" + turtle;
const listenerName = "_musickeyboard_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.musicKeyboard.init(logo);
};

Expand Down Expand Up @@ -803,10 +805,10 @@ function setupWidgetBlocks() {

logo.inPitchStaircase = true;

let listenerName = "_pitchstaircase_" + turtle;
const listenerName = "_pitchstaircase_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.pitchStaircase.init(logo);
logo.inPitchStaircase = false;
};
Expand Down Expand Up @@ -890,10 +892,10 @@ function setupWidgetBlocks() {
logo.rhythmRuler.Drums = [];
logo.inRhythmRuler = true;

let listenerName = "_rhythmruler_" + turtle;
const listenerName = "_rhythmruler_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.rhythmRuler.init();
};

Expand Down Expand Up @@ -1033,10 +1035,10 @@ function setupWidgetBlocks() {
logo.tupletParams = [];
logo.addingNotesToTuplet = false;

let listenerName = "_matrix_" + turtle;
const listenerName = "_matrix_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
if (
logo.tupletRhythms.length === 0 ||
logo.phraseMaker.rowLabels.length === 0
Expand All @@ -1061,7 +1063,8 @@ function setupWidgetBlocks() {
switch (logo.tupletRhythms[i][0]) {
case "notes":
case "simple":
let tupletParam = [logo.tupletParams[logo.tupletRhythms[i][1]]];
// eslint-disable-next-line no-case-declarations
const tupletParam = [logo.tupletParams[logo.tupletRhythms[i][1]]];
tupletParam.push([]);
for (
let j = 2;
Expand Down Expand Up @@ -1138,10 +1141,10 @@ function setupWidgetBlocks() {

logo.inStatusMatrix = true;

let listenerName = "_status_" + turtle;
const listenerName = "_status_" + turtle;
logo.setDispatchBlock(blk, turtle, listenerName);

let __listener = function(event) {
const __listener = function(event) {
logo.statusMatrix.init(logo);
logo.inStatusMatrix = false;
};
Expand Down
Loading

0 comments on commit 37809b6

Please sign in to comment.