diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..0e7ea4a --- /dev/null +++ b/.eslintrc @@ -0,0 +1,38 @@ +{ + "env": { + "node": true + }, + "parserOptions": { + "ecmaVersion": 6, + "ecmaFeatures": {} + }, + "rules": { + "block-scoped-var": 2, + "no-cond-assign": 2, + "no-control-regex": 2, + "no-debugger": 2, + "no-dupe-args": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-ex-assign": 2, + "no-extra-semi": 2, + "no-func-assign": 2, + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-negated-in-lhs": 2, + "no-obj-calls": 2, + "no-redeclare": 2, + "no-regex-spaces": 2, + "no-sparse-arrays": 2, + "no-unexpected-multiline": 2, + "no-unreachable": 2, + "no-delete-var": 2, + "no-shadow": 2, + "no-undef": 2, + "radix": 2, + "semi": 2, + "use-isnan": 2, + "valid-jsdoc": 2, + "valid-typeof": 2 + } +} diff --git a/.gitignore b/.gitignore index 081b9f6..63c3b82 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ node_modules/* .idea/* *.snap *.xlog + +npm-debug.log diff --git a/.travis.yml b/.travis.yml index 244606e..a5d4229 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,5 @@ script: - sudo apt-get -y install tarantool - ./test/box.lua & - sleep 2 - - npm test \ No newline at end of file + - npm run lint + - npm test diff --git a/lib/connection.js b/lib/connection.js index fceec0f..cd3d2d1 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -1,3 +1,5 @@ +/* global Promise */ + 'use strict'; var tarantoolConstants = require('./const'); var net = require('net'); @@ -18,7 +20,7 @@ var exampleCustomMsgpack = { return msgpack.encode(obj); }, decode: function(buf){ - return msgpack.decode(obj); + return msgpack.decode(buf); } }; @@ -91,7 +93,7 @@ TarantoolConnection.prototype._getSpaceId = function(name){ { throw new Error('Cannot read a space name or space is not defined'); } - }.bind(this)) + }.bind(this)); }; TarantoolConnection.prototype._getIndexId = function(spaceId, indexName){ @@ -126,7 +128,7 @@ TarantoolConnection.prototype._getMetadata = function(spaceName, indexName){ return this._getSpaceId(spaceName) .then(function(spaceId){ return Promise.all([spaceId, this._getIndexId(spaceId, indexName)]); - }.bind(this)) + }.bind(this)); } var promises = []; if (typeof(spaceName) == 'string') @@ -143,7 +145,7 @@ TarantoolConnection.prototype._getMetadata = function(spaceName, indexName){ }; TarantoolConnection.prototype.onData = function(data){ - + var trackResult; switch(this.state){ case states.PREHELLO: for (var i = 0; i