aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-10 19:21:14 -0500
committerGitHub <noreply@github.com>2023-12-11 00:21:14 +0000
commite9dde826df738c4094709804d72de4991b377a8a (patch)
tree22e20851ea92868e29e0afe70e745fcc306661b1 /ext/js
parenta6c57cc4d7ffeff16320e1d27280ac752fb80e21 (diff)
Change no-console to error, only for ext files (#352)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/core.js2
-rw-r--r--ext/js/debug/timer.js1
-rw-r--r--ext/js/display/display-anki.js1
-rw-r--r--ext/js/display/display.js1
-rw-r--r--ext/js/dom/sandbox/css-style-applier.js1
-rw-r--r--ext/js/pages/settings/anki-controller.js1
-rw-r--r--ext/js/pages/settings/backup-controller.js6
7 files changed, 13 insertions, 0 deletions
diff --git a/ext/js/core.js b/ext/js/core.js
index 5c03b44b..14d0ef56 100644
--- a/ext/js/core.js
+++ b/ext/js/core.js
@@ -727,6 +727,7 @@ export class Logger extends EventDispatcher {
}
message += '\n\nIssues can be reported at https://github.com/themoeway/yomitan/issues';
+ /* eslint-disable no-console */
switch (level) {
case 'info': console.info(message); break;
case 'debug': console.debug(message); break;
@@ -734,6 +735,7 @@ export class Logger extends EventDispatcher {
case 'error': console.error(message); break;
default: console.log(message); break;
}
+ /* eslint-enable no-console */
this.trigger('log', {error, level, context});
}
diff --git a/ext/js/debug/timer.js b/ext/js/debug/timer.js
index 7381dab5..d5f286a1 100644
--- a/ext/js/debug/timer.js
+++ b/ext/js/debug/timer.js
@@ -56,6 +56,7 @@ export class Timer {
Timer.current = this.parent;
if (this.parent === null) {
if (!skip) {
+ // eslint-disable-next-line no-console
console.log(this.toString());
}
} else {
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index d0da568c..574e90ee 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -564,6 +564,7 @@ export class DisplayAnki {
const content = this._display.displayGenerator.createAnkiNoteErrorsNotificationContent(displayErrors);
for (const node of content.querySelectorAll('.anki-note-error-log-link')) {
/** @type {EventListenerCollection} */ (this._errorNotificationEventListeners).addEventListener(node, 'click', () => {
+ // eslint-disable-next-line no-console
console.log({ankiNoteErrors: errors});
}, false);
}
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index 6e1450c3..9c2d97f2 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -2027,6 +2027,7 @@ export class Display extends EventDispatcher {
}
}
+ // eslint-disable-next-line no-console
console.log(result);
}
diff --git a/ext/js/dom/sandbox/css-style-applier.js b/ext/js/dom/sandbox/css-style-applier.js
index ea36a02d..200fd05f 100644
--- a/ext/js/dom/sandbox/css-style-applier.js
+++ b/ext/js/dom/sandbox/css-style-applier.js
@@ -49,6 +49,7 @@ export class CssStyleApplier {
try {
rawData = await this._fetchJsonAsset(this._styleDataUrl);
} catch (e) {
+ // eslint-disable-next-line no-console
console.error(e);
}
const styleData = this._styleData;
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index 05bfdadc..737cc04a 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -272,6 +272,7 @@ export class AnkiController {
/** */
_onAnkiErrorLogLinkClick() {
if (this._ankiError === null) { return; }
+ // eslint-disable-next-line no-console
console.log({error: this._ankiError});
}
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index bf44bb90..95433d1c 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -555,12 +555,14 @@ export class BackupController {
* @param {{totalRows: number, completedRows: number, done: boolean}} details
*/
_databaseExportProgressCallback({totalRows, completedRows, done}) {
+ // eslint-disable-next-line no-console
console.log(`Progress: ${completedRows} of ${totalRows} rows completed`);
const messageContainer = /** @type {HTMLElement} */ (document.querySelector('#db-ops-progress-report'));
messageContainer.style.display = 'block';
messageContainer.textContent = `Export Progress: ${completedRows} of ${totalRows} rows completed`;
if (done) {
+ // eslint-disable-next-line no-console
console.log('Done exporting.');
messageContainer.style.display = 'none';
}
@@ -600,6 +602,7 @@ export class BackupController {
const blob = new Blob([data], {type: 'application/json'});
this._saveBlob(blob, fileName);
} catch (error) {
+ // eslint-disable-next-line no-console
console.log(error);
this._databaseExportImportErrorMessage('Errors encountered while exporting. Please try again. Restart the browser if it continues to fail.');
} finally {
@@ -614,6 +617,7 @@ export class BackupController {
* @param {{totalRows: number, completedRows: number, done: boolean}} details
*/
_databaseImportProgressCallback({totalRows, completedRows, done}) {
+ // eslint-disable-next-line no-console
console.log(`Progress: ${completedRows} of ${totalRows} rows completed`);
const messageContainer = /** @type {HTMLElement} */ (document.querySelector('#db-ops-progress-report'));
messageContainer.style.display = 'block';
@@ -621,6 +625,7 @@ export class BackupController {
messageContainer.textContent = `Import Progress: ${completedRows} of ${totalRows} rows completed`;
if (done) {
+ // eslint-disable-next-line no-console
console.log('Done importing.');
messageContainer.style.color = '#006633';
messageContainer.textContent = 'Done importing. You will need to re-enable the dictionaries and refresh afterward. If you run into issues, please restart the browser. If it continues to fail, reinstall Yomitan and import dictionaries one-by-one.';
@@ -668,6 +673,7 @@ export class BackupController {
this._settingsExportDatabaseToken = token;
await this._importDatabase(this._dictionariesDatabaseName, file);
} catch (error) {
+ // eslint-disable-next-line no-console
console.log(error);
const messageContainer = /** @type {HTMLElement} */ (document.querySelector('#db-ops-progress-report'));
messageContainer.style.color = 'red';