aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/data/language/japanese-transforms.json1
-rw-r--r--ext/js/background/backend.js2
-rw-r--r--ext/js/comm/cross-frame-api.js1
-rw-r--r--ext/js/core/logger.js1
-rw-r--r--ext/js/data/json-schema.js2
-rw-r--r--ext/js/data/options-util.js9
-rw-r--r--ext/js/dictionary/dictionary-database.js5
-rw-r--r--ext/js/display/display-audio.js6
-rw-r--r--ext/js/display/display.js6
-rw-r--r--ext/js/pages/action-popup-main.js3
-rw-r--r--ext/js/pages/settings/backup-controller.js12
-rw-r--r--ext/js/pages/settings/profile-controller.js3
-rw-r--r--ext/js/pages/welcome-main.js2
-rw-r--r--ext/js/templates/sandbox/anki-template-renderer.js6
-rw-r--r--ext/js/templates/template-renderer-proxy.js14
15 files changed, 49 insertions, 24 deletions
diff --git a/ext/data/language/japanese-transforms.json b/ext/data/language/japanese-transforms.json
index b3a00a73..b1f39cbc 100644
--- a/ext/data/language/japanese-transforms.json
+++ b/ext/data/language/japanese-transforms.json
@@ -1010,4 +1010,3 @@
}
]
}
-
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 909faf29..8b5e8383 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -2480,7 +2480,7 @@ export class Backend {
chrome.storage.session.get(['openedWelcomePage']).then((result) => {
if (!result.openedWelcomePage) {
this._openWelcomeGuidePage();
- chrome.storage.session.set({'openedWelcomePage': true});
+ chrome.storage.session.set({openedWelcomePage: true});
}
});
}
diff --git a/ext/js/comm/cross-frame-api.js b/ext/js/comm/cross-frame-api.js
index 8fbee20c..4b4e9419 100644
--- a/ext/js/comm/cross-frame-api.js
+++ b/ext/js/comm/cross-frame-api.js
@@ -410,6 +410,7 @@ export class CrossFrameAPI {
}
return await this._createCommPort(otherTabId, otherFrameId);
}
+
/**
* @param {number} otherTabId
* @param {number} otherFrameId
diff --git a/ext/js/core/logger.js b/ext/js/core/logger.js
index 165e1ae2..6cf1cc1f 100644
--- a/ext/js/core/logger.js
+++ b/ext/js/core/logger.js
@@ -59,6 +59,7 @@ export class Logger extends EventDispatcher {
} else {
errorString = (
typeof error === 'object' && error !== null ?
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
error.toString() :
`${error}`
);
diff --git a/ext/js/data/json-schema.js b/ext/js/data/json-schema.js
index 9b7ea011..3342e387 100644
--- a/ext/js/data/json-schema.js
+++ b/ext/js/data/json-schema.js
@@ -805,7 +805,7 @@ export class JsonSchema {
const {type: schemaType, const: schemaConst, enum: schemaEnum} = schema;
const type = this._getValueType(value);
if (!this._isValueTypeAny(value, type, schemaType)) {
- throw this._createError(`Value type ${type} does not match schema type ${schemaType}`);
+ throw this._createError(`Value type ${type} does not match schema type ${Array.isArray(schemaType) ? schemaType.join(',') : schemaType}`);
}
if (typeof schemaConst !== 'undefined' && !this._valuesAreEqual(value, schemaConst)) {
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index d93927a7..2ecd5527 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -46,7 +46,8 @@ export class OptionsUtil {
// Invalid options
let options = /** @type {{[key: string]: unknown}} */ (
typeof optionsInput === 'object' && optionsInput !== null && !Array.isArray(optionsInput) ?
- optionsInput : {}
+ optionsInput :
+ {}
);
// Check for legacy options
@@ -495,6 +496,7 @@ export class OptionsUtil {
* @returns {import('options-util').UpdateFunction[]}
*/
_getVersionUpdates(targetVersion) {
+ /* eslint-disable @typescript-eslint/unbound-method */
const result = [
this._updateVersion1,
this._updateVersion2,
@@ -521,6 +523,7 @@ export class OptionsUtil {
this._updateVersion23,
this._updateVersion24
];
+ /* eslint-enable @typescript-eslint/unbound-method */
if (typeof targetVersion === 'number' && targetVersion < result.length) {
result.splice(targetVersion);
}
@@ -1090,9 +1093,9 @@ export class OptionsUtil {
}
if (customTemplates && isObject(chrome.storage)) {
- chrome.storage.session.set({'needsCustomTemplatesWarning': true});
+ chrome.storage.session.set({needsCustomTemplatesWarning: true});
await this._createTab(chrome.runtime.getURL('/welcome.html'));
- chrome.storage.session.set({'openedWelcomePage': true});
+ chrome.storage.session.set({openedWelcomePage: true});
}
}
diff --git a/ext/js/dictionary/dictionary-database.js b/ext/js/dictionary/dictionary-database.js
index 1c52b7ab..6c7de339 100644
--- a/ext/js/dictionary/dictionary-database.js
+++ b/ext/js/dictionary/dictionary-database.js
@@ -37,7 +37,10 @@ export class DictionaryDatabase {
/** @type {import('dictionary-database').CreateQuery<string>} */
this._createBoundQuery1 = (item) => IDBKeyRange.bound(item, `${item}\uffff`, false, false);
/** @type {import('dictionary-database').CreateQuery<string>} */
- this._createBoundQuery2 = (item) => { item = stringReverse(item); return IDBKeyRange.bound(item, `${item}\uffff`, false, false); };
+ this._createBoundQuery2 = (item) => {
+ item = stringReverse(item);
+ return IDBKeyRange.bound(item, `${item}\uffff`, false, false);
+ };
/** @type {import('dictionary-database').CreateResult<import('dictionary-database').TermExactRequest, import('dictionary-database').DatabaseTermEntryWithId, import('dictionary-database').TermEntry>} */
this._createTermBind1 = this._createTermExact.bind(this);
/** @type {import('dictionary-database').CreateResult<import('dictionary-database').DictionaryAndQueryRequest, import('dictionary-database').DatabaseTermEntryWithId, import('dictionary-database').TermEntry>} */
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index deaa0976..7d75d6b0 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -514,8 +514,10 @@ export class DisplayAudio {
!canToggleOff ||
primaryCardAudio === null ||
primaryCardAudio.index !== index ||
- primaryCardAudio.subIndex !== subIndex
- ) ? {index: index, subIndex} : null;
+ primaryCardAudio.subIndex !== subIndex ?
+ {index: index, subIndex} :
+ null
+ );
cacheEntry.primaryCardAudio = primaryCardAudio;
if (menu !== null) {
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index f05feac8..a5dad2d1 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -806,8 +806,10 @@ export class Display extends EventDispatcher {
const historyMode = (
eventType === 'click' ||
!(typeof historyState === 'object' && historyState !== null) ||
- historyState.cause !== 'queryParser'
- ) ? 'new' : 'overwrite';
+ historyState.cause !== 'queryParser' ?
+ 'new' :
+ 'overwrite'
+ );
/** @type {import('display').ContentDetails} */
const details = {
focus: false,
diff --git a/ext/js/pages/action-popup-main.js b/ext/js/pages/action-popup-main.js
index e5738878..b5728215 100644
--- a/ext/js/pages/action-popup-main.js
+++ b/ext/js/pages/action-popup-main.js
@@ -50,7 +50,8 @@ class DisplayController {
typeof manifest.options_ui === 'object' &&
manifest.options_ui !== null &&
typeof manifest.options_ui.page === 'string' ?
- manifest.options_ui.page : ''
+ manifest.options_ui.page :
+ ''
);
this._setupButtonEvents('.action-open-settings', 'openSettingsPage', chrome.runtime.getURL(optionsPageUrl));
this._setupButtonEvents('.action-open-permissions', null, chrome.runtime.getURL('/permissions.html'));
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index 79733c4d..59bcaed9 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -579,7 +579,9 @@ export class BackupController {
*/
async _exportDatabase(databaseName) {
const db = await new Dexie(databaseName).open();
- const blob = await db.export({progressCallback: this._databaseExportProgressCallback});
+ const blob = await db.export({
+ progressCallback: this._databaseExportProgressCallback.bind(this)
+ });
await db.close();
return blob;
}
@@ -639,12 +641,14 @@ export class BackupController {
}
/**
- * @param {string} databaseName
+ * @param {string} _databaseName
* @param {File} file
*/
- async _importDatabase(databaseName, file) {
+ async _importDatabase(_databaseName, file) {
await this._settingsController.application.api.purgeDatabase();
- await Dexie.import(file, {progressCallback: this._databaseImportProgressCallback});
+ await Dexie.import(file, {
+ progressCallback: this._databaseImportProgressCallback.bind(this)
+ });
this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'import');
this._settingsController.application.triggerStorageChanged();
}
diff --git a/ext/js/pages/settings/profile-controller.js b/ext/js/pages/settings/profile-controller.js
index c5ccbe7d..5a7b5ed4 100644
--- a/ext/js/pages/settings/profile-controller.js
+++ b/ext/js/pages/settings/profile-controller.js
@@ -549,7 +549,8 @@ export class ProfileController {
Number.isFinite(intValue) &&
intValue >= 0 &&
intValue < this.profileCount ?
- intValue : null
+ intValue :
+ null
);
}
diff --git a/ext/js/pages/welcome-main.js b/ext/js/pages/welcome-main.js
index 82afaacb..9990b4e7 100644
--- a/ext/js/pages/welcome-main.js
+++ b/ext/js/pages/welcome-main.js
@@ -63,7 +63,7 @@ await Application.main(async (application) => {
setupEnvironmentInfo(application.api);
- chrome.storage.session.get({'needsCustomTemplatesWarning': false}).then((result) => {
+ chrome.storage.session.get({needsCustomTemplatesWarning: false}).then((result) => {
if (result.needsCustomTemplatesWarning) {
document.documentElement.dataset.warnCustomTemplates = 'true';
chrome.storage.session.remove(['needsCustomTemplatesWarning']);
diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js
index 135200da..2320a0b1 100644
--- a/ext/js/templates/sandbox/anki-template-renderer.js
+++ b/ext/js/templates/sandbox/anki-template-renderer.js
@@ -279,7 +279,10 @@ export class AnkiTemplateRenderer {
const regex = new RegExp(pattern, typeof flags === 'string' ? flags : '');
/** @type {string[]} */
const parts = [];
- value.replace(regex, (g0) => { parts.push(g0); return g0; });
+ value.replace(regex, (g0) => {
+ parts.push(g0);
+ return g0;
+ });
value = parts.join('');
} catch (e) {
return `${e}`;
@@ -531,6 +534,7 @@ export class AnkiTemplateRenderer {
_concat(args) {
let result = '';
for (let i = 0, ii = args.length; i < ii; ++i) {
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
result += args[i];
}
return result;
diff --git a/ext/js/templates/template-renderer-proxy.js b/ext/js/templates/template-renderer-proxy.js
index e4814ec4..c1f5a5bf 100644
--- a/ext/js/templates/template-renderer-proxy.js
+++ b/ext/js/templates/template-renderer-proxy.js
@@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {generateId} from '../core/utilities.js';
import {ExtensionError} from '../core/extension-error.js';
+import {generateId} from '../core/utilities.js';
export class TemplateRendererProxy {
constructor() {
@@ -220,10 +220,14 @@ export class TemplateRendererProxy {
}
};
- let timer = (typeof timeout === 'number' ? setTimeout(() => {
- cleanup();
- reject(new Error('Timeout'));
- }, timeout) : null);
+ let timer = (
+ typeof timeout === 'number' ?
+ setTimeout(() => {
+ cleanup();
+ reject(new Error('Timeout'));
+ }, timeout) :
+ null
+ );
this._invocations.add(invocation);