Skip to content

Commit

Permalink
style: getting linting to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserf committed Mar 30, 2017
1 parent 9bfbbdc commit f1eb710
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Client = function (url, options) {
this._messageCallbacks[C.TOPIC.ERROR] = this._onErrorMessage.bind(this)
}

Emitter(Client.prototype)
Emitter(Client.prototype) // eslint-disable-line

/**
* Send authentication parameters to the client to fully open
Expand Down Expand Up @@ -251,7 +251,7 @@ Client.prototype._getOptions = function (options) {
* @public
* @returns {void}
*/
function createDeepstream(url, options) {
function createDeepstream (url, options) {
return new Client(url, options)
}

Expand Down
4 changes: 2 additions & 2 deletions src/constants/merge-strategies.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ module.exports = {
/**
* Choose the server's state over the client's
**/
REMOTE_WINS(record, remoteValue, remoteVersion, callback) {
REMOTE_WINS (record, remoteValue, remoteVersion, callback) {
callback(null, remoteValue)
},
/**
* Choose the local state over the server's
**/
LOCAL_WINS(record, remoteValue, remoteVersion, callback) {
LOCAL_WINS (record, remoteValue, remoteVersion, callback) {
callback(null, record.get())
}
}
8 changes: 4 additions & 4 deletions src/message/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Connection.prototype.getState = function () {
* @returns {void}
*/
Connection.prototype.authenticate = function (authParams, callback) {
if(typeof authParams !== 'object') {
if (typeof authParams !== 'object') {
this._client._$onError(C.TOPIC.ERROR, C.EVENT.INVALID_AUTH_MSG, 'authParams is not an object')
return
}
Expand Down Expand Up @@ -272,7 +272,7 @@ Connection.prototype._checkHeartBeat = function () {
this._client._$onError(
C.TOPIC.CONNECTION,
C.EVENT.CONNECTION_ERROR,
'heartbeat not received in the last ' + heartBeatTolerance + ' milliseconds')
`heartbeat not received in the last ${heartBeatTolerance} milliseconds`)
this._endpoint.close()
}
}
Expand Down Expand Up @@ -453,8 +453,8 @@ Connection.prototype._handleAuthResponse = function (message) {
if (this._authCallback) {
this._authCallback(false, 'invalid authentication message')
}
return;

return
} else {
this._setState(C.CONNECTION_STATE.AWAITING_AUTHENTICATION)
}
Expand Down
3 changes: 2 additions & 1 deletion src/record/anonymous-record.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
/* eslint-disable prefer-rest-params, prefer-spread */

const Record = require('./record')
const EventEmitter = require('component-emitter2')
Expand Down Expand Up @@ -29,7 +30,7 @@ const AnonymousRecord = function (recordHandler) {
this._proxyMethod('discard')
}

EventEmitter(AnonymousRecord.prototype)
EventEmitter(AnonymousRecord.prototype) // eslint-disable-line

/**
* Proxies the actual record's get method. It is valid
Expand Down
14 changes: 7 additions & 7 deletions src/record/json-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ const cache = Object.create(null)
*/
module.exports.get = function (data, path, deepCopy) {
const tokens = tokenize(path)

let value = data
for (let i = 0; i < tokens.length; i++) {
if (data === undefined) {
if (value === undefined) {
return undefined
}
if (typeof data !== 'object') {
if (typeof value !== 'object') {
throw new Error('invalid data or path')
}
data = data[tokens[i]]
value = data[tokens[i]]
}

return deepCopy !== false ? utils.deepCopy(data) : data
return deepCopy !== false ? utils.deepCopy(value) : value
}

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ module.exports.set = function (data, path, value, deepCopy) {
* @param {boolean} deepCopy
* @return {Mixed}
*/
function patch(oldValue, newValue, deepCopy) {
function patch (oldValue, newValue, deepCopy) {
let i
let j
if (oldValue === null || newValue === null) {
Expand Down Expand Up @@ -132,7 +132,7 @@ function patch(oldValue, newValue, deepCopy) {
*
* @returns Array of tokens
*/
function tokenize(path) {
function tokenize (path) {
if (cache[path]) {
return cache[path]
}
Expand Down
3 changes: 2 additions & 1 deletion src/record/list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
/* eslint-disable prefer-rest-params */

const EventEmitter = require('component-emitter2')
const Record = require('./record')
Expand Down Expand Up @@ -45,7 +46,7 @@ const List = function (recordHandler, name, options) {
this.whenReady = this._record.whenReady.bind(this)
}

EventEmitter(List.prototype)
EventEmitter(List.prototype) // eslint-disable-line

/**
* Returns the array of list entries or an
Expand Down
11 changes: 7 additions & 4 deletions src/record/record.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
/* eslint-disable prefer-spread, prefer-rest-params */

const jsonPath = require('./json-path')
const ResubscribeNotifier = require('../utils/resubscribe-notifier')
Expand Down Expand Up @@ -66,7 +67,7 @@ const Record = function (name, recordOptions, connection, options, client) {
this._sendRead()
}

EventEmitter(Record.prototype)
EventEmitter(Record.prototype) // eslint-disable-line

/**
* Set a merge strategy to resolve any merge conflicts that may occur due
Expand Down Expand Up @@ -137,7 +138,7 @@ Record.prototype.set = function (pathOrData, dataOrCallback, callback) {
} else if (typeof pathOrData === 'object' && typeof dataOrCallback === 'function') {
// set( data, callback )
data = pathOrData
callback = dataOrCallback
callback = dataOrCallback // eslint-disable-line
} else {
throw new Error('invalid argument path')
}
Expand All @@ -150,8 +151,8 @@ Record.prototype.set = function (pathOrData, dataOrCallback, callback) {
data = dataOrCallback
}

if(!path && (data === null || typeof data !== 'object')) {
throw new Error('invalid arguments, scalar values cannot be set without path');
if (!path && (data === null || typeof data !== 'object')) {
throw new Error('invalid arguments, scalar values cannot be set without path')
}

if (this._checkDestroyed('set')) {
Expand Down Expand Up @@ -207,6 +208,7 @@ Record.prototype.set = function (pathOrData, dataOrCallback, callback) {
* @public
* @returns {void}
*/
// eslint-disable-next-line
Record.prototype.subscribe = function (path, callback, triggerNow) {
const args = this._normalizeArguments(arguments)

Expand Down Expand Up @@ -249,6 +251,7 @@ Record.prototype.subscribe = function (path, callback, triggerNow) {
* @public
* @returns {void}
*/
// eslint-disable-next-line
Record.prototype.unsubscribe = function (pathOrCallback, callback) {
const args = this._normalizeArguments(arguments)

Expand Down
2 changes: 1 addition & 1 deletion src/utils/ack-timeout-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const AckTimeoutRegistry = function (client, options) {
client.on('connectionStateChanged', this._onConnectionStateChanged.bind(this))
}

EventEmitter(AckTimeoutRegistry.prototype)
EventEmitter(AckTimeoutRegistry.prototype) // eslint-disable-line

/**
* Add an entry
Expand Down
2 changes: 1 addition & 1 deletion test-e2e/features

0 comments on commit f1eb710

Please sign in to comment.