You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/08/29 23:34:38 UTC

[5/5] cordova-plugin-file git commit: CB-12895 : setup eslint and took out jshint

CB-12895 : setup eslint and took out jshint


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/07557e02
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/07557e02
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/07557e02

Branch: refs/heads/master
Commit: 07557e02a6ae58cf54d4c96e5ea89d6180ab7782
Parents: b514aaf
Author: Audrey So <au...@apache.org>
Authored: Fri Jun 9 16:06:08 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Wed Aug 23 09:38:32 2017 -0700

----------------------------------------------------------------------
 .eslintrc.yml                                 |   10 +
 package.json                                  |   12 +-
 src/blackberry10/index.js                     |   24 +-
 src/browser/FileProxy.js                      |  354 ++--
 src/firefoxos/FileProxy.js                    |  272 +--
 src/windows/FileProxy.js                      |  625 +++---
 tests/tests.js                                | 2158 ++++++++++----------
 www/DirectoryEntry.js                         |   42 +-
 www/DirectoryReader.js                        |   19 +-
 www/Entry.js                                  |  132 +-
 www/File.js                                   |    5 +-
 www/FileEntry.js                              |   29 +-
 www/FileError.js                              |    4 +-
 www/FileReader.js                             |  109 +-
 www/FileSystem.js                             |   10 +-
 www/FileUploadOptions.js                      |    2 +-
 www/FileUploadResult.js                       |   10 +-
 www/FileWriter.js                             |  106 +-
 www/Flags.js                                  |    2 +-
 www/Metadata.js                               |    6 +-
 www/ProgressEvent.js                          |   24 +-
 www/android/FileSystem.js                     |   11 +-
 www/blackberry10/FileSystem.js                |   27 +-
 www/blackberry10/copyTo.js                    |   56 +-
 www/blackberry10/createEntryFromNative.js     |   42 +-
 www/blackberry10/getDirectory.js              |   57 +-
 www/blackberry10/getFile.js                   |   30 +-
 www/blackberry10/getFileMetadata.js           |   37 +-
 www/blackberry10/getMetadata.js               |   32 +-
 www/blackberry10/getParent.js                 |   37 +-
 www/blackberry10/info.js                      |   10 +-
 www/blackberry10/moveTo.js                    |    6 +-
 www/blackberry10/readAsArrayBuffer.js         |   46 +-
 www/blackberry10/readAsBinaryString.js        |   46 +-
 www/blackberry10/readAsDataURL.js             |   43 +-
 www/blackberry10/readAsText.js                |   51 +-
 www/blackberry10/readEntries.js               |   64 +-
 www/blackberry10/remove.js                    |   40 +-
 www/blackberry10/removeRecursively.js         |   46 +-
 www/blackberry10/requestAllFileSystems.js     |    4 +-
 www/blackberry10/requestAnimationFrame.js     |    6 +-
 www/blackberry10/requestFileSystem.js         |   22 +-
 www/blackberry10/resolveLocalFileSystemURI.js |   93 +-
 www/blackberry10/setMetadata.js               |   10 +-
 www/blackberry10/truncate.js                  |   46 +-
 www/blackberry10/write.js                     |   51 +-
 www/browser/FileSystem.js                     |    9 +-
 www/browser/Preparing.js                      |   72 +-
 www/fileSystemPaths.js                        |    5 +-
 www/fileSystems-roots.js                      |    7 +-
 www/fileSystems.js                            |    2 +-
 www/firefoxos/FileSystem.js                   |    7 +-
 www/ios/FileSystem.js                         |    9 +-
 www/osx/FileSystem.js                         |    9 +-
 www/requestFileSystem.js                      |   29 +-
 www/resolveLocalFileSystemURI.js              |   45 +-
 www/ubuntu/FileSystem.js                      |    9 +-
 www/ubuntu/FileWriter.js                      |   61 +-
 www/ubuntu/fileSystems-roots.js               |   13 +-
 www/wp/FileUploadOptions.js                   |   13 +-
 60 files changed, 2587 insertions(+), 2571 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+  indent:
