From 05fa22086b8aebbdf7636c0ff2379f53731908d3 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Tue, 15 Nov 2022 14:28:25 +0100 Subject: [PATCH] refactor: use polyfill but ignore type #1051 --- .eslintrc.json | 6 ++++++ src/extension/background-script/state.ts | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5aa2e237ab..0fb77b0522 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,12 @@ "jest": true }, "rules": { + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-ignore": "allow-with-description" + } + ], "@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }], // No warnings for unused function arguments, which might be used in the future. "no-console": ["error", { "allow": ["info", "warn", "error"] }], "no-constant-binary-expression": "error", diff --git a/src/extension/background-script/state.ts b/src/extension/background-script/state.ts index c4332d6e57..6a165eb283 100644 --- a/src/extension/background-script/state.ts +++ b/src/extension/background-script/state.ts @@ -81,9 +81,13 @@ const state = createState((set, get) => ({ nostrPrivateKey: null, password: async (password) => { if (password) { - await chrome.storage.session.set({ password }); + // @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329 + await browser.storage.session.set({ password }); } - const storageSessionPassword = await chrome.storage.session.get("password"); + // @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329 + const storageSessionPassword = await browser.storage.session.get( + "password" + ); return storageSessionPassword.password; }, @@ -124,7 +128,8 @@ const state = createState((set, get) => ({ return nostr; }, lock: async () => { - await chrome.storage.session.set({ password: null }); + // @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329 + await browser.storage.session.set({ password: null }); const connector = await get().connector; if (connector) { await connector.unload();