Permalink
Browse files

jshint —> semistandard

  • Loading branch information...
1 parent 583e15d commit 695cbe7c80b12cf36f0190a17c4c37c2e4e9cc61 @corymsmith corymsmith committed Oct 22, 2016
Showing with 61 additions and 95 deletions.
  1. +0 −32 .jshintrc
  2. +0 −1 .npmignore
  3. +1 −1 example/app.js
  4. +12 −3 package.json
  5. +1 −1 src/index.js
  6. +6 −7 src/services/call.js
  7. +6 −7 src/services/sms.js
  8. +0 −3 test/call.test.js
  9. +33 −38 test/sms.test.js
  10. +2 −2 test/test-app.js
View
@@ -1,32 +0,0 @@
-{
- "node": true,
- "esnext": true,
- "bitwise": true,
- "camelcase": true,
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "indent": 2,
- "latedef": "nofunc",
- "newcap": true,
- "noarg": true,
- "quotmark": "single",
- "regexp": true,
- "undef": true,
- "unused": true,
- "strict": false,
- "trailing": true,
- "smarttabs": true,
- "white": false,
- "loopfunc": true,
- "expr": true,
- "globals": {
- "it": true,
- "describe": true,
- "before": true,
- "beforeEach": true,
- "after": true,
- "afterEach": true,
- "exports": true
- }
-}
View
@@ -1,6 +1,5 @@
.babelrc
.codeclimate.yml
-.jshintrc
.travis.yml
.idea/
src/
View
@@ -39,4 +39,4 @@ const port = 3030;
app.listen(port, function () {
console.log(`Feathers server listening on port ${port}`);
-});
+});
View
@@ -36,11 +36,19 @@
"release:major": "npm version major && npm publish",
"compile": "rm -rf lib/ && babel -d lib/ src/",
"watch": "babel --watch -d lib/ src/",
- "jshint": "jshint src/. test/. --config",
+ "lint": "eslint-if-supported semistandard --fix",
"mocha": "mocha test/ --compilers js:babel-core/register",
- "test": "npm run compile && npm run jshint && npm run mocha && nsp check",
+ "test": "npm run compile && npm run lint && npm run mocha && nsp check",
"start": "node example/app"
},
+ "semistandard": {
+ "env": [
+ "mocha"
+ ],
+ "ignore": [
+ "/lib"
+ ]
+ },
"engines": {
"node": ">=0.10.0",
"npm": ">=1.4.0"
@@ -60,12 +68,13 @@
"babel-preset-es2015": "^6.3.13",
"body-parser": "^1.13.2",
"chai": "^3.0.0",
+ "eslint-if-supported": "^1.0.1",
"feathers": "^2.0.0-pre.4",
"feathers-rest": "^1.1.1",
"feathers-socketio": "^1.3.3",
- "jshint": "^2.8.0",
"mocha": "^2.2.5",
"nsp": "^2.2.0",
+ "semistandard": "^9.1.0",
"sinon": "^1.17.3"
}
}
View
@@ -3,4 +3,4 @@ if (!global._babelPolyfill) { require('babel-polyfill'); }
import call from './services/call';
import sms from './services/sms';
-export default { call, sms };
+export default { call, sms };
View
@@ -2,8 +2,7 @@ import errors from 'feathers-errors';
import twilio from 'twilio';
class Service {
- constructor(options = {}) {
-
+ constructor (options = {}) {
if (!options.accountSid) {
throw new Error('Twilio `accountSid` needs to be provided');
}
@@ -17,14 +16,14 @@ class Service {
this.twilio = twilio(options.accountSid, options.authToken);
}
- find(params) {
+ find (params) {
params = params || {};
return new Promise((resolve, reject) => {
return this.twilio.calls.get().then(resolve).catch(reject);
});
}
- get(id) {
+ get (id) {
return new Promise((resolve, reject) => {
if (!id) {
return reject(new errors.BadRequest('`id` needs to be provided'));
@@ -34,7 +33,7 @@ class Service {
});
}
- create(data) {
+ create (data) {
return new Promise((resolve, reject) => {
data.from = data.from || this.from;
@@ -55,8 +54,8 @@ class Service {
}
}
-export default function init(options) {
+export default function init (options) {
return new Service(options);
}
-init.Service = Service;
+init.Service = Service;
View
@@ -2,8 +2,7 @@ import errors from 'feathers-errors';
import twilio from 'twilio';
class Service {
- constructor(options = {}) {
-
+ constructor (options = {}) {
if (!options.accountSid) {
throw new Error('Twilio `accountSid` needs to be provided');
}
@@ -17,15 +16,15 @@ class Service {
this.twilio = twilio(options.accountSid, options.authToken);
}
- find(params) {
+ find (params) {
params = params || {};
// TODO (EK): Do something with params and pagination
return new Promise((resolve, reject) => {
return this.twilio.messages.get().then(resolve).catch(reject);
});
}
- get(id) {
+ get (id) {
return new Promise((resolve, reject) => {
if (!id) {
return reject(new errors.BadRequest('`id` needs to be provided'));
@@ -35,7 +34,7 @@ class Service {
});
}
- create(data) {
+ create (data) {
return new Promise((resolve, reject) => {
data.from = data.from || this.from;
@@ -56,8 +55,8 @@ class Service {
}
}
-export default function init(options) {
+export default function init (options) {
return new Service(options);
}
-init.Service = Service;
+init.Service = Service;
View
@@ -1,6 +1,3 @@
-/*jshint expr: true*/
-
-
import { expect } from 'chai';
import testApp from './test-app';
import { call as callService } from '../src';
View
@@ -1,7 +1,4 @@
-/*jshint expr: true*/
-
-import chai from 'chai';
-import { expect } from 'chai';
+import chai, { expect } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
chai.use(sinonChai);
@@ -15,7 +12,6 @@ let server;
let app;
describe('Twilio SMS Service', function () {
-
describe('Initialization', () => {
describe('when missing accountSid key', () => {
it('throws an error', () => {
@@ -30,51 +26,51 @@ describe('Twilio SMS Service', function () {
});
});
- describe('Validation', () => {
- before(done => {
- const options = {
- accountSid: 'your account sid',
- authToken: 'your auth token' // ex. your.domain.com
- };
- app = testApp(options);
+ describe('Validation', () => {
+ before(done => {
+ const options = {
+ accountSid: 'your account sid',
+ authToken: 'your auth token' // ex. your.domain.com
+ };
+ app = testApp(options);
- server = app.listen(3030, () => {
- done();
- });
+ server = app.listen(3030, () => {
+ done();
});
+ });
- after(done => server.close(() => done()));
+ after(done => server.close(() => done()));
- describe('when missing from field', () => {
- it('throws an error', (done) => {
- app.service('twilio/sms').create({}).then(done).catch(err => {
- expect(err.code).to.equal(400);
- expect(err.message).to.equal('`from` must be specified');
- done();
- });
+ describe('when missing from field', () => {
+ it('throws an error', (done) => {
+ app.service('twilio/sms').create({}).then(done).catch(err => {
+ expect(err.code).to.equal(400);
+ expect(err.message).to.equal('`from` must be specified');
+ done();
});
});
+ });
- describe('when missing to field', () => {
- it('throws an error', (done) => {
- app.service('twilio/sms').create({from: '+15005550006'}).then(done).catch(err => {
- expect(err.code).to.equal(400);
- expect(err.message).to.equal('`to` must be specified');
- done();
- });
+ describe('when missing to field', () => {
+ it('throws an error', (done) => {
+ app.service('twilio/sms').create({from: '+15005550006'}).then(done).catch(err => {
+ expect(err.code).to.equal(400);
+ expect(err.message).to.equal('`to` must be specified');
+ done();
});
});
+ });
- describe('when missing body or mediaUrl field', () => {
- it('throws an error', (done) => {
- app.service('twilio/sms').create({from: '+15005550006', to: '+15551234567'}).then(done).catch(err => {
- expect(err.code).to.equal(400);
- expect(err.message).to.equal('`body` or `mediaUrl` must be specified');
- done();
- });
+ describe('when missing body or mediaUrl field', () => {
+ it('throws an error', (done) => {
+ app.service('twilio/sms').create({from: '+15005550006', to: '+15551234567'}).then(done).catch(err => {
+ expect(err.code).to.equal(400);
+ expect(err.message).to.equal('`body` or `mediaUrl` must be specified');
+ done();
});
});
});
+ });
describe('Sending messages', () => {
var createMessage;
@@ -161,4 +157,3 @@ describe('Twilio SMS Service', function () {
});
});
-
View
@@ -3,9 +3,9 @@ const smsService = require('../lib').sms;
const callService = require('../lib').call;
// We're passing in options just to configure the test app for certain test scenarios
-export default function(options) {
+export default function (options) {
// Create a feathers instance with a mailer service
-var app = feathers()
+ var app = feathers()
.use('/twilio/sms', smsService(options))
.use('/twilio/calls', callService(options));
return app;

0 comments on commit 695cbe7

Please sign in to comment.