+    - error
+    - 4
+  camelcase: off
+  padded-blocks: off
+  operator-linebreak: off
+  no-throw-literal: off
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8d25378..1747782 100644
--- a/package.json
+++ b/package.json
@@ -43,8 +43,8 @@
     "cordova-firefoxos"
   ],
   "scripts": {
-    "test": "npm run jshint",
-    "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
+    "test": "npm run eslint",
+    "eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint src && node node_modules/eslint/bin/eslint tests"
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -56,6 +56,12 @@
     }
   },
   "devDependencies": {
-    "jshint": "^2.6.0"
+    "eslint": "^3.19.0",
+    "eslint-config-semistandard": "^11.0.0",
+    "eslint-config-standard": "^10.2.1",
+    "eslint-plugin-import": "^2.3.0",
+    "eslint-plugin-node": "^5.0.0",
+    "eslint-plugin-promise": "^3.5.0",
+    "eslint-plugin-standard": "^3.0.1"
   }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index e995986..c5d8837 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -22,26 +22,26 @@
 /* global PluginResult */
 
 module.exports = {
-    setSandbox : function (success, fail, args, env) {
-        require("lib/webview").setSandbox(JSON.parse(decodeURIComponent(args[0])));
+    setSandbox: function (success, fail, args, env) {
+        require('lib/webview').setSandbox(JSON.parse(decodeURIComponent(args[0])));
         new PluginResult(args, env).ok();
     },
 
     getHomePath: function (success, fail, args, env) {
-        var homeDir = window.qnx.webplatform.getApplication().getEnv("HOME");
+        var homeDir = window.qnx.webplatform.getApplication().getEnv('HOME');
         new PluginResult(args, env).ok(homeDir);
     },
 
     requestAllPaths: function (success, fail, args, env) {
-        var homeDir = 'file://' + window.qnx.webplatform.getApplication().getEnv("HOME").replace('/data', ''),
-            paths = {
-                applicationDirectory: homeDir + '/app/native/',
-                applicationStorageDirectory: homeDir + '/',
-                dataDirectory: homeDir + '/data/webviews/webfs/persistent/local__0/',
-                cacheDirectory: homeDir + '/data/webviews/webfs/temporary/local__0/',
-                externalRootDirectory: 'file:///accounts/1000/removable/sdcard/',
-                sharedDirectory: homeDir + '/shared/'
-            };
+        var homeDir = 'file://' + window.qnx.webplatform.getApplication().getEnv('HOME').replace('/data', '');
+        var paths = {
+            applicationDirectory: homeDir + '/app/native/',
+            applicationStorageDirectory: homeDir + '/',
+            dataDirectory: homeDir + '/data/webviews/webfs/persistent/local__0/',
+            cacheDirectory: homeDir + '/data/webviews/webfs/temporary/local__0/',
+            externalRootDirectory: 'file:///accounts/1000/removable/sdcard/',
+            sharedDirectory: homeDir + '/shared/'
+        };
         success(paths);
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/src/browser/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/FileProxy.js b/src/browser/FileProxy.js
index 2d937f4..66ad46b 100644
--- a/src/browser/FileProxy.js
+++ b/src/browser/FileProxy.js
@@ -18,10 +18,10 @@
  * under the License.
  *
  */
-(function() {
-    /*global require, exports, module*/
-    /*global FILESYSTEM_PREFIX*/
-    /*global IDBKeyRange*/
+(function () {
+    /* global require, exports, module */
+    /* global FILESYSTEM_PREFIX */
+    /* global IDBKeyRange */
 
     /* Heavily based on https://github.com/ebidel/idb.filesystem.js */
 
@@ -30,33 +30,33 @@
     if (require('./isChrome')()) {
         var pathsPrefix = {
             // Read-only directory where the application is installed.
-            applicationDirectory: location.origin + "/",
+            applicationDirectory: location.origin + '/', // eslint-disable-line no-undef
             // Where to put app-specific data files.
             dataDirectory: 'filesystem:file:///persistent/',
             // Cached files that should survive app restarts.
             // Apps should not rely on the OS to delete files in here.
-            cacheDirectory: 'filesystem:file:///temporary/',
+            cacheDirectory: 'filesystem:file:///temporary/'
         };
 
-        exports.requestAllPaths = function(successCallback) {
+        exports.requestAllPaths = function (successCallback) {
             successCallback(pathsPrefix);
         };
 
-        require("cordova/exec/proxy").add("File", module.exports);
+        require('cordova/exec/proxy').add('File', module.exports);
         return;
     }
 
-    var LocalFileSystem = require('./LocalFileSystem'),
-        FileSystem = require('./FileSystem'),
-        FileEntry = require('./FileEntry'),
-        FileError = require('./FileError'),
-        DirectoryEntry = require('./DirectoryEntry'),
-        File = require('./File');
+    var LocalFileSystem = require('./LocalFileSystem');
+    var FileSystem = require('./FileSystem');
+    var FileEntry = require('./FileEntry');
+    var FileError = require('./FileError');
+    var DirectoryEntry = require('./DirectoryEntry');
+    var File = require('./File');
 
-    (function(exports, global) {
+    (function (exports, global) {
         var indexedDB = global.indexedDB || global.mozIndexedDB;
         if (!indexedDB) {
-            throw "Firefox OS File plugin: indexedDB not supported";
+            throw 'Firefox OS File plugin: indexedDB not supported';
         }
 
         var fs_ = null;
@@ -69,23 +69,23 @@
 
         var pathsPrefix = {
             // Read-only directory where the application is installed.
-            applicationDirectory: location.origin + "/",
+            applicationDirectory: location.origin + '/', // eslint-disable-line no-undef
             // Where to put app-specific data files.
             dataDirectory: 'file:///persistent/',
             // Cached files that should survive app restarts.
             // Apps should not rely on the OS to delete files in here.
-            cacheDirectory: 'file:///temporary/',
+            cacheDirectory: 'file:///temporary/'
         };
 
         var unicodeLastChar = 65535;
 
-    /*** Exported functionality ***/
+    /** * Exported functionality ***/
 
-        exports.requestFileSystem = function(successCallback, errorCallback, args) {
+        exports.requestFileSystem = function (successCallback, errorCallback, args) {
             var type = args[0];
             // Size is ignored since IDB filesystem size depends
             // on browser implementation and can't be set up by user
-            var size = args[1]; // jshint ignore: line
+            var size = args[1]; // eslint-disable-line no-unused-vars
 
             if (type !== LocalFileSystem.TEMPORARY && type !== LocalFileSystem.PERSISTENT) {
                 if (errorCallback) {
@@ -95,23 +95,23 @@
             }
 
             var name = type === LocalFileSystem.TEMPORARY ? 'temporary' : 'persistent';
-            var storageName = (location.protocol + location.host).replace(/:/g, '_');
+            var storageName = (location.protocol + location.host).replace(/:/g, '_'); // eslint-disable-line no-undef
 
             var root = new DirectoryEntry('', DIR_SEPARATOR);
             fs_ = new FileSystem(name, root);
 
-            idb_.open(storageName, function() {
+            idb_.open(storageName, function () {
                 successCallback(fs_);
             }, errorCallback);
         };
 
         // Overridden by Android, BlackBerry 10 and iOS to populate fsMap
-        require('./fileSystems').getFs = function(name, callback) {
+        require('./fileSystems').getFs = function (name, callback) {
             callback(new FileSystem(name, fs_.root));
         };
 
         // list a directory's contents (files and folders).
-        exports.readEntries = function(successCallback, errorCallback, args) {
+        exports.readEntries = function (successCallback, errorCallback, args) {
             var fullPath = args[0];
 
             if (typeof successCallback !== 'function') {
@@ -120,18 +120,18 @@
 
             var path = resolveToFullPath_(fullPath);
 
-            exports.getDirectory(function() {
-                idb_.getAllEntries(path.fullPath + DIR_SEPARATOR, path.storagePath, function(entries) {
+            exports.getDirectory(function () {
+                idb_.getAllEntries(path.fullPath + DIR_SEPARATOR, path.storagePath, function (entries) {
                     successCallback(entries);
                 }, errorCallback);
-            }, function() {
+            }, function () {
                 if (errorCallback) {
                     errorCallback(FileError.NOT_FOUND_ERR);
                 }
             }, [path.storagePath, path.fullPath, {create: false}]);
         };
 
-        exports.getFile = function(successCallback, errorCallback, args) {
+        exports.getFile = function (successCallback, errorCallback, args) {
             var fullPath = args[0];
             var path = args[1];
             var options = args[2] || {};
@@ -139,7 +139,7 @@
             // Create an absolute path if we were handed a relative one.
             path = resolveToFullPath_(fullPath, path);
 
-            idb_.get(path.storagePath, function(fileEntry) {
+            idb_.get(path.storagePath, function (fileEntry) {
                 if (options.create === true && options.exclusive === true && fileEntry) {
                     // If create and exclusive are both true, and the path already exists,
                     // getFile must fail.
@@ -164,7 +164,7 @@
                 } else if (options.create === true && fileEntry) {
                     if (fileEntry.isFile) {
                         // Overwrite file, delete then create new.
-                        idb_['delete'](path.storagePath, function() {
+                        idb_['delete'](path.storagePath, function () {
                             var newFileEntry = new FileEntry(path.fileName, path.fullPath, new FileSystem(path.fsName, fs_.root));
 
                             newFileEntry.file_ = new MyFile({
@@ -202,16 +202,16 @@
             }, errorCallback);
         };
 
-        exports.getFileMetadata = function(successCallback, errorCallback, args) {
+        exports.getFileMetadata = function (successCallback, errorCallback, args) {
             var fullPath = args[0];
 
-            exports.getFile(function(fileEntry) {
+            exports.getFile(function (fileEntry) {
                 successCallback(new File(fileEntry.file_.name, fileEntry.fullPath, '', fileEntry.file_.lastModifiedDate,
                     fileEntry.file_.size));
             }, errorCallback, [fullPath, null]);
         };
 
-        exports.getMetadata = function(successCallback, errorCallback, args) {
+        exports.getMetadata = function (successCallback, errorCallback, args) {
             exports.getFile(function (fileEntry) {
                 successCallback(
                     {
@@ -221,21 +221,21 @@
             }, errorCallback, args);
         };
 
-        exports.setMetadata = function(successCallback, errorCallback, args) {
+        exports.setMetadata = function (successCallback, errorCallback, args) {
             var fullPath = args[0];
             var metadataObject = args[1];
 
             exports.getFile(function (fileEntry) {
-                  fileEntry.file_.lastModifiedDate = metadataObject.modificationTime;
-                  idb_.put(fileEntry, fileEntry.file_.storagePath, successCallback, errorCallback);
+                fileEntry.file_.lastModifiedDate = metadataObject.modificationTime;
+                idb_.put(fileEntry, fileEntry.file_.storagePath, successCallback, errorCallback);
             }, errorCallback, [fullPath, null]);
         };
 
-        exports.write = function(successCallback, errorCallback, args) {
-            var fileName = args[0],
-                data = args[1],
-                position = args[2],
-                isBinary = args[3]; // jshint ignore: line
+        exports.write = function (successCallback, errorCallback, args) {
+            var fileName = args[0];
+            var data = args[1];
+            var position = args[2];
+            var isBinary = args[3]; // eslint-disable-line no-unused-vars
 
             if (!data) {
                 if (errorCallback) {
@@ -245,14 +245,14 @@
             }
 
             if (typeof data === 'string' || data instanceof String) {
-                data = new Blob([data]);
+                data = new Blob([data]); // eslint-disable-line no-undef
             }
 
-            exports.getFile(function(fileEntry) {
+            exports.getFile(function (fileEntry) {
                 var blob_ = fileEntry.file_.blob_;
 
                 if (!blob_) {
-                    blob_ = new Blob([data], {type: data.type});
+                    blob_ = new Blob([data], {type: data.type}); // eslint-disable-line no-undef
                 } else {
                     // Calc the head and tail fragments
                     var head = blob_.slice(0, position);
@@ -265,7 +265,7 @@
                     }
 
                     // Do the "write". In fact, a full overwrite of the Blob.
-                    blob_ = new Blob([head, new Uint8Array(padding), data, tail],
+                    blob_ = new Blob([head, new Uint8Array(padding), data, tail], // eslint-disable-line no-undef
                         {type: data.type});
                 }
 
@@ -276,46 +276,46 @@
                 fileEntry.file_.name = blob_.name;
                 fileEntry.file_.type = blob_.type;
 
-                idb_.put(fileEntry, fileEntry.file_.storagePath, function() {
+                idb_.put(fileEntry, fileEntry.file_.storagePath, function () {
                     successCallback(data.size || data.byteLength);
                 }, errorCallback);
             }, errorCallback, [fileName, null]);
         };
 
-        exports.readAsText = function(successCallback, errorCallback, args) {
-            var fileName = args[0],
-                enc = args[1],
-                startPos = args[2],
-                endPos = args[3];
+        exports.readAsText = function (successCallback, errorCallback, args) {
+            var fileName = args[0];
+            var enc = args[1];
+            var startPos = args[2];
+            var endPos = args[3];
 
             readAs('text', fileName, enc, startPos, endPos, successCallback, errorCallback);
         };
 
-        exports.readAsDataURL = function(successCallback, errorCallback, args) {
-            var fileName = args[0],
-                startPos = args[1],
-                endPos = args[2];
+        exports.readAsDataURL = function (successCallback, errorCallback, args) {
+            var fileName = args[0];
+            var startPos = args[1];
+            var endPos = args[2];
 
             readAs('dataURL', fileName, null, startPos, endPos, successCallback, errorCallback);
         };
 
-        exports.readAsBinaryString = function(successCallback, errorCallback, args) {
-            var fileName = args[0],
-                startPos = args[1],
-                endPos = args[2];
+        exports.readAsBinaryString = function (successCallback, errorCallback, args) {
+            var fileName = args[0];
+            var startPos = args[1];
+            var endPos = args[2];
 
             readAs('binaryString', fileName, null, startPos, endPos, successCallback, errorCallback);
         };
 
-        exports.readAsArrayBuffer = function(successCallback, errorCallback, args) {
-            var fileName = args[0],
-                startPos = args[1],
-                endPos = args[2];
+        exports.readAsArrayBuffer = function (successCallback, errorCallback, args) {
+            var fileName = args[0];
+            var startPos = args[1];
+            var endPos = args[2];
 
             readAs('arrayBuffer', fileName, null, startPos, endPos, successCallback, errorCallback);
         };
 
-        exports.removeRecursively = exports.remove = function(successCallback, errorCallback, args) {
+        exports.removeRecursively = exports.remove = function (successCallback, errorCallback, args) {
             if (typeof successCallback !== 'function') {
                 throw Error('Expected successCallback argument.');
             }
@@ -326,26 +326,26 @@
                 return;
             }
 
-            function deleteEntry(isDirectory) {
+            function deleteEntry (isDirectory) {
                 // TODO: This doesn't protect against directories that have content in it.
                 // Should throw an error instead if the dirEntry is not empty.
-                idb_['delete'](fullPath, function() {
+                idb_['delete'](fullPath, function () {
                     successCallback();
-                }, function() {
-                        if (errorCallback) { errorCallback(); }
+                }, function () {
+                    if (errorCallback) { errorCallback(); }
                 }, isDirectory);
             }
 
             // We need to to understand what we are deleting:
-            exports.getDirectory(function(entry) {
+            exports.getDirectory(function (entry) {
                 deleteEntry(entry.isDirectory);
-            }, function(){
-                //DirectoryEntry was already deleted or entry is FileEntry
+            }, function () {
+                // DirectoryEntry was already deleted or entry is FileEntry
                 deleteEntry(false);
             }, [fullPath, null, {create: false}]);
         };
 
-        exports.getDirectory = function(successCallback, errorCallback, args) {
+        exports.getDirectory = function (successCallback, errorCallback, args) {
             var fullPath = args[0];
             var path = args[1];
             var options = args[2];
@@ -353,7 +353,7 @@
             // Create an absolute path if we were handed a relative one.
             path = resolveToFullPath_(fullPath, path);
 
-            idb_.get(path.storagePath, function(folderEntry) {
+            idb_.get(path.storagePath, function (folderEntry) {
                 if (!options) {
                     options = {};
                 }
@@ -423,15 +423,15 @@
             }, errorCallback);
         };
 
-        exports.getParent = function(successCallback, errorCallback, args) {
+        exports.getParent = function (successCallback, errorCallback, args) {
             if (typeof successCallback !== 'function') {
                 throw Error('Expected successCallback argument.');
             }
 
             var fullPath = args[0];
-            //fullPath is like this:
-            //file:///persistent/path/to/file or
-            //file:///persistent/path/to/directory/
+            // fullPath is like this:
+            // file:///persistent/path/to/file or
+            // file:///persistent/path/to/directory/
 
             if (fullPath === DIR_SEPARATOR || fullPath === pathsPrefix.cacheDirectory ||
                 fullPath === pathsPrefix.dataDirectory) {
@@ -439,7 +439,7 @@
                 return;
             }
 
-            //To delete all slashes at the end
+            // To delete all slashes at the end
             while (fullPath[fullPath.length - 1] === '/') {
                 fullPath = fullPath.substr(0, fullPath.length - 1);
             }
@@ -449,8 +449,8 @@
             var parentName = pathArr.pop();
             var path = pathArr.join(DIR_SEPARATOR) + DIR_SEPARATOR;
 
-            //To get parent of root files
-            var joined = path + parentName + DIR_SEPARATOR;//is like this: file:///persistent/
+            // To get parent of root files
+            var joined = path + parentName + DIR_SEPARATOR;// is like this: file:///persistent/
             if (joined === pathsPrefix.cacheDirectory || joined === pathsPrefix.dataDirectory) {
                 exports.getDirectory(successCallback, errorCallback, [joined, DIR_SEPARATOR, {create: false}]);
                 return;
@@ -459,7 +459,7 @@
             exports.getDirectory(successCallback, errorCallback, [path, parentName, {create: false}]);
         };
 
-        exports.copyTo = function(successCallback, errorCallback, args) {
+        exports.copyTo = function (successCallback, errorCallback, args) {
             var srcPath = args[0];
             var parentFullPath = args[1];
             var name = args[2];
@@ -473,33 +473,33 @@
             }
 
             // Read src file
-            exports.getFile(function(srcFileEntry) {
+            exports.getFile(function (srcFileEntry) {
 
                 var path = resolveToFullPath_(parentFullPath);
-                //Check directory
-                exports.getDirectory(function() {
+                // Check directory
+                exports.getDirectory(function () {
 
                     // Create dest file
-                    exports.getFile(function(dstFileEntry) {
+                    exports.getFile(function (dstFileEntry) {
 
-                        exports.write(function() {
+                        exports.write(function () {
                             successCallback(dstFileEntry);
                         }, errorCallback, [dstFileEntry.file_.storagePath, srcFileEntry.file_.blob_, 0]);
 
                     }, errorCallback, [parentFullPath, name, {create: true}]);
 
-                }, function() { if (errorCallback) { errorCallback(FileError.NOT_FOUND_ERR); }},
-                [path.storagePath, null, {create:false}]);
+                }, function () { if (errorCallback) { errorCallback(FileError.NOT_FOUND_ERR); } },
+                [path.storagePath, null, {create: false}]);
 
             }, errorCallback, [srcPath, null]);
         };
 
-        exports.moveTo = function(successCallback, errorCallback, args) {
+        exports.moveTo = function (successCallback, errorCallback, args) {
             var srcPath = args[0];
             // parentFullPath and name parameters is ignored because
             // args is being passed downstream to exports.copyTo method
-            var parentFullPath = args[1]; // jshint ignore: line
-            var name = args[2]; // jshint ignore: line
+            var parentFullPath = args[1]; // eslint-disable-line
+            var name = args[2]; // eslint-disable-line
 
             exports.copyTo(function (fileEntry) {
 
@@ -510,16 +510,16 @@
             }, errorCallback, args);
         };
 
-        exports.resolveLocalFileSystemURI = function(successCallback, errorCallback, args) {
+        exports.resolveLocalFileSystemURI = function (successCallback, errorCallback, args) {
             var path = args[0];
 
             // Ignore parameters
             if (path.indexOf('?') !== -1) {
-                path = String(path).split("?")[0];
+                path = String(path).split('?')[0];
             }
 
             // support for encodeURI
-            if (/\%5/g.test(path) || /\%20/g.test(path)) {
+            if (/\%5/g.test(path) || /\%20/g.test(path)) {  // eslint-disable-line no-useless-escape
                 path = decodeURI(path);
             }
 
@@ -530,23 +530,23 @@
                 return;
             }
 
-            //support for cdvfile
-            if (path.trim().substr(0,7) === "cdvfile") {
-                if (path.indexOf("cdvfile://localhost") === -1) {
+            // support for cdvfile
+            if (path.trim().substr(0, 7) === 'cdvfile') {
+                if (path.indexOf('cdvfile://localhost') === -1) {
                     if (errorCallback) {
                         errorCallback(FileError.ENCODING_ERR);
                     }
                     return;
                 }
 
-                var indexPersistent = path.indexOf("persistent");
-                var indexTemporary = path.indexOf("temporary");
+                var indexPersistent = path.indexOf('persistent');
+                var indexTemporary = path.indexOf('temporary');
 
-                //cdvfile://localhost/persistent/path/to/file
+                // cdvfile://localhost/persistent/path/to/file
                 if (indexPersistent !== -1) {
-                    path =  "file:///persistent" + path.substr(indexPersistent + 10);
+                    path = 'file:///persistent' + path.substr(indexPersistent + 10);
                 } else if (indexTemporary !== -1) {
-                    path = "file:///temporary" + path.substr(indexTemporary + 9);
+                    path = 'file:///temporary' + path.substr(indexTemporary + 9);
                 } else {
                     if (errorCallback) {
                         errorCallback(FileError.ENCODING_ERR);
@@ -556,8 +556,8 @@
             }
 
             // to avoid path form of '///path/to/file'
-            function handlePathSlashes(path) {
-                var cutIndex  = 0;
+            function handlePathSlashes (path) {
+                var cutIndex = 0;
                 for (var i = 0; i < path.length - 1; i++) {
                     if (path[i] === DIR_SEPARATOR && path[i + 1] === DIR_SEPARATOR) {
                         cutIndex = i + 1;
@@ -576,8 +576,8 @@
                 path = path.substring(pathsPrefix.dataDirectory.length - 1);
                 path = handlePathSlashes(path);
 
-                exports.requestFileSystem(function() {
-                    exports.getFile(successCallback, function() {
+                exports.requestFileSystem(function () {
+                    exports.getFile(successCallback, function () {
                         exports.getDirectory(successCallback, errorCallback, [pathsPrefix.dataDirectory, path,
                         {create: false}]);
                     }, [pathsPrefix.dataDirectory, path, {create: false}]);
@@ -586,47 +586,47 @@
                 path = path.substring(pathsPrefix.cacheDirectory.length - 1);
                 path = handlePathSlashes(path);
 
-                exports.requestFileSystem(function() {
-                    exports.getFile(successCallback, function() {
+                exports.requestFileSystem(function () {
+                    exports.getFile(successCallback, function () {
                         exports.getDirectory(successCallback, errorCallback, [pathsPrefix.cacheDirectory, path,
                         {create: false}]);
                     }, [pathsPrefix.cacheDirectory, path, {create: false}]);
                 }, errorCallback, [LocalFileSystem.TEMPORARY]);
             } else if (path.indexOf(pathsPrefix.applicationDirectory) === 0) {
                 path = path.substring(pathsPrefix.applicationDirectory.length);
-                //TODO: need to cut out redundant slashes?
+                // TODO: need to cut out redundant slashes?
 
-                var xhr = new XMLHttpRequest();
-                xhr.open("GET", path, true);
+                var xhr = new XMLHttpRequest(); // eslint-disable-line no-undef
+                xhr.open('GET', path, true);
                 xhr.onreadystatechange = function () {
                     if (xhr.status === 200 && xhr.readyState === 4) {
-                        exports.requestFileSystem(function(fs) {
-                            fs.name = location.hostname;
+                        exports.requestFileSystem(function (fs) {
+                            fs.name = location.hostname; // eslint-disable-line no-undef
 
-                            //TODO: need to call exports.getFile(...) to handle errors correct
+                            // TODO: need to call exports.getFile(...) to handle errors correct
                             fs.root.getFile(path, {create: true}, writeFile, errorCallback);
                         }, errorCallback, [LocalFileSystem.PERSISTENT]);
                     }
                 };
 
                 xhr.onerror = function () {
-                    if(errorCallback) {
+                    if (errorCallback) {
                         errorCallback(FileError.NOT_READABLE_ERR);
                     }
                 };
 
                 xhr.send();
             } else {
-                if(errorCallback) {
+                if (errorCallback) {
                     errorCallback(FileError.NOT_FOUND_ERR);
                 }
             }
 
-            function writeFile(entry) {
+            function writeFile (entry) {
                 entry.createWriter(function (fileWriter) {
                     fileWriter.onwriteend = function (evt) {
                         if (!evt.target.error) {
-                            entry.filesystemName = location.hostname;
+                            entry.filesystemName = location.hostname; // eslint-disable-line no-undef
                             successCallback(entry);
                         }
                     };
@@ -635,16 +635,16 @@
                             errorCallback(FileError.NOT_READABLE_ERR);
                         }
                     };
-                    fileWriter.write(new Blob([xhr.response]));
-                }, errorCallback);
+                    fileWriter.write(new Blob([xhr.response])); // eslint-disable-line no-undef
+                }, errorCallback); // eslint-disable-line no-undef
             }
         };
 
-        exports.requestAllPaths = function(successCallback) {
+        exports.requestAllPaths = function (successCallback) {
             successCallback(pathsPrefix);
         };
 
-    /*** Helpers ***/
+    /** * Helpers ***/
 
         /**
          * Interface to wrap the native File interface.
@@ -657,8 +657,8 @@
          * @param {Object} opts Initial values.
          * @constructor
          */
-        function MyFile(opts) {
-            var blob_ = new Blob();
+        function MyFile (opts) {
+            var blob_ = new Blob(); // eslint-disable-line no-undef
 
             this.size = opts.size || 0;
             this.name = opts.name || '';
@@ -670,10 +670,10 @@
             // blob that is saved.
             Object.defineProperty(this, 'blob_', {
                 enumerable: true,
-                get: function() {
+                get: function () {
                     return blob_;
                 },
-                set: function(val) {
+                set: function (val) {
                     blob_ = val;
                     this.size = blob_.size;
                     this.name = blob_.name;
@@ -688,7 +688,7 @@
         // When saving an entry, the fullPath should always lead with a slash and never
         // end with one (e.g. a directory). Also, resolve '.' and '..' to an absolute
         // one. This method ensures path is legit!
-        function resolveToFullPath_(cwdFullPath, path) {
+        function resolveToFullPath_ (cwdFullPath, path) {
             path = path || '';
             var fullPath = path;
             var prefix = '';
@@ -722,7 +722,7 @@
                     parts[i] = '';
                 }
             }
-            fullPath = parts.filter(function(el) {
+            fullPath = parts.filter(function (el) {
                 return el;
             }).join(DIR_SEPARATOR);
 
@@ -758,7 +758,7 @@
             };
         }
 
-        function fileEntryFromIdbEntry(fileEntry) {
+        function fileEntryFromIdbEntry (fileEntry) {
             // IDB won't save methods, so we need re-create the FileEntry.
             var clonedFileEntry = new FileEntry(fileEntry.name, fileEntry.fullPath, fileEntry.filesystem);
             clonedFileEntry.file_ = fileEntry.file_;
@@ -766,46 +766,46 @@
             return clonedFileEntry;
         }
 
-        function readAs(what, fullPath, encoding, startPos, endPos, successCallback, errorCallback) {
-            exports.getFile(function(fileEntry) {
-                var fileReader = new FileReader(),
-                    blob = fileEntry.file_.blob_.slice(startPos, endPos);
+        function readAs (what, fullPath, encoding, startPos, endPos, successCallback, errorCallback) {
+            exports.getFile(function (fileEntry) {
+                var fileReader = new FileReader(); // eslint-disable-line no-undef
+                var blob = fileEntry.file_.blob_.slice(startPos, endPos);
 
-                fileReader.onload = function(e) {
+                fileReader.onload = function (e) {
                     successCallback(e.target.result);
                 };
 
                 fileReader.onerror = errorCallback;
 
                 switch (what) {
-                    case 'text':
-                        fileReader.readAsText(blob, encoding);
-                        break;
-                    case 'dataURL':
-                        fileReader.readAsDataURL(blob);
-                        break;
-                    case 'arrayBuffer':
-                        fileReader.readAsArrayBuffer(blob);
-                        break;
-                    case 'binaryString':
-                        fileReader.readAsBinaryString(blob);
-                        break;
+                case 'text':
+                    fileReader.readAsText(blob, encoding);
+                    break;
+                case 'dataURL':
+                    fileReader.readAsDataURL(blob);
+                    break;
+                case 'arrayBuffer':
+                    fileReader.readAsArrayBuffer(blob);
+                    break;
+                case 'binaryString':
+                    fileReader.readAsBinaryString(blob);
+                    break;
                 }
 
             }, errorCallback, [fullPath, null]);
         }
 
-    /*** Core logic to handle IDB operations ***/
+    /** * Core logic to handle IDB operations ***/
 
-        idb_.open = function(dbName, successCallback, errorCallback) {
+        idb_.open = function (dbName, successCallback, errorCallback) {
             var self = this;
 
             // TODO: FF 12.0a1 isn't liking a db name with : in it.
-            var request = indexedDB.open(dbName.replace(':', '_')/*, 1 /*version*/);
+            var request = indexedDB.open(dbName.replace(':', '_')/*, 1 /*version */);
 
             request.onerror = errorCallback || onError;
 
-            request.onupgradeneeded = function(e) {
+            request.onupgradeneeded = function (e) {
                 // First open was called or higher db version was used.
 
                 // console.log('onupgradeneeded: oldVersion:' + e.oldVersion,
@@ -815,11 +815,11 @@
                 self.db.onerror = onError;
 
                 if (!self.db.objectStoreNames.contains(FILE_STORE_)) {
-                    self.db.createObjectStore(FILE_STORE_/*,{keyPath: 'id', autoIncrement: true}*/);
+                    self.db.createObjectStore(FILE_STORE_/*, {keyPath: 'id', autoIncrement: true} */);
                 }
             };
 
-            request.onsuccess = function(e) {
+            request.onsuccess = function (e) {
                 self.db = e.target.result;
                 self.db.onerror = onError;
                 successCallback(e);
@@ -828,12 +828,12 @@
             request.onblocked = errorCallback || onError;
         };
 
-        idb_.close = function() {
+        idb_.close = function () {
             this.db.close();
             this.db = null;
         };
 
-        idb_.get = function(fullPath, successCallback, errorCallback) {
+        idb_.get = function (fullPath, successCallback, errorCallback) {
             if (!this.db) {
                 if (errorCallback) {
                     errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -846,12 +846,12 @@
             var request = tx.objectStore(FILE_STORE_).get(fullPath);
 
             tx.onabort = errorCallback || onError;
-            tx.oncomplete = function() {
+            tx.oncomplete = function () {
                 successCallback(request.result);
             };
         };
 
-        idb_.getAllEntries = function(fullPath, storagePath, successCallback, errorCallback) {
+        idb_.getAllEntries = function (fullPath, storagePath, successCallback, errorCallback) {
             if (!this.db) {
                 if (errorCallback) {
                     errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -870,8 +870,8 @@
 
             var tx = this.db.transaction([FILE_STORE_], 'readonly');
             tx.onabort = errorCallback || onError;
-            tx.oncomplete = function() {
-                results = results.filter(function(val) {
+            tx.oncomplete = function () {
+                results = results.filter(function (val) {
                     var pathWithoutSlash = val.fullPath;
 
                     if (val.fullPath[val.fullPath.length - 1] === DIR_SEPARATOR) {
@@ -883,9 +883,9 @@
 
                     /* Input fullPath parameter  equals '//' for root folder */
                     /* Entries in root folder has valPartsLen equals 2 (see below) */
-                    if (fullPath[fullPath.length -1] === DIR_SEPARATOR && fullPath.trim().length === 2) {
+                    if (fullPath[fullPath.length - 1] === DIR_SEPARATOR && fullPath.trim().length === 2) {
                         fullPathPartsLen = 1;
-                    } else if (fullPath[fullPath.length -1] === DIR_SEPARATOR) {
+                    } else if (fullPath[fullPath.length - 1] === DIR_SEPARATOR) {
                         fullPathPartsLen = fullPath.substr(0, fullPath.length - 1).split(DIR_SEPARATOR).length;
                     } else {
                         fullPathPartsLen = fullPath.split(DIR_SEPARATOR).length;
@@ -903,7 +903,7 @@
 
             var request = tx.objectStore(FILE_STORE_).openCursor(range);
 
-            request.onsuccess = function(e) {
+            request.onsuccess = function (e) {
                 var cursor = e.target.result;
                 if (cursor) {
                     var val = cursor.value;
@@ -914,7 +914,7 @@
             };
         };
 
-        idb_['delete'] = function(fullPath, successCallback, errorCallback, isDirectory) {
+        idb_['delete'] = function (fullPath, successCallback, errorCallback, isDirectory) {
             if (!idb_.db) {
                 if (errorCallback) {
                     errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -925,14 +925,14 @@
             var tx = this.db.transaction([FILE_STORE_], 'readwrite');
             tx.oncomplete = successCallback;
             tx.onabort = errorCallback || onError;
-            tx.oncomplete = function() {
+            tx.oncomplete = function () {
                 if (isDirectory) {
-                    //We delete nested files and folders after deleting parent folder
-                    //We use ranges: https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange
+                    // We delete nested files and folders after deleting parent folder
+                    // We use ranges: https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange
                     fullPath = fullPath + DIR_SEPARATOR;
 
-                    //Range contains all entries in the form fullPath<symbol> where
-                    //symbol in the range from ' ' to symbol which has code `unicodeLastChar`
+                    // Range contains all entries in the form fullPath<symbol> where
+                    // symbol in the range from ' ' to symbol which has code `unicodeLastChar`
                     var range = IDBKeyRange.bound(fullPath + ' ', fullPath + String.fromCharCode(unicodeLastChar));
 
                     var newTx = this.db.transaction([FILE_STORE_], 'readwrite');
@@ -946,7 +946,7 @@
             tx.objectStore(FILE_STORE_)['delete'](fullPath);
         };
 
-        idb_.put = function(entry, storagePath, successCallback, errorCallback) {
+        idb_.put = function (entry, storagePath, successCallback, errorCallback) {
             if (!this.db) {
                 if (errorCallback) {
                     errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -956,7 +956,7 @@
 
             var tx = this.db.transaction([FILE_STORE_], 'readwrite');
             tx.onabort = errorCallback || onError;
-            tx.oncomplete = function() {
+            tx.oncomplete = function () {
                 // TODO: Error is thrown if we pass the request event back instead.
                 successCallback(entry);
             };
@@ -965,14 +965,14 @@
         };
 
         // Global error handler. Errors bubble from request, to transaction, to db.
-        function onError(e) {
+        function onError (e) {
             switch (e.target.errorCode) {
-                case 12:
-                    console.log('Error - Attempt to open db with a lower version than the ' +
+            case 12:
+                console.log('Error - Attempt to open db with a lower version than the ' +
                         'current one.');
-                    break;
-                default:
-                    console.log('errorCode: ' + e.target.errorCode);
+                break;
+            default:
+                console.log('errorCode: ' + e.target.errorCode);
             }
 
             console.log(e, e.code, e.message);
@@ -980,5 +980,5 @@
 
     })(module.exports, window);
 
-    require("cordova/exec/proxy").add("File", module.exports);
+    require('cordova/exec/proxy').add('File', module.exports);
 })();

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/src/firefoxos/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/FileProxy.js b/src/firefoxos/FileProxy.js
index 946304b..8ae181d 100644
--- a/src/firefoxos/FileProxy.js
+++ b/src/firefoxos/FileProxy.js
@@ -1,4 +1,4 @@
-/*
+/*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,12 +21,12 @@
 
 /* global IDBKeyRange */
 
-var LocalFileSystem = require('./LocalFileSystem'),
-    FileSystem = require('./FileSystem'),
-    FileEntry = require('./FileEntry'),
-    FileError = require('./FileError'),
-    DirectoryEntry = require('./DirectoryEntry'),
-    File = require('./File');
+var LocalFileSystem = require('./LocalFileSystem');
+var FileSystem = require('./FileSystem');
+var FileEntry = require('./FileEntry');
+var FileError = require('./FileError');
+var DirectoryEntry = require('./DirectoryEntry'); // eslint-disable-line no-undef
+var File = require('./File');
 
 /*
 QUIRKS:
@@ -39,11 +39,10 @@ QUIRKS:
     Heavily based on https://github.com/ebidel/idb.filesystem.js
  */
 
-
-(function(exports, global) {
+(function (exports, global) {
     var indexedDB = global.indexedDB || global.mozIndexedDB;
     if (!indexedDB) {
-        throw "Firefox OS File plugin: indexedDB not supported";
+        throw 'Firefox OS File plugin: indexedDB not supported';
     }
 
     var fs_ = null;
@@ -57,19 +56,19 @@ QUIRKS:
 
     var pathsPrefix = {
         // Read-only directory where the application is installed.
-        applicationDirectory: location.origin + "/",
+        applicationDirectory: location.origin + '/', // eslint-disable-line no-undef
         // Where to put app-specific data files.
         dataDirectory: 'file:///persistent/',
         // Cached files that should survive app restarts.
         // Apps should not rely on the OS to delete files in here.
-        cacheDirectory: 'file:///temporary/',
+        cacheDirectory: 'file:///temporary/'
     };
 
-/*** Exported functionality ***/
+/** * Exported functionality ***/
 
-    exports.requestFileSystem = function(successCallback, errorCallback, args) {
+    exports.requestFileSystem = function (successCallback, errorCallback, args) {
         var type = args[0];
-        //var size = args[1];
+        // var size = args[1];
 
         if (type !== LocalFileSystem.TEMPORARY && type !== LocalFileSystem.PERSISTENT) {
             if (errorCallback) {
@@ -79,22 +78,22 @@ QUIRKS:
         }
 
         var name = type === LocalFileSystem.TEMPORARY ? 'temporary' : 'persistent';
-        var storageName = (location.protocol + location.host).replace(/:/g, '_');
+        var storageName = (location.protocol + location.host).replace(/:/g, '_'); // eslint-disable-line no-undef
 
         var root = new DirectoryEntry('', DIR_SEPARATOR);
         fs_ = new FileSystem(name, root);
 
-        idb_.open(storageName, function() {
+        idb_.open(storageName, function () {
             successCallback(fs_);
         }, errorCallback);
     };
 
-    require('./fileSystems').getFs = function(name, callback) {
+    require('./fileSystems').getFs = function (name, callback) {
         callback(new FileSystem(name, fs_.root));
     };
 
     // list a directory's contents (files and folders).
-    exports.readEntries = function(successCallback, errorCallback, args) {
+    exports.readEntries = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
 
         if (!successCallback) {
@@ -103,12 +102,12 @@ QUIRKS:
 
         var path = resolveToFullPath_(fullPath);
 
-        idb_.getAllEntries(path.fullPath, path.storagePath, function(entries) {
+        idb_.getAllEntries(path.fullPath, path.storagePath, function (entries) {
             successCallback(entries);
         }, errorCallback);
     };
 
-    exports.getFile = function(successCallback, errorCallback, args) {
+    exports.getFile = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
         var path = args[1];
         var options = args[2] || {};
@@ -116,7 +115,7 @@ QUIRKS:
         // Create an absolute path if we were handed a relative one.
         path = resolveToFullPath_(fullPath, path);
 
-        idb_.get(path.storagePath, function(fileEntry) {
+        idb_.get(path.storagePath, function (fileEntry) {
             if (options.create === true && options.exclusive === true && fileEntry) {
                 // If create and exclusive are both true, and the path already exists,
                 // getFile must fail.
@@ -141,7 +140,7 @@ QUIRKS:
             } else if (options.create === true && fileEntry) {
                 if (fileEntry.isFile) {
                     // Overwrite file, delete then create new.
-                    idb_['delete'](path.storagePath, function() {
+                    idb_['delete'](path.storagePath, function () {
                         var newFileEntry = new FileEntry(path.fileName, path.fullPath, new FileSystem(path.fsName, fs_.root));
 
                         newFileEntry.file_ = new MyFile({
@@ -179,16 +178,16 @@ QUIRKS:
         }, errorCallback);
     };
 
-    exports.getFileMetadata = function(successCallback, errorCallback, args) {
+    exports.getFileMetadata = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
 
-        exports.getFile(function(fileEntry) {
+        exports.getFile(function (fileEntry) {
             successCallback(new File(fileEntry.file_.name, fileEntry.fullPath, '', fileEntry.file_.lastModifiedDate,
                 fileEntry.file_.size));
         }, errorCallback, [fullPath, null]);
     };
 
-    exports.getMetadata = function(successCallback, errorCallback, args) {
+    exports.getMetadata = function (successCallback, errorCallback, args) {
         exports.getFile(function (fileEntry) {
             successCallback(
                 {
@@ -198,20 +197,20 @@ QUIRKS:
         }, errorCallback, args);
     };
 
-    exports.setMetadata = function(successCallback, errorCallback, args) {
+    exports.setMetadata = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
         var metadataObject = args[1];
 
         exports.getFile(function (fileEntry) {
-              fileEntry.file_.lastModifiedDate = metadataObject.modificationTime;
+            fileEntry.file_.lastModifiedDate = metadataObject.modificationTime;
         }, errorCallback, [fullPath, null]);
     };
 
-    exports.write = function(successCallback, errorCallback, args) {
-        var fileName = args[0],
-            data = args[1],
-            position = args[2];
-            //isBinary = args[3];
+    exports.write = function (successCallback, errorCallback, args) {
+        var fileName = args[0];
+        var data = args[1];
+        var position = args[2];
+            // isBinary = args[3];
 
         if (!data) {
             if (errorCallback) {
@@ -220,11 +219,11 @@ QUIRKS:
             return;
         }
 
-        exports.getFile(function(fileEntry) {
+        exports.getFile(function (fileEntry) {
             var blob_ = fileEntry.file_.blob_;
 
             if (!blob_) {
-                blob_ = new Blob([data], {type: data.type});
+                blob_ = new Blob([data], {type: data.type}); // eslint-disable-line no-undef
             } else {
                 // Calc the head and tail fragments
                 var head = blob_.slice(0, position);
@@ -237,7 +236,7 @@ QUIRKS:
                 }
 
                 // Do the "write". In fact, a full overwrite of the Blob.
-                blob_ = new Blob([head, new Uint8Array(padding), data, tail],
+                blob_ = new Blob([head, new Uint8Array(padding), data, tail], // eslint-disable-line no-undef
                     {type: data.type});
             }
 
@@ -248,56 +247,56 @@ QUIRKS:
             fileEntry.file_.name = blob_.name;
             fileEntry.file_.type = blob_.type;
 
-            idb_.put(fileEntry, fileEntry.file_.storagePath, function() {
+            idb_.put(fileEntry, fileEntry.file_.storagePath, function () {
                 successCallback(data.byteLength);
             }, errorCallback);
         }, errorCallback, [fileName, null]);
     };
 
-    exports.readAsText = function(successCallback, errorCallback, args) {
-        var fileName = args[0],
-            enc = args[1],
-            startPos = args[2],
-            endPos = args[3];
+    exports.readAsText = function (successCallback, errorCallback, args) {
+        var fileName = args[0];
+        var enc = args[1];
+        var startPos = args[2];
+        var endPos = args[3];
 
         readAs('text', fileName, enc, startPos, endPos, successCallback, errorCallback);
     };
 
-    exports.readAsDataURL = function(successCallback, errorCallback, args) {
-        var fileName = args[0],
-            startPos = args[1],
-            endPos = args[2];
+    exports.readAsDataURL = function (successCallback, errorCallback, args) {
+        var fileName = args[0];
+        var startPos = args[1];
+        var endPos = args[2];
 
         readAs('dataURL', fileName, null, startPos, endPos, successCallback, errorCallback);
     };
 
-    exports.readAsBinaryString = function(successCallback, errorCallback, args) {
-        var fileName = args[0],
-            startPos = args[1],
-            endPos = args[2];
+    exports.readAsBinaryString = function (successCallback, errorCallback, args) {
+        var fileName = args[0];
+        var startPos = args[1];
+        var endPos = args[2];
 
         readAs('binaryString', fileName, null, startPos, endPos, successCallback, errorCallback);
     };
 
-    exports.readAsArrayBuffer = function(successCallback, errorCallback, args) {
-        var fileName = args[0],
-            startPos = args[1],
-            endPos = args[2];
+    exports.readAsArrayBuffer = function (successCallback, errorCallback, args) {
+        var fileName = args[0];
+        var startPos = args[1];
+        var endPos = args[2];
 
         readAs('arrayBuffer', fileName, null, startPos, endPos, successCallback, errorCallback);
     };
 
-    exports.removeRecursively = exports.remove = function(successCallback, errorCallback, args) {
+    exports.removeRecursively = exports.remove = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
 
         // TODO: This doesn't protect against directories that have content in it.
         // Should throw an error instead if the dirEntry is not empty.
-        idb_['delete'](fullPath, function() {
+        idb_['delete'](fullPath, function () {
             successCallback();
         }, errorCallback);
     };
 
-    exports.getDirectory = function(successCallback, errorCallback, args) {
+    exports.getDirectory = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
         var path = args[1];
         var options = args[2];
@@ -305,7 +304,7 @@ QUIRKS:
         // Create an absolute path if we were handed a relative one.
         path = resolveToFullPath_(fullPath, path);
 
-        idb_.get(path.storagePath, function(folderEntry) {
+        idb_.get(path.storagePath, function (folderEntry) {
             if (!options) {
                 options = {};
             }
@@ -361,7 +360,7 @@ QUIRKS:
         }, errorCallback);
     };
 
-    exports.getParent = function(successCallback, errorCallback, args) {
+    exports.getParent = function (successCallback, errorCallback, args) {
         var fullPath = args[0];
 
         if (fullPath === DIR_SEPARATOR) {
@@ -377,18 +376,18 @@ QUIRKS:
         exports.getDirectory(successCallback, errorCallback, [path, namesa, {create: false}]);
     };
 
-    exports.copyTo = function(successCallback, errorCallback, args) {
+    exports.copyTo = function (successCallback, errorCallback, args) {
         var srcPath = args[0];
         var parentFullPath = args[1];
         var name = args[2];
 
         // Read src file
-        exports.getFile(function(srcFileEntry) {
+        exports.getFile(function (srcFileEntry) {
 
             // Create dest file
-            exports.getFile(function(dstFileEntry) {
+            exports.getFile(function (dstFileEntry) {
 
-                exports.write(function() {
+                exports.write(function () {
                     successCallback(dstFileEntry);
                 }, errorCallback, [dstFileEntry.file_.storagePath, srcFileEntry.file_.blob_, 0]);
 
@@ -397,10 +396,10 @@ QUIRKS:
         }, errorCallback, [srcPath, null]);
     };
 
-    exports.moveTo = function(successCallback, errorCallback, args) {
+    exports.moveTo = function (successCallback, errorCallback, args) {
         var srcPath = args[0];
-        //var parentFullPath = args[1];
-        //var name = args[2];
+        // var parentFullPath = args[1];
+        // var name = args[2];
 
         exports.copyTo(function (fileEntry) {
 
@@ -411,44 +410,44 @@ QUIRKS:
         }, errorCallback, args);
     };
 
-    exports.resolveLocalFileSystemURI = function(successCallback, errorCallback, args) {
+    exports.resolveLocalFileSystemURI = function (successCallback, errorCallback, args) {
         var path = args[0];
 
         // Ignore parameters
         if (path.indexOf('?') !== -1) {
-            path = String(path).split("?")[0];
+            path = String(path).split('?')[0];
         }
 
         // support for encodeURI
-        if (/\%5/g.test(path)) {
+        if (/\%5/g.test(path)) { // eslint-disable-line no-useless-escape
             path = decodeURI(path);
         }
 
         if (path.indexOf(pathsPrefix.dataDirectory) === 0) {
             path = path.substring(pathsPrefix.dataDirectory.length - 1);
 
-            exports.requestFileSystem(function(fs) {
-                fs.root.getFile(path, {create: false}, successCallback, function() {
+            exports.requestFileSystem(function (fs) {
+                fs.root.getFile(path, {create: false}, successCallback, function () {
                     fs.root.getDirectory(path, {create: false}, successCallback, errorCallback);
                 });
             }, errorCallback, [LocalFileSystem.PERSISTENT]);
         } else if (path.indexOf(pathsPrefix.cacheDirectory) === 0) {
             path = path.substring(pathsPrefix.cacheDirectory.length - 1);
 
-            exports.requestFileSystem(function(fs) {
-                fs.root.getFile(path, {create: false}, successCallback, function() {
+            exports.requestFileSystem(function (fs) {
+                fs.root.getFile(path, {create: false}, successCallback, function () {
                     fs.root.getDirectory(path, {create: false}, successCallback, errorCallback);
                 });
             }, errorCallback, [LocalFileSystem.TEMPORARY]);
         } else if (path.indexOf(pathsPrefix.applicationDirectory) === 0) {
             path = path.substring(pathsPrefix.applicationDirectory.length);
 
-            var xhr = new XMLHttpRequest();
-            xhr.open("GET", path, true);
+            var xhr = new XMLHttpRequest(); // eslint-disable-line no-undef
+            xhr.open('GET', path, true);
             xhr.onreadystatechange = function () {
                 if (xhr.status === 200 && xhr.readyState === 4) {
-                    exports.requestFileSystem(function(fs) {
-                        fs.name = location.hostname;
+                    exports.requestFileSystem(function (fs) {
+                        fs.name = location.hostname; // eslint-disable-line no-undef
                         fs.root.getFile(path, {create: true}, writeFile, errorCallback);
                     }, errorCallback, [LocalFileSystem.PERSISTENT]);
                 }
@@ -467,11 +466,11 @@ QUIRKS:
             }
         }
 
-        function writeFile(entry) {
+        function writeFile (entry) {
             entry.createWriter(function (fileWriter) {
                 fileWriter.onwriteend = function (evt) {
                     if (!evt.target.error) {
-                        entry.filesystemName = location.hostname;
+                        entry.filesystemName = location.hostname; // eslint-disable-line no-undef
                         successCallback(entry);
                     }
                 };
@@ -480,16 +479,16 @@ QUIRKS:
                         errorCallback(FileError.NOT_READABLE_ERR);
                     }
                 };
-                fileWriter.write(new Blob([xhr.response]));
+                fileWriter.write(new Blob([xhr.response])); // eslint-disable-line no-undef
             }, errorCallback);
         }
     };
 
-    exports.requestAllPaths = function(successCallback) {
+    exports.requestAllPaths = function (successCallback) {
         successCallback(pathsPrefix);
     };
 
-/*** Helpers ***/
+/** * Helpers ***/
 
     /**
      * Interface to wrap the native File interface.
@@ -502,8 +501,8 @@ QUIRKS:
      * @param {Object} opts Initial values.
      * @constructor
      */
-    function MyFile(opts) {
-        var blob_ = new Blob();
+    function MyFile (opts) {
+        var blob_ = new Blob(); // eslint-disable-line no-undef
 
         this.size = opts.size || 0;
         this.name = opts.name || '';
@@ -515,10 +514,10 @@ QUIRKS:
         // blob that is saved.
         Object.defineProperty(this, 'blob_', {
             enumerable: true,
-            get: function() {
+            get: function () {
                 return blob_;
             },
-            set: function(val) {
+            set: function (val) {
                 blob_ = val;
                 this.size = blob_.size;
                 this.name = blob_.name;
@@ -533,21 +532,22 @@ QUIRKS:
     // When saving an entry, the fullPath should always lead with a slash and never
     // end with one (e.g. a directory). Also, resolve '.' and '..' to an absolute
     // one. This method ensures path is legit!
-    function resolveToFullPath_(cwdFullPath, path) {
+    function resolveToFullPath_ (cwdFullPath, path) {
         path = path || '';
         var fullPath = path;
         var prefix = '';
 
         cwdFullPath = cwdFullPath || DIR_SEPARATOR;
+        /* eslint-disable no-undef */
         if (cwdFullPath.indexOf(FILESYSTEM_PREFIX) === 0) {
             prefix = cwdFullPath.substring(0, cwdFullPath.indexOf(DIR_SEPARATOR, FILESYSTEM_PREFIX.length));
             cwdFullPath = cwdFullPath.substring(cwdFullPath.indexOf(DIR_SEPARATOR, FILESYSTEM_PREFIX.length));
         }
-
+        /* eslint-enable no-undef */
         var relativePath = path[0] !== DIR_SEPARATOR;
         if (relativePath) {
             fullPath = cwdFullPath;
-            if (cwdFullPath != DIR_SEPARATOR) {
+            if (cwdFullPath !== DIR_SEPARATOR) {
                 fullPath += DIR_SEPARATOR + path;
             } else {
                 fullPath += path;
@@ -558,12 +558,12 @@ QUIRKS:
         var parts = fullPath.split(DIR_SEPARATOR);
         for (var i = 0; i < parts.length; ++i) {
             var part = parts[i];
-            if (part == '..') {
+            if (part === '..') {
                 parts[i - 1] = '';
                 parts[i] = '';
             }
         }
-        fullPath = parts.filter(function(el) {
+        fullPath = parts.filter(function (el) {
             return el;
         }).join(DIR_SEPARATOR);
 
@@ -582,8 +582,8 @@ QUIRKS:
         fullPath = fullPath.replace(/\/\./g, DIR_SEPARATOR);
 
         // Remove '/' if it appears on the end.
-        if (fullPath[fullPath.length - 1] == DIR_SEPARATOR &&
-            fullPath != DIR_SEPARATOR) {
+        if (fullPath[fullPath.length - 1] === DIR_SEPARATOR &&
+            fullPath !== DIR_SEPARATOR) {
             fullPath = fullPath.substring(0, fullPath.length - 1);
         }
 
@@ -595,7 +595,7 @@ QUIRKS:
         };
     }
 
-    function fileEntryFromIdbEntry(fileEntry) {
+    function fileEntryFromIdbEntry (fileEntry) {
         // IDB won't save methods, so we need re-create the FileEntry.
         var clonedFileEntry = new FileEntry(fileEntry.name, fileEntry.fullPath, fileEntry.fileSystem);
         clonedFileEntry.file_ = fileEntry.file_;
@@ -603,46 +603,46 @@ QUIRKS:
         return clonedFileEntry;
     }
 
-    function readAs(what, fullPath, encoding, startPos, endPos, successCallback, errorCallback) {
-        exports.getFile(function(fileEntry) {
-            var fileReader = new FileReader(),
-                blob = fileEntry.file_.blob_.slice(startPos, endPos);
+    function readAs (what, fullPath, encoding, startPos, endPos, successCallback, errorCallback) {
+        exports.getFile(function (fileEntry) {
+            var fileReader = new FileReader(); // eslint-disable-line no-undef
+            var blob = fileEntry.file_.blob_.slice(startPos, endPos);
 
-            fileReader.onload = function(e) {
+            fileReader.onload = function (e) {
                 successCallback(e.target.result);
             };
 
             fileReader.onerror = errorCallback;
 
             switch (what) {
-                case 'text':
-                    fileReader.readAsText(blob, encoding);
-                    break;
-                case 'dataURL':
-                    fileReader.readAsDataURL(blob);
-                    break;
-                case 'arrayBuffer':
-                    fileReader.readAsArrayBuffer(blob);
-                    break;
-                case 'binaryString':
-                    fileReader.readAsBinaryString(blob);
-                    break;
+            case 'text':
+                fileReader.readAsText(blob, encoding);
+                break;
+            case 'dataURL':
+                fileReader.readAsDataURL(blob);
+                break;
+            case 'arrayBuffer':
+                fileReader.readAsArrayBuffer(blob);
+                break;
+            case 'binaryString':
+                fileReader.readAsBinaryString(blob);
+                break;
             }
 
         }, errorCallback, [fullPath, null]);
     }
 
-/*** Core logic to handle IDB operations ***/
+/** * Core logic to handle IDB operations ***/
 
-    idb_.open = function(dbName, successCallback, errorCallback) {
+    idb_.open = function (dbName, successCallback, errorCallback) {
         var self = this;
 
         // TODO: FF 12.0a1 isn't liking a db name with : in it.
-        var request = indexedDB.open(dbName.replace(':', '_')/*, 1 /*version*/);
+        var request = indexedDB.open(dbName.replace(':', '_')/*, 1 /*version */);
 
         request.onerror = errorCallback || onError;
 
-        request.onupgradeneeded = function(e) {
+        request.onupgradeneeded = function (e) {
             // First open was called or higher db version was used.
 
             // console.log('onupgradeneeded: oldVersion:' + e.oldVersion,
@@ -652,11 +652,11 @@ QUIRKS:
             self.db.onerror = onError;
 
             if (!self.db.objectStoreNames.contains(FILE_STORE_)) {
-                self.db.createObjectStore(FILE_STORE_/*,{keyPath: 'id', autoIncrement: true}*/);
+                self.db.createObjectStore(FILE_STORE_/*, {keyPath: 'id', autoIncrement: true} */);
             }
         };
 
-        request.onsuccess = function(e) {
+        request.onsuccess = function (e) {
             self.db = e.target.result;
             self.db.onerror = onError;
             successCallback(e);
@@ -665,12 +665,12 @@ QUIRKS:
         request.onblocked = errorCallback || onError;
     };
 
-    idb_.close = function() {
+    idb_.close = function () {
         this.db.close();
         this.db = null;
     };
 
-    idb_.get = function(fullPath, successCallback, errorCallback) {
+    idb_.get = function (fullPath, successCallback, errorCallback) {
         if (!this.db) {
             if (errorCallback) {
                 errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -680,18 +680,18 @@ QUIRKS:
 
         var tx = this.db.transaction([FILE_STORE_], 'readonly');
 
-        //var request = tx.objectStore(FILE_STORE_).get(fullPath);
+        // var request = tx.objectStore(FILE_STORE_).get(fullPath);
         var range = IDBKeyRange.bound(fullPath, fullPath + DIR_OPEN_BOUND,
             false, true);
         var request = tx.objectStore(FILE_STORE_).get(range);
 
         tx.onabort = errorCallback || onError;
-        tx.oncomplete = function(e) {
+        tx.oncomplete = function (e) {
             successCallback(request.result);
         };
     };
 
-    idb_.getAllEntries = function(fullPath, storagePath, successCallback, errorCallback) {
+    idb_.getAllEntries = function (fullPath, storagePath, successCallback, errorCallback) {
         if (!this.db) {
             if (errorCallback) {
                 errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -710,8 +710,8 @@ QUIRKS:
 
         var tx = this.db.transaction([FILE_STORE_], 'readonly');
         tx.onabort = errorCallback || onError;
-        tx.oncomplete = function(e) {
-            results = results.filter(function(val) {
+        tx.oncomplete = function (e) {
+            results = results.filter(function (val) {
                 var valPartsLen = val.fullPath.split(DIR_SEPARATOR).length;
                 var fullPathPartsLen = fullPath.split(DIR_SEPARATOR).length;
 
@@ -733,7 +733,7 @@ QUIRKS:
 
         var request = tx.objectStore(FILE_STORE_).openCursor(range);
 
-        request.onsuccess = function(e) {
+        request.onsuccess = function (e) {
             var cursor = e.target.result;
             if (cursor) {
                 var val = cursor.value;
@@ -744,7 +744,7 @@ QUIRKS:
         };
     };
 
-    idb_['delete'] = function(fullPath, successCallback, errorCallback) {
+    idb_['delete'] = function (fullPath, successCallback, errorCallback) {
         if (!this.db) {
             if (errorCallback) {
                 errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -756,13 +756,13 @@ QUIRKS:
         tx.oncomplete = successCallback;
         tx.onabort = errorCallback || onError;
 
-        //var request = tx.objectStore(FILE_STORE_).delete(fullPath);
+        // var request = tx.objectStore(FILE_STORE_).delete(fullPath);
         var range = IDBKeyRange.bound(
             fullPath, fullPath + DIR_OPEN_BOUND, false, true);
         tx.objectStore(FILE_STORE_)['delete'](range);
     };
 
-    idb_.put = function(entry, storagePath, successCallback, errorCallback) {
+    idb_.put = function (entry, storagePath, successCallback, errorCallback) {
         if (!this.db) {
             if (errorCallback) {
                 errorCallback(FileError.INVALID_MODIFICATION_ERR);
@@ -772,7 +772,7 @@ QUIRKS:
 
         var tx = this.db.transaction([FILE_STORE_], 'readwrite');
         tx.onabort = errorCallback || onError;
-        tx.oncomplete = function(e) {
+        tx.oncomplete = function (e) {
             // TODO: Error is thrown if we pass the request event back instead.
             successCallback(entry);
         };
@@ -781,14 +781,14 @@ QUIRKS:
     };
 
     // Global error handler. Errors bubble from request, to transaction, to db.
-    function onError(e) {
+    function onError (e) {
         switch (e.target.errorCode) {
-            case 12:
-                console.log('Error - Attempt to open db with a lower version than the ' +
+        case 12:
+            console.log('Error - Attempt to open db with a lower version than the ' +
                     'current one.');
-                break;
-            default:
-                console.log('errorCode: ' + e.target.errorCode);
+            break;
+        default:
+            console.log('errorCode: ' + e.target.errorCode);
         }
 
         console.log(e, e.code, e.message);
@@ -802,4 +802,4 @@ QUIRKS:
 
 })(module.exports, window);
 
-require("cordova/exec/proxy").add("File", module.exports);
+require('cordova/exec/proxy').add('File', module.exports);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org