Merge pull request #2796 from loganrosen/eslint-v9
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": {
|
||||
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.36.0",
|
||||
"addons-linter": "^5.28.0",
|
||||
"ajv": "^6.6.3",
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-no-unsanitized": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.2.0",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-plugin-no-unsanitized": "^4.1.4",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"globals": "^16.4.0",
|
||||
"htmllint-cli": "0.0.7",
|
||||
"json": ">=10.0.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);
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
data.identityMacAddonUUID =
|
||||
await identityState.lookupMACaddonUUID(data.userContextId);
|
||||
await this.area.set({
|
||||
@@ -233,7 +232,7 @@ window.assignManager = {
|
||||
try {
|
||||
container = await browser.contextualIdentities
|
||||
.get(backgroundLogic.cookieStoreId(siteSettings.userContextId));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
container = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ const backgroundLogic = {
|
||||
containerState.isIsolated = "locked";
|
||||
}
|
||||
return await identityState.storageArea.set(cookieStoreId, containerState);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// console.error(`No container: ${cookieStoreId}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -141,7 +141,6 @@ const messageHandler = {
|
||||
if (!extensionInfo.permissions.includes("contextualIdentities")) {
|
||||
throw new Error("Missing contextualIdentities permission");
|
||||
}
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
externalExtensionAllowed[sender.id] = true;
|
||||
}
|
||||
let response;
|
||||
|
||||
@@ -27,7 +27,7 @@ const MozillaVPN_Background = {
|
||||
// invalid proxy connection.
|
||||
this.port.onDisconnect.addListener(() => this.increaseIsolationKey());
|
||||
|
||||
} catch(e) {
|
||||
} catch {
|
||||
this._installed = false;
|
||||
this._connected = false;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ async function reconcileIdentities(){
|
||||
if (deletedCookieStoreId){
|
||||
try{
|
||||
await browser.contextualIdentities.remove(deletedCookieStoreId);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// if the identity we are deleting is not there, that's fine.
|
||||
console.error("Error deleting contextualIdentity", deletedCookieStoreId);
|
||||
continue;
|
||||
@@ -514,7 +514,7 @@ async function reconcileSiteAssignments() {
|
||||
await setAssignmentWithUUID(assignedSite, urlKey);
|
||||
continue;
|
||||
}
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// this is probably old or incorrect site info in Sync
|
||||
// skip and move on.
|
||||
}
|
||||
@@ -565,7 +565,6 @@ async function setAssignmentWithUUID(assignedSite, urlKey) {
|
||||
const uuid = assignedSite.identityMacAddonUUID;
|
||||
const cookieStoreId = await identityState.lookupCookieStoreId(uuid);
|
||||
if (cookieStoreId) {
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
assignedSite.userContextId = cookieStoreId
|
||||
.replace(/^firefox-container-/, "");
|
||||
await assignManager.storageArea.set(
|
||||
|
||||
@@ -88,7 +88,7 @@ const MozillaVPN = {
|
||||
el.classList.remove("display-none");
|
||||
});
|
||||
this.setStatusIndicatorIcons(mozillaVpnInstalled);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
mozVpnLogotypes.forEach(el => {
|
||||
el.style.display = "none";
|
||||
});
|
||||
@@ -139,7 +139,7 @@ const MozillaVPN = {
|
||||
try {
|
||||
const proxy = await proxifiedContainers.retrieve(identity.cookieStoreId);
|
||||
proxies[identity.cookieStoreId] = proxy;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
proxies[identity.cookieStoreId] = {};
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -198,7 +198,7 @@ const Logic = {
|
||||
// Handle old style rejection with null and also Promise.reject new style
|
||||
try {
|
||||
return await browser.contextualIdentities.get(cookieStoreId) || defaultContainer;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return defaultContainer;
|
||||
}
|
||||
},
|
||||
@@ -425,7 +425,7 @@ const Logic = {
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
@@ -762,7 +762,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
method: "sortTabs"
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
@@ -851,7 +851,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
@@ -862,7 +862,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
@@ -912,7 +912,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
incompatible = await browser.runtime.sendMessage({
|
||||
method: "checkIncompatibleAddons"
|
||||
});
|
||||
} catch (e) {
|
||||
} catch {
|
||||
throw new Error("Could not check for incompatible add-ons.");
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
@@ -1009,7 +1009,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
cookieStoreId: Logic.currentCookieStoreId()
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
@@ -1086,7 +1086,7 @@ Logic.registerPanel(OPEN_NEW_CONTAINER_PICKER, {
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
window.close();
|
||||
}
|
||||
};
|
||||
@@ -1848,7 +1848,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||
});
|
||||
await Logic.refreshIdentities();
|
||||
Logic.showPreviousPanel();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
Logic.showPreviousPanel();
|
||||
}
|
||||
},
|
||||
@@ -2339,7 +2339,7 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
|
||||
await Logic.removeIdentity(Utils.userContextId(Logic.currentIdentity().cookieStoreId));
|
||||
await Logic.refreshIdentities();
|
||||
Logic.showPreviousPanel();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
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")) {
|
||||
// eslint-disable-next-line no-console
|
||||
process.on("unhandledRejection", r => console.log(r));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user