Bug 1294542 - Enable the block-spacing rule for eslint. r=felipe

MozReview-Commit-ID: AAXqh63QNv3
This commit is contained in:
Jared Wein 2016-08-16 15:44:13 -04:00
Родитель e9556c03b7
Коммит b82aa6f6de
28 изменённых файлов: 61 добавлений и 55 удалений

Просмотреть файл

@ -150,7 +150,7 @@ var healthReportWrapper = {
initRemotePage: function () { initRemotePage: function () {
let iframe = document.getElementById("remote-report").contentDocument; let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand", iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) {healthReportWrapper.handleRemoteCommand(e);}, function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); },
false); false);
healthReportWrapper.updatePrefState(); healthReportWrapper.updatePrefState();
}, },

Просмотреть файл

@ -72,7 +72,7 @@ function synthesizeDragWithDirection(aElement, aExpectedDragData, aDirection, aC
aCallback() aCallback()
}, false); }, false);
var prevent = function(aEvent) {aEvent.preventDefault();} var prevent = function(aEvent) { aEvent.preventDefault(); }
var xIncrement = 0; var xIncrement = 0;
var yIncrement = 0; var yIncrement = 0;

Просмотреть файл

@ -46,7 +46,11 @@ function initTest() {
"Browser:Cookies", "", {}); "Browser:Cookies", "", {});
// when it has loaded, run actual tests // when it has loaded, run actual tests
cmd.addEventListener("load", function() {executeSoon(function() {runTest(cmd, searchTerm, vals.length, matches);});}, false); cmd.addEventListener("load", function() {
executeSoon(function() {
runTest(cmd, searchTerm, vals.length, matches);
});
}, false);
} }
function isDisabled(win, expectation) { function isDisabled(win, expectation) {

Просмотреть файл

@ -91,8 +91,8 @@ add_task(function* testSyncedTabsSidebarList() {
SyncedTabs._internal = { SyncedTabs._internal = {
isConfiguredToSyncTabs: true, isConfiguredToSyncTabs: true,
hasSyncedThisSession: true, hasSyncedThisSession: true,
getTabClients() { return Promise.resolve([])}, getTabClients() { return Promise.resolve([]) },
syncTabs() {return Promise.resolve();}, syncTabs() { return Promise.resolve(); },
}; };
sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true)); sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true));
@ -144,8 +144,8 @@ add_task(function* testSyncedTabsSidebarFilteredList() {
SyncedTabs._internal = { SyncedTabs._internal = {
isConfiguredToSyncTabs: true, isConfiguredToSyncTabs: true,
hasSyncedThisSession: true, hasSyncedThisSession: true,
getTabClients() { return Promise.resolve([])}, getTabClients() { return Promise.resolve([]) },
syncTabs() {return Promise.resolve();}, syncTabs() { return Promise.resolve(); },
}; };
sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true)); sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true));
@ -204,7 +204,7 @@ add_task(function* testSyncedTabsSidebarStatus() {
isConfiguredToSyncTabs: false, isConfiguredToSyncTabs: false,
hasSyncedThisSession: false, hasSyncedThisSession: false,
getTabClients() {}, getTabClients() {},
syncTabs() {return Promise.resolve();}, syncTabs() { return Promise.resolve(); },
}; };
Assert.ok(syncedTabsDeckComponent, "component exists"); Assert.ok(syncedTabsDeckComponent, "component exists");
@ -266,8 +266,8 @@ add_task(function* testSyncedTabsSidebarContextMenu() {
SyncedTabs._internal = { SyncedTabs._internal = {
isConfiguredToSyncTabs: true, isConfiguredToSyncTabs: true,
hasSyncedThisSession: true, hasSyncedThisSession: true,
getTabClients() { return Promise.resolve([])}, getTabClients() { return Promise.resolve([]) },
syncTabs() {return Promise.resolve();}, syncTabs() { return Promise.resolve(); },
}; };
sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true)); sinon.stub(syncedTabsDeckComponent, "_accountStatus", ()=> Promise.resolve(true));

Просмотреть файл

@ -1438,7 +1438,7 @@ add_task(function* test_DirectoryLinksProvider_getFrequencyCapLogic() {
// now step into the furture // now step into the furture
let _wasTodayOrig = DirectoryLinksProvider._wasToday; let _wasTodayOrig = DirectoryLinksProvider._wasToday;
DirectoryLinksProvider._wasToday = function () {return false;} DirectoryLinksProvider._wasToday = function () { return false; }
// exhaust total views // exhaust total views
DirectoryLinksProvider._addFrequencyCapView("1") DirectoryLinksProvider._addFrequencyCapView("1")
do_check_true(DirectoryLinksProvider._testFrequencyCapLimits("1")); do_check_true(DirectoryLinksProvider._testFrequencyCapLimits("1"));
@ -1487,7 +1487,7 @@ add_task(function* test_DirectoryLinksProvider_getFrequencyCapReportSiteAction()
targetedSite: "foo.com", targetedSite: "foo.com",
url: "bar.com" url: "bar.com"
}, },
isPinned: function() {return false;}, isPinned: function() { return false; },
}], "view", 0); }], "view", 0);
// read file content and ensure that view counters are updated // read file content and ensure that view counters are updated
@ -1531,9 +1531,9 @@ add_task(function* test_DirectoryLinksProvider_ClickRemoval() {
}] }]
}, },
{ {
handleError: function () {do_check_true(false);}, handleError: function () { do_check_true(false); },
handleResult: function () {}, handleResult: function () {},
handleCompletion: function () {resolve();} handleCompletion: function () { resolve(); }
} }
); );
}); });
@ -1828,7 +1828,7 @@ add_task(function* test_blockSuggestedTiles() {
// block suggested tile in a regular way // block suggested tile in a regular way
DirectoryLinksProvider.reportSitesAction([{ DirectoryLinksProvider.reportSitesAction([{
isPinned: function() {return false;}, isPinned: function() { return false; },
link: Object.assign({frecency: 1000},suggestedLink) link: Object.assign({frecency: 1000},suggestedLink)
}], "block", 0); }], "block", 0);

Просмотреть файл

@ -9,7 +9,7 @@
// "arrow-spacing": 2, // "arrow-spacing": 2,
// Always require spacing around a single line block // Always require spacing around a single line block
// "block-spacing": 1, "block-spacing": 2,
// No newline before open brace for a block // No newline before open brace for a block
// "brace-style": 2, // "brace-style": 2,

Просмотреть файл

@ -130,7 +130,7 @@ let tabFinder = {
function wait(ms = 0) { function wait(ms = 0) {
try { try {
let resolve; let resolve;
let p = new Promise(resolve_ => {resolve = resolve_}); let p = new Promise(resolve_ => { resolve = resolve_ });
setTimeout(resolve, ms); setTimeout(resolve, ms);
return p; return p;
} catch (e) { } catch (e) {

Просмотреть файл

@ -40,7 +40,7 @@ function test_portal_not_found() {
do_check_eq(++step, 2); do_check_eq(++step, 2);
do_check_true(success); do_check_true(success);
do_check_eq(attempt, 1); do_check_eq(attempt, 1);
gServer.stop(function() {dump('server stop\n'); do_test_finished(); }); gServer.stop(function() { dump('server stop\n'); do_test_finished(); });
} }
}; };

Просмотреть файл

@ -228,7 +228,7 @@ ContentPrefService.prototype = {
if (this._privModeStorage.has(group, aName)) { if (this._privModeStorage.has(group, aName)) {
let value = this._privModeStorage.get(group, aName); let value = this._privModeStorage.get(group, aName);
if (aCallback) { if (aCallback) {
this._scheduleCallback(function() {aCallback.onResult(value);}); this._scheduleCallback(function() { aCallback.onResult(value); });
return undefined; return undefined;
} }
return value; return value;
@ -597,7 +597,7 @@ ContentPrefService.prototype = {
if (this._cache.has(aGroup, aSetting)) { if (this._cache.has(aGroup, aSetting)) {
value = this._cache.get(aGroup, aSetting); value = this._cache.get(aGroup, aSetting);
if (aCallback) { if (aCallback) {
this._scheduleCallback(function() {aCallback.onResult(value);}); this._scheduleCallback(function() { aCallback.onResult(value); });
return undefined; return undefined;
} }
return value; return value;
@ -647,7 +647,7 @@ ContentPrefService.prototype = {
if (this._cache.has(null, aName)) { if (this._cache.has(null, aName)) {
value = this._cache.get(null, aName); value = this._cache.get(null, aName);
if (aCallback) { if (aCallback) {
this._scheduleCallback(function() {aCallback.onResult(value);}); this._scheduleCallback(function() { aCallback.onResult(value); });
return undefined; return undefined;
} }
return value; return value;

Просмотреть файл

@ -2652,7 +2652,7 @@ function run_single_closure_tests(library, abi, suffix)
// mismatch with the cx stashed in the closure. // mismatch with the cx stashed in the closure.
try { try {
var sb = Components.utils.Sandbox("http://www.example.com"); var sb = Components.utils.Sandbox("http://www.example.com");
sb.fn = fn_v_t(function() {sb.foo = {};}); sb.fn = fn_v_t(function() { sb.foo = {}; });
Components.utils.evalInSandbox("fn();", sb); Components.utils.evalInSandbox("fn();", sb);
} catch (e) {} // Components not available in workers. } catch (e) {} // Components not available in workers.

Просмотреть файл

@ -26,9 +26,9 @@ var rejectsTreeView = {
} }
return rv; return rv;
}, },
isSeparator : function(index) {return false;}, isSeparator : function(index) { return false; },
isSorted: function() { return false; }, isSorted: function() { return false; },
isContainer : function(index) {return false;}, isContainer : function(index) { return false; },
cycleHeader : function(column) {}, cycleHeader : function(column) {},
getRowProperties : function(row) { return ""; }, getRowProperties : function(row) { return ""; },
getColumnProperties : function(column) { return ""; }, getColumnProperties : function(column) { return ""; },

Просмотреть файл

@ -43,11 +43,11 @@ function burnCPOW() {
let gBurnCPOW = null; let gBurnCPOW = null;
function burnContentCPU() { function burnContentCPU() {
setTimeout(() => {try { setTimeout(() => { try {
gBurnContentCPU() gBurnContentCPU()
} catch (ex) { } catch (ex) {
dump(`test-addon error: ${ex}\n`); dump(`test-addon error: ${ex}\n`);
}}, 0); } }, 0);
} }
let gBurnContentCPU = null; let gBurnContentCPU = null;

Просмотреть файл

@ -184,7 +184,7 @@ add_task(function* test_insert_multiple_error_cases() {
add_task(function* test_history_insertMany() { add_task(function* test_history_insertMany() {
const BAD_URLS = ["about:config", "chrome://browser/content/browser.xul"]; const BAD_URLS = ["about:config", "chrome://browser/content/browser.xul"];
const GOOD_URLS = [1, 2, 3].map(x => {return `http://mozilla.com/${x}`;}); const GOOD_URLS = [1, 2, 3].map(x => { return `http://mozilla.com/${x}`; });
let makePageInfos = Task.async(function*(urls, filter = x => x) { let makePageInfos = Task.async(function*(urls, filter = x => x) {
let pageInfos = []; let pageInfos = [];

Просмотреть файл

@ -74,7 +74,7 @@ var containers = [
]; ];
var visibleContainers = containers.filter( var visibleContainers = containers.filter(
function(aContainer) {return aContainer.visible}); function(aContainer) { return aContainer.visible });
/** /**
* Asynchronous task that fills history and checks containers' labels. * Asynchronous task that fills history and checks containers' labels.

Просмотреть файл

@ -442,7 +442,7 @@ add_task(function* test_getLivemark_removeItem_contention() {
PlacesUtils.livemarks.addLivemark({ title: "test" PlacesUtils.livemarks.addLivemark({ title: "test"
, parentGuid: PlacesUtils.bookmarks.unfiledGuid , parentGuid: PlacesUtils.bookmarks.unfiledGuid
, feedURI: FEED_URI , feedURI: FEED_URI
}).catch(() => {/* swallow errors*/}); }).catch(() => { /* swallow errors*/ });
yield PlacesUtils.bookmarks.eraseEverything(); yield PlacesUtils.bookmarks.eraseEverything();
let livemark = yield PlacesUtils.livemarks.addLivemark( let livemark = yield PlacesUtils.livemarks.addLivemark(
{ title: "test" { title: "test"

Просмотреть файл

@ -142,7 +142,7 @@ function onCancel ()
try { try {
printProgress.processCanceledByUser = true; printProgress.processCanceledByUser = true;
} }
catch (e) {return true;} catch (e) { return true; }
// don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted. // don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted.
return false; return false;

Просмотреть файл

@ -244,7 +244,7 @@ function onLoad() {
// Set up dialog button callbacks. // Set up dialog button callbacks.
var object = this; var object = this;
doSetOKCancel("", function () { return object.onCancel();}); doSetOKCancel("", function () { return object.onCancel(); });
// Fill dialog. // Fill dialog.
loadDialog(); loadDialog();
@ -278,7 +278,7 @@ function onCancel ()
{ {
printProgress.processCanceledByUser = true; printProgress.processCanceledByUser = true;
} }
catch ( exception ) {return true;} catch ( exception ) { return true; }
// don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted. // don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted.
return false; return false;

Просмотреть файл

@ -110,14 +110,14 @@ var view = {
}, },
selectionChanged : function() {}, selectionChanged : function() {},
cycleCell: function(row, col) {}, cycleCell: function(row, col) {},
isEditable: function(row, col) {return false; }, isEditable: function(row, col) { return false; },
isSelectable: function(row, col) {return false; }, isSelectable: function(row, col) { return false; },
setCellValue: function(row, col, value) {}, setCellValue: function(row, col, value) {},
setCellText: function(row, col, value) {}, setCellText: function(row, col, value) {},
performAction: function(action) {}, performAction: function(action) {},
performActionOnRow: function(action, row) {}, performActionOnRow: function(action, row) {},
performActionOnCell: function(action, row, col) {}, performActionOnCell: function(action, row, col) {},
isSeparator: function(index) {return false; } isSeparator: function(index) { return false; }
}; };
// find the index in gPrefView of a pref object // find the index in gPrefView of a pref object

Просмотреть файл

@ -491,10 +491,10 @@ var gViewSourceUtils = {
} }
}, },
onLocationChange: function() {return 0;}, onLocationChange: function() { return 0; },
onProgressChange: function() {return 0;}, onProgressChange: function() { return 0; },
onStatusChange: function() {return 0;}, onStatusChange: function() { return 0; },
onSecurityChange: function() {return 0;}, onSecurityChange: function() { return 0; },
webShell: null, webShell: null,
editor: null, editor: null,

Просмотреть файл

@ -302,9 +302,10 @@ var snapshotFormatters = {
combined.push(assembled); combined.push(assembled);
} }
combined.sort(function(a,b) { combined.sort(function(a,b) {
if (a.index < b.index) return -1; if (a.index < b.index) return -1;
if (a.index > b.index) return 1; if (a.index > b.index) return 1;
return 0;}); return 0;
});
$.append($("graphics-failures-tbody"), $.append($("graphics-failures-tbody"),
combined.map(function(val) { combined.map(function(val) {
return $.new("tr", [$.new("th", val.header, "column"), return $.new("tr", [$.new("th", val.header, "column"),

Просмотреть файл

@ -492,7 +492,7 @@ this.CrashSubmit = {
let [dump, extra, mem] = getPendingMinidump(id); let [dump, extra, mem] = getPendingMinidump(id);
return OS.File.open(dump.path + ".ignore", {create: true}, return OS.File.open(dump.path + ".ignore", {create: true},
{unixFlags: OS.Constants.libc.O_CREAT}) {unixFlags: OS.Constants.libc.O_CREAT})
.then((file) => {file.close(); }); .then((file) => { file.close(); });
}, },
/** /**

Просмотреть файл

@ -18,7 +18,8 @@ var ProductAddonCheckerScope = Cu.import("resource://gre/modules/addons/ProductA
do_get_profile(); do_get_profile();
function run_test() {Cu.import("resource://gre/modules/Preferences.jsm") function run_test() {
Cu.import("resource://gre/modules/Preferences.jsm");
Preferences.set("media.gmp.log.dump", true); Preferences.set("media.gmp.log.dump", true);
Preferences.set("media.gmp.log.level", 0); Preferences.set("media.gmp.log.level", 0);
run_next_test(); run_next_test();

Просмотреть файл

@ -371,23 +371,23 @@ add_task(function* log_message_with_params() {
// If an object has a .toJSON method, the formatter uses it. // If an object has a .toJSON method, the formatter uses it.
let ob = function() {}; let ob = function() {};
ob.toJSON = function() {return {sneaky: "value"}}; ob.toJSON = function() { return {sneaky: "value"} };
do_check_eq(formatMessage("JSON is ${sub}", {sub: ob}), do_check_eq(formatMessage("JSON is ${sub}", {sub: ob}),
'JSON is {"sneaky":"value"}'); 'JSON is {"sneaky":"value"}');
// Fall back to .toSource() if JSON.stringify() fails on an object. // Fall back to .toSource() if JSON.stringify() fails on an object.
ob = function() {}; ob = function() {};
ob.toJSON = function() {throw "oh noes JSON"}; ob.toJSON = function() { throw "oh noes JSON" };
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}), do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is (function () {})'); 'Fail is (function () {})');
// Fall back to .toString if both .toJSON and .toSource fail. // Fall back to .toString if both .toJSON and .toSource fail.
ob.toSource = function() {throw "oh noes SOURCE"}; ob.toSource = function() { throw "oh noes SOURCE" };
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}), do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is function () {}'); 'Fail is function () {}');
// Fall back to '[object]' if .toJSON, .toSource and .toString fail. // Fall back to '[object]' if .toJSON, .toSource and .toString fail.
ob.toString = function() {throw "oh noes STRING"}; ob.toString = function() { throw "oh noes STRING" };
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}), do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is [object]'); 'Fail is [object]');
@ -446,7 +446,7 @@ add_task(function* log_message_with_params() {
// We use object.valueOf() internally; make sure a broken valueOf() method // We use object.valueOf() internally; make sure a broken valueOf() method
// doesn't cause the logger to fail. // doesn't cause the logger to fail.
let vOf = {a: 1, valueOf: function() {throw "oh noes valueOf"}}; let vOf = {a: 1, valueOf: function() { throw "oh noes valueOf" }};
do_check_eq(formatMessage("Broken valueOf ${}", vOf), do_check_eq(formatMessage("Broken valueOf ${}", vOf),
'Broken valueOf ({a:1, valueOf:(function () {throw "oh noes valueOf"})})'); 'Broken valueOf ({a:1, valueOf:(function () {throw "oh noes valueOf"})})');

Просмотреть файл

@ -948,7 +948,7 @@ tests.push(
}, null); }, null);
do_print("Setting wait for second promise"); do_print("Setting wait for second promise");
return promise2.catch(error => {return 3;}) return promise2.catch(error => { return 3; })
.then( .then(
count => { count => {
shouldExitNestedEventLoop = true; shouldExitNestedEventLoop = true;
@ -1074,7 +1074,7 @@ make_promise_test(function test_caught_is_not_reported() {
let promise = wait_for_uncaught([salt], 500); let promise = wait_for_uncaught([salt], 500);
(function() { (function() {
let uncaught = Promise.reject("This error, on the other hand, is caught " + salt); let uncaught = Promise.reject("This error, on the other hand, is caught " + salt);
uncaught.catch(function() { /* ignore rejection */}); uncaught.catch(function() { /* ignore rejection */ });
uncaught = null; uncaught = null;
})(); })();
// Isolate this in a function to increase likelihood that the gc will // Isolate this in a function to increase likelihood that the gc will

Просмотреть файл

@ -217,7 +217,7 @@ this.DeferredSave.prototype = {
return; return;
} }
writing.then(null, error => {return 0;}) writing.then(null, error => { return 0; })
.then(count => { .then(count => {
this.logger.debug("Starting write"); this.logger.debug("Starting write");
this.totalSaves++; this.totalSaves++;

Просмотреть файл

@ -168,7 +168,7 @@ function WebAPITask(apiRequest, apiArgs, processor) {
Addon.prototype = { Addon.prototype = {
uninstall: WebAPITask("addonUninstall", function() { return [this.id]; }), uninstall: WebAPITask("addonUninstall", function() { return [this.id]; }),
setEnabled: WebAPITask("addonSetEnabled", function(value) {return [this.id, value]; }), setEnabled: WebAPITask("addonSetEnabled", function(value) { return [this.id, value]; }),
}; };
const INSTALL_EVENTS = [ const INSTALL_EVENTS = [

Просмотреть файл

@ -392,7 +392,7 @@ function check_test_pt1() {
do_throw("Addon " + (i + 1) + " did not get installed correctly"); do_throw("Addon " + (i + 1) + " did not get installed correctly");
} }
do_execute_soon(function checkstate1() {check_state("start", null, run_test_pt2);}); do_execute_soon(function checkstate1() { check_state("start", null, run_test_pt2); });
}); });
} }

Просмотреть файл

@ -183,7 +183,7 @@ function check_test_1() {
do_check_eq(a1.icon64URL, uri + "icon64.png"); do_check_eq(a1.icon64URL, uri + "icon64.png");
a1.uninstall(); a1.uninstall();
do_execute_soon(function() {run_test_2(a1)}); do_execute_soon(function() { run_test_2(a1) });
}); });
}); });
})); }));