Merge pull request #717 from metamaps/feature/eslint-updates
eslint updates
This commit is contained in:
commit
40453242fa
17 changed files with 403 additions and 397 deletions
|
@ -11,5 +11,8 @@ module.exports = {
|
|||
"promise",
|
||||
"standard",
|
||||
"react"
|
||||
]
|
||||
],
|
||||
"rules": {
|
||||
"yoda": [2, "never", { "exceptRange": true }]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global $, CanvasLoader */
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
@ -43,7 +45,7 @@ const Account = {
|
|||
|
||||
var file = $('#user_image')[0].files[0]
|
||||
|
||||
var reader = new FileReader()
|
||||
var reader = new window.FileReader()
|
||||
|
||||
reader.onload = function (e) {
|
||||
var $canvas = $('<canvas>').attr({
|
||||
|
@ -51,7 +53,7 @@ const Account = {
|
|||
height: 84
|
||||
})
|
||||
var context = $canvas[0].getContext('2d')
|
||||
var imageObj = new Image()
|
||||
var imageObj = new window.Image()
|
||||
|
||||
imageObj.onload = function () {
|
||||
$('.userImageDiv canvas').remove()
|
||||
|
|
|
@ -41,7 +41,7 @@ const Admin = {
|
|||
var self = Admin
|
||||
|
||||
if (self.selectMetacodes.length == 0) {
|
||||
alert('Would you pretty please select at least one metacode for the set?')
|
||||
window.alert('Would you pretty please select at least one metacode for the set?')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ const Control = {
|
|||
return
|
||||
}
|
||||
|
||||
var r = confirm(outdent`
|
||||
var r = window.confirm(outdent`
|
||||
You have ${ntext} and ${etext} selected. Are you sure you want
|
||||
to permanently delete them all? This will remove them from all
|
||||
maps they appear on.`)
|
||||
|
@ -456,7 +456,7 @@ const Control = {
|
|||
var message = nString + ' you can edit updated to ' + metacode.get('name')
|
||||
GlobalUI.notifyUser(message)
|
||||
Visualize.mGraph.plot()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default Control
|
||||
|
|
|
@ -169,15 +169,15 @@ const Create = {
|
|||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: '/topics/autocomplete_topic?term=%QUERY',
|
||||
wildcard: '%QUERY',
|
||||
},
|
||||
wildcard: '%QUERY'
|
||||
}
|
||||
})
|
||||
|
||||
// initialize the autocomplete results for the metacode spinner
|
||||
$('#topic_name').typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 2,
|
||||
minLength: 2
|
||||
},
|
||||
[{
|
||||
name: 'topic_autocomplete',
|
||||
|
@ -186,7 +186,7 @@ const Create = {
|
|||
templates: {
|
||||
suggestion: function (s) {
|
||||
return Hogan.compile($('#topicAutocompleteTemplate').html()).render(s)
|
||||
},
|
||||
}
|
||||
},
|
||||
source: topicBloodhound,
|
||||
}]
|
||||
|
|
|
@ -143,7 +143,7 @@ const Import = {
|
|||
// FALL THROUGH - if we're not sure what to do, pretend
|
||||
// we're on the TOPICS_NEED_HEADERS state and parse some headers
|
||||
|
||||
case STATES.TOPICS_NEED_HEADERS: // eslint-disable-line
|
||||
case STATES.TOPICS_NEED_HEADERS: // eslint-disable-line no-fallthrough
|
||||
if (noblanks.length < 2) {
|
||||
self.abort('Not enough topic headers on line ' + index)
|
||||
state = STATES.ABORT
|
||||
|
@ -207,8 +207,8 @@ const Import = {
|
|||
}
|
||||
break
|
||||
case STATES.ABORT:
|
||||
|
||||
default:
|
||||
// FALL THROUGH
|
||||
default: // eslint-disable-line no-fallthrough
|
||||
self.abort('Invalid state while parsing import data. Check code.')
|
||||
state = STATES.ABORT
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,5 @@
|
|||
/* global $ */
|
||||
|
||||
const CheatSheet = {
|
||||
init: function () {
|
||||
// tab the cheatsheet
|
||||
|
|
|
@ -343,7 +343,7 @@ const InfoBox = {
|
|||
permission: permission
|
||||
})
|
||||
Active.Map.updateMapWrapper()
|
||||
shareable = permission === 'private' ? '' : 'shareable'
|
||||
const shareable = permission === 'private' ? '' : 'shareable'
|
||||
$('.mapPermission').removeClass('commons public private minimize').addClass(permission)
|
||||
$('.mapPermission .permissionSelect').remove()
|
||||
$('.mapInfoBox').removeClass('shareable').addClass(shareable)
|
||||
|
@ -369,7 +369,7 @@ const InfoBox = {
|
|||
GlobalUI.notifyUser('Map eliminated!')
|
||||
}
|
||||
else if (!authorized) {
|
||||
alert("Hey now. We can't just go around willy nilly deleting other people's maps now can we? Run off and find something constructive to do, eh?")
|
||||
window.alert("Hey now. We can't just go around willy nilly deleting other people's maps now can we? Run off and find something constructive to do, eh?")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ const Map = {
|
|||
canEditNow: function () {
|
||||
var confirmString = "You've been granted permission to edit this map. "
|
||||
confirmString += 'Do you want to reload and enable realtime collaboration?'
|
||||
var c = confirm(confirmString)
|
||||
var c = window.confirm(confirmString)
|
||||
if (c) {
|
||||
Router.maps(Active.Map.id)
|
||||
}
|
||||
|
@ -256,10 +256,11 @@ const Map = {
|
|||
canvas.getSize = function () {
|
||||
if (this.size) return this.size
|
||||
var canvas = this.canvas
|
||||
return this.size = {
|
||||
this.size = {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
}
|
||||
return this.size
|
||||
}
|
||||
canvas.scale = function (x, y) {
|
||||
var px = this.scaleOffsetX * x,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* global $ */
|
||||
|
||||
import _ from 'lodash'
|
||||
|
||||
import $jit from '../patched/JIT'
|
||||
|
@ -44,7 +42,7 @@ const Organize = {
|
|||
var column = floor(width / cellWidth)
|
||||
var totalCells = row * column
|
||||
|
||||
if (totalCells)
|
||||
if (totalCells) {
|
||||
Visualize.mGraph.graph.eachNode(function (n) {
|
||||
if (column == numColumns) {
|
||||
column = 0
|
||||
|
@ -56,6 +54,7 @@ const Organize = {
|
|||
n.setPos(newPos, 'end')
|
||||
column += 1
|
||||
})
|
||||
}
|
||||
Visualize.mGraph.animate(JIT.ForceDirected.animateSavedLayout)
|
||||
} else if (layout == 'radial') {
|
||||
var centerX = centerNode.getPos().x
|
||||
|
@ -112,7 +111,7 @@ const Organize = {
|
|||
console.log(lowX, lowY, highX, highY)
|
||||
var newOriginX = (lowX + highX) / 2
|
||||
var newOriginY = (lowY + highY) / 2
|
||||
} else alert('please call function with a valid layout dammit!')
|
||||
} else window.alert('please call function with a valid layout dammit!')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,16 +13,16 @@ const PasteInput = {
|
|||
// intercept dragged files
|
||||
// see http://stackoverflow.com/questions/6756583
|
||||
window.addEventListener("dragover", function(e) {
|
||||
e = e || event;
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
window.addEventListener("drop", function(e) {
|
||||
e = e || event;
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
var coords = Util.pixelsToCoords({ x: e.clientX, y: e.clientY })
|
||||
if (e.dataTransfer.files.length > 0) {
|
||||
var fileReader = new FileReader()
|
||||
var text = fileReader.readAsText(e.dataTransfer.files[0])
|
||||
var fileReader = new window.FileReader()
|
||||
fileReader.readAsText(e.dataTransfer.files[0])
|
||||
fileReader.onload = function(e) {
|
||||
var text = e.currentTarget.result
|
||||
if (text.substring(0,5) === '<?xml') {
|
||||
|
|
|
@ -8,6 +8,7 @@ import GlobalUI from './GlobalUI'
|
|||
import JIT from './JIT'
|
||||
import Map from './Map'
|
||||
import Mapper from './Mapper'
|
||||
import Synapse from './Synapse'
|
||||
import Topic from './Topic'
|
||||
import Util from './Util'
|
||||
import Views from './Views'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Selected = {
|
||||
reset: function () {
|
||||
var self = Metamaps.Selected
|
||||
var self = Selected
|
||||
self.Nodes = []
|
||||
self.Edges = []
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ const Settings = {
|
|||
background: '#18202E',
|
||||
text: '#DDD'
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default Settings
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Metamaps, $ */
|
||||
/* global Metamaps, $, CanvasLoader, Countable, Hogan, embedly */
|
||||
|
||||
import Active from './Active'
|
||||
import GlobalUI from './GlobalUI'
|
||||
|
|
|
@ -40,7 +40,10 @@
|
|||
"babel-eslint": "^6.1.2",
|
||||
"chai": "^3.5.0",
|
||||
"eslint": "^3.5.0",
|
||||
"eslint-config-standard": "^6.2.0",
|
||||
"eslint-plugin-promise": "^2.0.1",
|
||||
"eslint-plugin-react": "^6.3.0",
|
||||
"eslint-plugin-standard": "^2.0.1",
|
||||
"mocha": "^3.0.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
|
Loading…
Reference in a new issue