Skip to content

Commit

Permalink
Adds ESLint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick Harrison committed Jul 20, 2016
1 parent 9492579 commit b38f2a9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@meadow",

"parserOptions": {
"sourceType": "script"
},
}
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const DEFAULT_OPTS = {
accessKeyId: '',
secretAccessKey: '',
queue: ''
}
};

const Client = function Client (opts = DEFAULT_OPTS) {
if (!(this instanceof Client)) return new Client(opts);
if (!(this instanceof Client)) {
return new Client(opts);
}

const { region, accessKeyId, secretAccessKey, queue } = opts;

Expand Down Expand Up @@ -44,7 +46,7 @@ Client.prototype.sendMessage = function sendMessage (payload) {
return reject(err);
}

resolve(data);
return resolve(data);
});
});
};
Expand Down Expand Up @@ -72,6 +74,10 @@ Client.prototype.pollQueue = function pollQueue (opts = {}, handler) {
const self = this;

this.sqs.receiveMessage(this.receiveOptions, (err, data) => {
if (err) {
// Not needed
}

const promises = [];

if (data && data.Messages) {
Expand Down Expand Up @@ -109,7 +115,7 @@ Client.prototype.handleMessage = function handleMessage (message, handler) {

return messagePromise.then(() => {
return this.deleteMessage(message.ReceiptHandle);
})
});
};

/*
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Client for Amazon SQS with built-in long polling.",
"main": "index.js",
"scripts": {
"lint": "eslint ./ --ext .js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -29,5 +30,10 @@
"dependencies": {
"aws-sdk": "^2.4.7",
"lodash.assign": "^4.0.9"
},
"devDependencies": {
"@meadow/eslint-config": "^2.0.0",
"babel-eslint": "^6.1.2",
"eslint": "^3.1.1"
}
}

0 comments on commit b38f2a9

Please sign in to comment.