diff --git a/.jshintrc b/.jshintrc index c3c58cd8..7cf0813b 100644 --- a/.jshintrc +++ b/.jshintrc @@ -18,7 +18,7 @@ "quotmark": "single", "regexp": true, "smarttabs": false, - "strict": true, + "strict": false, "trailing": true, "undef": true, "unused": true, @@ -26,7 +26,7 @@ "maxstatements": 25, "maxcomplexity": 10, "maxdepth": 4, - "maxlen": 120, + "maxlen": 140, "multistr": true, "predef": [ "after", diff --git a/lib/scaffold/default-config.js b/lib/scaffold/default-config.js index 0621aa06..17d3a68b 100644 --- a/lib/scaffold/default-config.js +++ b/lib/scaffold/default-config.js @@ -3,6 +3,10 @@ var mkdirp = require('mkdirp'); var fs = require('fs'); var package = require('../../package'); +function getMajorVersion(versionString) { + return parseInt(versionString.split('.')[0]); +} + /** * Will return the path and default bitcore-node configuration. It will search for the * configuration file in the "~/.bitcore" directory, and if it doesn't exist, it will create one @@ -25,16 +29,12 @@ function getDefaultConfig(options) { if (fs.existsSync(defaultConfigFile)) { const currentConfig = require(defaultConfigFile); - - function getMajorVersion(versionString) { - return parseInt(versionString.split('.')[0]) - } // config must have a `version` field with major equal to package major version if(currentConfig.version && getMajorVersion(package.version) === getMajorVersion(currentConfig.version)) { return { path: defaultPath, - config: config + config: currentConfig }; } @@ -42,7 +42,7 @@ function getDefaultConfig(options) { const now = new Date(); // bitcore-node.YYYY-MM-DD.UnixTimestamp.json - const backupFileName = `bitcore-node.${now.getUTCFullYear() + '-' + now.getUTCMonth() + '-' + now.getUTCDate() + '.' + now.getTime()}.json`; + const backupFileName = `bitcore-node.${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getTime()}.json`; const backupFile = path.resolve(defaultPath, backupFileName); fs.renameSync(defaultConfigFile, backupFile); console.log(`The previous configuration file has been moved to: ${backupFile}.`); diff --git a/lib/scaffold/start.js b/lib/scaffold/start.js index dca22f52..f3384283 100644 --- a/lib/scaffold/start.js +++ b/lib/scaffold/start.js @@ -1,5 +1,3 @@ -'use strict'; - var path = require('path'); var BitcoreNode = require('../node'); var index = require('../'); @@ -86,11 +84,13 @@ function lookInRequirePathConfig(req, service) { } function lookInCwd(req, service) { - var location = service.config.cwdRequirePath ? service.config.cwdRequirePath : service.name + const location = service.config.cwdRequirePath ? service.config.cwdRequirePath : service.name; try { return req(process.cwd() + '/' + location); } catch(e) { - if(e.code !== 'MODULE_NOT_FOUND') log.error(e); + if(e.code !== 'MODULE_NOT_FOUND') { + log.error(e); + } log.info('Checked the current working directory for service: ' + location); } } @@ -100,7 +100,9 @@ function lookInBuiltInPath(req, service) { var serviceFile = path.resolve(__dirname, '../services/' + service.name); return req(serviceFile); } catch(e) { - if(e.code !== 'MODULE_NOT_FOUND') log.error(e); + if(e.code !== 'MODULE_NOT_FOUND') { + log.error(e); + } log.info('Checked the built-in path: lib/services, for service: ' + service.name); } }