Merge pull request #755 from embark-framework/chores/es-lint-no-else

Enable no-else-return
This commit is contained in:
Iuri Matias 2018-08-31 07:49:25 -04:00 committed by GitHub
commit f0221bbb10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 21 deletions

View File

@ -113,7 +113,7 @@
"no-continue": "off", "no-continue": "off",
"no-div-regex": "error", "no-div-regex": "error",
"no-duplicate-imports": "error", "no-duplicate-imports": "error",
"no-else-return": "off", "no-else-return": 2,
"no-empty-function": "off", "no-empty-function": "off",
"no-eq-null": "error", "no-eq-null": "error",
"no-eval": "off", "no-eval": "off",

View File

@ -156,9 +156,8 @@ Config.prototype._mergeConfig = function(configFilePath, defaultConfig, env, ena
if (env) { if (env) {
return utils.recursiveMerge(configObject['default'] || {}, configObject[env]); return utils.recursiveMerge(configObject['default'] || {}, configObject[env]);
} else {
return configObject;
} }
return configObject;
}; };
Config.prototype._getFileOrOject = function(object, filePath, property) { Config.prototype._getFileOrOject = function(object, filePath, property) {

View File

@ -230,9 +230,8 @@ Plugin.prototype.runPipeline = function(args) {
var shouldRunPipeline = utils.fileMatchesPattern(pipeline.matcthingFiles, args.targetFile); var shouldRunPipeline = utils.fileMatchesPattern(pipeline.matcthingFiles, args.targetFile);
if (shouldRunPipeline) { if (shouldRunPipeline) {
return pipeline.cb.call(this, args); return pipeline.cb.call(this, args);
} else {
return args.source;
} }
return args.source;
}; };
module.exports = Plugin; module.exports = Plugin;

View File

@ -313,9 +313,8 @@ var BlockchainClient = function(blockchainConfig, client, env, onReadyCallback,
// TODO add other clients at some point // TODO add other clients at some point
if (client === 'geth') { if (client === 'geth') {
return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback}); return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback});
} else {
throw new Error('unknown client');
} }
throw new Error('unknown client');
}; };
module.exports = BlockchainClient; module.exports = BlockchainClient;

View File

@ -304,11 +304,10 @@ class CodeGenerator {
self.events.request("version:get:web3", function(web3Version) { self.events.request("version:get:web3", function(web3Version) {
if (web3Version === "1.0.0-beta") { if (web3Version === "1.0.0-beta") {
return next(null, fs.embarkPath("node_modules/web3")); return next(null, fs.embarkPath("node_modules/web3"));
} else { }
self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) {
return next(null, fs.dappPath(location)); return next(null, fs.dappPath(location));
}); });
}
}); });
}, },
function getImports(web3Location, next) { function getImports(web3Location, next) {
@ -370,11 +369,10 @@ class CodeGenerator {
self.events.request("version:get:web3", function(web3Version) { self.events.request("version:get:web3", function(web3Version) {
if (web3Version === "1.0.0-beta") { if (web3Version === "1.0.0-beta") {
return next(null, utils.joinPath(fs.embarkPath("node_modules/web3"))); return next(null, utils.joinPath(fs.embarkPath("node_modules/web3")));
} else { }
self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) {
return next(null, fs.dappPath(location)); return next(null, fs.dappPath(location));
}); });
}
}); });
}, },
function getImports(web3Location, next) { function getImports(web3Location, next) {

View File

@ -235,9 +235,8 @@ class ContractDeployer {
} catch(e) { } catch(e) {
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) { if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className))); return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className)));
} else {
return next(new Error(e));
} }
return next(new Error(e));
} }
next(); next();
}, },

View File

@ -38,9 +38,8 @@ class Whisper {
self.web3.shh.getVersion(function (err, version) { self.web3.shh.getVersion(function (err, version) {
if (err || version == "2") { if (err || version == "2") {
return cb({name: 'Whisper', status: 'off'}); return cb({name: 'Whisper', status: 'off'});
} else {
return cb({name: 'Whisper (version ' + version + ')', status: 'on'});
} }
return cb({name: 'Whisper (version ' + version + ')', status: 'on'});
}); });
}); });
} }

View File

@ -277,9 +277,8 @@ function isValidDomain(domain) {
function isValidEthDomain(ethDomain) { function isValidEthDomain(ethDomain) {
if (!isValidDomain(ethDomain)) { if (!isValidDomain(ethDomain)) {
return false; return false;
} else {
return ethDomain.substring(ethDomain.lastIndexOf('.'), ethDomain.length) === '.eth';
} }
return ethDomain.substring(ethDomain.lastIndexOf('.'), ethDomain.length) === '.eth';
} }
function decodeParams(typesArray, hexString) { function decodeParams(typesArray, hexString) {