summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json9
-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
8 files changed, 21 insertions, 1 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 9f1c3255..f1c995a0 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -61,7 +61,6 @@
"no-case-declarations": "error",
"no-const-assign": "error",
"no-constant-condition": "off",
- "no-console": "warn",
"no-global-assign": "error",
"no-param-reassign": "off",
"no-prototype-builtins": "error",
@@ -561,6 +560,14 @@
},
{
"files": [
+ "ext/**/*.js"
+ ],
+ "rules": {
+ "no-console": "error"
+ }
+ },
+ {
+ "files": [
"ext/js/core.js",
"ext/js/core/extension-error.js",
"ext/js/**/sandbox/**/*.js"
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';