Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
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 unresolved imports ie: idb-connector import will be unresolved when on non IBM i system.
'import/no-unresolved': ['off', { commonjs: true }],
module.exports = {
extends: 'airbnb-base',
plugins: [
'mocha',
],
env: {
node: true,
},
rules: {
// Tweak rules set by airbnb config
// We need to allow use of console.log for verbose mode
'no-console': 'off',
},
overrides: [
{
files: ['test/**/*.js'],
env: {
node: true,
mocha: true,
},
extends: 'plugin:mocha/recommended',
rules: {
// These are set by airbnb-base, but go against Mocha conventions
// See https://mochajs.org/#arrow-functions
// and https://github.com/airbnb/javascript/issues/433
'func-names': 'off',
'prefer-arrow-callback': 'off',

// The following rules cause problems for our existing tests, so they are disabled for now:
'mocha/no-mocha-arrows': 'off',
'mocha/no-skipped-tests': 'off',
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-identical-title': 'off',
},
},
],
};
5 changes: 4 additions & 1 deletion lib/transports/idbTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
const idbCall = (config, xmlInput, cb) => {
const {
dbconn, dbstmt, IN, CLOB, CHAR, SQL_ATTR_DBC_SYS_NAMING, SQL_FALSE,
// eslint-disable-next-line global-require
// idb-connector is an optional dependency, since users may not use this transport
// thus we can't globally require it
// eslint-disable-next-line max-len
// eslint-disable-next-line global-require, import/no-extraneous-dependencies, import/no-unresolved
} = require('idb-connector');

const {
Expand Down
3 changes: 2 additions & 1 deletion lib/transports/odbcTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

function odbcCall(config, xmlInput, done) {
// eslint-disable-next-line global-require
// odbc is an optional dependency, since users may not use this transport
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const odbc = require('odbc');

const {
Expand Down
3 changes: 2 additions & 1 deletion lib/transports/sshTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
// 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
// ssh2 is an optional dependency, since users may not use this transport
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const { Client } = require('ssh2');

const {
Expand Down
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"eslint": "^6.2.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-mocha": "^7.0.1",
"mocha": "^6.2.3",
"sinon": "^7.4.1",
"standard-version": "^7.0.0"
Expand Down
2 changes: 0 additions & 2 deletions test/functional/CommandCallFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */

const { expect } = require('chai');
const { parseString } = require('xml2js');
const { CommandCall, Connection } = require('../../lib/itoolkit');
Expand Down
1 change: 0 additions & 1 deletion test/functional/ProgramCallFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */

const { expect } = require('chai');
const { parseString } = require('xml2js');
Expand Down
11 changes: 10 additions & 1 deletion test/functional/checkObjectExists.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const createLib = `CRTLIB LIB(${lib}) TYPE(*TEST) TEXT('Used to test Node.js too
const findLib = `SELECT SCHEMA_NAME FROM qsys2.sysschemas WHERE SCHEMA_NAME = '${lib}'`;

function checkObjectExistsSSH(config, object = {}, callback) {
/* eslint-disable global-require */
// ssh2 is an optional dependency, since users may not use this transport
// thus we can't globally require it
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const { Client } = require('ssh2');

const client = new Client();
Expand Down Expand Up @@ -68,6 +70,9 @@ function checkObjectExistsSSH(config, object = {}, callback) {
}

function checkObjectExistsODBC(config, object = {}, callback) {
// odbc is an optional dependency, since users may not use this transport
// thus we can't globally require it
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const odbc = require('odbc');

const connectionString = config.dsn || `DRIVER=IBM i Access ODBC Driver;SYSTEM=${config.host};UID=${config.username};PWD=${config.password};`;
Expand Down Expand Up @@ -110,6 +115,10 @@ function checkObjectExistsODBC(config, object = {}, callback) {
}

function checkObjectExistsIDB(config, object = {}, callback) {
// idb-connector is an optional dependency, since users may not use this transport
// thus we can't globally require it
// eslint-disable-next-line max-len
// eslint-disable-next-line global-require, import/no-extraneous-dependencies, import/no-unresolved
const { dbconn, dbstmt } = require('idb-connector');

/* eslint-disable new-cap */
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/commandsFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */


Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iDataQueueFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iNetworkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iObjFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iPgmFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iProdFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iSqlFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */


Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iUserSpaceFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iWorkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iDataQueueFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iNetworkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iObjFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iProdFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iSqlFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iUserSpaceFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iWorkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/unit/CommandCallUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
const { expect } = require('chai');
const { CommandCall } = require('../../lib/itoolkit');

Expand Down
1 change: 0 additions & 1 deletion test/unit/ConnectionUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/unit/ProgamCallUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/unit/deprecated/iConnUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/unit/deprecated/iPgmUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
1 change: 0 additions & 1 deletion test/unit/deprecated/iSqlUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */
/* eslint-disable new-cap */

const { expect } = require('chai');
Expand Down
2 changes: 0 additions & 2 deletions test/unit/deprecated/xmlToJsonUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-env mocha */

const { expect } = require('chai');
const { xmlToJson } = require('../../../lib/itoolkit');

Expand Down