From 710be8870ab23852c1782d4cacf14fd35ed82ca8 Mon Sep 17 00:00:00 2001 From: Martin Ek Date: Thu, 3 Mar 2016 15:48:50 +0100 Subject: [PATCH] Update dependencies and update eslint config --- .eslintrc | 17 ++--------------- lib/bot.js | 6 +++--- package.json | 27 ++++++++++++++------------- test/bot-events.test.js | 2 +- test/bot.test.js | 2 +- test/cli.test.js | 10 +++++----- test/create-bots.test.js | 2 +- test/join-part.test.js | 2 +- 8 files changed, 28 insertions(+), 40 deletions(-) diff --git a/.eslintrc b/.eslintrc index 12ac7b4..6f3b867 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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 diff --git a/lib/bot.js b/lib/bot.js index bacd9f0..0cae845 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -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}`); } }); @@ -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); }); diff --git a/package.json b/package.json index c576b47..1b7ba34 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/test/bot-events.test.js b/test/bot-events.test.js index 59eba3f..543b807 100644 --- a/test/bot-events.test.js +++ b/test/bot-events.test.js @@ -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'; diff --git a/test/bot.test.js b/test/bot.test.js index c25ffe1..11cfcfd 100644 --- a/test/bot.test.js +++ b/test/bot.test.js @@ -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'; diff --git a/test/cli.test.js b/test/cli.test.js index f064239..a746ff0 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -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'; @@ -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'); diff --git a/test/create-bots.test.js b/test/create-bots.test.js index 1213bc4..5d392a3 100644 --- a/test/create-bots.test.js +++ b/test/create-bots.test.js @@ -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'; diff --git a/test/join-part.test.js b/test/join-part.test.js index 06d3d42..89cb93a 100644 --- a/test/join-part.test.js +++ b/test/join-part.test.js @@ -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';