Fixing issues raised by the linter. Fixes #68

+ just cleans up issues, and disables one test that can't be fixed.
+ biggest change is encoders not using multiple imports now.
This commit is contained in:
Paul Kinlan
2018-06-29 21:12:17 +00:00
parent 7c220b1a92
commit 3b9b1e9f2e
5 changed files with 13 additions and 15 deletions

View File

@@ -1,13 +1,14 @@
import { bind } from '../../../../lib/util';
import './styles.css';
// tslint:disable-next-line:max-line-length
function firstMatchingItem(list: DataTransferItemList, acceptVal: string): DataTransferItem | undefined {
// Split accepts values by ',' then by '/'. Trim everything & lowercase.
const accepts = acceptVal.toLowerCase().split(',').map(accept => {
const accepts = acceptVal.toLowerCase().split(',').map((accept) => {
return accept.trim().split('/').map(part => part.trim());
}).filter(acceptParts => acceptParts.length === 2); // Filter invalid values
return Array.from(list).find(item => {
return Array.from(list).find((item) => {
if (item.kind !== 'file') return false;
// 'Parse' the type.
@@ -56,7 +57,7 @@ export class FileDrop extends HTMLElement {
constructor() {
super();
this.addEventListener('dragover', (event) => event.preventDefault());
this.addEventListener('dragover', event => event.preventDefault());
this.addEventListener('drop', this._onDrop);
this.addEventListener('dragenter', this._onDragEnter);
this.addEventListener('dragend', () => this._reset());
@@ -73,7 +74,7 @@ export class FileDrop extends HTMLElement {
@bind
private _onDragEnter(event: DragEvent) {
this._dragEnterCount++;
this._dragEnterCount += 1;
if (this._dragEnterCount > 1) return;
// We don't have data, attempt to get it and if it matches, set the correct state.
@@ -87,7 +88,7 @@ export class FileDrop extends HTMLElement {
@bind
private _onDragLeave() {
this._dragEnterCount--;
this._dragEnterCount -= 1;
if (this._dragEnterCount === 0) {
this._reset();
}

View File

@@ -1,5 +1,4 @@
import { FileDropEvent, FileDrop } from ".";
import { FileDropEvent, FileDrop } from '.';
declare global {
@@ -17,4 +16,4 @@ declare global {
onfiledrop?: ((this: FileDrop, ev: FileDropEvent) => any) | null;
}
}
}
}