Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Mar 1, 2015
1 parent 5d2826f commit 0489848
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
20 changes: 12 additions & 8 deletions modules/backends/HTML5.js
Expand Up @@ -24,6 +24,13 @@ function getElementRect(el) {
return { top: rect.top, left: rect.left, width: rect.width, height: rect.height };
}

function getClientOffset(e) {
return {
x: e.clientX,
y: e.clientY
};
}

function checkIfCurrentDragTargetRectChanged() {
if (!_dragTargetRectDidChange) {
var currentRect = getElementRect(_currentDragTarget);
Expand Down Expand Up @@ -69,7 +76,7 @@ function handleTopDragEnter(e) {
function handleTopDragOver(e) {
preventDefaultNativeDropAction(e);

var offsetFromClient = HTML5.getOffsetFromClient(_currentComponent, e);
var offsetFromClient = getClientOffset(e);
DragDropActionCreators.drag(offsetFromClient);

// At the top level of event bubbling, use previously set drop effect and reset it.
Expand Down Expand Up @@ -106,7 +113,7 @@ function handleTopDrop(e) {
}

var HTML5 = {
setup(component) {
setup() {
if (typeof window === 'undefined') {
return;
}
Expand All @@ -117,7 +124,7 @@ var HTML5 = {
window.addEventListener('drop', handleTopDrop);
},

teardown(component) {
teardown() {
if (typeof window === 'undefined') {
return;
}
Expand All @@ -143,7 +150,7 @@ var HTML5 = {
window.addEventListener('mousemove', triggerDragEndIfDragSourceWasRemovedFromDOM, true);
},

endDrag(component) {
endDrag() {
_currentDragTarget = null;
_currentComponent = null;
_initialDragTargetRect = null;
Expand Down Expand Up @@ -177,10 +184,7 @@ var HTML5 = {
},

getOffsetFromClient(component, e) {
return {
x: e.clientX,
y: e.clientY
};
return getClientOffset(e);
}
};

Expand Down
2 changes: 0 additions & 2 deletions modules/constants/NativeDragItemTypes.js
@@ -1,7 +1,5 @@
'use strict';

var keyMirror = require('react/lib/keyMirror');

var NativeDragItemTypes = {
FILE: '__NATIVE_FILE__',
URL: '__NATIVE_URL__'
Expand Down
7 changes: 3 additions & 4 deletions modules/utils/createDragDropMixin.js
Expand Up @@ -14,8 +14,7 @@ var DragDropActionCreators = require('../actions/DragDropActionCreators'),
assign = require('react/lib/Object.assign'),
defaults = require('lodash/object/defaults'),
isArray = require('lodash/lang/isArray'),
isObject = require('lodash/lang/isObject'),
noop = require('lodash/utility/noop');
isObject = require('lodash/lang/isObject');

function checkValidType(component, type) {
/*jshint -W122 */
Expand Down Expand Up @@ -242,7 +241,7 @@ function createDragDropMixin(backend) {
});
},

handleDragEnd(type, e) {
handleDragEnd(type) {
backend.endDrag(this);

var { endDrag } = this._dragSources[type],
Expand Down Expand Up @@ -316,7 +315,7 @@ function createDragDropMixin(backend) {

e.preventDefault();

var { over, getDropEffect } = this._dropTargets[this.state.draggedItemType];
var { over } = this._dropTargets[this.state.draggedItemType];
over(this, this.state.draggedItem);

// Don't use `none` because this will prevent browser from firing `dragend`
Expand Down
2 changes: 1 addition & 1 deletion modules/utils/isFileDragDropEvent.js
Expand Up @@ -2,7 +2,7 @@

function isFileDragDropEvent(e) {
if (!e.dataTransfer) {
return false;
return false;
}

var types = Array.prototype.slice.call(e.dataTransfer.types);
Expand Down

0 comments on commit 0489848

Please sign in to comment.