Skip to content

Commit

Permalink
Merge "[FAB-8128] Fix ESLint config"
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisob authored and Gerrit Code Review committed Feb 8, 2018
2 parents 91fa863 + 352174e commit 70468d5
Show file tree
Hide file tree
Showing 21 changed files with 183 additions and 187 deletions.
7 changes: 2 additions & 5 deletions build/tasks/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ gulp.task('lint', function () {
'**/*.js',
'fabric-client/**/*.js',
'fabric-ca-client/lib/*.js',
'examples/**/*.js',
'!examples/balance-transfer/node_modules/**',
'!node_modules/**',
'!fabric-client/node_modules/**',
'!fabric-ca-client/node_modules/**',
Expand Down Expand Up @@ -45,10 +43,9 @@ gulp.task('lint', function () {
'ignoreRegExpLiterals': true,
},
],
},
fix: true,
}
}
))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
});
4 changes: 2 additions & 2 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ var debugPath = path.join(testConstants.tempdir, 'test-log/debug.log');
process.env.HFC_LOGGING = util.format('{"debug":"%s"}', escapeWindowsPath(debugPath));

function escapeWindowsPath(p) {
if (path.sep == "/") return p
return p.replace(/\\/g, "\\\\")
if (path.sep == '/') return p;
return p.replace(/\\/g, '\\\\');
}

console.log('\n####################################################');
Expand Down
2 changes: 1 addition & 1 deletion fabric-ca-client/lib/FabricCAClientImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var FabricCAServices = class extends BaseClient {
url = url_p.url;
tlsOptions = url_p.tlsOptions;
caName = url_p.caName;
cryptoSuite = url_p.cryptoSuite
cryptoSuite = url_p.cryptoSuite;
} else {
url = url_p;
tlsOptions = tlsOptions_p;
Expand Down
32 changes: 16 additions & 16 deletions fabric-client/lib/BlockDecoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,26 +1334,26 @@ var HeaderType = class {
static decodePayloadBasedOnType(proto_data, type) {
let result = null;
switch(type) {
case 1:
result = decodeConfigEnvelope(proto_data);
break;
case 2:
result = decodeConfigUpdateEnvelope(proto_data);
break;
case 3:
result = decodeEndorserTransaction(proto_data);
break;
default:
logger.debug(' ***** found a header type of %s :: %s', type, HeaderType.convertToString(type));
// return empty data on types we do not know so that
// event processing may continue on blocks we do not
// care about
result = {};
case 1:
result = decodeConfigEnvelope(proto_data);
break;
case 2:
result = decodeConfigUpdateEnvelope(proto_data);
break;
case 3:
result = decodeEndorserTransaction(proto_data);
break;
default:
logger.debug(' ***** found a header type of %s :: %s', type, HeaderType.convertToString(type));
// return empty data on types we do not know so that
// event processing may continue on blocks we do not
// care about
result = {};
}

return result;
}
}
};

module.exports = BlockDecoder;
module.exports.HeaderType = HeaderType;
2 changes: 1 addition & 1 deletion fabric-client/lib/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var Channel = class {
logger.info('close - closing connections');
var closer = function (ep) {
ep.close();
}
};
this._peers.map(closer);
this._orderers.map(closer);
}
Expand Down
35 changes: 17 additions & 18 deletions fabric-client/lib/ChannelEventHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ var ChannelEventHub = class {

if(have_end_block) {
if(have_start_block && converted_options.start_block.greaterThan(converted_options.end_block)) {
throw new Error(util.format('"startBlock" (%s) must not be larger than "endBlock" (%s)',converted_options.start_block,converted_options.end_block))
throw new Error(util.format('"startBlock" (%s) must not be larger than "endBlock" (%s)', converted_options.start_block, converted_options.end_block));
}
this._ending_block_number = converted_options.end_block;
this._allowRegistration = false;
Expand Down Expand Up @@ -821,7 +821,7 @@ var ChannelEventHub = class {
self.unregisterChaincodeEvent(chaincode_reg);
};
}
this._checkConnection()
this._checkConnection();

return chaincode_reg;
}
Expand Down Expand Up @@ -912,8 +912,7 @@ var ChannelEventHub = class {
self.unregisterBlockEvent(block_registration_number);
};
}
this._checkConnection()

this._checkConnection();

return block_registration_number;
}
Expand Down Expand Up @@ -988,7 +987,7 @@ var ChannelEventHub = class {
self.unregisterTxEvent(txid);
};
}
this._checkConnection()
this._checkConnection();

return txid;
}
Expand Down Expand Up @@ -1136,7 +1135,7 @@ var ChannelEventHub = class {
logger.debug('_processChaincodeEvents - no transactions or transaction actions');
}
} else {
logger.debug('_processChaincodeEvents - block is not endorser transaction type')
logger.debug('_processChaincodeEvents - block is not endorser transaction type');
}
} catch (err) {
logger.error('on.data - Error unmarshalling transaction=', err);
Expand Down Expand Up @@ -1226,18 +1225,18 @@ function getStreamState(self) {
/*
* Utility method to get the string state from an integer
*/
function getStateText(state) {
let result = null;
try {
result = CONNECTION_STATE[state];
} catch(error) {
logger.error('Connection state conversion - unknown state - %s',state);
}
if(!result) {
result = 'UNKNOWN_STATE';
}
return result;
}
function getStateText(state) {
let result = null;
try {
result = CONNECTION_STATE[state];
} catch(error) {
logger.error('Connection state conversion - unknown state - %s',state);
}
if(!result) {
result = 'UNKNOWN_STATE';
}
return result;
}
/*
* The ChaincodeRegistration is used internal to the ChannelEventHub to hold chaincode
* event registration callbacks.
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ var Client = class extends BaseClient {
let connection_options = ca.getConnectionOptions();
let verify = true; //default if not found
if(connection_options && typeof connection_options.verify === 'boolean') {
verify = connection_options.verify
verify = connection_options.verify;
}
tls_options = {
trustedRoots: tlsCACerts,
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/Organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ var Organization = class {
toString() {
var peers = '';
this._peers.forEach((peer) => {peers = peers + peer.toString() + ',';});
var ehs = ''
var ehs = '';
this._event_hubs.forEach((event_hub) => {ehs = ehs + event_hub.toString() + ',';});
var cas = '';
this._certificateAuthorities.forEach((ca) => {cas = cas + ca.toString() + ',';});
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/Remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ var Endpoint = class {
throw new Error('PEM encoded clientKey and clientCert are required.');
}
} else {
throw new Error('clientKey and clientCert are both required.')
throw new Error('clientKey and clientCert are both required.');
}
} else {
var pembuf = Buffer.concat([Buffer.from(pem), Buffer.from('\0')]);
Expand Down
Loading

0 comments on commit 70468d5

Please sign in to comment.