Skip to content

Commit

Permalink
Chore: Format all source code with prettier (#143)
Browse files Browse the repository at this point in the history
- Team voted to switch to 120 line width
  • Loading branch information
tonyjin authored May 25, 2017
1 parent be0d2b0 commit d2a6835
Show file tree
Hide file tree
Showing 136 changed files with 2,566 additions and 2,070 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"lint": "NODE_ENV=dev ./node_modules/.bin/eslint src/lib && ./node_modules/.bin/stylelint 'src/lib/**/*.scss'",
"precommit": "lint-staged",
"prepush": "yarn run lint",
"prettier": "prettier-eslint \"src/lib/**/*.js\" --single-quote --tab-width 4 --write",
"prettier": "prettier-eslint \"src/lib/**/*.js\" --print-width 120 --single-quote --tab-width 4 --write",
"prod": "BABEL_ENV=production NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --progress --colors --config build/webpack.config.js",
"release": "yarn run clean && yarn run build-rb && yarn run lint && yarn run test && yarn run prod",
"test": "NODE_ENV=test ./node_modules/.bin/karma start build/karma.conf.js",
Expand All @@ -118,7 +118,7 @@
},
"lint-staged": {
"src/lib/**/*.js": [
"prettier-eslint --single-quote --tab-width 4 --write",
"prettier-eslint --print-width 120 --single-quote --tab-width 4 --write",
"git add"
]
}
Expand Down
5 changes: 2 additions & 3 deletions src/lib/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,12 @@ class Browser {
e.stopPropagation();
});


try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {
// no-op
}
supportsWebGL = (gl !== null && gl !== undefined);
supportsWebGL = gl !== null && gl !== undefined;
}

return supportsWebGL;
Expand Down Expand Up @@ -250,7 +249,7 @@ class Browser {
try {
hasFlash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
} catch (exception) {
hasFlash = (typeof global.navigator.mimeTypes['application/x-shockwave-flash'] !== 'undefined');
hasFlash = typeof global.navigator.mimeTypes['application/x-shockwave-flash'] !== 'undefined';
}
return hasFlash;
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/Cache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Cache {

//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
Expand Down
10 changes: 4 additions & 6 deletions src/lib/Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const SHOW_PREVIEW_CONTROLS_CLASS = 'box-show-preview-controls';
const CONTROLS_AUTO_HIDE_TIMEOUT_IN_MILLIS = 1500;

class Controls {

/**
* [constructor]
*
Expand Down Expand Up @@ -99,7 +98,7 @@ class Controls {
*/
mouseenterHandler = () => {
this.blockHiding = true;
}
};

/**
* Mouse leave handler
Expand All @@ -109,7 +108,7 @@ class Controls {
*/
mouseleaveHandler = () => {
this.blockHiding = false;
}
};

/**
* Handles all focusin events for the module.
Expand All @@ -122,7 +121,7 @@ class Controls {
if (this.isPreviewControlButton(event.target)) {
this.containerEl.classList.add(SHOW_PREVIEW_CONTROLS_CLASS);
}
}
};

/**
* Handles all focusout events for the module.
Expand All @@ -135,7 +134,7 @@ class Controls {
if (this.isPreviewControlButton(event.target) && !this.isPreviewControlButton(event.relatedTarget)) {
this.containerEl.classList.remove(SHOW_PREVIEW_CONTROLS_CLASS);
}
}
};

/**
* Adds buttons to controls
Expand Down Expand Up @@ -190,7 +189,6 @@ class Controls {
disable() {
this.controlsEl.classList.add(CLASS_HIDDEN);
}

}

export default Controls;
19 changes: 12 additions & 7 deletions src/lib/Fullscreen.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import EventEmitter from 'events';
import {
CLASS_FULLSCREEN
} from './constants';
import { CLASS_FULLSCREEN } from './constants';

class Fullscreen extends EventEmitter {

/**
* [constructor]
*
Expand All @@ -26,7 +23,12 @@ class Fullscreen extends EventEmitter {
* @return {boolean} Fullscreen supported or not
*/
isSupported() {
return document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled;
return (
document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled
);
}

/**
Expand All @@ -39,7 +41,10 @@ class Fullscreen extends EventEmitter {
isFullscreen(element) {
let fullscreen;
if (this.isSupported()) {
fullscreen = !!(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement);
fullscreen = !!(document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement);
} else {
fullscreen = element instanceof HTMLElement && element.classList.contains(CLASS_FULLSCREEN);
}
Expand Down Expand Up @@ -69,7 +74,7 @@ class Fullscreen extends EventEmitter {
} else {
this.emit('exit');
}
}
};

/**
* Toggles fullscreen mode
Expand Down
2 changes: 0 additions & 2 deletions src/lib/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const CLIENT_VERSION = __VERSION__;
/* eslint-enable no-undef */

class Logger {

/**
* [constructor]
*
Expand Down Expand Up @@ -128,7 +127,6 @@ class Logger {
this.log.time.rendering = this.log.time.total - this.log.time.conversion;
return this.log;
}

}

export default Logger;
5 changes: 2 additions & 3 deletions src/lib/Notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { CLASS_HIDDEN } from './constants';
const HIDE_TIMEOUT_MS = 5000; // 5s

class Notification {

/**
* [constructor]
*
* @param {HTMLElement} containerEl - Container element
* @return {Notification} Notification
*/
constructor(containerEl) {
const uniqueLabel = `notification_${(new Date()).getTime()}_label`;
const uniqueLabel = `notification_${new Date().getTime()}_label`;

this.notificationEl = document.createElement('div');
this.notificationEl.className = 'bp-notification bp-is-hidden';
Expand Down Expand Up @@ -83,7 +82,7 @@ class Notification {
if (event.target === this.buttonEl) {
this.hide();
}
}
};
}

export default Notification;
15 changes: 5 additions & 10 deletions src/lib/Popup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { CLASS_HIDDEN } from './constants';
import {
ICON_CLOSE
} from './icons/icons';
import {
decodeKeydown
} from './util';
import { ICON_CLOSE } from './icons/icons';
import { decodeKeydown } from './util';

class Popup {

/**
* [constructor]
*
Expand All @@ -16,7 +11,7 @@ class Popup {
*/
constructor(containerEl) {
this.containerEl = containerEl;
const uniqueLabel = `popup_${(new Date()).getTime()}_label`;
const uniqueLabel = `popup_${new Date().getTime()}_label`;

this.popupEl = document.createElement('div');
this.popupEl.className = 'bp-modal-dialog bp-is-hidden';
Expand Down Expand Up @@ -185,7 +180,7 @@ class Popup {
this.hide();
}
}
}
};

/**
* Keydown handler for popup
Expand All @@ -204,7 +199,7 @@ class Popup {
return false;
}
return true;
}
};
}

export default Popup;
Loading

0 comments on commit d2a6835

Please sign in to comment.