Skip to content

Commit

Permalink
Use ESLint instead of JSHint and JSCS
Browse files Browse the repository at this point in the history
  • Loading branch information
ekmartin committed Oct 6, 2015
1 parent f31db26 commit e94a27e
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 61 deletions.
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "airbnb/legacy",
"rules": {
"func-names": 0,
"vars-on-top": 0,
"id-length": 0,
"comma-dangle": [2, "never"]
},
"env": {
"mocha": true,
"node": true
}
}
4 changes: 2 additions & 2 deletions .frigg.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- npm install
- make lint
- make cover
- npm run lint
- npm run coverage

coverage:
path: coverage/cobertura-coverage.xml
Expand Down
8 changes: 0 additions & 8 deletions .jscsrc

This file was deleted.

5 changes: 0 additions & 5 deletions .jshintrc

This file was deleted.

31 changes: 0 additions & 31 deletions Makefile

This file was deleted.

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,28 @@ as long as they're present in the channel mapping.
## Tests
Run the tests with:
```bash
$ make test
$ npm test
```

## Style Guide
slack-irc uses a slightly modified version of the
[Airbnb Style Guide](https://github.com/airbnb/javascript/tree/master/es5).
[ESLint](http://eslint.org/) is used to make sure this is followed correctly, which can be run with:

```bash
$ npm run lint
```

The deviations from the Airbnb Style Guide can be seen in the [.eslintrc](.eslintrc) file.

## Docker
A third-party Docker container can be found [here](https://github.com/caktux/slackbridge/).

## License

(The MIT License)

Copyright (c) 2015 Martin Ek <mail@ekmartin.no>
Copyright (c) 2015 Martin Ek <mail@ekmartin.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
var createBots = require('./lib/helpers').createBots;
var logger = require('winston');

/*istanbul ignore next*/
/* istanbul ignore next */
if (process.env.NODE_ENV === 'development') {
logger.level = 'debug';
}

/* istanbul ignore next*/
/* istanbul ignore next */
if (!module.parent) {
require('./lib/cli')();
}
Expand Down
1 change: 0 additions & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _ = require('lodash');
var path = require('path');
var Bot = require('./bot');
var errors = require('./errors');

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
},
"scripts": {
"start": "node index.js",
"test": "make test"
"lint": "eslint . --ignore-path .gitignore",
"coverage": "istanbul cover _mocha $(find test -name '*.test.js') && istanbul report cobertura",
"test": "npm run lint && npm run coverage"
},
"bin": {
"slack-irc": "./index.js"
Expand All @@ -38,11 +40,13 @@
},
"devDependencies": {
"chai": "~2.3.0",
"eslint": "~1.6.0",
"eslint-config-airbnb": "~0.1.0",
"istanbul": "~0.3.5",
"jscs": "~1.13.1",
"jshint": "~2.7.0",
"mocha": "~2.2.5",
"rewire": "^2.3.1",
"rewire": "~2.3.1",
"sinon": "~1.14.1",
"sinon-chai": "~2.7.0"
}
Expand Down
3 changes: 1 addition & 2 deletions test/bot-events.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* jshint expr: true */
/* eslint no-unused-expressions: 0 */
var chai = require('chai');
var sinonChai = require('sinon-chai');
var sinon = require('sinon');
Expand All @@ -7,7 +7,6 @@ var irc = require('irc');
var logger = require('winston');
var Bot = rewire('../lib/bot');
var SlackStub = require('./stubs/slack-stub');
var ChannelStub = require('./stubs/channel-stub');
var ClientStub = require('./stubs/irc-client-stub');
var config = require('./fixtures/single-test-config.json');

Expand Down
3 changes: 1 addition & 2 deletions test/bot.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr: true */
/* eslint no-unused-expressions: 0 */
var chai = require('chai');
var sinonChai = require('sinon-chai');
var sinon = require('sinon');
var rewire = require('rewire');
var irc = require('irc');
var Bot = rewire('../lib/bot');
Expand Down
2 changes: 1 addition & 1 deletion test/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* jshint expr: true */
/* eslint no-unused-expressions: 0 */
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
Expand Down
3 changes: 1 addition & 2 deletions test/create-bots.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr: true */
/* eslint no-unused-expressions: 0 */
var chai = require('chai');
var logger = require('winston');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
var createBots = require('../lib/helpers').createBots;
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/slack-stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function SlackStub() {
util.inherits(SlackStub, events.EventEmitter);

SlackStub.prototype.getChannelStub = function() {
if (this.returnWrongStubInfo) return;
if (this.returnWrongStubInfo) return null;
return new ChannelStub();
};

Expand Down

0 comments on commit e94a27e

Please sign in to comment.