зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1734823 - Enable ESLint rule no-unused-vars globally for xpcshell test*.js files. r=necko-reviewers,Gijs,valentin
This enables it as a warning for all files, and as an error for some files. Differential Revision: https://phabricator.services.mozilla.com/D127944
This commit is contained in:
Родитель
e0845722c3
Коммит
f7ee253451
72
.eslintrc.js
72
.eslintrc.js
|
@ -21,7 +21,7 @@ function removeOverrides(config) {
|
|||
return config;
|
||||
}
|
||||
|
||||
const xpcshellTestPaths = ["**/test*/unit*/", "**/test*/xpcshell/"];
|
||||
const xpcshellTestPaths = ["**/test*/unit*/**/", "**/test*/xpcshell/**/"];
|
||||
|
||||
const browserTestPaths = ["**/test*/**/browser*/"];
|
||||
|
||||
|
@ -124,6 +124,76 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// This section enables warning of no-unused-vars globally for all test*.js
|
||||
// files in xpcshell test paths.
|
||||
// These are turned into errors with selected exclusions in the next
|
||||
// section.
|
||||
// Bug 1612907: This section should go away once the exclusions are removed
|
||||
// from the following section.
|
||||
files: xpcshellTestPaths.map(path => `${path}test*.js`),
|
||||
rules: {
|
||||
// No declaring variables that are never used
|
||||
"no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
args: "none",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// This section makes global issues with no-unused-vars be reported as
|
||||
// errors - except for the excluded lists which are being fixed in the
|
||||
// dependencies of bug 1612907.
|
||||
files: xpcshellTestPaths.map(path => `${path}test*.js`),
|
||||
excludedFiles: [
|
||||
// These are suitable as good first bugs, take one or two related lines
|
||||
// per bug.
|
||||
"caps/tests/unit/test_origin.js",
|
||||
"caps/tests/unit/test_site_origin.js",
|
||||
"chrome/test/unit/test_no_remote_registration.js",
|
||||
"extensions/permissions/**",
|
||||
"image/test/unit/**",
|
||||
"intl/uconv/tests/unit/test_bug317216.js",
|
||||
"intl/uconv/tests/unit/test_bug340714.js",
|
||||
"modules/libjar/test/unit/test_empty_jar_telemetry.js",
|
||||
"modules/libjar/zipwriter/test/unit/test_alignment.js",
|
||||
"modules/libjar/zipwriter/test/unit/test_bug419769_2.js",
|
||||
"modules/libjar/zipwriter/test/unit/test_storedata.js",
|
||||
"modules/libjar/zipwriter/test/unit/test_zippermissions.js",
|
||||
"modules/libpref/test/unit/test_changeType.js",
|
||||
"modules/libpref/test/unit/test_dirtyPrefs.js",
|
||||
"toolkit/crashreporter/test/unit/test_crash_AsyncShutdown.js",
|
||||
"toolkit/mozapps/update/tests/unit_aus_update/testConstants.js",
|
||||
"xpcom/tests/unit/test_hidden_files.js",
|
||||
"xpcom/tests/unit/test_localfile.js",
|
||||
|
||||
// These are more complicated bugs which may require some in-depth
|
||||
// investigation or different solutions. They are also likely to be
|
||||
// a reasonable size.
|
||||
"browser/components/**",
|
||||
"browser/modules/**",
|
||||
"dom/**",
|
||||
"netwerk/**",
|
||||
"security/manager/ssl/tests/unit/**",
|
||||
"services/**",
|
||||
"testing/xpcshell/**",
|
||||
"toolkit/components/**",
|
||||
"toolkit/modules/**",
|
||||
],
|
||||
rules: {
|
||||
// No declaring variables that are never used
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
...browserTestConfig,
|
||||
files: browserTestPaths.map(path => `${path}**`),
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
extends: ["plugin:mozilla/xpcshell-test"],
|
||||
};
|
|
@ -66,11 +66,9 @@ const SEGMENT_AND_HALF = [1, 2, 3, 4, 5, 6];
|
|||
const QUARTER_SEGMENT = [1];
|
||||
const HALF_SEGMENT = [1, 2];
|
||||
const SECOND_HALF_SEGMENT = [3, 4];
|
||||
const THREE_QUARTER_SEGMENT = [1, 2, 3];
|
||||
const EXTRA_HALF_SEGMENT = [5, 6];
|
||||
const MIDDLE_HALF_SEGMENT = [2, 3];
|
||||
const LAST_QUARTER_SEGMENT = [4];
|
||||
const FOURTH_HALF_SEGMENT = [7, 8];
|
||||
const HALF_THIRD_SEGMENT = [9, 10];
|
||||
const LATTER_HALF_THIRD_SEGMENT = [11, 12];
|
||||
|
||||
|
@ -388,6 +386,8 @@ function note(m) {
|
|||
* PUBLIC API! If you use any of these I will knowingly break your code by
|
||||
* changing the names of variables and properties.
|
||||
*/
|
||||
// These are used in head.js.
|
||||
/* exported BinaryInputStream, BinaryOutputStream */
|
||||
var BinaryInputStream = function BIS(stream) {
|
||||
return stream;
|
||||
};
|
||||
|
|
|
@ -105,11 +105,10 @@ function newPrefixHandler(channel) {
|
|||
}
|
||||
|
||||
var srv;
|
||||
var serverBasePath;
|
||||
var testsDirectory;
|
||||
|
||||
function run_test() {
|
||||
testsDirectory = do_get_profile();
|
||||
// Ensure the profile exists.
|
||||
do_get_profile();
|
||||
|
||||
srv = createServer();
|
||||
srv.start(-1);
|
||||
|
|
|
@ -36,7 +36,6 @@ function veryLongRequestLine(request, response) {
|
|||
response.setStatusLine(request.httpVersion, 200, "TEST PASSED");
|
||||
}
|
||||
|
||||
var path = "/very-long-request-line?";
|
||||
var reallyLong = "0123456789ABCDEF0123456789ABCDEF"; // 32
|
||||
reallyLong = reallyLong + reallyLong + reallyLong + reallyLong; // 128
|
||||
reallyLong = reallyLong + reallyLong + reallyLong + reallyLong; // 512
|
||||
|
|
|
@ -44,14 +44,6 @@ function checkException(fun, err, msg) {
|
|||
do_throw(msg);
|
||||
}
|
||||
|
||||
function callASAPLater(fun) {
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run() {
|
||||
fun();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** ***************
|
||||
* PATH HANDLERS *
|
||||
*****************/
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
var now = Date.now() * 1000;
|
||||
|
||||
// Test that importing bookmark data where a bookmark has a tag longer than 100
|
||||
// chars imports everything except the tags for that bookmark.
|
||||
add_task(async function() {
|
||||
|
|
|
@ -35,8 +35,6 @@ scenarios:
|
|||
|
||||
*/
|
||||
|
||||
const DEFAULT_INDEX = PlacesUtils.bookmarks.DEFAULT_INDEX;
|
||||
|
||||
var test = {
|
||||
_testRootId: null,
|
||||
_testRootTitle: "test root",
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
/* This test checks that bookmarks service is correctly forwarding async
|
||||
* events like visit or favicon additions. */
|
||||
|
||||
const NOW = Date.now() * 1000;
|
||||
let gBookmarkGuids = [];
|
||||
|
||||
add_task(async function setup() {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var folderIds = [];
|
||||
var folderGuids = [];
|
||||
var bookmarkGuids = [];
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const MOBILE_BOOKMARKS_PREF = "browser.bookmarks.showMobileBookmarks";
|
||||
|
||||
const expectedRoots = [
|
||||
{
|
||||
title: "OrganizerQueryHistory",
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let unfiledFolderId;
|
||||
|
||||
add_task(async function setup() {
|
||||
unfiledFolderId = await PlacesUtils.promiseItemId(
|
||||
PlacesUtils.bookmarks.unfiledGuid
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_value_combo() {
|
||||
let buf = await openMirror("value_combo");
|
||||
let now = Date.now();
|
||||
|
|
|
@ -4,8 +4,6 @@ ChromeUtils.defineModuleGetter(
|
|||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
|
||||
const SYNC_PARENT_ANNO = "sync/parent";
|
||||
|
||||
var makeGuid = PlacesUtils.history.makeGuid;
|
||||
|
||||
function shuffle(array) {
|
||||
|
@ -85,11 +83,6 @@ var populateTree = async function populate(parentGuid, ...items) {
|
|||
return guids;
|
||||
};
|
||||
|
||||
var recordIdToId = async function recordIdToId(recordId) {
|
||||
let guid = await PlacesSyncUtils.bookmarks.recordIdToGuid(recordId);
|
||||
return PlacesUtils.promiseItemId(guid);
|
||||
};
|
||||
|
||||
var moveSyncedBookmarksToUnsyncedParent = async function() {
|
||||
info("Insert synced bookmarks");
|
||||
let syncedGuids = await populateTree(
|
||||
|
|
|
@ -368,15 +368,6 @@ function ensureItemsUrlChanged(...items) {
|
|||
}
|
||||
}
|
||||
|
||||
function ensureTimestampsUpdated(aGuid, aCheckDateAdded = false) {
|
||||
Assert.ok(observer.itemsChanged.has(aGuid));
|
||||
let changes = observer.itemsChanged.get(aGuid);
|
||||
if (aCheckDateAdded) {
|
||||
Assert.ok(changes.has("dateAdded"));
|
||||
}
|
||||
Assert.ok(changes.has("lastModified"));
|
||||
}
|
||||
|
||||
function ensureTagsForURI(aURI, aTags) {
|
||||
let tagsSet = tagssvc.getTagsForURI(Services.io.newURI(aURI));
|
||||
Assert.equal(tagsSet.length, aTags.length);
|
||||
|
|
|
@ -23,9 +23,6 @@ const { BookmarkJSONUtils } = ChromeUtils.import(
|
|||
"resource://gre/modules/BookmarkJSONUtils.jsm"
|
||||
);
|
||||
|
||||
// Exported bookmarks file pointer.
|
||||
var bookmarksExportedFile;
|
||||
|
||||
add_task(async function test_import_bookmarks() {
|
||||
let bookmarksFile = OS.Path.join(do_get_cwd().path, "bookmarks_corrupt.json");
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
const { PromiseUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/PromiseUtils.jsm"
|
||||
);
|
||||
|
||||
const PREF_FREC_DECAY_RATE_DEF = 0.975;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var current_test = 0;
|
||||
|
||||
function AutoCompleteInput(aSearches) {
|
||||
this.searches = aSearches;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const Cm = Components.manager;
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
|
|
|
@ -23,6 +23,19 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// No declaring variables that are never used
|
||||
files: "test*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
rules: {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const gProfDir = do_get_profile();
|
||||
do_get_profile();
|
||||
const server = new HttpServer();
|
||||
server.registerDirectory("/", do_get_cwd());
|
||||
server.start(-1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче