chore: Update eslint to enforce quotes and fix the existing linting errors (#355)

This commit is contained in:
Federico Brigante 2022-01-19 04:10:34 +08:00 committed by GitHub
parent 2d75968a98
commit 31ed31a6e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -415,7 +415,7 @@
"quote-props": 0, "quote-props": 0,
// Double quotes should be used. // Double quotes should be used.
"quotes": [1, "double", {"avoidEscape": true, "allowTemplateLiterals": true}], "quotes": [2, "double", {"avoidEscape": true, "allowTemplateLiterals": true}],
// Require use of the second argument for parseInt(). // Require use of the second argument for parseInt().
"radix": 2, "radix": 2,

View File

@ -37,18 +37,18 @@ test("browser api object in background page", async (t) => {
test("error types", async (t) => { test("error types", async (t) => {
if (navigator.userAgent.includes("Firefox/")) { if (navigator.userAgent.includes("Firefox/")) {
try { try {
await browser.storage.sync.set({a: 'a'}); await browser.storage.sync.set({a: "a"});
t.fail('It should throw when attempting to call storage.sync with a temporary addon ID'); t.fail("It should throw when attempting to call storage.sync with a temporary addon ID");
} catch (error) { } catch (error) {
t.equal(error.message, 'The storage API will not work with a temporary addon ID. Please add an explicit addon ID to your manifest. For more information see https://mzl.la/3lPk1aE.'); t.equal(error.message, "The storage API will not work with a temporary addon ID. Please add an explicit addon ID to your manifest. For more information see https://mzl.la/3lPk1aE.");
t.ok(error instanceof Error); t.ok(error instanceof Error);
} }
} else { } else {
await new Promise(resolve => { await new Promise(resolve => {
chrome.storage.local.set({a: 'a'.repeat(10000000)}, resolve); chrome.storage.local.set({a: "a".repeat(10000000)}, resolve);
}); });
t.ok(chrome.runtime.lastError, 'It should throw when attempting to set an object over quota'); t.ok(chrome.runtime.lastError, "It should throw when attempting to set an object over quota");
t.equal(chrome.runtime.lastError.message, 'QUOTA_BYTES quota exceeded'); t.equal(chrome.runtime.lastError.message, "QUOTA_BYTES quota exceeded");
t.notOk(chrome.runtime.lastError instanceof Error); t.notOk(chrome.runtime.lastError instanceof Error);
} }
}); });