Skip to content

Commit

Permalink
Update dependencies and update eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
ekmartin committed Mar 3, 2016
1 parent 8175ed9 commit 710be88
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 40 deletions.
17 changes: 2 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
{
"extends": "airbnb/base",
"rules": {
"func-names": 0,
"vars-on-top": 0,
"id-length": 0,
"comma-dangle": [2, "never"],
"object-curly-spacing": [2, "always"],
"prefer-spread": 2,
"constructor-super": 2,
"arrow-spacing": [2, { "before": true, "after": true }],
"space-before-function-paren": 0
},
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"extends": "webkom",
"parser": "babel-eslint",
"env": {
"mocha": true,
"node": true
Expand Down
6 changes: 3 additions & 3 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Bot {
constructor(options) {
REQUIRED_FIELDS.forEach(field => {
if (!options[field]) {
throw new ConfigurationError('Missing configuration field ' + field);
throw new ConfigurationError(`Missing configuration field ${field}`);
}
});

Expand Down Expand Up @@ -93,12 +93,12 @@ class Bot {
this.ircClient.on('message', this.sendToSlack.bind(this));

this.ircClient.on('notice', (author, to, text) => {
const formattedText = '*' + text + '*';
const formattedText = `*${text}*`;
this.sendToSlack(author, to, formattedText);
});

this.ircClient.on('action', (author, to, text) => {
const formattedText = '_' + text + '_';
const formattedText = `_${text}_`;
this.sendToSlack(author, to, formattedText);
});

Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,25 @@
"dependencies": {
"check-env": "1.2.0",
"commander": "2.9.0",
"irc": "0.4.0",
"irc": "0.4.1",
"lodash": "4.6.1",
"slack-client": "1.5.0",
"strip-json-comments": "2.0.0",
"strip-json-comments": "2.0.1",
"winston": "2.2.0"
},
"devDependencies": {
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-eslint": "^5.0.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"chai": "3.4.1",
"eslint": "^1.10.2",
"eslint-config-airbnb": "^3.1.0",
"mocha": "2.3.4",
"nyc": "^5.3.0",
"sinon": "1.17.2",
"babel-cli": "^6.6.4",
"babel-core": "^6.6.4",
"babel-eslint": "^6.0.0-beta.1",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"chai": "3.5.0",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"eslint-config-webkom": "^1.3.4",
"mocha": "2.4.5",
"nyc": "^5.6.0",
"sinon": "1.17.3",
"sinon-chai": "2.8.0"
}
}
2 changes: 1 addition & 1 deletion test/bot-events.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-unused-expressions: 0 */
/* eslint-disable prefer-arrow-callback, no-unused-expressions */
import chai from 'chai';
import sinonChai from 'sinon-chai';
import sinon from 'sinon';
Expand Down
2 changes: 1 addition & 1 deletion test/bot.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-unused-expressions: 0 */
/* eslint-disable prefer-arrow-callback, no-unused-expressions */
import chai from 'chai';
import sinon from 'sinon';
import logger from 'winston';
Expand Down
10 changes: 5 additions & 5 deletions test/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-unused-expressions: 0 */
/* eslint-disable prefer-arrow-callback, no-unused-expressions */
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
Expand All @@ -25,28 +25,28 @@ describe('CLI', function() {
});

it('should be possible to give the config as an env var', function() {
process.env.CONFIG_FILE = process.cwd() + '/test/fixtures/test-config.json';
process.env.CONFIG_FILE = `${process.cwd()}/test/fixtures/test-config.json`;
process.argv = ['node', 'index.js'];
cli();
this.createBotsStub.should.have.been.calledWith(testConfig);
});

it('should strip comments from JSON config', function() {
process.env.CONFIG_FILE = process.cwd() + '/test/fixtures/test-config-comments.json';
process.env.CONFIG_FILE = `${process.cwd()}/test/fixtures/test-config-comments.json`;
process.argv = ['node', 'index.js'];
cli();
this.createBotsStub.should.have.been.calledWith(testConfig);
});

it('should support JS configs', function() {
process.env.CONFIG_FILE = process.cwd() + '/test/fixtures/test-javascript-config.js';
process.env.CONFIG_FILE = `${process.cwd()}/test/fixtures/test-javascript-config.js`;
process.argv = ['node', 'index.js'];
cli();
this.createBotsStub.should.have.been.calledWith(testConfig);
});

it('should throw a ConfigurationError for invalid JSON', function() {
process.env.CONFIG_FILE = process.cwd() + '/test/fixtures/invalid-config.json';
process.env.CONFIG_FILE = `${process.cwd()}/test/fixtures/invalid-config.json`;
process.argv = ['node', 'index.js'];
const wrap = () => cli();
(wrap).should.throw('The configuration file contains invalid JSON');
Expand Down
2 changes: 1 addition & 1 deletion test/create-bots.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-unused-expressions: 0 */
/* eslint-disable prefer-arrow-callback, no-unused-expressions */
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
Expand Down
2 changes: 1 addition & 1 deletion test/join-part.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-unused-expressions: 0 */
/* eslint-disable prefer-arrow-callback, no-unused-expressions */
import _ from 'lodash';
import chai from 'chai';
import sinonChai from 'sinon-chai';
Expand Down

0 comments on commit 710be88

Please sign in to comment.