From 6dba16ac249a3ee1d0ddfc6b379d37b43b5a7ce7 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Fri, 11 Mar 2016 13:29:01 -0500 Subject: [PATCH] Move eslint settings to .eslintrc, and fix minor code style issues --- .eslintrc | 38 +++++++++++++++++++++++++++++++ .istanbul.yml | 6 ----- gulpfile.js | 43 ++---------------------------------- lib/NodeQuery.js | 4 +--- lib/drivers/Sqlite.js | 4 +--- lib/promisify.js | 4 +--- test/.jscsrc | 7 ------ test/adapters/dblite_test.js | 4 +--- 8 files changed, 44 insertions(+), 66 deletions(-) create mode 100644 .eslintrc delete mode 100644 .istanbul.yml delete mode 100644 test/.jscsrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..2116a09 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,38 @@ +{ + "env": { + "node": true, + "es6": true + }, + "rules": { + "arrow-parens": [2, "as-needed"], + "no-console": [1], + "no-constant-condition": [1], + "no-extra-semi": [1], + "no-func-assign": [1], + "no-obj-calls": [2], + "no-unexpected-multiline" : [2], + "no-unneeded-ternary": [2], + "radix": [2], + "no-with": [2], + "no-eval": [2], + "no-unreachable": [1], + "no-irregular-whitespace": [1], + "no-new-wrappers": [2], + "no-new-func": [2], + "curly" : [2, "multi-line"], + "no-implied-eval": [2], + "no-invalid-this": [2], + "constructor-super": [2], + "no-dupe-args": [2], + "no-dupe-keys": [2], + "no-dupe-class-members": [2], + "no-this-before-super": [2], + "prefer-arrow-callback": [1], + "no-var": [2], + "valid-jsdoc": [1], + "strict": [2, "global"], + "callback-return": [1], + "object-shorthand": [1, "methods"], + "prefer-template": [1] + } +} \ No newline at end of file diff --git a/.istanbul.yml b/.istanbul.yml deleted file mode 100644 index 1a66a95..0000000 --- a/.istanbul.yml +++ /dev/null @@ -1,6 +0,0 @@ -reporting: - reports: - - lcov - - lcovonly - report-config: - lcovonly: {file: ../coverage/lcov.info} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 487e2eb..c0a84e8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,45 +15,6 @@ const TEST_FILES = [ 'test/adapters/*_test.js' ]; -const ESLINT_SETTINGS = { - "env": { - "node": true, - "es6": true - }, - "rules": { - "arrow-parens": [2, "as-needed"], - "no-console": [1], - "no-constant-condition": [1], - "no-extra-semi": [1], - "no-func-assign": [1], - "no-obj-calls": [2], - "no-unexpected-multiline" : [2], - "no-unneeded-ternary": [2], - "radix": [2], - "no-with": [2], - "no-eval": [2], - "no-unreachable": [1], - "no-irregular-whitespace": [1], - "no-new-wrappers": [2], - "no-new-func": [2], - "curly" : [2, "multi-line"], - "no-implied-eval": [2], - "no-invalid-this": [2], - "constructor-super": [2], - "no-dupe-args": [2], - "no-dupe-keys": [2], - "no-dupe-class-members": [2], - "no-this-before-super": [2], - "prefer-arrow-callback": [1], - "no-var": [2], - "valid-jsdoc": [1], - "strict": [2, "global"], - "callback-return": [1], - "object-shorthand": [1, "methods"], - "prefer-template": [1] - } -}; - const MOCHA_OPTIONS = { ui: 'tdd', bail: true, @@ -63,7 +24,7 @@ const MOCHA_OPTIONS = { gulp.task('lint', () => { pipe(gulp.src(SRC_FILES), [ - eslint(ESLINT_SETTINGS), + eslint(), eslint.format(), eslint.failAfterError() ]); @@ -75,7 +36,7 @@ gulp.task('lint', () => { gulp.task('lint-tests', ['lint'], () => { pipe(gulp.src(['test/**/*.js']), [ - eslint(ESLINT_SETTINGS), + eslint(), eslint.format(), eslint.failAfterError() ]); diff --git a/lib/NodeQuery.js b/lib/NodeQuery.js index 2e901d4..eb0de18 100755 --- a/lib/NodeQuery.js +++ b/lib/NodeQuery.js @@ -93,6 +93,4 @@ class NodeQuery { } } -module.exports = (config => { - return new NodeQuery(config); -}); \ No newline at end of file +module.exports = (config => new NodeQuery(config)); \ No newline at end of file diff --git a/lib/drivers/Sqlite.js b/lib/drivers/Sqlite.js index 6a7e6a3..f771128 100644 --- a/lib/drivers/Sqlite.js +++ b/lib/drivers/Sqlite.js @@ -50,9 +50,7 @@ module.exports = (() => { sql += `SELECT ${cols.join(', ')}\n`; vals.forEach(rowValues => { - let quoted = rowValues.map(value => { - return String(value).replace('\'', '\'\''); - }); + let quoted = rowValues.map(value => String(value).replace('\'', '\'\'')); sql += `UNION ALL SELECT '${quoted.join('\', \'')}'\n`; }); diff --git a/lib/promisify.js b/lib/promisify.js index 1079b49..ad7fe8d 100644 --- a/lib/promisify.js +++ b/lib/promisify.js @@ -16,9 +16,7 @@ function promisify(fn) { return function () { let args = [].slice.call(arguments); return new Promise(function (resolve, reject) { - fn.apply(undefined, args.concat((error, value) => { - return error ? reject(error) : resolve(value); - })); + fn.apply(undefined, args.concat((error, value) => error ? reject(error) : resolve(value))); }); }; } diff --git a/test/.jscsrc b/test/.jscsrc deleted file mode 100644 index 49f6214..0000000 --- a/test/.jscsrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "preset": "airbnb", - "validateIndentation": null, - "requireLineFeedAtFileEnd": null, - "disallowSpaceAfterPrefixUnaryOperators": null, - "disallowMultipleVarDecl": null -} \ No newline at end of file diff --git a/test/adapters/dblite_test.js b/test/adapters/dblite_test.js index faef847..678e456 100644 --- a/test/adapters/dblite_test.js +++ b/test/adapters/dblite_test.js @@ -23,9 +23,7 @@ suite('Dblite adapter tests -', () => { let sql = `CREATE TABLE IF NOT EXISTS "create_test" ("id" INTEGER PRIMARY KEY, "key" TEXT, "val" TEXT); CREATE TABLE IF NOT EXISTS "create_join" ("id" INTEGER PRIMARY KEY, "key" TEXT, "val" TEXT);`; - qb.query(sql, () => { - return done(); - }); + qb.query(sql, () => done()); }); /*---------------------------------------------------------------------------