From 3087f08c3807060d912464605a557b0961182560 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Wed, 8 Apr 2020 15:23:33 -0500 Subject: [PATCH 1/3] fix: eslint errors --- .eslintrc.js | 14 +++++++++++++- lib/transports/idbTransport.js | 4 ++-- lib/transports/sshTransport.js | 1 + package.json | 1 + test/functional/checkObjectExists.js | 2 -- test/functional/deprecated/iProdFunctional.js | 1 - test/functional/iDataQueueFunctional.js | 4 ++-- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dafb44e3..650798f7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1 +1,13 @@ -module.exports = { "extends": "airbnb-base" }; \ No newline at end of file +module.exports = { + "extends": "airbnb-base", + env: { + node: true + }, + rules: { + // Tweak rules set by airbnb config + 'no-console': 'off', // allow console + 'import/no-extraneous-dependencies': ["error", {"optionalDependencies": true}], // Allow optional dep import + // Warn unreoslved imports ie: idb-connector import will be unresolved when on non IBM i system. + 'import/no-unresolved': ['warn', { commonjs: true, caseSensitive: true }], + }, +}; diff --git a/lib/transports/idbTransport.js b/lib/transports/idbTransport.js index 48bc32a9..502be3f3 100644 --- a/lib/transports/idbTransport.js +++ b/lib/transports/idbTransport.js @@ -18,6 +18,7 @@ const idbCall = (config, xmlInput, cb) => { const { dbconn, dbstmt, IN, CLOB, CHAR, SQL_ATTR_DBC_SYS_NAMING, SQL_FALSE, + // eslint-disable-next-line global-require } = require('idb-connector'); const { @@ -67,7 +68,7 @@ const idbCall = (config, xmlInput, cb) => { conn.close(); cb(err, val); - } + }; stmt.prepare(sql, (prepareError) => { if (prepareError) { @@ -101,7 +102,6 @@ const idbCall = (config, xmlInput, cb) => { xmlOutput += chunk.OUT151; }); done(null, xmlOutput); - return; }); }); }); diff --git a/lib/transports/sshTransport.js b/lib/transports/sshTransport.js index 727b9559..884c506d 100644 --- a/lib/transports/sshTransport.js +++ b/lib/transports/sshTransport.js @@ -16,6 +16,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. function sshCall(config, xmlIn, done) { + // eslint-disable-next-line global-require const { Client } = require('ssh2'); const { diff --git a/package.json b/package.json index f35b8442..6e544230 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "test": "./node_modules/mocha/bin/mocha --recursive test/unit", "test-integration": "./node_modules/mocha/bin/mocha --timeout 5s test/functional/*.js", + "lint": "./node_modules/eslint/bin/eslint.js lib/ test/", "release": "standard-version" }, "repository": { diff --git a/test/functional/checkObjectExists.js b/test/functional/checkObjectExists.js index 969965da..02f1aa58 100644 --- a/test/functional/checkObjectExists.js +++ b/test/functional/checkObjectExists.js @@ -1,8 +1,6 @@ const lib = 'NODETKTEST'; const createLib = `CRTLIB LIB(${lib}) TYPE(*TEST) TEXT('Used to test Node.js toolkit')`; const findLib = `SELECT SCHEMA_NAME FROM qsys2.sysschemas WHERE SCHEMA_NAME = '${lib}'`; -const dataQueue = 'TESTQ'; -const dataArea = 'TESTDA'; function checkObjectExistsSSH(config, object = {}, callback) { /* eslint-disable global-require */ diff --git a/test/functional/deprecated/iProdFunctional.js b/test/functional/deprecated/iProdFunctional.js index d3a38c61..d30d90f4 100644 --- a/test/functional/deprecated/iProdFunctional.js +++ b/test/functional/deprecated/iProdFunctional.js @@ -132,7 +132,6 @@ describe('iProd Functional Tests', () => { // REST transport currently failing with 414 URI Too Long response code // The requested URL's length exceeds the capacity limit for this server describe('getInstalledProducts', () => { - // eslint-disable-next-line func-names it('returns info for installed products', (done) => { const connection = new iConn(database, username, password, restOptions); diff --git a/test/functional/iDataQueueFunctional.js b/test/functional/iDataQueueFunctional.js index fae5705c..b0e7cd4a 100644 --- a/test/functional/iDataQueueFunctional.js +++ b/test/functional/iDataQueueFunctional.js @@ -34,8 +34,8 @@ describe('DataQueue Functional Tests', () => { checkObjectExists(config, dqName, '*DTAQ', (error) => { if (error) { throw error; } - checkObjectExists(config, dqName2, '*DTAQ', (error) => { - if (error) { throw error; } + checkObjectExists(config, dqName2, '*DTAQ', (error2) => { + if (error2) { throw error2; } done(); }); }); From b76aead80e8bc645ab8128a065f15a4e217c14f3 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Wed, 8 Apr 2020 16:07:43 -0500 Subject: [PATCH 2/3] fixup! fix: eslint errors --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 650798f7..66b81679 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,6 +8,6 @@ module.exports = { 'no-console': 'off', // allow console 'import/no-extraneous-dependencies': ["error", {"optionalDependencies": true}], // Allow optional dep import // Warn unreoslved imports ie: idb-connector import will be unresolved when on non IBM i system. - 'import/no-unresolved': ['warn', { commonjs: true, caseSensitive: true }], + 'import/no-unresolved': ['off', { commonjs: true }], }, }; From 61fbc3f5e1c6927cb1b29bae003a08e1df058690 Mon Sep 17 00:00:00 2001 From: Kevin Adler Date: Fri, 17 Apr 2020 10:43:40 -0500 Subject: [PATCH 3/3] Update .eslintrc.js --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 66b81679..07591b79 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { // Tweak rules set by airbnb config 'no-console': 'off', // allow console 'import/no-extraneous-dependencies': ["error", {"optionalDependencies": true}], // Allow optional dep import - // Warn unreoslved imports ie: idb-connector import will be unresolved when on non IBM i system. + // Warn unresolved imports ie: idb-connector import will be unresolved when on non IBM i system. 'import/no-unresolved': ['off', { commonjs: true }], }, };