Clean up indent eslint errors

This commit is contained in:
Kevin Sawicki 2016-01-19 10:25:03 -08:00
parent 45ddbb6d67
commit 4f4456bde8
3 changed files with 561 additions and 561 deletions

View file

@ -1,15 +1,15 @@
(function () { (function () {
const asar = process.binding('atom_common_asar'); const asar = process.binding('atom_common_asar');
const child_process = require('child_process'); const child_process = require('child_process');
const path = require('path'); const path = require('path');
const util = require('util'); const util = require('util');
var hasProp = {}.hasOwnProperty; var hasProp = {}.hasOwnProperty;
// Cache asar archive objects. // Cache asar archive objects.
var cachedArchives = {}; var cachedArchives = {};
var getOrCreateArchive = function(p) { var getOrCreateArchive = function(p) {
var archive; var archive;
archive = cachedArchives[p]; archive = cachedArchives[p];
if (archive != null) { if (archive != null) {
@ -20,10 +20,10 @@ var getOrCreateArchive = function(p) {
return false; return false;
} }
return cachedArchives[p] = archive; return cachedArchives[p] = archive;
}; };
// Clean cache on quit. // Clean cache on quit.
process.on('exit', function() { process.on('exit', function() {
var archive, p, results; var archive, p, results;
results = []; results = [];
for (p in cachedArchives) { for (p in cachedArchives) {
@ -32,10 +32,10 @@ process.on('exit', function() {
results.push(archive.destroy()); results.push(archive.destroy());
} }
return results; return results;
}); });
// Separate asar package's path from full path. // Separate asar package's path from full path.
var splitPath = function(p) { var splitPath = function(p) {
var index; var index;
// shortcut to disable asar. // shortcut to disable asar.
@ -55,18 +55,18 @@ var splitPath = function(p) {
return [false]; return [false];
} }
return [true, p.substr(0, index + 5), p.substr(index + 6)]; return [true, p.substr(0, index + 5), p.substr(index + 6)];
}; };
// Convert asar archive's Stats object to fs's Stats object. // Convert asar archive's Stats object to fs's Stats object.
var nextInode = 0; var nextInode = 0;
var uid = process.getuid != null ? process.getuid() : 0; var uid = process.getuid != null ? process.getuid() : 0;
var gid = process.getgid != null ? process.getgid() : 0; var gid = process.getgid != null ? process.getgid() : 0;
var fakeTime = new Date(); var fakeTime = new Date();
var asarStatsToFsStats = function(stats) { var asarStatsToFsStats = function(stats) {
return { return {
dev: 1, dev: 1,
ino: ++nextInode, ino: ++nextInode,
@ -102,10 +102,10 @@ var asarStatsToFsStats = function(stats) {
return false; return false;
} }
}; };
}; };
// Create a ENOENT error. // Create a ENOENT error.
var notFoundError = function(asarPath, filePath, callback) { var notFoundError = function(asarPath, filePath, callback) {
var error; var error;
error = new Error("ENOENT, " + filePath + " not found in " + asarPath); error = new Error("ENOENT, " + filePath + " not found in " + asarPath);
error.code = "ENOENT"; error.code = "ENOENT";
@ -116,10 +116,10 @@ var notFoundError = function(asarPath, filePath, callback) {
return process.nextTick(function() { return process.nextTick(function() {
return callback(error); return callback(error);
}); });
}; };
// Create a ENOTDIR error. // Create a ENOTDIR error.
var notDirError = function(callback) { var notDirError = function(callback) {
var error; var error;
error = new Error('ENOTDIR, not a directory'); error = new Error('ENOTDIR, not a directory');
error.code = 'ENOTDIR'; error.code = 'ENOTDIR';
@ -130,10 +130,10 @@ var notDirError = function(callback) {
return process.nextTick(function() { return process.nextTick(function() {
return callback(error); return callback(error);
}); });
}; };
// Create invalid archive error. // Create invalid archive error.
var invalidArchiveError = function(asarPath, callback) { var invalidArchiveError = function(asarPath, callback) {
var error; var error;
error = new Error("Invalid package " + asarPath); error = new Error("Invalid package " + asarPath);
if (typeof callback !== 'function') { if (typeof callback !== 'function') {
@ -142,10 +142,10 @@ var invalidArchiveError = function(asarPath, callback) {
return process.nextTick(function() { return process.nextTick(function() {
return callback(error); return callback(error);
}); });
}; };
// Override APIs that rely on passing file path instead of content to C++. // Override APIs that rely on passing file path instead of content to C++.
var overrideAPISync = function(module, name, arg) { var overrideAPISync = function(module, name, arg) {
var old; var old;
if (arg == null) { if (arg == null) {
arg = 0; arg = 0;
@ -169,9 +169,9 @@ var overrideAPISync = function(module, name, arg) {
arguments[arg] = newPath; arguments[arg] = newPath;
return old.apply(this, arguments); return old.apply(this, arguments);
}; };
}; };
var overrideAPI = function(module, name, arg) { var overrideAPI = function(module, name, arg) {
var old; var old;
if (arg == null) { if (arg == null) {
arg = 0; arg = 0;
@ -199,10 +199,10 @@ var overrideAPI = function(module, name, arg) {
arguments[arg] = newPath; arguments[arg] = newPath;
return old.apply(this, arguments); return old.apply(this, arguments);
}; };
}; };
// Override fs APIs. // Override fs APIs.
exports.wrapFsWithAsar = function(fs) { exports.wrapFsWithAsar = function(fs) {
var exists, existsSync, internalModuleReadFile, internalModuleStat, lstat, lstatSync, mkdir, mkdirSync, open, openSync, readFile, readFileSync, readdir, readdirSync, realpath, realpathSync, stat, statSync, statSyncNoException; var exists, existsSync, internalModuleReadFile, internalModuleStat, lstat, lstatSync, mkdir, mkdirSync, open, openSync, readFile, readFileSync, readdir, readdirSync, realpath, realpathSync, stat, statSync, statSyncNoException;
lstatSync = fs.lstatSync; lstatSync = fs.lstatSync;
fs.lstatSync = function(p) { fs.lstatSync = function(p) {
@ -583,5 +583,5 @@ exports.wrapFsWithAsar = function(fs) {
overrideAPISync(require('module')._extensions, '.node', 1); overrideAPISync(require('module')._extensions, '.node', 1);
overrideAPISync(fs, 'openSync'); overrideAPISync(fs, 'openSync');
return overrideAPISync(child_process, 'execFileSync'); return overrideAPISync(child_process, 'execFileSync');
}; };
})() })()

View file

@ -1,5 +1,5 @@
(function () { (function () {
return function(process, require, asarSource) { return function(process, require, asarSource) {
var createArchive, source; var createArchive, source;
createArchive = process.binding('atom_common_asar').createArchive; createArchive = process.binding('atom_common_asar').createArchive;
@ -13,5 +13,5 @@ return function(process, require, asarSource) {
source = process.binding('natives'); source = process.binding('natives');
source['original-fs'] = source.fs; source['original-fs'] = source.fs;
return source['fs'] = "var src = '(function (exports, require, module, __filename, __dirname) { ' +\n process.binding('natives')['original-fs'] +\n ' });';\nvar vm = require('vm');\nvar fn = vm.runInThisContext(src, { filename: 'fs.js' });\nfn(exports, require, module);\nvar asar = require('ATOM_SHELL_ASAR');\nasar.wrapFsWithAsar(exports);"; return source['fs'] = "var src = '(function (exports, require, module, __filename, __dirname) { ' +\n process.binding('natives')['original-fs'] +\n ' });';\nvar vm = require('vm');\nvar fn = vm.runInThisContext(src, { filename: 'fs.js' });\nfn(exports, require, module);\nvar asar = require('ATOM_SHELL_ASAR');\nasar.wrapFsWithAsar(exports);";
}; };
})() })()

View file

@ -1,7 +1,7 @@
{ {
"rules": { "rules": {
"indent": [ "indent": [
0, 2,
2, 2,
{ {
"SwitchCase": 1 "SwitchCase": 1