Skip to content

Commit

Permalink
lint refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Mar 11, 2017
1 parent d7fdc31 commit 1a70b66
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
32 changes: 15 additions & 17 deletions lib/formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
};

Expand Down Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions lib/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1a70b66

Please sign in to comment.