diff --git a/.eslintignore b/.eslintignore index fc0f3564..277bca3b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,2 @@ src/client/Snap--Build-Your-Own-Blocks/ -src/virtual-client/ +src/client/dist diff --git a/.eslintrc.yml b/.eslintrc.yml index da7b6e66..87159528 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -14,6 +14,7 @@ rules: quotes: - 2 - single + - allowTemplateLiterals: true semi: - 2 - always diff --git a/src/client/actions.js b/src/client/actions.js index fc659f2c..b591ce72 100644 --- a/src/client/actions.js +++ b/src/client/actions.js @@ -147,7 +147,7 @@ SnapActions.applyEvent = function(event) { ide.promptExitReplay(function() { // Netsblox addition: start if (!myself.isCollaborating() || myself.isLeader) { - // Netsblox addition: end + // Netsblox addition: end myself.acceptEvent(event); } else { myself.send(event); diff --git a/src/client/blocks.js b/src/client/blocks.js index ffae4c27..32d7a9aa 100644 --- a/src/client/blocks.js +++ b/src/client/blocks.js @@ -6,7 +6,7 @@ ColorSlotMorph, TemplateSlotMorph, FunctionSlotMorph, ReporterSlotMorph, SymbolMorph, MorphicPreferences, contains, IDE_Morph, Costume, ScriptsMorph, MessageDefinitionBlock, RPCInputSlotMorph, SnapActions, MultiHintArgMorph, - PrototypeHatBlockMorph + PrototypeHatBlockMorph, CommandBlockMorph */ BlockMorph.prototype.setSpec = function (spec, silently) { @@ -802,7 +802,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part = new ReporterSlotMorph(true); break; - // code mapping (experimental) + // code mapping (experimental) case '%codeListPart': part = new InputSlotMorph( @@ -829,7 +829,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { ); break; - // symbols: + // symbols: case '%turtle': part = new SymbolMorph('turtle'); @@ -837,7 +837,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.color = new Color(255, 255, 255); part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%turtleOutline': @@ -847,7 +847,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = true; // doesn't participate in zebraing part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%clockwise': @@ -857,7 +857,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = false; // zebra colors part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%counterclockwise': @@ -867,7 +867,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = false; // zebra colors part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%greenflag': @@ -877,7 +877,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = true; // doesn't participate in zebraing part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%stop': @@ -887,7 +887,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = true; // doesn't participate in zebraing part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; case '%pause': @@ -897,7 +897,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = true; // doesn't participate in zebraing part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); break; default: @@ -906,7 +906,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { } else if (spec[0] === '$' && spec.length > 1 && this.selector !== 'reportGetVar') { -/* + /* // allow costumes as label symbols // has issues when loading costumes (asynchronously) // commented out for now @@ -938,7 +938,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isBold = true; part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); return part; } @@ -952,7 +952,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { part.isProtectedLabel = tokens.length > 2; // zebra colors part.shadowColor = this.color.darker(this.labelContrast); part.shadowOffset = MorphicPreferences.isFlat ? - new Point() : this.embossing; + new Point() : this.embossing; part.drawNew(); } else { part = new StringMorph( @@ -963,7 +963,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { false, // italic false, // isNumeric MorphicPreferences.isFlat ? - new Point() : this.embossing, // shadowOffset + new Point() : this.embossing, // shadowOffset this.color.darker(this.labelContrast), // shadowColor new Color(255, 255, 255), // color this.labelFontName // fontName diff --git a/src/client/byob.js b/src/client/byob.js index a60a5ea1..d77b8895 100644 --- a/src/client/byob.js +++ b/src/client/byob.js @@ -191,7 +191,7 @@ InputSlotDialogMorph.prototype.createSlotTypeButtons = function () { function () { myself.setSlotArity('single'); }, - "Single input.", + 'Single input.', function () { return myself.fragment.isSingleInput(); } @@ -208,12 +208,12 @@ InputSlotDialogMorph.prototype.createSlotTypeButtons = function () { this.addSlotArityButton( function () {myself.setSlotArity('multiple'); }, - "Multiple inputs (value is list of inputs)", + 'Multiple inputs (value is list of inputs)', function () {return myself.fragment.isMultipleInput(); } ); this.addSlotArityButton( function () {myself.setSlotArity('upvar'); }, - "Upvar - make internal variable visible to caller", + 'Upvar - make internal variable visible to caller', function () {return myself.fragment.isUpvar(); } ); @@ -223,9 +223,9 @@ InputSlotDialogMorph.prototype.createSlotTypeButtons = function () { defLabel.setColor(new Color(255, 255, 255)); defLabel.refresh = function () { if (myself.isExpanded && contains( - ['%s', '%n', '%txt', '%anyUE'], - myself.fragment.type - )) { + ['%s', '%n', '%txt', '%anyUE'], + myself.fragment.type + )) { defLabel.show(); } else { defLabel.hide(); @@ -394,7 +394,7 @@ BlockExportDialogMorph.prototype.buildContents = function (stage) { checkBox.setPosition(new Point( x, y + (checkBox.top() - checkBox.toggleElement.top()) - )); + )); palette.addContents(checkBox); y += checkBox.fullBounds().height() + padding; }.bind(this)); diff --git a/src/client/cloud.js b/src/client/cloud.js index 1f8c06a2..5f5d6317 100644 --- a/src/client/cloud.js +++ b/src/client/cloud.js @@ -1,4 +1,4 @@ -/* global localize, nop, IDE_Morph, Cloud, detect, SnapActions*/ +/* global localize, nop, IDE_Morph, Cloud, detect, SnapActions, world*/ NetCloud.prototype = new Cloud(); function NetCloud(url) { diff --git a/src/client/gui.js b/src/client/gui.js index 53e041f9..7f62170d 100644 --- a/src/client/gui.js +++ b/src/client/gui.js @@ -284,16 +284,16 @@ ProjectDialogMorph.prototype.installShareCloudProjectList = function (pl) { this.projectList = pl || []; this.projectList.sort(function (x, y) { return x.ProjectName.toLowerCase() < y.ProjectName.toLowerCase() ? - -1 : 1; + -1 : 1; }); this.listField.destroy(); this.listField = new ListMorph( this.projectList, this.projectList.length > 0 ? - function (element) { - return element.ProjectName || element; - } : null, + function (element) { + return element.ProjectName || element; + } : null, [ // format: display shared project names bold [ 'bold', @@ -327,7 +327,7 @@ ProjectDialogMorph.prototype.installShareCloudProjectList = function (pl) { // Netsblox addition: start localize('owner') + ': ' + item.Owner + '\n' + localize('last changed') + '\n' + item.Updated, - // Netsblox addition: end + // Netsblox addition: end null, null, null, @@ -417,9 +417,9 @@ ProjectDialogMorph.prototype.setSource = function (source) { this.listField = new ListMorph( this.projectList, this.projectList.length > 0 ? - function (element) { - return element.name; - } : null, + function (element) { + return element.name; + } : null, null, function () {myself.ok(); } ); @@ -616,9 +616,9 @@ ProjectDialogMorph.prototype.saveProject = function () { if (name) { if (this.source === 'cloud') { if (detect( - this.projectList, - function (item) {return item.ProjectName === name; } - )) { + this.projectList, + function (item) {return item.ProjectName === name; } + )) { this.ide.confirm( localize( 'Are you sure you want to replace' @@ -659,9 +659,9 @@ ProjectDialogMorph.prototype.saveProject = function () { } } else { // 'local' if (detect( - this.projectList, - function (item) {return item.name === name; } - )) { + this.projectList, + function (item) {return item.name === name; } + )) { this.ide.confirm( localize( 'Are you sure you want to replace' diff --git a/src/client/netsblox.js b/src/client/netsblox.js index d797d9f3..9b31fdab 100644 --- a/src/client/netsblox.js +++ b/src/client/netsblox.js @@ -6,7 +6,7 @@ ScrollFrameMorph, SnapUndo, LibraryImportDialogMorph, CollaboratorDialogMorph, SnapSerializer, isRetinaSupported, isRetinaEnabled, useBlurredShadows, BlockMorph, SyntaxElementMorph, ScriptsMorph, InputSlotDialogMorph, ArgMorph, - BlockLabelPlaceHolderMorph, TableMorph*/ + BlockLabelPlaceHolderMorph, TableMorph, contains*/ // Netsblox IDE (subclass of IDE_Morph) NetsBloxMorph.prototype = new IDE_Morph(); NetsBloxMorph.prototype.constructor = NetsBloxMorph; @@ -96,7 +96,7 @@ NetsBloxMorph.prototype.openIn = function (world) { } } - function applyFlags(dict) { + function applyFlags(dict) { if (dict.editMode) { myself.toggleAppMode(false); } else { @@ -112,7 +112,7 @@ NetsBloxMorph.prototype.openIn = function (world) { if (dict.noExitWarning) { window.onbeforeunload = nop; } - } + } // dynamic notifications from non-source text files // has some issues, commented out for now @@ -144,20 +144,20 @@ NetsBloxMorph.prototype.openIn = function (world) { hash = decodeURIComponent(hash); } if (contains( - ['project', 'blocks', 'sprites', 'snapdata'].map( - function (each) { - return hash.substr(0, 8).indexOf(each); - } - ), - 1 - )) { + ['project', 'blocks', 'sprites', 'snapdata'].map( + function (each) { + return hash.substr(0, 8).indexOf(each); + } + ), + 1 + )) { this.droppedText(hash); } else { this.droppedText(getURL(hash)); } } else if (location.hash.substr(0, 5) === '#run:') { hash = location.hash.substr(5); - idx = hash.indexOf("&"); + idx = hash.indexOf('&'); if (idx > 0) { hash = hash.slice(0, idx); } @@ -1032,7 +1032,7 @@ NetsBloxMorph.prototype.createControlBar = function () { var suffix = ' @ ' + myself.room.name; suffix += myself.world().isDevMode ? - ' - ' + localize('development mode') : ''; + ' - ' + localize('development mode') : ''; if (this.label) { this.label.destroy(); @@ -1169,7 +1169,7 @@ NetsBloxMorph.prototype.createSpriteBar = function () { button.setPosition(myself.spriteBar.position().add(2)); button.setTop(button.top() + ((rotationStyleButtons.length - 1) * (button.height() + 2)) - ); + ); myself.spriteBar.add(button); if (myself.currentSprite instanceof StageMorph) { button.hide(); @@ -1237,7 +1237,7 @@ NetsBloxMorph.prototype.createSpriteBar = function () { padlock.pressColor = tabColors[1]; padlock.tick.shadowOffset = MorphicPreferences.isFlat ? - new Point() : new Point(-1, -1); + new Point() : new Point(-1, -1); padlock.tick.shadowColor = new Color(); // black padlock.tick.color = this.buttonLabelColor; padlock.tick.isBold = false; @@ -1361,7 +1361,7 @@ NetsBloxMorph.prototype.projectMenu = function () { world = this.world(), pos = this.controlBar.projectButton.bottomLeft(), graphicsName = this.currentSprite instanceof SpriteMorph ? - 'Costumes' : 'Backgrounds', + 'Costumes' : 'Backgrounds', shiftClicked = (world.currentKey === 16); // Netsblox addition: start @@ -1395,9 +1395,9 @@ NetsBloxMorph.prototype.projectMenu = function () { menu.addPair('New', 'createNewProject', '^N'); menu.addPair('Open...', 'openProjectsBrowser', '^O'); if (!this.room.isGuest()) { - menu.addPair('Save', "save", '^S'); + menu.addPair('Save', 'save', '^S'); } else { - menu.addPair('Save a Copy', "save", '^S'); + menu.addPair('Save a Copy', 'save', '^S'); } menu.addItem('Save As...', function() { if (myself.isPreviousVersion()) { @@ -1432,15 +1432,15 @@ NetsBloxMorph.prototype.projectMenu = function () { myself.filePicker = null; } inp.type = 'file'; - inp.style.color = "transparent"; - inp.style.backgroundColor = "transparent"; - inp.style.border = "none"; - inp.style.outline = "none"; - inp.style.position = "absolute"; - inp.style.top = "0px"; - inp.style.left = "0px"; - inp.style.width = "0px"; - inp.style.height = "0px"; + inp.style.color = 'transparent'; + inp.style.backgroundColor = 'transparent'; + inp.style.border = 'none'; + inp.style.outline = 'none'; + inp.style.position = 'absolute'; + inp.style.top = '0px'; + inp.style.left = '0px'; + inp.style.width = '0px'; + inp.style.height = '0px'; inp.addEventListener( 'change', function () { @@ -1473,18 +1473,18 @@ NetsBloxMorph.prototype.projectMenu = function () { myself.filePicker = null; } inp.type = 'file'; - inp.style.color = "transparent"; - inp.style.backgroundColor = "transparent"; - inp.style.border = "none"; - inp.style.outline = "none"; - inp.style.position = "absolute"; - inp.style.top = "0px"; - inp.style.left = "0px"; - inp.style.width = "0px"; - inp.style.height = "0px"; - inp.style.display = "none"; + inp.style.color = 'transparent'; + inp.style.backgroundColor = 'transparent'; + inp.style.border = 'none'; + inp.style.outline = 'none'; + inp.style.position = 'absolute'; + inp.style.top = '0px'; + inp.style.left = '0px'; + inp.style.width = '0px'; + inp.style.height = '0px'; + inp.style.display = 'none'; inp.addEventListener( - "change", + 'change', function () { document.body.removeChild(inp); myself.filePicker = null; @@ -1521,7 +1521,7 @@ NetsBloxMorph.prototype.projectMenu = function () { } menu.addItem( shiftClicked ? - 'Export project as plain text...' : 'Export project...', + 'Export project as plain text...' : 'Export project...', function () { if (myself.projectName) { myself.exportProject(myself.projectName, shiftClicked); @@ -1543,7 +1543,7 @@ NetsBloxMorph.prototype.projectMenu = function () { 'show global custom block definitions/message types as XML' + '\nin a new browser window' ); - // Netsblox addition: end + // Netsblox addition: end menu.addItem( 'Unused blocks...', function () {myself.removeUnusedBlocks(); }, diff --git a/src/client/objects.js b/src/client/objects.js index 5f9dcc92..69b0825b 100644 --- a/src/client/objects.js +++ b/src/client/objects.js @@ -7,20 +7,20 @@ SnapUndo, newCanvas, ReplayControls, copy*/ SpriteMorph.prototype.categories = - [ - 'motion', - 'control', - 'looks', - 'sensing', - 'sound', - 'operators', - 'pen', - 'variables', - 'network', - 'custom', - 'lists', - 'other' - ]; +[ + 'motion', + 'control', + 'looks', + 'sensing', + 'sound', + 'operators', + 'pen', + 'variables', + 'network', + 'custom', + 'lists', + 'other' +]; SpriteMorph.prototype.blockColor.network = new Color(217, 77, 17); SpriteMorph.prototype.blockColor.custom = new Color(120, 120, 120); @@ -55,19 +55,19 @@ SpriteMorph.prototype.freshPalette = function (category) { control: ['doWarp'], variables: - [ - 'doDeclareVariables', - 'reportNewList', - 'reportCONS', - 'reportListItem', - 'reportCDR', - 'reportListLength', - 'reportListContainsItem', - 'doAddToList', - 'doDeleteFromList', - 'doInsertInList', - 'doReplaceInList' - ] + [ + 'doDeclareVariables', + 'reportNewList', + 'reportCONS', + 'reportListItem', + 'reportCDR', + 'reportListLength', + 'reportListContainsItem', + 'doAddToList', + 'doDeleteFromList', + 'doInsertInList', + 'doReplaceInList' + ] }; function hasHiddenPrimitives() { @@ -523,7 +523,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('comeToFront')); blocks.push(block('goBack')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -559,7 +559,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(watcherToggle('getTempo')); blocks.push(block('getTempo')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -618,7 +618,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('doReport')); blocks.push('-'); - /* + /* // old STOP variants, migrated to a newer version, now redundant blocks.push(block('doStopBlock')); blocks.push(block('doStop')); @@ -631,7 +631,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('fork')); blocks.push(block('evaluate')); blocks.push('-'); - /* + /* // list variants commented out for now (redundant) blocks.push(block('doRunWithInputList')); blocks.push(block('forkWithInputList')); @@ -740,7 +740,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportStageHeight')); blocks.push(block('reportStageWidth')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { @@ -800,7 +800,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('reportJSFunction')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -878,14 +878,14 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('doHideVar')); blocks.push(block('doDeclareVariables')); - // inheritance: + // inheritance: if (StageMorph.prototype.enableInheritance) { blocks.push('-'); blocks.push(block('doDeleteAttr')); } - /////////////////////////////// + /////////////////////////////// blocks.push('='); @@ -903,7 +903,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('doInsertInList')); blocks.push(block('doReplaceInList')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -920,7 +920,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('doShowTable')); } - ///////////////////////////////// + ///////////////////////////////// blocks.push('='); @@ -1016,7 +1016,9 @@ SpriteMorph.prototype.deleteMessageType = function(name) { if (ide && ide.currentTab === 'room') { ide.spriteBar.tabBar.tabTo('room'); } - } catch(e) {} + } catch(e) { + //do nothing + } ide.flushBlocksCache(cat); // b/c of inheritance ide.refreshPalette(); @@ -1055,7 +1057,9 @@ StageMorph.prototype.addMessageType = function (messageType) { if (ide && ide.currentTab === 'room') { ide.spriteBar.tabBar.tabTo('room'); } - } catch(e) {} + } catch(e) { + // do nothing + } }; StageMorph.prototype.processKeyEvent = function (event, action) { @@ -1217,7 +1221,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('show')); blocks.push(block('hide')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -1253,7 +1257,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(watcherToggle('getTempo')); blocks.push(block('getTempo')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -1350,7 +1354,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('doReport')); blocks.push('-'); - /* + /* // old STOP variants, migrated to a newer version, now redundant blocks.push(block('doStopBlock')); blocks.push(block('doStop')); @@ -1363,7 +1367,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('fork')); blocks.push(block('evaluate')); blocks.push('-'); - /* + /* // list variants commented out for now (redundant) blocks.push(block('doRunWithInputList')); blocks.push(block('forkWithInputList')); @@ -1411,7 +1415,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportStageHeight')); blocks.push(block('reportStageWidth')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { @@ -1473,7 +1477,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('-'); blocks.push(block('reportJSFunction')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -1559,7 +1563,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('doInsertInList')); blocks.push(block('doReplaceInList')); - // for debugging: /////////////// + // for debugging: /////////////// if (this.world().isDevMode) { blocks.push('-'); @@ -1576,7 +1580,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('doShowTable')); } - ///////////////////////////////// + ///////////////////////////////// blocks.push('='); @@ -1653,7 +1657,7 @@ StageMorph.prototype.thumbnail = function (extentPoint, excludedSprite) { (extentPoint.x / src.width), (extentPoint.y / src.height) ), - // Netsblox addition: start + // Netsblox addition: start trg, ctx, fb, @@ -1703,7 +1707,7 @@ SpriteMorph.prototype.thumbnail = function (extentPoint) { (extentPoint.x / src.width), (extentPoint.y / src.height) ), - // Netsblox addition: start + // Netsblox addition: start xOffset, yOffset, trg, diff --git a/src/client/room.js b/src/client/room.js index f3dde273..74cc024b 100644 --- a/src/client/room.js +++ b/src/client/room.js @@ -1274,8 +1274,8 @@ UserDialogMorph.prototype.fixLayout = function () { )); inputField.setWidth( - this.body.width() - this.padding * 6 - ); + this.body.width() - this.padding * 6 + ); inputField.setLeft(this.body.left() + this.padding * 3); inputField.drawNew(); @@ -1342,7 +1342,7 @@ UserDialogMorph.prototype.buildFilterField = function () { myself.userList.filter(function (username) { return username.toLowerCase().indexOf(text.toLowerCase()) > -1; }); - // Netsblox addition: end + // Netsblox addition: end if (myself.listField.elements.length === 0) { myself.listField.elements.push('(no matches)'); @@ -1397,9 +1397,9 @@ CollaboratorDialogMorph.prototype.buildContents = function() { this.listField = new ListMorph( this.userList, this.userList.length > 0 ? - function (element) { - return element.username || element; - } : null, + function (element) { + return element.username || element; + } : null, [ // format: display shared project names bold [ 'bold', diff --git a/src/client/store.js b/src/client/store.js index 98406158..f1319c1a 100644 --- a/src/client/store.js +++ b/src/client/store.js @@ -38,15 +38,15 @@ SnapSerializer.prototype.loadValue = function (model) { function record() { if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'id' - )) { + model.attributes, + 'id' + )) { myself.objects[model.attributes.id] = v; } if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'mediaID' - )) { + model.attributes, + 'mediaID' + )) { myself.mediaDict[model.attributes.mediaID] = v; } } @@ -56,9 +56,9 @@ SnapSerializer.prototype.loadValue = function (model) { return this.objects[model.attributes.id]; } if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'mediaID' - )) { + model.attributes, + 'mediaID' + )) { return this.mediaDict[model.attributes.mediaID]; } if (Object.prototype.hasOwnProperty.call(model.attributes, 'actionID')) { @@ -219,27 +219,27 @@ SnapSerializer.prototype.loadValue = function (model) { case 'costume': center = new Point(); if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'center-x' - )) { + model.attributes, + 'center-x' + )) { center.x = parseFloat(model.attributes['center-x']); } if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'center-y' - )) { + model.attributes, + 'center-y' + )) { center.y = parseFloat(model.attributes['center-y']); } if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'name' - )) { + model.attributes, + 'name' + )) { name = model.attributes.name; } if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'image' - )) { + model.attributes, + 'image' + )) { image = new Image(); if (model.attributes.image.indexOf('data:image/svg+xml') === 0 && !MorphicPreferences.rasterizeSVGs) { @@ -290,9 +290,9 @@ SnapSerializer.prototype.loadValue = function (model) { audio.src = model.attributes.sound; v = new Sound(audio, model.attributes.name); if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'mediaID' - )) { + model.attributes, + 'mediaID' + )) { myself.mediaDict[model.attributes.mediaID] = v; } v.id = model.attributes.collabId; @@ -362,9 +362,9 @@ NetsBloxSerializer.prototype.loadBlock = function (model, isReporter) { var block, info, inputs, isGlobal, rm, receiver; if (model.tag === 'block') { if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'var' - )) { + model.attributes, + 'var' + )) { block = SpriteMorph.prototype.variableBlock( model.attributes['var'] ); @@ -597,9 +597,9 @@ NetsBloxSerializer.prototype.rawLoadProjectModel = function (xmlNode) { } project.stage = new StageMorph(project.globalVariables); if (Object.prototype.hasOwnProperty.call( - model.stage.attributes, - 'id' - )) { + model.stage.attributes, + 'id' + )) { this.objects[model.stage.attributes.id] = project.stage; } if (model.stage.attributes.name) { @@ -753,9 +753,9 @@ NetsBloxSerializer.prototype.rawLoadProjectModel = function (xmlNode) { ) && (model.attributes.hidden !== 'false'); if (Object.prototype.hasOwnProperty.call( - model.attributes, - 'var' - )) { + model.attributes, + 'var' + )) { watcher = new WatcherMorph( model.attributes['var'], color, @@ -898,14 +898,14 @@ StageMorph.prototype.toXML = function (serializer) { serializer.store(this.scripts), serializer.store(this.children), Object.keys(StageMorph.prototype.hiddenPrimitives).reduce( - function (a, b) {return a + ' ' + b; }, - '' - ), + function (a, b) {return a + ' ' + b; }, + '' + ), code('codeHeaders'), code('codeMappings'), serializer.store(this.globalBlocks), (ide && ide.globalVariables) ? - serializer.store(ide.globalVariables) : '', + serializer.store(ide.globalVariables) : '', serializer.isSavingHistory ? serializer.historyXML(this.id): '', serializer.isSavingHistory ? serializer.replayHistory() : '' ); diff --git a/src/common/sha512.js b/src/common/sha512.js index 2013d2f8..f753fca2 100644 --- a/src/common/sha512.js +++ b/src/common/sha512.js @@ -1,3 +1,4 @@ +/* eslint-disable */ /* sha512.js diff --git a/src/server/rooms/netsblox-socket.js b/src/server/rooms/netsblox-socket.js index 036712a8..ef018f73 100644 --- a/src/server/rooms/netsblox-socket.js +++ b/src/server/rooms/netsblox-socket.js @@ -317,7 +317,7 @@ class NetsBloxSocket { } sendMessageTo (msg, dstId) { - dstId = dstId + ""; // make sure dstId is string + dstId = dstId + ''; // make sure dstId is string dstId = dstId.replace(/^\s*/, '').replace(/\s*$/, ''); msg.dstId = dstId; if (dstId === 'others in room' || dstId === Constants.EVERYONE || diff --git a/src/server/routes/middleware.js b/src/server/routes/middleware.js index 7791094a..5fa8d965 100644 --- a/src/server/routes/middleware.js +++ b/src/server/routes/middleware.js @@ -35,7 +35,7 @@ var tryLogIn = function(req, res, cb, skipRefresh) { req.session = req.session || new Session(res); if (cookie) { // verify the cookie is valid - logger.trace(`validating cookie`); + logger.trace('validating cookie'); jwt.verify(cookie, sessionSecret, (err, token) => { if (err) { logger.error(`Error verifying jwt: ${err}`); @@ -80,7 +80,7 @@ var saveLogin = function(res, user, remember) { if (typeof remember === 'boolean') { cookie.remember = remember; } - refreshCookie(res, cookie); + refreshCookie(res, cookie); }; var refreshCookie = function(res, cookie) { diff --git a/src/server/routes/projects.js b/src/server/routes/projects.js index e298ff8c..ab3b21fb 100644 --- a/src/server/routes/projects.js +++ b/src/server/routes/projects.js @@ -288,7 +288,7 @@ module.exports = [ const previews = projects.map(getPreview); info(`Projects for ${username} are ${JSON.stringify( previews.map(preview => preview.ProjectName) - )}` + )}` ); if (req.query.format === 'json') { diff --git a/src/server/routes/rooms.js b/src/server/routes/rooms.js index 8e018989..749b2a5f 100644 --- a/src/server/routes/rooms.js +++ b/src/server/routes/rooms.js @@ -165,7 +165,7 @@ module.exports = [ }; socket.send(msg); } - ); + ); res.send('ok'); } }, @@ -211,8 +211,8 @@ module.exports = [ if (response) { return Q(acceptInvitation(invite, socketId)) - .then(project => res.status(200).send(project)) - .fail(err => res.status(500).send(`ERROR: ${err}`)); + .then(project => res.status(200).send(project)) + .fail(err => res.status(500).send(`ERROR: ${err}`)); } else { res.sendStatus(200); } @@ -366,7 +366,7 @@ module.exports = [ }; socket.send(msg); } - ); + ); res.send('ok'); } }, diff --git a/src/server/routes/users.js b/src/server/routes/users.js index c3579ef1..35c98605 100644 --- a/src/server/routes/users.js +++ b/src/server/routes/users.js @@ -36,7 +36,7 @@ module.exports = [ Method: 'post', Note: '', Handler: function(req, res) { - log(`received logout request!`); + log('received logout request!'); middleware.tryLogIn(req, res, err => { if (err) { return res.status(400).send(err); @@ -81,8 +81,8 @@ module.exports = [ } } ] -.map(function(api) { + .map(function(api) { // Set the URL to be the service name - api.URL = api.Service; - return api; -}); + api.URL = api.Service; + return api; + }); diff --git a/src/server/rpc/procedures/battleship/battleship.js b/src/server/rpc/procedures/battleship/battleship.js index f358f660..009b110a 100644 --- a/src/server/rpc/procedures/battleship/battleship.js +++ b/src/server/rpc/procedures/battleship/battleship.js @@ -39,11 +39,11 @@ Battleship.prototype.start = function() { board; if (this._state._STATE !== BattleshipConstants.PLACING) { - return `Game has already started!`; + return 'Game has already started!'; } if (!roles.length) { - return `Waiting on everyone! Place some ships!`; + return 'Waiting on everyone! Place some ships!'; } for (var i = roles.length; i--;) { @@ -73,7 +73,7 @@ Battleship.prototype.placeShip = function(ship, row, column, facing) { column--; if (this._state._STATE !== BattleshipConstants.PLACING) { - return `Cannot move ships after game has started`; + return 'Cannot move ships after game has started'; } if (!DIRS[facing]) { diff --git a/src/server/rpc/procedures/eclipse-2017/stations.js b/src/server/rpc/procedures/eclipse-2017/stations.js index a9171534..3c480a9d 100644 --- a/src/server/rpc/procedures/eclipse-2017/stations.js +++ b/src/server/rpc/procedures/eclipse-2017/stations.js @@ -37,10 +37,10 @@ function availableStations(maxDistance, maxReadingMedian){ if (!maxReadingMedian) maxReadingMedian = Infinity; let query = {distance: {$lte: maxDistance}, readingMedian: {$ne: null, $lte: maxReadingMedian}}; return getStationsCol().find(query).toArray() - .then(stations => { - logger.info(`found ${stations.length} stations for query ${JSON.stringify(query)} `); - return stations; - }); + .then(stations => { + logger.info(`found ${stations.length} stations for query ${JSON.stringify(query)} `); + return stations; + }); } @@ -57,14 +57,6 @@ function nearbyStations(lat, lon, maxDistance){ }); } // end of nearbyStations -function dynamicStations(){ - const numSections = 160; - const perSection = 1; - return selectSectionBased(numSections, perSection).then(stations => { - return stations; - }); -} - // need a way to make sure that the whole path is covered. // divide the path into sections (using min max lon + distance should be fine) // best station finder for a given section diff --git a/src/server/rpc/procedures/geolocation/geolocation.js b/src/server/rpc/procedures/geolocation/geolocation.js index 5073e144..ce4e32eb 100644 --- a/src/server/rpc/procedures/geolocation/geolocation.js +++ b/src/server/rpc/procedures/geolocation/geolocation.js @@ -61,17 +61,17 @@ if(!process.env.GOOGLE_GEOCODING_API) { cache.wrap(lat + ', ' + lon + query, cacheCallback => { trace('Geocoding (not cached)', lat, lon); geocoder.reverse({lat, lon}) - .then(function(res) { + .then(function(res) { // only intereseted in the first match - res = queryJson(res[0], query); - if (res === null) return cacheCallback('not found', null); - // send the response to user - return cacheCallback(null, res); - }) - .catch((err) => { - error(err); - return cacheCallback('Error in reverse geocoding', null); - }); + res = queryJson(res[0], query); + if (res === null) return cacheCallback('not found', null); + // send the response to user + return cacheCallback(null, res); + }) + .catch((err) => { + error(err); + return cacheCallback('Error in reverse geocoding', null); + }); }, (err, results) => { if(results){ trace('answering with',results); diff --git a/src/server/rpc/procedures/nasa/nasa.js b/src/server/rpc/procedures/nasa/nasa.js index 4bedbc32..4a024cdf 100644 --- a/src/server/rpc/procedures/nasa/nasa.js +++ b/src/server/rpc/procedures/nasa/nasa.js @@ -2,11 +2,7 @@ 'use strict'; -var debug = require('debug'), - log = debug('netsblox:rpc:nasa:log'), - error = debug('netsblox:rpc:nasa:error'), - trace = debug('netsblox:rpc:nasa:trace'), - request = require('request'), +var request = require('request'), KEY = process.env.NASA_KEY, APOD_URL = 'https://api.nasa.gov/planetary/apod?api_key=' + KEY, MARS_URL = 'http://marsweather.ingenology.com/v1/latest/'; diff --git a/src/server/rpc/procedures/simple-hangman/simple-hangman.js b/src/server/rpc/procedures/simple-hangman/simple-hangman.js index bb668c05..ded9b0cf 100644 --- a/src/server/rpc/procedures/simple-hangman/simple-hangman.js +++ b/src/server/rpc/procedures/simple-hangman/simple-hangman.js @@ -4,22 +4,22 @@ // Word list var words = ['accurate','address', 'afford','alert','analyze','ancestor', -'annual','apparent','appropriate','arena','arrest','ascend','assist','attempt', -'attentive','attractive','awkward','baggage','basic','benefit','blend','blossom', -'burrow','calculate','capable','captivity','carefree','century','chamber', -'circular','coax','column','communicate','competition','complete','concentrate', -'concern','conclude','confuse','congratulate','considerable','content','contribute', -'crafty','create','demonstrate','descend','desire','destructive','develop','disaster', -'disclose','distract','distress','dusk','eager','ease','entertain','entire','entrance', -'envy','essential','extraordinary','flexible','focus','fragile','frantic','frequent', -'frontier','furious','generosity','hail','hardship','heroic','host','humble','Impact', -'increase','indicate','inspire','instant','invisible','jagged','lack','limb','limp', -'manufacture','master','mature','meadow','mistrust','mock','modest','noble','orchard', -'outstanding','peculiar','peer','permit','plead','plentiful','pointless','portion', -'practice','precious','prefer','prepare','proceed','queasy','recent','recognize','reduce', -'release','represent','request','resist','response','reveal','routine','severe','shabby', -'shallow','sole','source','sturdy','surface','survive','terror','threat','tidy','tour', -'tradition','tragic','typical','vacant','valiant','variety','vast','venture','weary']; + 'annual','apparent','appropriate','arena','arrest','ascend','assist','attempt', + 'attentive','attractive','awkward','baggage','basic','benefit','blend','blossom', + 'burrow','calculate','capable','captivity','carefree','century','chamber', + 'circular','coax','column','communicate','competition','complete','concentrate', + 'concern','conclude','confuse','congratulate','considerable','content','contribute', + 'crafty','create','demonstrate','descend','desire','destructive','develop','disaster', + 'disclose','distract','distress','dusk','eager','ease','entertain','entire','entrance', + 'envy','essential','extraordinary','flexible','focus','fragile','frantic','frequent', + 'frontier','furious','generosity','hail','hardship','heroic','host','humble','Impact', + 'increase','indicate','inspire','instant','invisible','jagged','lack','limb','limp', + 'manufacture','master','mature','meadow','mistrust','mock','modest','noble','orchard', + 'outstanding','peculiar','peer','permit','plead','plentiful','pointless','portion', + 'practice','precious','prefer','prepare','proceed','queasy','recent','recognize','reduce', + 'release','represent','request','resist','response','reveal','routine','severe','shabby', + 'shallow','sole','source','sturdy','surface','survive','terror','threat','tidy','tour', + 'tradition','tragic','typical','vacant','valiant','variety','vast','venture','weary']; var debug = require('debug'), trace = debug('netsblox:rpc:simple-hangman:trace'); diff --git a/src/server/rpc/procedures/thing-speak/thing-speak.js b/src/server/rpc/procedures/thing-speak/thing-speak.js index faf2354e..4147b103 100644 --- a/src/server/rpc/procedures/thing-speak/thing-speak.js +++ b/src/server/rpc/procedures/thing-speak/thing-speak.js @@ -142,20 +142,20 @@ thingspeakIoT.channelDetails = function(id) { return this._requestData({queryString: id + '.json?'}).then( data => { let details = detailParser(data); return this._requestData({queryString: id + '/feeds.json?results=10'}) - .then( resp => { - details.updated_at = new Date(resp.channel.updated_at); - details.total_entries = resp.channel.last_entry_id; - details.fields = []; - for(var prop in resp.channel) { - if (resp.channel.hasOwnProperty(prop) && prop.match(/field\d/)) { - let match = prop.match(/field\d/)[0]; - details.fields.push(resp.channel[match]); + .then( resp => { + details.updated_at = new Date(resp.channel.updated_at); + details.total_entries = resp.channel.last_entry_id; + details.fields = []; + for(var prop in resp.channel) { + if (resp.channel.hasOwnProperty(prop) && prop.match(/field\d/)) { + let match = prop.match(/field\d/)[0]; + details.fields.push(resp.channel[match]); + } } - } - details.feeds = feedParser(resp); - this._logger.info(`channel ${id} details`, details); - return rpcUtils.jsonToSnapList(details); - }); + details.feeds = feedParser(resp); + this._logger.info(`channel ${id} details`, details); + return rpcUtils.jsonToSnapList(details); + }); }); }; diff --git a/src/server/rpc/procedures/twenty-questions/twenty-questions.js b/src/server/rpc/procedures/twenty-questions/twenty-questions.js index 3b0cb03e..2724398e 100644 --- a/src/server/rpc/procedures/twenty-questions/twenty-questions.js +++ b/src/server/rpc/procedures/twenty-questions/twenty-questions.js @@ -2,11 +2,7 @@ 'use strict'; -var debug = require('debug'), - log = debug('netsblox:rpc:twenty-questions:log'), - error = debug('netsblox:rpc:twenty-questions:error'), - trace = debug('netsblox:rpc:twenty-questions:trace'), - Constants = require('../../../../common/constants'); +var Constants = require('../../../../common/constants'); let TwentyQuestions = function () { this._state = {}; @@ -78,21 +74,21 @@ TwentyQuestions.prototype.guess = function(guess) { // guesses are up! guesser loses... if (this._state.guessCount === 20) { this.socket._room.sockets() - .forEach(socket => { - let msg = msgSocket; - msg.msgType = 'EndGame'; - msg.content.GuesserWin = false; - socket.send(msg); - }); + .forEach(socket => { + let msg = msgSocket; + msg.msgType = 'EndGame'; + msg.content.GuesserWin = false; + socket.send(msg); + }); // wait for answerer to answer the question } else { this.socket._room.sockets() - .forEach(socket => { - let msg = msgSocket; - msg.msgType = 'EndGuesserTurn'; - msg.content.guess = guess; - socket.send(msg); - }); + .forEach(socket => { + let msg = msgSocket; + msg.msgType = 'EndGuesserTurn'; + msg.content.guess = guess; + socket.send(msg); + }); } return correct; } diff --git a/src/server/rpc/procedures/twitter/twitter.js b/src/server/rpc/procedures/twitter/twitter.js index b330c986..e2da4409 100644 --- a/src/server/rpc/procedures/twitter/twitter.js +++ b/src/server/rpc/procedures/twitter/twitter.js @@ -3,7 +3,6 @@ 'use strict'; var debug = require('debug'), - log = debug('netsblox:rpc:twitter:log'), error = debug('netsblox:rpc:twitter:error'), trace = debug('netsblox:rpc:twitter:trace'), request = require('request'), diff --git a/src/server/rpc/procedures/utils/index.js b/src/server/rpc/procedures/utils/index.js index 336626ce..0b5ab248 100644 --- a/src/server/rpc/procedures/utils/index.js +++ b/src/server/rpc/procedures/utils/index.js @@ -50,7 +50,7 @@ const encodeQueryData = tuple => { for (let d in tuple) ret.push(encodeURIComponent(d) + '=' + encodeURIComponent(tuple[d])); return ret.join('&'); -} +}; module.exports = { sendImageBuffer, diff --git a/src/server/server-utils.js b/src/server/server-utils.js index 8e7c8150..44afa234 100644 --- a/src/server/server-utils.js +++ b/src/server/server-utils.js @@ -194,10 +194,10 @@ SnapXml.format = function (string) { // value = values[(isNaN(index) ? (i += 1) : index) + 1]; return spec === '@' ? - SnapXml.escape(value) - : spec === '$' ? - SnapXml.escape(value, true) - : value; + SnapXml.escape(value) + : spec === '$' ? + SnapXml.escape(value, true) + : value; }); }; diff --git a/src/server/storage/projects.js b/src/server/storage/projects.js index da8aab85..a9c2f949 100644 --- a/src/server/storage/projects.js +++ b/src/server/storage/projects.js @@ -12,13 +12,13 @@ blob.store(content.SourceCode), blob.store(content.Media) ]) - .then(hashes => { - const [srcHash, mediaHash] = hashes; + .then(hashes => { + const [srcHash, mediaHash] = hashes; - content.SourceCode = srcHash; - content.Media = mediaHash; - return content; - }); + content.SourceCode = srcHash; + content.Media = mediaHash; + return content; + }); }; const loadRoleContent = function(role) { @@ -26,12 +26,12 @@ blob.get(role.SourceCode), blob.get(role.Media) ]) - .then(data => { - const [code, media] = data; - role.SourceCode = code; - role.Media = media; - return role; - }); + .then(data => { + const [code, media] = data; + role.SourceCode = code; + role.Media = media; + return role; + }); }; const clean = function(project, logger) { diff --git a/src/server/storage/storage.js b/src/server/storage/storage.js index b43c00aa..f19d2aa8 100644 --- a/src/server/storage/storage.js +++ b/src/server/storage/storage.js @@ -35,6 +35,7 @@ Storage.prototype.connect = function(mongoURI) { return db; }) .catch(err => { + /* eslint-disable no-console */ console.error(`Could not connect to mongodb at ${mongoURI}.`); console.error('To connect to a different mongo instance, set MONGO_URI to the mongo uri and try again:'); console.error(''); @@ -44,6 +45,7 @@ Storage.prototype.connect = function(mongoURI) { console.error(''); console.error(' MONGO_URI=mongodb://some.ip.address:27017/ ./bin/netsblox start'); console.error(''); + /* eslint-enable no-console */ throw err; }); }; diff --git a/src/server/utils.js b/src/server/utils.js index ceed8e14..27280cfd 100644 --- a/src/server/utils.js +++ b/src/server/utils.js @@ -4,7 +4,7 @@ // "not") 'use strict'; -var inherit = function(child, parents) { +var inherit = function(child/*, parents*/) { for (var i = 1; i < arguments.length; i++) { for (var key in arguments[i]) { child[key] = arguments[i][key]; diff --git a/src/server/vantage/vantage.js b/src/server/vantage/vantage.js index 850eb8b9..db308d3b 100644 --- a/src/server/vantage/vantage.js +++ b/src/server/vantage/vantage.js @@ -6,22 +6,12 @@ var vantage = require('vantage')(), chalk = require('chalk'), repl = require('vantage-repl'), Query = require('../../common/data-query'), - banner, CONNECTED_STATE = [ 'CONNECTING', 'OPEN', 'CLOSING', 'CLOSED' ], RoomManager = require('../rooms/room-manager'), NO_USER_LABEL = ''; -// Set the banner -banner = ['\n'+ - '#####################################################', - '# #', - '# NetsBlox Server #', - '# #', - '#####################################################'] - .join('\n'); - var NetsBloxVantage = function(server) { this.initRoomManagement(server); @@ -94,7 +84,7 @@ var NetsBloxVantage = function(server) { } cb(); }) - .catch(err => cb(err)); + .catch(err => cb(err)); } }); @@ -202,16 +192,15 @@ NetsBloxVantage.checkSocket = function(args, nbSocket) { NetsBloxVantage.prettyPrintGroup = function(group) { var text = group.name+':\n'+ group.groups - .map(function(group) { - return ' '+group.join(' '); - }) - .join('\n'); + .map(function(group) { + return ' '+group.join(' '); + }) + .join('\n'); return text; }; NetsBloxVantage.prototype.start = function(port) { vantage - .banner(banner) .delimiter(chalk.white('netsblox~$')) .listen(port || 1234) .use(repl) diff --git a/test/client/serialization.spec.js b/test/client/serialization.spec.js index 04b16f34..5edbe918 100644 --- a/test/client/serialization.spec.js +++ b/test/client/serialization.spec.js @@ -5,8 +5,8 @@ describe('serialization', function() { const libPath = path.join(__dirname, 'assets'); fs.readdirSync(libPath) - .filter(file => path.extname(file) === '.xml') - .map(file => [file, fs.readFileSync(path.join(libPath, file), 'utf8')]) - .forEach(pair => it(`should parse ${pair[0]}`, utils.canLoadXml.bind(null, pair[1]))); + .filter(file => path.extname(file) === '.xml') + .map(file => [file, fs.readFileSync(path.join(libPath, file), 'utf8')]) + .forEach(pair => it(`should parse ${pair[0]}`, utils.canLoadXml.bind(null, pair[1]))); }); diff --git a/test/client/services.spec.js b/test/client/services.spec.js index 83baffd1..062d836d 100644 --- a/test/client/services.spec.js +++ b/test/client/services.spec.js @@ -1,4 +1,4 @@ -/* globals expect, driver, MessageCreatorMorph, PushButtonMorph, NetsProcess*/ +/* globals expect, driver, NetsProcess, List*/ describe('services', function() { diff --git a/test/server/rooms/active-room.spec.js b/test/server/rooms/active-room.spec.js index 7799db8d..00d959c5 100644 --- a/test/server/rooms/active-room.spec.js +++ b/test/server/rooms/active-room.spec.js @@ -357,8 +357,8 @@ describe('active-room', function() { afterEach(function(done) { project.destroy() - .then(() => done()) - .catch(done); + .then(() => done()) + .catch(done); }); describe('collaborators', function() { @@ -439,7 +439,7 @@ describe('active-room', function() { assert.equal(r.getRoleNames().length, 3); done(); }) - .catch(() => done()); + .catch(() => done()); }); it('should remove a role', function(done) { @@ -447,7 +447,7 @@ describe('active-room', function() { assert.equal(r.getRoleNames().length, 2); done(); }) - .catch(() => done()); + .catch(() => done()); }); it('should rename a role', function(done) { @@ -455,7 +455,7 @@ describe('active-room', function() { assert.equal(r.getRoleNames()[1], 'roleNew'); done(); }) - .catch(() => done()); + .catch(() => done()); }); }); }); diff --git a/test/server/rpc/libs/libs.spec.js b/test/server/rpc/libs/libs.spec.js index b4337e63..453a362b 100644 --- a/test/server/rpc/libs/libs.spec.js +++ b/test/server/rpc/libs/libs.spec.js @@ -7,7 +7,7 @@ describe('rpc libs', function() { // Read in the xml files and test each of them fs.readdirSync(libPath) - .filter(file => path.extname(file) === '.xml') - .map(file => [file, fs.readFileSync(path.join(libPath, file), 'utf8')]) - .forEach(pair => it(`should parse ${pair[0]}`, utils.canLoadXml.bind(null, pair[1]))); + .filter(file => path.extname(file) === '.xml') + .map(file => [file, fs.readFileSync(path.join(libPath, file), 'utf8')]) + .forEach(pair => it(`should parse ${pair[0]}`, utils.canLoadXml.bind(null, pair[1]))); }); diff --git a/test/server/rpc/procedures/eclipse-2017.spec.js b/test/server/rpc/procedures/eclipse-2017.spec.js index c4882c59..a251cbb2 100644 --- a/test/server/rpc/procedures/eclipse-2017.spec.js +++ b/test/server/rpc/procedures/eclipse-2017.spec.js @@ -3,9 +3,7 @@ const Eclipse = require('../../../../src/server/rpc/procedures/eclipse-2017/ecli assert = require('assert'), RPCMock = require('../../../assets/mock-rpc'), utils = require('../../../assets/utils'), - stationUtils = require('../../../../src/server/rpc/procedures/eclipse-2017/stations.js'), rpcStorage = require('../../../../src/server/rpc/storage.js'), - checkStations = require('../../../../utils/rpc/eclipse-2017/checkStations.js'), eclipsePath = require('../../../../utils/rpc/eclipse-2017/eclipsePath.js'), eclipse = new RPCMock(Eclipse); @@ -66,10 +64,10 @@ describe('eclipse utils', function() { describe('database', function(){ - const baseSeconds = new Date("2017-08-23T11:00:30.000Z").getTime(); + const baseSeconds = new Date('2017-08-23T11:00:30.000Z').getTime(); // returns a date relative to a predefined base function rDate(delta){ - mSeconds = baseSeconds + (delta * 1000); + let mSeconds = baseSeconds + (delta * 1000); return new Date(mSeconds); } diff --git a/test/server/rpc/procedures/geolocation.spec.js b/test/server/rpc/procedures/geolocation.spec.js index 2d14c176..edd9a756 100644 --- a/test/server/rpc/procedures/geolocation.spec.js +++ b/test/server/rpc/procedures/geolocation.spec.js @@ -5,9 +5,9 @@ describe('geolocation', function() { geocoding = new RPCMock(Geocoding); utils.verifyRPCInterfaces(geocoding, [ - ['city', ['latitude', 'longitude']], - ['country', ['latitude', 'longitude']], - ['countryCode', ['latitude', 'longitude']], - ['geolocate', ['address']] + ['city', ['latitude', 'longitude']], + ['country', ['latitude', 'longitude']], + ['countryCode', ['latitude', 'longitude']], + ['geolocate', ['address']] ]); }); diff --git a/test/server/rpc/procedures/utils/api-consumer.spec.js b/test/server/rpc/procedures/utils/api-consumer.spec.js index 6eed9577..ed7f807e 100644 --- a/test/server/rpc/procedures/utils/api-consumer.spec.js +++ b/test/server/rpc/procedures/utils/api-consumer.spec.js @@ -47,11 +47,11 @@ describe('ApiConsumer', function(){ cache.set(requestCacheKey, 'response', function(err) { if (err) { throw err; } testRpc._rpc._requestData(queryOpts) - .then(data => { + .then(data => { // requesting for the same key should return 'response' as data - assert.deepEqual(data,'response'); - done(); - }); + assert.deepEqual(data,'response'); + done(); + }); }); }); }); diff --git a/test/server/rpc/procedures/utils/dataset-test.spec.js b/test/server/rpc/procedures/utils/dataset-test.spec.js index ca69b353..c769c1a5 100644 --- a/test/server/rpc/procedures/utils/dataset-test.spec.js +++ b/test/server/rpc/procedures/utils/dataset-test.spec.js @@ -43,7 +43,7 @@ describe('dataset-test', function() { it('should get the right number of layers', function() { assert.equal(test.isMultipleDataset(dataset8), true); - assert.equal(test.isMultipleDataset(dataset1), false) + assert.equal(test.isMultipleDataset(dataset1), false); }); }); }); \ No newline at end of file diff --git a/test/server/server.js b/test/server/server.js index bf8bd054..936f394b 100644 --- a/test/server/server.js +++ b/test/server/server.js @@ -115,7 +115,7 @@ describe('Server Tests', function() { assert.deepEqual(res.body.timeOutputFormat, '%H:%M'); done(); }); - }).catch(done) + }).catch(done); }); describe('login tests', function() { @@ -313,8 +313,8 @@ describe('Server Tests', function() { .expect(200) .end(function() { //api.get('/restart?uuid='+username2) - //.expect(200) - //.end(done); + //.expect(200) + //.end(done); done(); }); }); diff --git a/test/server/storage/projects.js b/test/server/storage/projects.js index 6b6df6d0..5b168420 100644 --- a/test/server/storage/projects.js +++ b/test/server/storage/projects.js @@ -27,7 +27,7 @@ describe('projects', function() { project = room.getProject(); done(); }) - .catch(done); + .catch(done); }); afterEach(function(done) { @@ -100,7 +100,7 @@ describe('projects', function() { assert.equal(role.ProjectName, 'clone1'); done(); }) - .catch(done); + .catch(done); }); it('should remove the project from db on destroy', function(done) { @@ -147,7 +147,7 @@ describe('projects', function() { project = room.getProject(); project.destroy().then(() => done()); }) - .catch(done); + .catch(done); }); [ diff --git a/test/server/storage/users.spec.js b/test/server/storage/users.spec.js index 2c9a1d02..fc75d29c 100644 --- a/test/server/storage/users.spec.js +++ b/test/server/storage/users.spec.js @@ -30,7 +30,7 @@ describe('users', function() { } return user.setGroupId(groupId); }))) - .nodeify(done); + .nodeify(done); }); it('should not include users in groups from outside', function(done) { diff --git a/utils/blob-migration.js b/utils/blob-migration.js index 8a5890e1..3794e13a 100644 --- a/utils/blob-migration.js +++ b/utils/blob-migration.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ // migration for converting projects to be stored in the blob... // Backup the database first! diff --git a/utils/migrations/v0.15.0/migrate.js b/utils/migrations/v0.15.0/migrate.js index be2abca2..146bc2a6 100644 --- a/utils/migrations/v0.15.0/migrate.js +++ b/utils/migrations/v0.15.0/migrate.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ // migration for converting nested projects to their own collection // Backup the database first! diff --git a/utils/publicize-migration.js b/utils/publicize-migration.js index d3724341..ae5ca08c 100644 --- a/utils/publicize-migration.js +++ b/utils/publicize-migration.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ // migration for replicating published projects to a separate collection const MongoClient = require('mongodb').MongoClient; @@ -28,4 +29,4 @@ MongoClient.connect(mongoURI) }); cursor.on('error', err => console.error('ERROR!', err)); - }); \ No newline at end of file + }); diff --git a/utils/rpc/eclipse-2017/checkStations.js b/utils/rpc/eclipse-2017/checkStations.js index 6eac6216..17b26ebc 100644 --- a/utils/rpc/eclipse-2017/checkStations.js +++ b/utils/rpc/eclipse-2017/checkStations.js @@ -203,7 +203,7 @@ storage.connect().then(() => { scheduleUpdates(stationUtils.selected, interval); } }) -.then(() => storage.disconnect()); + .then(() => storage.disconnect()); if (process.argv.length < 3) console.log('pass in a command: seed, updateStats or pullUpdates');