From ebaae084ae27890274c581b6f4fbe4b305ea034c Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 26 Sep 2016 13:37:42 +0800 Subject: [PATCH] simple eslint fixes --- frontend/src/Metamaps/Create.js | 4 ++-- frontend/src/Metamaps/GlobalUI.js | 2 +- frontend/src/Metamaps/JIT.js | 20 ++++++++------------ frontend/src/Metamaps/Map/InfoBox.js | 6 +++--- frontend/src/Metamaps/Realtime.js | 4 ++-- frontend/src/Metamaps/Views/ChatView.js | 8 +++++++- frontend/src/Metamaps/index.js | 2 +- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/frontend/src/Metamaps/Create.js b/frontend/src/Metamaps/Create.js index 1fc18b87..5d290fcd 100644 --- a/frontend/src/Metamaps/Create.js +++ b/frontend/src/Metamaps/Create.js @@ -1,4 +1,4 @@ -/* global Metamaps, $ */ +/* global Metamaps, $, Hogan, Bloodhound */ import Mouse from './Mouse' import Selected from './Selected' @@ -54,7 +54,7 @@ const Create = { }, updateMetacodeSet: function (set, index, custom) { if (custom && Create.newSelectedMetacodes.length == 0) { - alert('Please select at least one metacode to use!') + window.alert('Please select at least one metacode to use!') return false } diff --git a/frontend/src/Metamaps/GlobalUI.js b/frontend/src/Metamaps/GlobalUI.js index b24b31c7..7af133de 100644 --- a/frontend/src/Metamaps/GlobalUI.js +++ b/frontend/src/Metamaps/GlobalUI.js @@ -1,3 +1,4 @@ +/* global Metamaps, $, Hogan, Bloodhound */ import Active from './Active' import Create from './Create' import Filter from './Filter' @@ -585,7 +586,6 @@ GlobalUI.Search = { if (["topic", "map", "mapper"].indexOf(datum.rtype) !== -1) { self.close(0, true); - var win; if (datum.rtype == "topic") { Router.topics(datum.id); } else if (datum.rtype == "map") { diff --git a/frontend/src/Metamaps/JIT.js b/frontend/src/Metamaps/JIT.js index fa5c894f..ba8bdb8f 100644 --- a/frontend/src/Metamaps/JIT.js +++ b/frontend/src/Metamaps/JIT.js @@ -1,4 +1,4 @@ -/* global Metamaps, $jit */ +/* global Metamaps, $, Image, CanvasLoader */ import _ from 'lodash' @@ -79,7 +79,6 @@ const JIT = { var jitReady = [] var synapsesToRemove = [] - var topic var mapping var node var nodes = {} @@ -183,8 +182,6 @@ const JIT = { if (!synapse) return // this means there are no corresponding synapses for // this edge, don't render it - var directionCat = synapse.get('category') - // label placement on edges if (canvas.denySelected) { var color = Settings.colors.synapses.normal @@ -282,8 +279,8 @@ const JIT = { if (synapseNum > 1) { var ctx = canvas.getCtx() - var x = (pos.x + posChild.x) / 2 - var y = (pos.y + posChild.y) / 2 + const x = (pos.x + posChild.x) / 2 + const y = (pos.y + posChild.y) / 2 drawSynapseCount(ctx, x, y, synapseNum) } } @@ -847,8 +844,8 @@ const JIT = { // set the draw synapse start positions var l = Selected.Nodes.length if (l > 0) { - for (var i = l - 1; i >= 0; i -= 1) { - var n = Selected.Nodes[i] + for (let i = l - 1; i >= 0; i -= 1) { + const n = Selected.Nodes[i] Mouse.synapseStartCoordinates.push({ x: n.pos.getc().x, y: n.pos.getc().y @@ -1541,8 +1538,6 @@ const JIT = { if (adj.getData('alpha') === 0) return; // don't do anything if the edge is filtered - var authorized - e.preventDefault() e.stopPropagation() @@ -1827,10 +1822,11 @@ const JIT = { width = canvas.getSize().width, maxX, minX, maxY, minY, counter = 0 + let nodes if (!denySelected && Selected.Nodes.length > 0) { - var nodes = Selected.Nodes + nodes = Selected.Nodes } else { - var nodes = _.values(Visualize.mGraph.graph.nodes) + nodes = _.values(Visualize.mGraph.graph.nodes) } if (nodes.length > 1) { diff --git a/frontend/src/Metamaps/Map/InfoBox.js b/frontend/src/Metamaps/Map/InfoBox.js index ec5c1405..c36f70c3 100644 --- a/frontend/src/Metamaps/Map/InfoBox.js +++ b/frontend/src/Metamaps/Map/InfoBox.js @@ -1,4 +1,4 @@ -/* global Metamaps, $ */ +/* global Metamaps, $, Hogan, Bloodhound, Countable */ import Active from '../Active' import GlobalUI from '../GlobalUI' @@ -236,7 +236,7 @@ const InfoBox = { Metamaps.Collaborators.add(mapper) var mapperIds = Metamaps.Collaborators.models.map(function (mapper) { return mapper.id }) $.post('/maps/' + Active.Map.id + '/access', { access: mapperIds }) - var name = Metamaps.Collaborators.get(newCollaboratorId).get('name') + var name = Metamaps.Collaborators.get(newCollaboratorId).get('name') GlobalUI.notifyUser(name + ' will be notified by email') self.updateNumbers() } @@ -349,7 +349,7 @@ const InfoBox = { var confirmString = 'Are you sure you want to delete this map? ' confirmString += 'This action is irreversible. It will not delete the topics and synapses on the map.' - var doIt = confirm(confirmString) + var doIt = window.confirm(confirmString) var map = Active.Map var mapper = Active.Mapper var authorized = map.authorizePermissionChange(mapper) diff --git a/frontend/src/Metamaps/Realtime.js b/frontend/src/Metamaps/Realtime.js index 355e73f8..608523c8 100644 --- a/frontend/src/Metamaps/Realtime.js +++ b/frontend/src/Metamaps/Realtime.js @@ -1,4 +1,4 @@ -/* global Metamaps, $ */ +/* global Metamaps, $, SocketIoConnection, SimpleWebRTC */ import _ from 'lodash' @@ -1106,7 +1106,7 @@ const Realtime = { } }, newSynapse: function (data) { - var topic1, topic2, node1, node2, synapse, mapping, cancel + var topic1, topic2, node1, node2, synapse, mapping, cancel, mapper var self = Realtime var socket = self.socket diff --git a/frontend/src/Metamaps/Views/ChatView.js b/frontend/src/Metamaps/Views/ChatView.js index a49aaa4d..473c6f1e 100644 --- a/frontend/src/Metamaps/Views/ChatView.js +++ b/frontend/src/Metamaps/Views/ChatView.js @@ -1,7 +1,13 @@ -/* global $ */ +/* global Metamaps, $, Howl */ + +/* + * Dependencies: + * Metamaps.Erb + */ import Backbone from 'backbone' import Autolinker from 'autolinker' +import _ from 'lodash' // TODO is this line good or bad // Backbone.$ = window.$ diff --git a/frontend/src/Metamaps/index.js b/frontend/src/Metamaps/index.js index 21a3fb8d..db67409b 100644 --- a/frontend/src/Metamaps/index.js +++ b/frontend/src/Metamaps/index.js @@ -1,4 +1,4 @@ -/* global $ */ +/* global Metamaps */ import Account from './Account' import Active from './Active'