diff --git a/.eslintrc.json b/.eslintrc.json index 70e5f272..1a46457e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,9 +8,13 @@ "sourceType": "module" }, "rules": { + "no-else-return": "error", + "no-multi-spaces": "error", "no-whitespace-before-property": "error", "camelcase": "error", "new-cap": "error", + "no-console": "error", + "comma-dangle": "error", "quotes": [ "error", "single" diff --git a/lib/formatting.js b/lib/formatting.js index 3df41b0b..b0d40b0b 100644 --- a/lib/formatting.js +++ b/lib/formatting.js @@ -162,12 +162,11 @@ var formatAs = { name: name.substr(0, mod.index), fm: fmMap[mod[0]] | (raw ? fmFlags.raw : 0) }; - } else { - return { - name: name, - fm: raw ? fmFlags.raw : null - }; } + return { + name: name, + fm: raw ? fmFlags.raw : null + }; } }; @@ -366,19 +365,18 @@ var $as = { if (name) { if (typeof name === 'string') { return /^\s*\*(\s*)$/.test(name) ? name : formatName(name); - } else { - if (typeof name === 'object') { - var keys = Array.isArray(name) ? name : Object.keys(name); - if (!keys.length) { - throw new Error('Cannot retrieve sql names from an empty array/object.'); - } - return $arr.map(keys, value => { - if (!value || typeof value !== 'string') { - throw new Error('Invalid sql name: ' + JSON.stringify(value)); - } - return formatName(value); - }).join(); + } + if (typeof name === 'object') { + var keys = Array.isArray(name) ? name : Object.keys(name); + if (!keys.length) { + throw new Error('Cannot retrieve sql names from an empty array/object.'); } + return $arr.map(keys, value => { + if (!value || typeof value !== 'string') { + throw new Error('Invalid sql name: ' + JSON.stringify(value)); + } + return formatName(value); + }).join(); } } diff --git a/lib/main.js b/lib/main.js index dd720ece..37acf042 100644 --- a/lib/main.js +++ b/lib/main.js @@ -149,7 +149,7 @@ function $main(options) { var config = { version: $npm.package.version, promiseLib: p.promiseLib, - promise: p.promise, + promise: p.promise }; $npm.utils.addReadProp(config, '$npm', {}, true); diff --git a/lib/task.js b/lib/task.js index 7b14475f..0193c0ea 100644 --- a/lib/task.js +++ b/lib/task.js @@ -242,10 +242,9 @@ Task.exec = (ctx, obj, isTX, config) => { if (success) { update(false, true, cbData); return cbData; - } else { - update(false, false, cbReason); - return $p.reject(cbReason); } + update(false, false, cbReason); + return $p.reject(cbReason); }, // istanbul ignore next: either `commit` or `rollback` has failed, which is // impossible to replicate in a test environment, so skipping from the test; diff --git a/lib/utils/public.js b/lib/utils/public.js index 69ec903c..9f04b970 100644 --- a/lib/utils/public.js +++ b/lib/utils/public.js @@ -76,9 +76,9 @@ function _enumSql(dir, options, cb, namePath) { // istanbul ignore next if (options.ignoreErrors) { return; // on to the next file/folder; - } else { - throw e; } + // istanbul ignore next + throw e; } if (stat.isDirectory()) { if (options.recursive) {