auto eslint and add commands for eslint

This commit is contained in:
Devin Howard 2017-01-10 18:11:19 -05:00
parent da94cd0c8b
commit 71bed1a919
9 changed files with 28 additions and 26 deletions

View file

@ -42,14 +42,14 @@ const Cable = {
if (t1.authorizeToShow(m) && t2.authorizeToShow(m) && s.authorizeToShow(m) && !DataModel.Synapses.get(event.synapse.id)) { if (t1.authorizeToShow(m) && t2.authorizeToShow(m) && s.authorizeToShow(m) && !DataModel.Synapses.get(event.synapse.id)) {
// refactor the heck outta this, its adding wicked wait time // refactor the heck outta this, its adding wicked wait time
var topic1, topic2, node1, node2, synapse, mapping, cancel, mapper var topic1, topic2, node1, node2, synapse, mapping, cancel, mapper
function waitThenRenderSynapse() { function waitThenRenderSynapse() {
if (synapse && mapping && mapper) { if (synapse && mapping && mapper) {
topic1 = synapse.getTopic1() topic1 = synapse.getTopic1()
node1 = topic1.get('node') node1 = topic1.get('node')
topic2 = synapse.getTopic2() topic2 = synapse.getTopic2()
node2 = topic2.get('node') node2 = topic2.get('node')
Synapse.renderSynapse(mapping, synapse, node1, node2, false) Synapse.renderSynapse(mapping, synapse, node1, node2, false)
} else if (!cancel) { } else if (!cancel) {
setTimeout(waitThenRenderSynapse, 10) setTimeout(waitThenRenderSynapse, 10)
@ -108,7 +108,7 @@ const Cable = {
if (edge.getData('mappings').length - 1 === 0) { if (edge.getData('mappings').length - 1 === 0) {
Control.hideEdge(edge) Control.hideEdge(edge)
} }
var index = indexOf(edge.getData('synapses'), synapse) var index = indexOf(edge.getData('synapses'), synapse)
edge.getData('mappings').splice(index, 1) edge.getData('mappings').splice(index, 1)
edge.getData('synapses').splice(index, 1) edge.getData('synapses').splice(index, 1)
@ -129,7 +129,7 @@ const Cable = {
if (t.authorizeToShow(m) && !DataModel.Topics.get(event.topic.id)) { if (t.authorizeToShow(m) && !DataModel.Topics.get(event.topic.id)) {
// refactor the heck outta this, its adding wicked wait time // refactor the heck outta this, its adding wicked wait time
var topic, mapping, mapper, cancel var topic, mapping, mapper, cancel
function waitThenRenderTopic() { function waitThenRenderTopic() {
if (topic && mapping && mapper) { if (topic && mapping && mapper) {
Topic.renderTopic(mapping, topic, false, false) Topic.renderTopic(mapping, topic, false, false)
@ -137,7 +137,7 @@ const Cable = {
setTimeout(waitThenRenderTopic, 10) setTimeout(waitThenRenderTopic, 10)
} }
} }
mapper = DataModel.Mappers.get(event.topic.user_id) mapper = DataModel.Mappers.get(event.topic.user_id)
if (mapper === undefined) { if (mapper === undefined) {
Mapper.get(event.topic.user_id, function(m) { Mapper.get(event.topic.user_id, function(m) {

View file

@ -291,18 +291,18 @@ const Create = {
}, },
source: synapseBloodhound source: synapseBloodhound
}, },
{ {
name: 'existing_synapses', name: 'existing_synapses',
limit: 50, limit: 50,
display: function(s) { return s.label }, display: function(s) { return s.label },
templates: { templates: {
suggestion: function(s) { suggestion: function(s) {
return Hogan.compile($('#synapseAutocompleteTemplate').html()).render(s) return Hogan.compile($('#synapseAutocompleteTemplate').html()).render(s)
},
header: '<h3>Existing synapses</h3>'
}, },
source: existingSynapseBloodhound header: '<h3>Existing synapses</h3>'
}] },
source: existingSynapseBloodhound
}]
) )
$('#synapse_desc').keyup(function(e) { $('#synapse_desc').keyup(function(e) {

View file

@ -14,7 +14,7 @@ module.exports = {
SEND_COORDS: 'SEND_COORDS', SEND_COORDS: 'SEND_COORDS',
DRAG_TOPIC: 'DRAG_TOPIC', DRAG_TOPIC: 'DRAG_TOPIC',
/* EVENTS RECEIVABLE FROM NODE SERVER*/ /* EVENTS RECEIVABLE FROM NODE SERVER */
JUNTO_UPDATED: 'JUNTO_UPDATED', JUNTO_UPDATED: 'JUNTO_UPDATED',
INVITED_TO_CALL: 'INVITED_TO_CALL', INVITED_TO_CALL: 'INVITED_TO_CALL',
INVITED_TO_JOIN: 'INVITED_TO_JOIN', INVITED_TO_JOIN: 'INVITED_TO_JOIN',
@ -29,5 +29,5 @@ module.exports = {
NEW_MAPPER: 'NEW_MAPPER', NEW_MAPPER: 'NEW_MAPPER',
LOST_MAPPER: 'LOST_MAPPER', LOST_MAPPER: 'LOST_MAPPER',
TOPIC_DRAGGED: 'TOPIC_DRAGGED', TOPIC_DRAGGED: 'TOPIC_DRAGGED',
PEER_COORDS_UPDATED: 'PEER_COORDS_UPDATED', PEER_COORDS_UPDATED: 'PEER_COORDS_UPDATED'
} }

View file

@ -152,7 +152,7 @@ let Realtime = {
config: { DOUBLE_CLICK_TOLERANCE: 200 } config: { DOUBLE_CLICK_TOLERANCE: 200 }
}) })
self.room.videoAdded(self.handleVideoAdded) self.room.videoAdded(self.handleVideoAdded)
self.startActiveMap() self.startActiveMap()
} // if Active.Mapper } // if Active.Mapper
}, },

View file

@ -210,7 +210,7 @@ export const callInProgress = self => () => {
GlobalUI.notifyUser(notifyText, true) GlobalUI.notifyUser(notifyText, true)
$('#toast button.yes').click(e => self.joinCall()) $('#toast button.yes').click(e => self.joinCall())
$('#toast button.no').click(e => GlobalUI.clearNotify()) $('#toast button.no').click(e => GlobalUI.clearNotify())
ChatView.conversationInProgress() ChatView.conversationInProgress()
} }
export const callStarted = self => () => { export const callStarted = self => () => {

View file

@ -49,7 +49,7 @@ const ChatView = {
$('#' + ChatView.domId).hide() $('#' + ChatView.domId).hide()
}, },
render: () => { render: () => {
if (!Active.Map) return if (!Active.Map) return
const self = ChatView const self = ChatView
self.mapChat = ReactDOM.render(React.createElement(MapChat, { self.mapChat = ReactDOM.render(React.createElement(MapChat, {
conversationLive: self.conversationLive, conversationLive: self.conversationLive,
@ -111,7 +111,7 @@ const ChatView = {
conversationInProgress: participating => { conversationInProgress: participating => {
ChatView.conversationLive = true ChatView.conversationLive = true
ChatView.isParticipating = participating ChatView.isParticipating = participating
ChatView.render() ChatView.render()
}, },
conversationEnded: () => { conversationEnded: () => {
ChatView.conversationLive = false ChatView.conversationLive = false
@ -144,7 +144,7 @@ const ChatView = {
}, },
addMessage: (message, isInitial, wasMe) => { addMessage: (message, isInitial, wasMe) => {
const self = ChatView const self = ChatView
if (!isInitial) self.mapChat.newMessage() if (!isInitial) self.mapChat.newMessage()
if (!wasMe && !isInitial && self.alertSound) self.sound.play('receivechat') if (!wasMe && !isInitial && self.alertSound) self.sound.play('receivechat')
self.messages.add(message) self.messages.add(message)
self.render() self.render()

View file

@ -9,7 +9,7 @@ import { JUNTO_UPDATED } from '../Realtime/events'
const Views = { const Views = {
init: (serverData) => { init: (serverData) => {
$(document).on(JUNTO_UPDATED, () => ExploreMaps.render()) $(document).on(JUNTO_UPDATED, () => ExploreMaps.render())
ChatView.init([serverData['sounds/MM_sounds.mp3'],serverData['sounds/MM_sounds.ogg']]) ChatView.init([serverData['sounds/MM_sounds.mp3'], serverData['sounds/MM_sounds.ogg']])
}, },
ExploreMaps, ExploreMaps,
ChatView, ChatView,

View file

@ -41,7 +41,7 @@ class Header extends Component {
linkClass={activeClass('active')} linkClass={activeClass('active')}
data-router="true" data-router="true"
text="All Maps" text="All Maps"
/> />
<MapLink show={signedIn && explore} <MapLink show={signedIn && explore}
href="/explore/mine" href="/explore/mine"
linkClass={activeClass('my')} linkClass={activeClass('my')}

View file

@ -5,7 +5,9 @@
"scripts": { "scripts": {
"build": "webpack", "build": "webpack",
"build:watch": "webpack --watch", "build:watch": "webpack --watch",
"test": "mocha --compilers js:babel-core/register frontend/test" "test": "mocha --compilers js:babel-core/register frontend/test",
"eslint": "eslint frontend",
"eslint:fix": "eslint --fix frontend"
}, },
"repository": { "repository": {
"type": "git", "type": "git",