From 0c3e1cbb4642e07028be31bc78e8555ef9b4ea32 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Wed, 20 Jan 2016 10:57:51 +0100 Subject: [PATCH] Fix linting --- src/plugins/GoogleDrive.js | 86 ++++++++++++++-------------- website/src/examples/dropbox/app.es6 | 5 +- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/plugins/GoogleDrive.js b/src/plugins/GoogleDrive.js index 8a7c9a40d..0ed6129e5 100644 --- a/src/plugins/GoogleDrive.js +++ b/src/plugins/GoogleDrive.js @@ -1,35 +1,37 @@ -import Utils from '../core/Utils'; -import Plugin from './Plugin'; -import request from 'superagent'; +// import Utils from '../core/Utils' +import Plugin from './Plugin' +import request from 'superagent' export default class Drive extends Plugin { - constructor(core, opts) { - super(core, opts); - this.type = 'selecter'; - this.authenticate = this.authenticate.bind(this); - this.connect = this.connect.bind(this); - this.render = this.render.bind(this); - this.files = []; - this.currentDir = '/'; + constructor (core, opts) { + super(core, opts) + this.type = 'selecter' + this.authenticate = this.authenticate.bind(this) + this.connect = this.connect.bind(this) + this.render = this.render.bind(this) + this.files = [] + this.currentDir = '/' } - connect(target) { - this.getDirectory(); + connect (target) { + this.getDirectory() } - authenticate() { + authenticate () { request.get('/drive/authenticate') .query({}) .end((err, res) => { - + if (err) { + console.err(err) + } }) } - addFile() { + addFile () { } - getDirectory() { + getDirectory () { var opts = { dir: 'pizza' } @@ -37,57 +39,57 @@ export default class Drive extends Plugin { .query(opts) .set('Content-Type', 'application/json') .end((err, res) => { - console.log(err); - console.log('yo!'); - console.log(res); + console.log(err) + console.log('yo!') + console.log(res) }) } - run(results) { + run (results) { } - render(files) { + render (files) { // for each file in the directory, create a list item element const elems = files.map((file, i) => { - const icon = (file.isFolder) ? 'folder' : 'file'; - return `
  • ${icon} : ${file.name}
  • `; - }); + const icon = (file.isFolder) ? 'folder' : 'file' + return `
  • ${icon} : ${file.name}
  • ` + }) // appends the list items to the target - this._target.innerHTML = elems.sort().join(''); + this._target.innerHTML = elems.sort().join('') if (this.currentDir.length > 1) { - const parent = document.createElement('LI'); - parent.setAttribute('data-type', 'parent'); - parent.innerHTML = '...'; - this._target.appendChild(parent); + const parent = document.createElement('LI') + parent.setAttribute('data-type', 'parent') + parent.innerHTML = '...' + this._target.appendChild(parent) } // add an onClick to each list item - const fileElems = this._target.querySelectorAll('li'); + const fileElems = this._target.querySelectorAll('li') Array.prototype.forEach.call(fileElems, element => { - const type = element.getAttribute('data-type'); + const type = element.getAttribute('data-type') if (type === 'file') { element.addEventListener('click', () => { - this.files.push(element.getAttribute('data-name')); - console.log(`files: ${this.files}`); - }); + this.files.push(element.getAttribute('data-name')) + console.log(`files: ${this.files}`) + }) } else { element.addEventListener('dblclick', () => { - const length = this.currentDir.split('/').length; + const length = this.currentDir.split('/').length if (type === 'folder') { - this.currentDir = `${this.currentDir}${element.getAttribute('data-name')}/`; + this.currentDir = `${this.currentDir}${element.getAttribute('data-name')}/` } else if (type === 'parent') { - this.currentDir = `${this.currentDir.split('/').slice(0, length - 2).join('/')}/`; + this.currentDir = `${this.currentDir.split('/').slice(0, length - 2).join('/')}/` } - console.log(this.currentDir); - this.getDirectory(); - }); + console.log(this.currentDir) + this.getDirectory() + }) } - }); + }) } } diff --git a/website/src/examples/dropbox/app.es6 b/website/src/examples/dropbox/app.es6 index ed46ae133..121644295 100644 --- a/website/src/examples/dropbox/app.es6 +++ b/website/src/examples/dropbox/app.es6 @@ -6,6 +6,7 @@ uppy .use(Dropbox, {selector: '#target'}) .run() -const drop = new Dropbox(); +const drop = new Dropbox() -console.log(uppy.type); +console.log(uppy.type) +console.dir(drop)