Upgrade to eslint v9
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
lib/testpilot/*.js
|
|
||||||
coverage
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2021
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es6": true,
|
|
||||||
"node": true,
|
|
||||||
"webextensions": true
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"Utils": true,
|
|
||||||
"CustomizableUI": true,
|
|
||||||
"CustomizableWidgets": true,
|
|
||||||
"SessionStore": true,
|
|
||||||
"Services": true,
|
|
||||||
"Components": true,
|
|
||||||
"XPCOMUtils": true,
|
|
||||||
"OS": true,
|
|
||||||
"ADDON_UNINSTALL": true,
|
|
||||||
"ADDON_DISABLE": true,
|
|
||||||
"CONTAINER_ORDER_STORAGE_KEY": true,
|
|
||||||
"proxifiedContainers": true,
|
|
||||||
"MozillaVPN": true,
|
|
||||||
"MozillaVPN_Background": true
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"promise",
|
|
||||||
"no-unsanitized"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended"
|
|
||||||
],
|
|
||||||
"root": true,
|
|
||||||
"rules": {
|
|
||||||
"promise/always-return": "off",
|
|
||||||
"promise/avoid-new": "off",
|
|
||||||
"promise/catch-or-return": "error",
|
|
||||||
"promise/no-callback-in-promise": "warn",
|
|
||||||
"promise/no-native": "off",
|
|
||||||
"promise/no-nesting": "warn",
|
|
||||||
"promise/no-promise-in-callback": "warn",
|
|
||||||
"promise/no-return-wrap": "error",
|
|
||||||
"promise/param-names": "error",
|
|
||||||
|
|
||||||
"no-unsanitized/method": [
|
|
||||||
"error"
|
|
||||||
],
|
|
||||||
"no-unsanitized/property": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"escape": {
|
|
||||||
"taggedTemplates": ["Utils.escaped"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"indent": ["error", 2],
|
|
||||||
"linebreak-style": ["error", "unix"],
|
|
||||||
"no-throw-literal": "error",
|
|
||||||
"no-warning-comments": "warn",
|
|
||||||
"no-var": "error",
|
|
||||||
"prefer-const": "error",
|
|
||||||
"quotes": ["error", "double"],
|
|
||||||
"radix": "error",
|
|
||||||
"semi": ["error", "always"]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
const {
|
||||||
|
defineConfig,
|
||||||
|
globalIgnores,
|
||||||
|
} = require("eslint/config");
|
||||||
|
|
||||||
|
const globals = require("globals");
|
||||||
|
const promise = require("eslint-plugin-promise");
|
||||||
|
const noUnsanitized = require("eslint-plugin-no-unsanitized");
|
||||||
|
const js = require("@eslint/js");
|
||||||
|
|
||||||
|
module.exports = defineConfig([{
|
||||||
|
languageOptions: {
|
||||||
|
"ecmaVersion": 2021,
|
||||||
|
parserOptions: {},
|
||||||
|
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.node,
|
||||||
|
...globals.webextensions,
|
||||||
|
"Utils": true,
|
||||||
|
"CustomizableUI": true,
|
||||||
|
"CustomizableWidgets": true,
|
||||||
|
"SessionStore": true,
|
||||||
|
"Services": true,
|
||||||
|
"Components": true,
|
||||||
|
"XPCOMUtils": true,
|
||||||
|
"OS": true,
|
||||||
|
"ADDON_UNINSTALL": true,
|
||||||
|
"ADDON_DISABLE": true,
|
||||||
|
"CONTAINER_ORDER_STORAGE_KEY": true,
|
||||||
|
"proxifiedContainers": true,
|
||||||
|
"MozillaVPN": true,
|
||||||
|
"MozillaVPN_Background": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
js,
|
||||||
|
promise,
|
||||||
|
"no-unsanitized": noUnsanitized,
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: ["js/recommended"],
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"promise/always-return": "off",
|
||||||
|
"promise/avoid-new": "off",
|
||||||
|
"promise/catch-or-return": "error",
|
||||||
|
"promise/no-callback-in-promise": "warn",
|
||||||
|
"promise/no-native": "off",
|
||||||
|
"promise/no-nesting": "warn",
|
||||||
|
"promise/no-promise-in-callback": "warn",
|
||||||
|
"promise/no-return-wrap": "error",
|
||||||
|
"promise/param-names": "error",
|
||||||
|
"no-unsanitized/method": ["error"],
|
||||||
|
|
||||||
|
"no-unsanitized/property": ["error", {
|
||||||
|
"escape": {
|
||||||
|
"taggedTemplates": ["Utils.escaped"],
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
|
||||||
|
"eqeqeq": "error",
|
||||||
|
"indent": ["error", 2],
|
||||||
|
"linebreak-style": ["error", "unix"],
|
||||||
|
"no-throw-literal": "error",
|
||||||
|
"no-warning-comments": "warn",
|
||||||
|
"no-var": "error",
|
||||||
|
"prefer-const": "error",
|
||||||
|
"quotes": ["error", "double"],
|
||||||
|
"radix": "error",
|
||||||
|
"semi": ["error", "always"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
files: ["test/**/*.js"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.mocha,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-restricted-globals": ["error", "browser"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
files: ["src/js/**/*.js"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
"assignManager": true,
|
||||||
|
"badge": true,
|
||||||
|
"backgroundLogic": true,
|
||||||
|
"identityState": true,
|
||||||
|
"messageHandler": true,
|
||||||
|
"sync": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
globalIgnores(["lib/testpilot/*.js", "**/coverage"])]);
|
||||||
Generated
+724
-536
File diff suppressed because it is too large
Load Diff
+5
-4
@@ -7,14 +7,15 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.36.0",
|
||||||
"addons-linter": "^5.28.0",
|
"addons-linter": "^5.28.0",
|
||||||
"ajv": "^6.6.3",
|
"ajv": "^6.6.3",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^9.36.0",
|
||||||
"eslint-plugin-no-unsanitized": "^4.0.0",
|
"eslint-plugin-no-unsanitized": "^4.1.4",
|
||||||
"eslint-plugin-promise": "^5.2.0",
|
"eslint-plugin-promise": "^7.2.1",
|
||||||
|
"globals": "^16.4.0",
|
||||||
"htmllint-cli": "0.0.7",
|
"htmllint-cli": "0.0.7",
|
||||||
"json": ">=10.0.0",
|
"json": ">=10.0.0",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
"extends": [
|
|
||||||
"../../.eslintrc.js"
|
|
||||||
],
|
|
||||||
"globals": {
|
|
||||||
"assignManager": true,
|
|
||||||
"badge": true,
|
|
||||||
"backgroundLogic": true,
|
|
||||||
"identityState": true,
|
|
||||||
"messageHandler": true,
|
|
||||||
"sync": true,
|
|
||||||
"Utils": true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -77,7 +77,6 @@ window.assignManager = {
|
|||||||
this.setExempted(pageUrlorUrlKey, tabId);
|
this.setExempted(pageUrlorUrlKey, tabId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line require-atomic-updates
|
|
||||||
data.identityMacAddonUUID =
|
data.identityMacAddonUUID =
|
||||||
await identityState.lookupMACaddonUUID(data.userContextId);
|
await identityState.lookupMACaddonUUID(data.userContextId);
|
||||||
await this.area.set({
|
await this.area.set({
|
||||||
@@ -233,7 +232,7 @@ window.assignManager = {
|
|||||||
try {
|
try {
|
||||||
container = await browser.contextualIdentities
|
container = await browser.contextualIdentities
|
||||||
.get(backgroundLogic.cookieStoreId(siteSettings.userContextId));
|
.get(backgroundLogic.cookieStoreId(siteSettings.userContextId));
|
||||||
} catch (e) {
|
} catch {
|
||||||
container = false;
|
container = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ const backgroundLogic = {
|
|||||||
containerState.isIsolated = "locked";
|
containerState.isIsolated = "locked";
|
||||||
}
|
}
|
||||||
return await identityState.storageArea.set(cookieStoreId, containerState);
|
return await identityState.storageArea.set(cookieStoreId, containerState);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// console.error(`No container: ${cookieStoreId}`);
|
// console.error(`No container: ${cookieStoreId}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ const messageHandler = {
|
|||||||
if (!extensionInfo.permissions.includes("contextualIdentities")) {
|
if (!extensionInfo.permissions.includes("contextualIdentities")) {
|
||||||
throw new Error("Missing contextualIdentities permission");
|
throw new Error("Missing contextualIdentities permission");
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line require-atomic-updates
|
|
||||||
externalExtensionAllowed[sender.id] = true;
|
externalExtensionAllowed[sender.id] = true;
|
||||||
}
|
}
|
||||||
let response;
|
let response;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const MozillaVPN_Background = {
|
|||||||
// invalid proxy connection.
|
// invalid proxy connection.
|
||||||
this.port.onDisconnect.addListener(() => this.increaseIsolationKey());
|
this.port.onDisconnect.addListener(() => this.increaseIsolationKey());
|
||||||
|
|
||||||
} catch(e) {
|
} catch {
|
||||||
this._installed = false;
|
this._installed = false;
|
||||||
this._connected = false;
|
this._connected = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ async function reconcileIdentities(){
|
|||||||
if (deletedCookieStoreId){
|
if (deletedCookieStoreId){
|
||||||
try{
|
try{
|
||||||
await browser.contextualIdentities.remove(deletedCookieStoreId);
|
await browser.contextualIdentities.remove(deletedCookieStoreId);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// if the identity we are deleting is not there, that's fine.
|
// if the identity we are deleting is not there, that's fine.
|
||||||
console.error("Error deleting contextualIdentity", deletedCookieStoreId);
|
console.error("Error deleting contextualIdentity", deletedCookieStoreId);
|
||||||
continue;
|
continue;
|
||||||
@@ -514,7 +514,7 @@ async function reconcileSiteAssignments() {
|
|||||||
await setAssignmentWithUUID(assignedSite, urlKey);
|
await setAssignmentWithUUID(assignedSite, urlKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
// this is probably old or incorrect site info in Sync
|
// this is probably old or incorrect site info in Sync
|
||||||
// skip and move on.
|
// skip and move on.
|
||||||
}
|
}
|
||||||
@@ -565,7 +565,6 @@ async function setAssignmentWithUUID(assignedSite, urlKey) {
|
|||||||
const uuid = assignedSite.identityMacAddonUUID;
|
const uuid = assignedSite.identityMacAddonUUID;
|
||||||
const cookieStoreId = await identityState.lookupCookieStoreId(uuid);
|
const cookieStoreId = await identityState.lookupCookieStoreId(uuid);
|
||||||
if (cookieStoreId) {
|
if (cookieStoreId) {
|
||||||
// eslint-disable-next-line require-atomic-updates
|
|
||||||
assignedSite.userContextId = cookieStoreId
|
assignedSite.userContextId = cookieStoreId
|
||||||
.replace(/^firefox-container-/, "");
|
.replace(/^firefox-container-/, "");
|
||||||
await assignManager.storageArea.set(
|
await assignManager.storageArea.set(
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const MozillaVPN = {
|
|||||||
el.classList.remove("display-none");
|
el.classList.remove("display-none");
|
||||||
});
|
});
|
||||||
this.setStatusIndicatorIcons(mozillaVpnInstalled);
|
this.setStatusIndicatorIcons(mozillaVpnInstalled);
|
||||||
} catch (e) {
|
} catch {
|
||||||
mozVpnLogotypes.forEach(el => {
|
mozVpnLogotypes.forEach(el => {
|
||||||
el.style.display = "none";
|
el.style.display = "none";
|
||||||
});
|
});
|
||||||
@@ -139,7 +139,7 @@ const MozillaVPN = {
|
|||||||
try {
|
try {
|
||||||
const proxy = await proxifiedContainers.retrieve(identity.cookieStoreId);
|
const proxy = await proxifiedContainers.retrieve(identity.cookieStoreId);
|
||||||
proxies[identity.cookieStoreId] = proxy;
|
proxies[identity.cookieStoreId] = proxy;
|
||||||
} catch (e) {
|
} catch {
|
||||||
proxies[identity.cookieStoreId] = {};
|
proxies[identity.cookieStoreId] = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -198,7 +198,7 @@ const Logic = {
|
|||||||
// Handle old style rejection with null and also Promise.reject new style
|
// Handle old style rejection with null and also Promise.reject new style
|
||||||
try {
|
try {
|
||||||
return await browser.contextualIdentities.get(cookieStoreId) || defaultContainer;
|
return await browser.contextualIdentities.get(cookieStoreId) || defaultContainer;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return defaultContainer;
|
return defaultContainer;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -425,7 +425,7 @@ const Logic = {
|
|||||||
cookieStoreId: identity.cookieStoreId
|
cookieStoreId: identity.cookieStoreId
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -762,7 +762,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||||||
method: "sortTabs"
|
method: "sortTabs"
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -851,7 +851,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||||||
cookieStoreId: identity.cookieStoreId
|
cookieStoreId: identity.cookieStoreId
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -862,7 +862,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||||||
cookieStoreId: identity.cookieStoreId
|
cookieStoreId: identity.cookieStoreId
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -912,7 +912,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||||||
incompatible = await browser.runtime.sendMessage({
|
incompatible = await browser.runtime.sendMessage({
|
||||||
method: "checkIncompatibleAddons"
|
method: "checkIncompatibleAddons"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch {
|
||||||
throw new Error("Could not check for incompatible add-ons.");
|
throw new Error("Could not check for incompatible add-ons.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +947,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||||||
cookieStoreId: identity.cookieStoreId
|
cookieStoreId: identity.cookieStoreId
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1009,7 +1009,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||||||
cookieStoreId: Logic.currentCookieStoreId()
|
cookieStoreId: Logic.currentCookieStoreId()
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1086,7 +1086,7 @@ Logic.registerPanel(OPEN_NEW_CONTAINER_PICKER, {
|
|||||||
cookieStoreId: identity.cookieStoreId
|
cookieStoreId: identity.cookieStoreId
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1848,7 +1848,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||||||
});
|
});
|
||||||
await Logic.refreshIdentities();
|
await Logic.refreshIdentities();
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
} catch (e) {
|
} catch {
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2339,7 +2339,7 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
|
|||||||
await Logic.removeIdentity(Utils.userContextId(Logic.currentIdentity().cookieStoreId));
|
await Logic.removeIdentity(Utils.userContextId(Logic.currentIdentity().cookieStoreId));
|
||||||
await Logic.refreshIdentities();
|
await Logic.refreshIdentities();
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
} catch (e) {
|
} catch {
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
"node": true,
|
|
||||||
"mocha": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2018
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-restricted-globals": ["error", "browser"]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
if (!process.listenerCount("unhandledRejection")) {
|
if (!process.listenerCount("unhandledRejection")) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
process.on("unhandledRejection", r => console.log(r));
|
process.on("unhandledRejection", r => console.log(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user