Skip to content

Commit

Permalink
Apply more stringent linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrown committed Oct 26, 2018
1 parent b96c4aa commit b2a7b46
Show file tree
Hide file tree
Showing 22 changed files with 599 additions and 424 deletions.
16 changes: 15 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{
"rules": {
"no-with": 2,
"template-curly-spacing": ["error", "always"],
"max-len": [
2,
250
],
"no-undef": "off",
"no-extra-semi": ["error"],
"no-empty":["error"],
"multiline-comment-style": ["error", "starred-block"],
"linebreak-style": ["error", "unix"],
"no-unused-vars": ["error"],
"no-trailing-spaces": ["error"],
"no-console": ["warn",{
"allow": ["warn","error"]
}],
"indent": [
2,
4,
{
"SwitchCase": 1
}
]
}
},
"env": {
"es6": true
}
}
20 changes: 12 additions & 8 deletions lib/BotFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ function BotFrameworkBot(configuration) {
// Create a core botkit bot
var bf_botkit = Botkit(configuration || {});

// customize the bot definition, which will be used when new connections
// spawn!
/*
* customize the bot definition, which will be used when new connections
* spawn!
*/
bf_botkit.defineBot(function(botkit, config) {

var bot = {
Expand All @@ -17,7 +19,7 @@ function BotFrameworkBot(configuration) {
};

bot.send = function(message, cb) {
function done(err, res) {
function done(err) {
if (cb) {
cb(err);
}
Expand Down Expand Up @@ -112,10 +114,12 @@ function BotFrameworkBot(configuration) {

bf_botkit.middleware.normalize.use(function(bot, message, next) {

// Break out user & channel fields from event
// - These fields are used as keys for tracking conversations and storage.
// - Prefixing with channelId to ensure that users & channels for different
// platforms are unique.
/*
* Break out user & channel fields from event
* - These fields are used as keys for tracking conversations and storage.
* - Prefixing with channelId to ensure that users & channels for different
* platforms are unique.
*/

var prefix = message.address.channelId + ':';
message.user = prefix + message.address.user.id;
Expand Down Expand Up @@ -174,6 +178,6 @@ function BotFrameworkBot(configuration) {
};

return bf_botkit;
};
}

module.exports = BotFrameworkBot;
3 changes: 2 additions & 1 deletion lib/ConsoleBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function TextBot(configuration) {
};

bot.send = function(message, cb) {
// eslint-disable-next-line no-console
console.log('BOT:', message.text);
if (cb) {
cb();
Expand Down Expand Up @@ -101,6 +102,6 @@ function TextBot(configuration) {
};

return text_botkit;
};
}

module.exports = TextBot;
Loading

0 comments on commit b2a7b46

Please sign in to comment.