Permalink
Browse files

jshint —> semistandard

This installd and implements semistandard for linting.  Uses eslint-if-supported for tests.
  • Loading branch information...
1 parent 38823c0 commit f401215d97f5a31cc4a68b7945604088011aa891 @marshallswain marshallswain committed Oct 17, 2016
View
@@ -35,10 +35,15 @@
"release:prerelease": "npm version prerelease && npm publish --tag pegasus",
"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 --opts mocha.opts",
"coverage": "istanbul cover _mocha -- --opts mocha.opts",
- "test": "npm run compile && npm run jshint && npm run coverage && nsp check"
+ "test": "npm run compile && npm run lint && npm run coverage && nsp check"
+ },
+ "semistandard": {
+ "env": [
+ "mocha"
+ ]
},
"engines": {
"node": ">= 0.10.0",
@@ -59,6 +64,7 @@
"babel-plugin-add-module-exports": "^0.2.0",
"babel-preset-es2015": "^6.3.13",
"body-parser": "^1.13.2",
+ "eslint-if-supported": "^1.0.1",
"feathers-rest": "^1.1.0",
"feathers-socketio": "^1.1.0",
"istanbul": "^1.1.0-alpha.1",
@@ -67,6 +73,7 @@
"nsp": "^2.2.0",
"q": "^1.0.1",
"request": "^2.x",
+ "semistandard": "^9.1.0",
"socket.io-client": "^1.4.6"
},
"browser": {
View
@@ -10,7 +10,7 @@ const Proto = Uberproto.extend({
});
export default {
- init() {
+ init () {
Object.assign(this, {
methods,
mixins: mixins(),
@@ -20,13 +20,13 @@ export default {
});
},
- service(location, service, options = {}) {
+ service (location, service, options = {}) {
location = stripSlashes(location);
- if(!service) {
+ if (!service) {
const current = this.services[location];
- if(typeof current === 'undefined' && typeof this.defaultService === 'function') {
+ if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
return this.service(location, this.defaultService(location), options);
}
@@ -40,7 +40,7 @@ export default {
// Add all the mixins
this.mixins.forEach(fn => fn.call(this, protoService));
- if(typeof protoService._setup === 'function') {
+ if (typeof protoService._setup === 'function') {
protoService._setup(this, location);
}
@@ -58,8 +58,9 @@ export default {
return (this.services[location] = protoService);
},
- use(location) {
- let service, middleware = Array.from(arguments)
+ use (location) {
+ let service;
+ let middleware = Array.from(arguments)
.slice(1)
.reduce(function (middleware, arg) {
if (typeof arg === 'function') {
@@ -80,7 +81,7 @@ export default {
);
// Check for service (any object with at least one service method)
- if(hasMethod(['handle', 'set']) || !hasMethod(this.methods.concat('setup'))) {
+ if (hasMethod(['handle', 'set']) || !hasMethod(this.methods.concat('setup'))) {
return this._super.apply(this, arguments);
}
@@ -90,7 +91,7 @@ export default {
return this;
},
- setup() {
+ setup () {
// Setup each service (pass the app so that they can look up other services etc.)
Object.keys(this.services).forEach(path => {
const service = this.services[path];
@@ -110,13 +111,13 @@ export default {
// That just takes a function in order to keep Feathers plugin configuration easier.
// Environment specific configurations should be done as suggested in the 4.x migration guide:
// https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x
- configure(fn){
+ configure (fn) {
fn.call(this);
return this;
},
- listen() {
+ listen () {
const server = this._super.apply(this, arguments);
this.setup(server);
View
@@ -1,42 +1,42 @@
import { EventEmitter } from 'events';
import Proto from 'uberproto';
-export default function() {
+export default function () {
const app = {
settings: {},
- get(name) {
+ get (name) {
return this.settings[name];
},
- set(name, value) {
+ set (name, value) {
this.settings[name] = value;
return this;
},
- disable(name) {
+ disable (name) {
this.settings[name] = false;
return this;
},
- disabled(name) {
+ disabled (name) {
return !this.settings[name];
},
- enable(name) {
+ enable (name) {
this.settings[name] = true;
return this;
},
- enabled(name) {
+ enabled (name) {
return !!this.settings[name];
},
- use() {
+ use () {
throw new Error('Middleware functions can not be used in the Feathers client');
},
- listen() {
+ listen () {
return {};
}
};
View
@@ -1,8 +1,8 @@
import feathers from '../feathers';
import express from './express';
-export default function createApplication(... args) {
- return feathers(express(... args));
+export default function createApplication (...args) {
+ return feathers(express(...args));
}
createApplication.version = '2.0.1';
View
@@ -7,7 +7,7 @@ import Application from './application';
* @return {Function}
* @api public
*/
-export default function createApplication(app) {
+export default function createApplication (app) {
Proto.mixin(Application, app);
app.init();
return app;
View
@@ -1,10 +1,10 @@
-if(!global._babelPolyfill) { require('babel-polyfill'); }
+if (!global._babelPolyfill) { require('babel-polyfill'); }
import express from 'express';
import feathers from './feathers';
-export default function createApplication(... args) {
- return feathers(express(... args));
+export default function createApplication (...args) {
+ return feathers(express(...args));
}
// Expose all express methods (like express.engine())
View
@@ -10,17 +10,17 @@ const eventMappings = {
patch: 'patched'
};
-function upperCase(name) {
+function upperCase (name) {
return name.charAt(0).toUpperCase() + name.substring(1);
}
-export default function(service) {
+export default function (service) {
const app = this;
const isEmitter = typeof service.on === 'function' &&
typeof service.emit === 'function';
const emitter = service._rubberDuck = rubberduck.emitter(service);
- if(typeof service.mixin === 'function' && !isEmitter) {
+ if (typeof service.mixin === 'function' && !isEmitter) {
service.mixin(EventEmitter.prototype);
}
View
@@ -1,13 +1,13 @@
-export default function() {
+export default function () {
const mixins = [
require('./promise'),
require('./event'),
require('./normalizer')
];
// Override push to make sure that normalize is always the last
- mixins.push = function() {
- const args = [ this.length - 1, 0].concat(Array.from(arguments));
+ mixins.push = function () {
+ const args = [this.length - 1, 0].concat(Array.from(arguments));
this.splice.apply(this, args);
return this.length;
};
@@ -5,8 +5,8 @@ export default function (service) {
const mixin = {};
this.methods.forEach(method => {
- if(typeof service[method] === 'function') {
- mixin[method] = function() {
+ if (typeof service[method] === 'function') {
+ mixin[method] = function () {
return this._super.apply(this, getArguments(method, arguments));
};
}
@@ -1,13 +1,13 @@
-function isPromise(result) {
+function isPromise (result) {
return typeof result !== 'undefined' &&
typeof result.then === 'function';
}
-function wrapper() {
+function wrapper () {
const result = this._super.apply(this, arguments);
const callback = arguments[arguments.length - 1];
- if(typeof callback === 'function' && isPromise(result)) {
+ if (typeof callback === 'function' && isPromise(result)) {
result.then(data => callback(null, data), error => callback(error));
}
return result;
@@ -18,7 +18,7 @@ export default function (service) {
const mixin = {};
this.methods.forEach(method => {
- if(typeof service[method] === 'function') {
+ if (typeof service[method] === 'function') {
mixin[method] = wrapper;
}
});
Oops, something went wrong.

0 comments on commit f401215

Please sign in to comment.