Skip to content

Commit

Permalink
Run format
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Frampton authored and Robert-Frampton committed Nov 21, 2017
1 parent 22c3ac1 commit bd6d8d2
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 40 deletions.
9 changes: 7 additions & 2 deletions packages/metal-component/src/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ class Component extends EventEmitter {
attachElement(parentElement, siblingElement) {
const element = this.element;
if (element && (siblingElement || !element.parentNode)) {
const parent = toElement(parentElement) || this.DEFAULT_ELEMENT_PARENT; // eslint-disable-line
const parent =
toElement(parentElement) || this.DEFAULT_ELEMENT_PARENT; // eslint-disable-line
parent.insertBefore(element, toElement(siblingElement));
}
}
Expand Down Expand Up @@ -648,7 +649,11 @@ class Component extends EventEmitter {
this.dataManager_ = getStaticProperty(this.constructor, 'DATA_MANAGER');
this.dataManager_.setUp(
this,
object.mixin({}, this.renderer_.getExtraDataConfig(this), Component.DATA) // eslint-disable-line
object.mixin(
{},
this.renderer_.getExtraDataConfig(this),
Component.DATA
) // eslint-disable-line
);
}

Expand Down
6 changes: 5 additions & 1 deletion packages/metal-component/src/ComponentDataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ class ComponentDataManager {
* @protected
*/
createState_(component, data) {
const state = new State(component.getInitialConfig(), component, component); // eslint-disable-line
const state = new State(
component.getInitialConfig(),
component,
component
); // eslint-disable-line
state.setKeysBlacklist(BLACKLIST);
state.configState(
object.mixin({}, data, State.getStateStatic(component.constructor))
Expand Down
4 changes: 3 additions & 1 deletion packages/metal-component/src/ComponentRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class ComponentRegistry {
const constructorFn = ComponentRegistry.components_[name];
if (!constructorFn) {
console.error(
`There's no constructor registered for the component named ${name}.
`There's no constructor registered for the component named ${
name
}.
Components need to be registered via ComponentRegistry.register.`
);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/metal-component/src/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export function addListenersFromObj(component, events) {
if (info.fn) {
let handle;
if (info.selector) {
handle = component.delegate(eventNames[i], info.selector, info.fn); // eslint-disable-line
handle = component.delegate(
eventNames[i],
info.selector,
info.fn
); // eslint-disable-line
} else {
handle = component.on(eventNames[i], info.fn);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/metal-component/src/sync/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ function getSyncFns_(component) {
const keys = component.getDataManager().getSyncKeys(component);
let canCache = true;
for (let i = 0; i < keys.length; i++) {
const name = `sync${keys[i].charAt(0).toUpperCase()}${keys[i].slice(1)}`;
const name = `sync${keys[i].charAt(0).toUpperCase()}${keys[i].slice(
1
)}`;
const fn = component[name];
if (fn) {
fns[keys[i]] = fn;
Expand Down
11 changes: 9 additions & 2 deletions packages/metal-dom/src/DomEventEmitterProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ class DomEventEmitterProxy extends EventEmitterProxy {
const index = event.indexOf(':', 9);
const eventName = event.substring(9, index);
const selector = event.substring(index + 1);
return delegate(this.originEmitter_, eventName, selector, listener); // eslint-disable-line
return delegate(
this.originEmitter_,
eventName,
selector,
listener
); // eslint-disable-line
} else {
return on(this.originEmitter_, event, listener);
}
Expand Down Expand Up @@ -66,7 +71,9 @@ class DomEventEmitterProxy extends EventEmitterProxy {
* @override
*/
shouldProxyEvent_(event) {
return super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event); // eslint-disable-line
return (
super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event)
); // eslint-disable-line
}
}

Expand Down
21 changes: 17 additions & 4 deletions packages/metal-dom/src/domNamed.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,13 @@ function isAbleToInteractWith_(node, eventName, eventObj) {
return false;
}

const matchesSelector = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'FIELDSET'];
const matchesSelector = [
'BUTTON',
'INPUT',
'SELECT',
'TEXTAREA',
'FIELDSET',
];
if (eventName === 'click' && matchesSelector.indexOf(node.tagName) > -1) {
return !(node.disabled || parent(node, 'fieldset[disabled]'));
}
Expand Down Expand Up @@ -370,7 +376,9 @@ export function hasClass(element, className) {
* @private
*/
function hasClassWithNative_(element, className) {
return className.indexOf(' ') === -1 && element.classList.contains(className);
return (
className.indexOf(' ') === -1 && element.classList.contains(className)
);
}

/**
Expand Down Expand Up @@ -723,7 +731,10 @@ export function toElement(selectorOrElement) {
) {
return selectorOrElement;
} else if (isString(selectorOrElement)) {
if (selectorOrElement[0] === '#' && selectorOrElement.indexOf(' ') === -1) {
if (
selectorOrElement[0] === '#' &&
selectorOrElement.indexOf(' ') === -1
) {
return document.getElementById(selectorOrElement.substr(1));
} else {
return document.querySelector(selectorOrElement);
Expand Down Expand Up @@ -786,7 +797,9 @@ function toggleClassesWithoutNative_(element, classes) {
elementClassName = `${elementClassName}${classes[i]} `;
} else {
const before = elementClassName.substring(0, classIndex);
const after = elementClassName.substring(classIndex + className.length); // eslint-disable-line
const after = elementClassName.substring(
classIndex + className.length
); // eslint-disable-line
elementClassName = `${before} ${after}`;
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/metal-dom/src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ function registerEvents() {
const related = event.relatedTarget;
const target = event.delegateTarget;
// eslint-disable-next-line
if (!related || (related !== target && !contains(target, related))) {
if (
!related ||
(related !== target && !contains(target, related))
) {
event.customType = eventName;
return callback(event);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/metal-dom/src/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ class features {
}
for (let i = 0; i < prefixes.length; i++) {
if (
features.animationElement_.style[prefixes[i] + typeTitleCase] !== // eslint-disable-line
undefined
features.animationElement_.style[
prefixes[i] + typeTitleCase
] !== undefined // eslint-disable-line
) {
return prefixes[i].toLowerCase() + suffixes[i];
}
Expand Down
7 changes: 6 additions & 1 deletion packages/metal-dom/src/globalEval.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ class globalEval {
scripts.item(index),
function() {
if (index < scripts.length - 1) {
globalEval.runScriptsInOrder(scripts, index + 1, defaultFn, appendFn); // eslint-disable-line
globalEval.runScriptsInOrder(
scripts,
index + 1,
defaultFn,
appendFn
); // eslint-disable-line
} else if (defaultFn) {
async.nextTick(defaultFn);
}
Expand Down
12 changes: 9 additions & 3 deletions packages/metal-events/src/EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ class EventEmitter extends Disposable {
*/
getRawListeners_(event) {
const directListeners = toArray(this.events_ && this.events_[event]);
return directListeners.concat(toArray(this.events_ && this.events_['*']));
return directListeners.concat(
toArray(this.events_ && this.events_['*'])
);
}

/**
Expand Down Expand Up @@ -241,7 +243,8 @@ class EventEmitter extends Disposable {
matchesListener_(listenerObj, listener) {
const fn = listenerObj.fn || listenerObj;
return (
fn === listener || (listenerObj.origin && listenerObj.origin === listener) // eslint-disable-line
fn === listener ||
(listenerObj.origin && listenerObj.origin === listener) // eslint-disable-line
);
}

Expand Down Expand Up @@ -285,7 +288,10 @@ class EventEmitter extends Disposable {
* @param {!function()} handler
*/
onListener(handler) {
this.listenerHandlers_ = this.addHandler_(this.listenerHandlers_, handler); // eslint-disable-line
this.listenerHandlers_ = this.addHandler_(
this.listenerHandlers_,
handler
); // eslint-disable-line
}

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/metal-incremental-dom/src/IncrementalDomRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ class IncrementalDomRenderer extends ComponentRenderer.constructor {
return false;
}
if (component.shouldUpdate) {
return component.shouldUpdate(...this.buildShouldUpdateArgs(changes)); // eslint-disable-line
return component.shouldUpdate(
...this.buildShouldUpdateArgs(changes)
); // eslint-disable-line
}
return true;
}
Expand Down
13 changes: 10 additions & 3 deletions packages/metal-incremental-dom/src/html/HTMLParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ var HTMLParser = function(html, handler) {
index = html.indexOf('-->');

if (index >= 0) {
if (handler.comment) handler.comment(html.substring(4, index));
if (handler.comment)
handler.comment(html.substring(4, index));
html = html.substring(index + 3);
chars = false;
}
Expand Down Expand Up @@ -203,7 +204,11 @@ var HTMLParser = function(html, handler) {
// usually add anything they want to spans, and browsers allow it).
// Note: this exception for "span" was added manually (i.e. it's not
// present in the original code).
while (stack.last() && inline[stack.last()] && stack.last() !== 'span') {
while (
stack.last() &&
inline[stack.last()] &&
stack.last() !== 'span'
) {
parseEndTag('', stack.last());
}
}
Expand All @@ -224,7 +229,9 @@ var HTMLParser = function(html, handler) {
? arguments[2]
: arguments[3]
? arguments[3]
: arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
: arguments[4]
? arguments[4]
: fillAttrs[name] ? name : '';

attrs.push({
name: name,
Expand Down
12 changes: 9 additions & 3 deletions packages/metal-incremental-dom/src/render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ function handleRegularCall_(...args) {
config.key = generateKey_(comp, config.key);

if (!getData(comp).rootElementReached) {
const elementClasses = comp.getDataManager().get(comp, 'elementClasses');
const elementClasses = comp
.getDataManager()
.get(comp, 'elementClasses');
if (elementClasses) {
addElementClasses_(elementClasses, config);
}
Expand Down Expand Up @@ -343,7 +345,9 @@ function inheritElementClasses_(parent, config) {
* @private
*/
export function isComponentTag_(tag) {
return isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase()); // eslint-disable-line
return (
isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase())
); // eslint-disable-line
}

/**
Expand Down Expand Up @@ -568,7 +572,9 @@ function resetNodeData_(node) {
*/
function updateContext_(comp, parent) {
const context = comp.context;
const childContext = parent.getChildContext ? parent.getChildContext() : null; // eslint-disable-line
const childContext = parent.getChildContext
? parent.getChildContext()
: null; // eslint-disable-line
object.mixin(context, parent.context, childContext);
comp.context = context;
}
Expand Down
7 changes: 6 additions & 1 deletion packages/metal-jsx/src/JSXDataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ class JSXDataManager extends ComponentDataManager.constructor {
}

const props = this.getManagerData(component).props_;
ComponentDataManager.replaceNonInternal.call(this, component, data, props); // eslint-disable-line
ComponentDataManager.replaceNonInternal.call(
this,
component,
data,
props
); // eslint-disable-line
this.addUnconfiguredProps_(component, props, data);
if (component.propsChanged) {
component.propsChanged(prevProps);
Expand Down
4 changes: 3 additions & 1 deletion packages/metal-soy/src/Soy.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class Soy extends IncrementalDomRenderer.constructor {
return function(data, ignored, ijData) {
if (!goog.loadedModules_[namespace]) {
throw new Error(
`No template with namespace "${namespace}" has been loaded yet.`
`No template with namespace "${
namespace
}" has been loaded yet.`
);
}
return goog.loadedModules_[namespace][templateName](
Expand Down
3 changes: 2 additions & 1 deletion packages/metal-soy/src/SoyAop.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const SoyAop = {
* interception.
*/
handleTemplateCall_: function(originalFn, data, ignored, ijData) {
const interceptFn = SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; // eslint-disable-line
const interceptFn =
SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; // eslint-disable-line
if (interceptFn) {
return interceptFn.call(null, originalFn, data, ignored, ijData);
} else {
Expand Down
15 changes: 11 additions & 4 deletions packages/metal-state/src/State.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ class State extends EventEmitter {
assertValidStateKeyName_(name) {
if (this.keysBlacklist_ && this.keysBlacklist_[name]) {
throw new Error(
`It's not allowed to create a state key with the name "${name}".`
`It's not allowed to create a state key with the name "${
name
}".`
);
}
}
Expand Down Expand Up @@ -294,7 +296,9 @@ class State extends EventEmitter {

ctor[staticKey] = ctor[staticKey] || {};

defineContext = ctor[staticKey][ctor.name] ? false : ctor.prototype; // eslint-disable-line
defineContext = ctor[staticKey][ctor.name]
? false
: ctor.prototype; // eslint-disable-line
ctor[staticKey][ctor.name] = true;
}
this.configState(State.getStateStatic(ctor), defineContext);
Expand Down Expand Up @@ -417,7 +421,8 @@ class State extends EventEmitter {
hasBeenSet(name) {
const info = this.getStateInfo(name);
return (
info.state === State.KeyStates.INITIALIZED || this.hasInitialValue_(name) // eslint-disable-line
info.state === State.KeyStates.INITIALIZED ||
this.hasInitialValue_(name) // eslint-disable-line
);
}

Expand Down Expand Up @@ -697,7 +702,9 @@ class State extends EventEmitter {
const disposed = this.isDisposed();
if (disposed) {
console.warn(
`Error. Trying to access property "${name}" on disposed instance`
`Error. Trying to access property "${
name
}" on disposed instance`
);
}
return disposed;
Expand Down
Loading

0 comments on commit bd6d8d2

Please sign in to comment.