Bug 1880535 - Enable ESLint rule no-unused-private-class-members. r=Gijs,webdriver-reviewers,webcompat-reviewers,extension-reviewers,application-update-reviewers,devtools-reviewers,translations-reviewers,bytesized,twisniewski,jhirsch,robwu,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D202002
This commit is contained in:
Mark Banner 2024-02-20 22:09:21 +00:00
parent cc3ac3045e
commit b4dc975e82
12 changed files with 8 additions and 53 deletions

View file

@ -10,7 +10,6 @@
const SHOPPING_SIDEBAR_WIDTH_PREF = const SHOPPING_SIDEBAR_WIDTH_PREF =
"browser.shopping.experience2023.sidebarWidth"; "browser.shopping.experience2023.sidebarWidth";
class ShoppingSidebar extends MozXULElement { class ShoppingSidebar extends MozXULElement {
#browser;
#initialized; #initialized;
static get markup() { static get markup() {
@ -46,7 +45,6 @@
} }
this.resizeObserverFn = this.resizeObserverFn.bind(this); this.resizeObserverFn = this.resizeObserverFn.bind(this);
this.appendChild(this.constructor.fragment); this.appendChild(this.constructor.fragment);
this.#browser = this.querySelector(".shopping-sidebar");
let previousWidth = Services.prefs.getIntPref( let previousWidth = Services.prefs.getIntPref(
SHOPPING_SIDEBAR_WIDTH_PREF, SHOPPING_SIDEBAR_WIDTH_PREF,

View file

@ -278,7 +278,6 @@ export class SuggestBackendJs extends BaseFeature {
#config = {}; #config = {};
#emitter = null; #emitter = null;
#logger = null;
#onSettingsSync = null; #onSettingsSync = null;
} }

View file

@ -38,8 +38,6 @@ async function promiseAddonEnabled() {
} }
class HelpMenuHelper { class HelpMenuHelper {
#popup = null;
async open() { async open() {
this.popup = document.getElementById("menu_HelpPopup"); this.popup = document.getElementById("menu_HelpPopup");
ok(this.popup, "Help menu should exist"); ok(this.popup, "Help menu should exist");

View file

@ -158,10 +158,6 @@ class LazyMessageList extends Component {
#cachedHeights; #cachedHeights;
#scrollHandlerBinding; #scrollHandlerBinding;
get #maxIndex() {
return this.props.items.length - 1;
}
get #overdrawHeight() { get #overdrawHeight() {
return this.props.scrollOverdrawCount * this.props.itemDefaultHeight; return this.props.scrollOverdrawCount * this.props.itemDefaultHeight;
} }

View file

@ -30,9 +30,11 @@ add_task(async function () {
} }
#privateProperty; #privateProperty;
// eslint-disable-next-line no-unused-private-class-members
#privateMethod() { #privateMethod() {
return Math.random(); return Math.random();
} }
// eslint-disable-next-line no-unused-private-class-members
get #privateGetter() { get #privateGetter() {
return 42; return 42;
} }

View file

@ -6,13 +6,11 @@
class TracerCommand { class TracerCommand {
constructor({ commands }) { constructor({ commands }) {
this.#targetCommand = commands.targetCommand;
this.#targetConfigurationCommand = commands.targetConfigurationCommand; this.#targetConfigurationCommand = commands.targetConfigurationCommand;
this.#resourceCommand = commands.resourceCommand; this.#resourceCommand = commands.resourceCommand;
} }
#resourceCommand; #resourceCommand;
#targetCommand;
#targetConfigurationCommand; #targetConfigurationCommand;
#isTracing = false; #isTracing = false;

View file

@ -77,13 +77,8 @@ export class NetworkResponseListener {
* *
* @type {nsIInputStream} * @type {nsIInputStream}
*/ */
// eslint-disable-next-line no-unused-private-class-members
#inputStream = null; #inputStream = null;
/**
* Explicit flag to check if this listener was already destroyed.
*
* @type {boolean}
*/
#isDestroyed = false;
/** /**
* Internal promise used to hold the completion of #getSecurityInfo. * Internal promise used to hold the completion of #getSecurityInfo.
* *
@ -553,8 +548,6 @@ export class NetworkResponseListener {
this.#inputStream = null; this.#inputStream = null;
this.#converter = null; this.#converter = null;
this.#request = null; this.#request = null;
this.#isDestroyed = true;
} }
/** /**

View file

@ -484,12 +484,6 @@ class RemoteAgentParentProcess {
} }
class RemoteAgentContentProcess { class RemoteAgentContentProcess {
#classID;
constructor() {
this.#classID = Components.ID("{8f685a9d-8181-46d6-a71d-869289099c6d}");
}
get running() { get running() {
let reply = Services.cpmm.sendSyncMessage("RemoteAgent:IsRunning"); let reply = Services.cpmm.sendSyncMessage("RemoteAgent:IsRunning");
if (!reply.length) { if (!reply.length) {

View file

@ -83,17 +83,6 @@ export class AboutTranslationsChild extends JSWindowActorChild {
); );
} }
/**
* @returns {TranslationsChild}
*/
#getTranslationsChild() {
const child = this.contentWindow.windowGlobalChild.getActor("Translations");
if (!child) {
throw new Error("Unable to find the TranslationsChild");
}
return child;
}
/** /**
* A privileged promise can't be used in the content page, so convert a privileged * A privileged promise can't be used in the content page, so convert a privileged
* promise into a content one. * promise into a content one.

View file

@ -273,8 +273,6 @@ class SitePermsAddonWrapper {
} }
class SitePermsAddonInstalling extends SitePermsAddonWrapper { class SitePermsAddonInstalling extends SitePermsAddonWrapper {
#install = null;
/** /**
* @param {string} siteOriginNoSuffix: The origin this addon is installed * @param {string} siteOriginNoSuffix: The origin this addon is installed
* for, WITHOUT the suffix generated from * for, WITHOUT the suffix generated from
@ -293,7 +291,6 @@ class SitePermsAddonInstalling extends SitePermsAddonWrapper {
}; };
super(siteOriginNoSuffix, [permission]); super(siteOriginNoSuffix, [permission]);
this.#install = install;
} }
get existingAddon() { get existingAddon() {

View file

@ -411,20 +411,6 @@ export class AppUpdater {
return Services.sysinfo.getProperty("isPackagedApp"); return Services.sysinfo.getProperty("isPackagedApp");
} }
// true when updating in background is enabled.
get #updateStagingEnabled() {
LOG(
"AppUpdater:#updateStagingEnabled" +
"canStageUpdates: " +
this.aus.canStageUpdates
);
return (
!this.aus.disabled &&
!this.#updateDisabledByPackage &&
this.aus.canStageUpdates
);
}
/** /**
* Downloads an update mar or connects to an in-progress download. * Downloads an update mar or connects to an in-progress download.
* Doesn't resolve until the update is ready to install, or a failure state * Doesn't resolve until the update is ready to install, or a failure state

View file

@ -320,6 +320,11 @@ module.exports = {
"no-unsanitized/method": "error", "no-unsanitized/method": "error",
"no-unsanitized/property": "error", "no-unsanitized/property": "error",
// Disallow unused private class members.
// This rule will be a recommended rule in ESLint v9 so may be removed
// when we upgrade to that.
"no-unused-private-class-members": "error",
// No declaring variables that are never used // No declaring variables that are never used
"no-unused-vars": [ "no-unused-vars": [
"error", "error",