mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1228628 - Add a minimal .eslintrc configuration for browser and start linting a few browser files with basic rules. r=Mossop
This commit is contained in:
parent
efb0a71446
commit
70f59040f6
@ -58,18 +58,26 @@ xulrunner/**
|
||||
# browser/ exclusions
|
||||
browser/app/**
|
||||
browser/base/**
|
||||
browser/branding/**
|
||||
browser/components/**
|
||||
browser/config/**
|
||||
browser/docs/**
|
||||
browser/components/customizableui/**
|
||||
browser/components/downloads/**
|
||||
browser/components/feeds/**
|
||||
browser/components/migration/**
|
||||
browser/components/*.js
|
||||
browser/components/places/**
|
||||
browser/components/pocket/**
|
||||
browser/components/preferences/**
|
||||
browser/components/privatebrowsing/**
|
||||
browser/components/sessionstore/**
|
||||
browser/components/shell/**
|
||||
browser/components/tabview/**
|
||||
browser/components/translation/**
|
||||
browser/components/uitour/**
|
||||
browser/experiments/**
|
||||
browser/extensions/pdfjs/**
|
||||
browser/extensions/shumway/**
|
||||
browser/fuel/**
|
||||
browser/installer/**
|
||||
browser/locales/**
|
||||
browser/modules/**
|
||||
browser/themes/**
|
||||
|
||||
# Loop specific exclusions
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
{
|
||||
// When adding items to this file please check for effects on sub-directories.
|
||||
"plugins": [
|
||||
"mozilla"
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
}
|
||||
|
6
browser/.eslintrc
Normal file
6
browser/.eslintrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
// When adding items to this file please check for effects on sub-directories.
|
||||
"rules": {
|
||||
"eol-last": 2,
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function validCacheMidPopulation() {
|
||||
add_task(function* validCacheMidPopulation() {
|
||||
let expectedLinks = makeLinks(0, 3, 1);
|
||||
|
||||
let provider = new TestProvider(done => done(expectedLinks));
|
||||
@ -36,7 +36,7 @@ add_task(function validCacheMidPopulation() {
|
||||
RemoteNewTabUtils.links.removeProvider(provider);
|
||||
});
|
||||
|
||||
add_task(function notifyLinkDelete() {
|
||||
add_task(function* notifyLinkDelete() {
|
||||
let expectedLinks = makeLinks(0, 3, 1);
|
||||
|
||||
let provider = new TestProvider(done => done(expectedLinks));
|
||||
@ -95,7 +95,7 @@ add_task(function populatePromise() {
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function isTopSiteGivenProvider() {
|
||||
add_task(function* isTopSiteGivenProvider() {
|
||||
let expectedLinks = makeLinks(0, 10, 2);
|
||||
|
||||
// The lowest 2 frecencies have the same base domain.
|
||||
@ -134,7 +134,7 @@ add_task(function isTopSiteGivenProvider() {
|
||||
RemoteNewTabUtils.links.removeProvider(provider);
|
||||
});
|
||||
|
||||
add_task(function multipleProviders() {
|
||||
add_task(function* multipleProviders() {
|
||||
// Make each provider generate RemoteNewTabUtils.links.maxNumLinks links to check
|
||||
// that no more than maxNumLinks are actually returned in the merged list.
|
||||
let evenLinks = makeLinks(0, 2 * RemoteNewTabUtils.links.maxNumLinks, 2);
|
||||
@ -159,7 +159,7 @@ add_task(function multipleProviders() {
|
||||
RemoteNewTabUtils.links.removeProvider(oddProvider);
|
||||
});
|
||||
|
||||
add_task(function changeLinks() {
|
||||
add_task(function* changeLinks() {
|
||||
let expectedLinks = makeLinks(0, 20, 2);
|
||||
let provider = new TestProvider(done => done(expectedLinks));
|
||||
|
||||
@ -217,7 +217,7 @@ add_task(function changeLinks() {
|
||||
RemoteNewTabUtils.links.removeProvider(provider);
|
||||
});
|
||||
|
||||
add_task(function oneProviderAlreadyCached() {
|
||||
add_task(function* oneProviderAlreadyCached() {
|
||||
let links1 = makeLinks(0, 10, 1);
|
||||
let provider1 = new TestProvider(done => done(links1));
|
||||
|
||||
@ -238,7 +238,7 @@ add_task(function oneProviderAlreadyCached() {
|
||||
RemoteNewTabUtils.links.removeProvider(provider2);
|
||||
});
|
||||
|
||||
add_task(function newLowRankedLink() {
|
||||
add_task(function* newLowRankedLink() {
|
||||
// Init a provider with 10 links and make its maximum number also 10.
|
||||
let links = makeLinks(0, 10, 1);
|
||||
let provider = new TestProvider(done => done(links));
|
||||
|
@ -148,11 +148,11 @@ function* prepareTest() {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
add_task(function testSetupEngine() {
|
||||
add_task(function* testSetupEngine() {
|
||||
yield promiseSetEngine();
|
||||
});
|
||||
|
||||
add_task(function testReturn() {
|
||||
add_task(function* testReturn() {
|
||||
yield prepareTest();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
let event = yield promiseOnLoad();
|
||||
@ -163,7 +163,7 @@ add_task(function testReturn() {
|
||||
is(event.originalTarget.URL, expectedURL(searchBar.value), "testReturn opened correct search page");
|
||||
});
|
||||
|
||||
add_task(function testAltReturn() {
|
||||
add_task(function* testAltReturn() {
|
||||
yield prepareTest();
|
||||
EventUtils.synthesizeKey("VK_RETURN", { altKey: true });
|
||||
let event = yield promiseOnLoad();
|
||||
@ -177,7 +177,7 @@ add_task(function testAltReturn() {
|
||||
});
|
||||
|
||||
//Shift key has no effect for now, so skip it
|
||||
add_task(function testShiftAltReturn() {
|
||||
add_task(function* testShiftAltReturn() {
|
||||
return;
|
||||
|
||||
yield prepareTest();
|
||||
@ -192,7 +192,7 @@ add_task(function testShiftAltReturn() {
|
||||
is(event.originalTarget.URL, expectedURL(searchBar.value), "testShiftAltReturn opened correct search page");
|
||||
});
|
||||
|
||||
add_task(function testLeftClick() {
|
||||
add_task(function* testLeftClick() {
|
||||
yield prepareTest();
|
||||
simulateClick({ button: 0 }, searchButton);
|
||||
let event = yield promiseOnLoad();
|
||||
@ -202,7 +202,7 @@ add_task(function testLeftClick() {
|
||||
is(event.originalTarget.URL, expectedURL(searchBar.value), "testLeftClick opened correct search page");
|
||||
});
|
||||
|
||||
add_task(function testMiddleClick() {
|
||||
add_task(function* testMiddleClick() {
|
||||
yield prepareTest();
|
||||
simulateClick({ button: 1 }, searchButton);
|
||||
let event = yield promiseOnLoad();
|
||||
@ -214,7 +214,7 @@ add_task(function testMiddleClick() {
|
||||
is(event.originalTarget.URL, expectedURL(searchBar.value), "testMiddleClick opened correct search page");
|
||||
});
|
||||
|
||||
add_task(function testShiftMiddleClick() {
|
||||
add_task(function* testShiftMiddleClick() {
|
||||
yield prepareTest();
|
||||
simulateClick({ button: 1, shiftKey: true }, searchButton);
|
||||
let event = yield promiseOnLoad();
|
||||
@ -226,7 +226,7 @@ add_task(function testShiftMiddleClick() {
|
||||
is(event.originalTarget.URL, expectedURL(searchBar.value), "testShiftMiddleClick opened correct search page");
|
||||
});
|
||||
|
||||
add_task(function testRightClick() {
|
||||
add_task(function* testRightClick() {
|
||||
preTabNo = gBrowser.tabs.length;
|
||||
content.location.href = "about:blank";
|
||||
simulateClick({ button: 2 }, searchButton);
|
||||
@ -242,7 +242,7 @@ add_task(function testRightClick() {
|
||||
searchBar.textbox.popup.hidePopup();
|
||||
});
|
||||
|
||||
add_task(function testSearchHistory() {
|
||||
add_task(function* testSearchHistory() {
|
||||
var textbox = searchBar._textbox;
|
||||
for (var i = 0; i < searchEntries.length; i++) {
|
||||
let count = yield countEntries(textbox.getAttribute("autocompletesearchparam"), searchEntries[i]);
|
||||
@ -250,7 +250,7 @@ add_task(function testSearchHistory() {
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function testAutocomplete() {
|
||||
add_task(function* testAutocomplete() {
|
||||
var popup = searchBar.textbox.popup;
|
||||
let popupShownPromise = promiseEvent(popup, "popupshown");
|
||||
searchBar.textbox.showHistoryPopup();
|
||||
@ -258,7 +258,7 @@ add_task(function testAutocomplete() {
|
||||
checkMenuEntries(searchEntries);
|
||||
});
|
||||
|
||||
add_task(function testClearHistory() {
|
||||
add_task(function* testClearHistory() {
|
||||
let controller = searchBar.textbox.controllers.getControllerForCommand("cmd_clearhistory")
|
||||
ok(controller.isCommandEnabled("cmd_clearhistory"), "Clear history command enabled");
|
||||
controller.doCommand("cmd_clearhistory");
|
||||
@ -266,7 +266,7 @@ add_task(function testClearHistory() {
|
||||
ok(count == 0, "History cleared");
|
||||
});
|
||||
|
||||
add_task(function asyncCleanup() {
|
||||
add_task(function* asyncCleanup() {
|
||||
searchBar.value = "";
|
||||
while (gBrowser.tabs.length != 1) {
|
||||
gBrowser.removeTab(gBrowser.tabs[0], {animate: false});
|
||||
|
@ -106,4 +106,4 @@ function resetPreferences() {
|
||||
.wrappedJSObject;
|
||||
service.policy._prefs.resetBranch("datareporting.policy.");
|
||||
service.policy.dataSubmissionPolicyBypassNotification = true;
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ function configureLogging() {
|
||||
// Returns a Promise resolved with the json payload or rejected with
|
||||
// OS.File.Error or JSON.parse() errors.
|
||||
function loadJSONAsync(file, options) {
|
||||
return Task.spawn(function() {
|
||||
return Task.spawn(function*() {
|
||||
let rawData = yield OS.File.read(file, options);
|
||||
// Read json file into a string
|
||||
let data;
|
||||
|
@ -1,35 +0,0 @@
|
||||
# This file currently uses a non-standard (and not on a standards track)
|
||||
# if statement within catch.
|
||||
content/modules/MozLoopWorker.js
|
||||
# This file currently uses es7 features eslint issue:
|
||||
# https://github.com/eslint/espree/issues/125
|
||||
content/modules/MozLoopAPI.jsm
|
||||
# Need to fix the configuration for this.
|
||||
bootstrap.js
|
||||
# Need to drop the preprocessing (bug 1212428)
|
||||
content/preferences/prefs.js
|
||||
# Libs we don't need to check
|
||||
content/panels/vendor
|
||||
content/shared/vendor
|
||||
standalone/content/libs
|
||||
standalone/node_modules
|
||||
# Libs we don't need to check
|
||||
test/shared/vendor
|
||||
# Coverage files
|
||||
test/coverage
|
||||
test/node_modules
|
||||
# These are generated react files that we don't need to check
|
||||
content/panels/js/conversation.js
|
||||
content/panels/js/conversationViews.js
|
||||
content/panels/js/panel.js
|
||||
content/panels/js/roomViews.js
|
||||
content/panels/js/feedbackViews.js
|
||||
content/shared/js/textChatView.js
|
||||
content/shared/js/linkifiedTextView.js
|
||||
content/shared/js/views.js
|
||||
standalone/content/js/standaloneRoomViews.js
|
||||
standalone/content/js/webapp.js
|
||||
ui/ui-showcase.js
|
||||
# Don't need to check the built tree
|
||||
standalone/dist
|
||||
|
@ -5,12 +5,23 @@
|
||||
"react"
|
||||
],
|
||||
"ecmaFeatures": {
|
||||
// Allow these.
|
||||
"forOf": true,
|
||||
"jsx": true,
|
||||
// Disallow due to content.
|
||||
"arrowFunctions": false,
|
||||
"blockBindings": false,
|
||||
"destructuring": false,
|
||||
"generators": false,
|
||||
"objectLiteralShorthandMethods": false,
|
||||
"restParams": false,
|
||||
"spread": false,
|
||||
"templateStrings": false,
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"mocha": true
|
||||
"es6": false,
|
||||
"mocha": true,
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
|
@ -1,7 +1,4 @@
|
||||
{
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"Cc": true,
|
||||
"Ci": true,
|
||||
|
@ -1,6 +1,5 @@
|
||||
env:
|
||||
browser: true
|
||||
es6: true
|
||||
|
||||
globals:
|
||||
Components: false
|
||||
|
Loading…
Reference in New Issue
Block a user