Use Prettier JS (#5017)

* Adds prettier

* Run lint before tests
This commit is contained in:
Florent Vilmart
2018-09-01 13:58:06 -04:00
committed by GitHub
parent 189cd259ee
commit d83a0b6808
240 changed files with 41098 additions and 29020 deletions

View File

@@ -13,7 +13,6 @@ var _adapter = Symbol();
import Config from '../Config';
export class AdaptableController {
constructor(adapter, appId, options) {
this.options = options;
this.appId = appId;
@@ -34,7 +33,7 @@ export class AdaptableController {
}
expectedAdapterType() {
throw new Error("Subclasses should implement expectedAdapterType()");
throw new Error('Subclasses should implement expectedAdapterType()');
}
validateAdapter(adapter) {
@@ -43,7 +42,7 @@ export class AdaptableController {
static validateAdapter(adapter, self, ExpectedType) {
if (!adapter) {
throw new Error(this.constructor.name + " requires an adapter");
throw new Error(this.constructor.name + ' requires an adapter');
}
const Type = ExpectedType || self.expectedAdapterType();
@@ -53,20 +52,27 @@ export class AdaptableController {
}
// Makes sure the prototype matches
const mismatches = Object.getOwnPropertyNames(Type.prototype).reduce((obj, key) => {
const adapterType = typeof adapter[key];
const expectedType = typeof Type.prototype[key];
if (adapterType !== expectedType) {
obj[key] = {
expected: expectedType,
actual: adapterType
const mismatches = Object.getOwnPropertyNames(Type.prototype).reduce(
(obj, key) => {
const adapterType = typeof adapter[key];
const expectedType = typeof Type.prototype[key];
if (adapterType !== expectedType) {
obj[key] = {
expected: expectedType,
actual: adapterType,
};
}
}
return obj;
}, {});
return obj;
},
{}
);
if (Object.keys(mismatches).length > 0) {
throw new Error("Adapter prototype don't match expected prototype", adapter, mismatches);
throw new Error(
"Adapter prototype don't match expected prototype",
adapter,
mismatches
);
}
}
}