Fix lint issues resulting from switching to airbnb (#94)

* Fix lint issues resulting from switching to airbnb.

* Case sensitivity change

* Fix lint script to actually lint tsx files
This commit is contained in:
Jason Miller
2018-07-10 09:01:09 -04:00
committed by Jake Archibald
parent 23ea9fad49
commit 835a537c55
19 changed files with 43 additions and 13 deletions

View File

@@ -25,6 +25,22 @@ export function bind(target: any, propertyKey: string, descriptor: PropertyDescr
};
}
/** Creates a function ref that assigns its value to a given property of an object.
* @example
* // element is stored as `this.foo` when rendered.
* <div ref={linkRef(this, 'foo')} />
*/
export function linkRef<T>(obj: any, name: string) {
const refName = `$$ref_${name}`;
let ref = obj[refName];
if (!ref) {
ref = obj[refName] = (c: T) => {
obj[name] = c;
};
}
return ref;
}
/**
* Turns a given `ImageBitmap` into `ImageData`.
*/