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

Lint, Pretify js/js-exp files #2806

Merged
merged 3 commits into from
Feb 5, 2021
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
4 changes: 4 additions & 0 deletions js/js-export/API/DictBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* MA 02110-1335 USA.
*/

/* global turtles, JSInterface */

/* exported DictBlocksAPI */

/**
* Class pertaining to the API methods specific to Dictionary blocks for JavaScript based Music Blocks
* programs.
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/DrumBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global MusicBlocks, JSInterface */

/* exported DrumBlocksAPI */

/**
* Class pertaining to the API methods specific to Drum blocks for JavaScript based Music Blocks
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/GraphicsBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface */

/* exported GraphicsBlocksAPI */

/**
* Class pertaining to the API methods specific to Graphics blocks for JavaScript based Music Blocks
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/IntervalsBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, MusicBlocks */

/* exported IntervalsBlocksAPI */

/**
* Class pertaining to the API methods specific to Intervals blocks for JavaScript based Music Blocks
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/MeterBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, Singer */

/* exported MeterBlocksAPI */

/**
* Class pertaining to the API methods specific to Meter blocks for JavaScript based Music Blocks
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/OrnamentBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, MusicBlocks */

/* exported OrnamentBlocksAPI */

/**
* Class pertaining to the API methods specific to Ornament blocks for JavaScript based Music Blocks
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/PenBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, turtles, logo */

/* exported PenBlocksAPI */

/**
* Class pertaining to the API methods specific to Pen blocks for JavaScript based Music Blocks
Expand Down
15 changes: 11 additions & 4 deletions js/js-export/API/PitchBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, MusicBlocks, Singer */

/* exported PitchBlocksAPI */

/**
* Class pertaining to the API methods specific to Pitch blocks for JavaScript based Music Blocks
Expand All @@ -35,9 +39,12 @@ class PitchBlocksAPI {

playNthModalPitch(number, octave) {
const args = JSInterface.validateArgs("playNthModalPitch", [number, octave]);
return this.runCommand(
"playNthModalPitch", [args[0], args[1], this.turIndex, MusicBlocks.BLK]
);
return this.runCommand("playNthModalPitch", [
args[0],
args[1],
this.turIndex,
MusicBlocks.BLK
]);
}

playPitchNumber(number) {
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/RhythmBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, MusicBlocks */

/* exported RhythmBlocksAPI */

/**
* Class pertaining to the API methods specific to Rhythm blocks for JavaScript based Music Blocks
Expand Down
13 changes: 11 additions & 2 deletions js/js-export/API/ToneBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, MusicBlocks */

/* exported ToneBlocksAPI */

/**
* Class pertaining to the API methods specific to Tone blocks for JavaScript based Music Blocks
Expand All @@ -38,7 +42,12 @@ class ToneBlocksAPI {
}

async doChorus(chorusRate, delayTime, chorusDepth, flow) {
const args = JSInterface.validateArgs("doChorus", [chorusRate, delayTime, chorusDepth, flow]);
const args = JSInterface.validateArgs("doChorus", [
chorusRate,
delayTime,
chorusDepth,
flow
]);
await this.runCommand("doChorus", [args[0], args[1], args[2], this.turIndex]);
await args[3]();
return this.ENDFLOWCOMMAND;
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/API/VolumeBlocksAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* You should have received a copy of the GNU Affero General Public License along with this
* library; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston,
* MA 02110-1335 USA.
*/
*/

/* global JSInterface, Singer */

/* exported VolumeBlocksAPI */

/**
* Class pertaining to the API methods specific to Volume blocks for JavaScript based Music Blocks
Expand Down
4 changes: 4 additions & 0 deletions js/js-export/ASTutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* Private members' names begin with underscore '_".
*/

/* global JSInterface, last */

/* exported ASTUtils */

/**
* @class
* @classdesc contains the barebone ASTs and utilities for generating the Abstract Syntax Tree for
Expand Down
38 changes: 20 additions & 18 deletions js/js-export/constraints.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* MA 02110-1335 USA.
*/

/* global JSInterface */

/**
* @static
* lookup table for API method names to argument constraints
Expand Down Expand Up @@ -990,24 +992,24 @@ JSInterface._methodArgConstraints = {
}
}
],
setBezierControlPoint1: [
{
type: "number",
constraints: {
min: -100000,
max: 100000,
integer: false
}
},
{
type: "number",
constraints: {
min: -100000,
max: 100000,
integer: false
}
}
],
// setBezierControlPoint1: [
// {
// type: "number",
// constraints: {
// min: -100000,
// max: 100000,
// integer: false
// }
// },
// {
// type: "number",
// constraints: {
// min: -100000,
// max: 100000,
// integer: false
// }
// }
// ],
scrollXY: [
{
type: "number",
Expand Down
3 changes: 3 additions & 0 deletions js/js-export/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* Internal functions' names are in PascalCase.
*/

/* global JSEditor, turtles, last, importMembers, logo, Singer, JSInterface */

/**
* @class
* @classdesc pertains to the Mouse (corresponding to Turtle) in JavaScript based Music Blocks programs.
Expand Down Expand Up @@ -46,6 +48,7 @@ class Mouse {
this.turtle.initTurtle(false);

this.flow = flow;
// eslint-disable-next-line no-use-before-define
this.MB = new MusicBlocks(this); // associate a MusicBlocks object with each Mouse

Mouse.MouseList.push(this);
Expand Down
5 changes: 5 additions & 0 deletions js/js-export/generate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
/**
* @file This contains the utilities for generating code from block stacks for JS Editor widget.
* @author Anindya Kundu
Expand All @@ -14,6 +15,10 @@
* MA 02110-1335 USA.
*/

/* global JSInterface, blocks, last, ASTUtils, astring */

/* exported JSGenerate */

/**
* @class
* @classdesc
Expand Down
6 changes: 5 additions & 1 deletion js/js-export/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
* Private members' names begin with underscore '_".
*/

/* global JSEditor, SHARP, FLAT, NATURAL, DOUBLESHARP, DOUBLEFLAT */

/* exported JSInterface */

/**
* @class
* @classdesc contains the lists and lookups for relevant blocks, and utility methods to access them.
Expand Down Expand Up @@ -374,7 +378,7 @@ class JSInterface {
if (!isNaN(Number(arg))) {
arg = Number(arg);
} else {
const error = "TypeMismatch error: expected \"number\" but found \"string\"";
const error = 'TypeMismatch error: expected "number" but found "string"';
JSEditor.logConsole(error, "maroon");
throw error;
}
Expand Down
2 changes: 2 additions & 0 deletions js/js-export/samples/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* MA 02110-1335 USA.
*/

/* exported JS_API, JS_STARTER, SAMPLE_1, SAMPLE_2 */

const JS_API = `/*
============================================================
API
Expand Down