1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

refactor(js): add jshint check for strict comparison

This commit is contained in:
Julien Voisin 2025-01-17 01:50:09 +00:00 committed by GitHub
parent 605eeb4525
commit 91f9a7650e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 11 deletions

View file

@ -1,6 +1,7 @@
{ {
"esversion": 11, "esversion": 11,
"bitwise": true, "bitwise": true,
"eqeqeq": true,
"freeze": true, "freeze": true,
"nonew": true, "nonew": true,
"latedef": "nofunc", "latedef": "nofunc",

View file

@ -151,7 +151,7 @@ function handleEntryStatus(item, element, setToRead) {
const toasting = !element; const toasting = !element;
const currentEntry = findEntry(element); const currentEntry = findEntry(element);
if (currentEntry) { if (currentEntry) {
if (!setToRead || currentEntry.querySelector(":is(a, button)[data-toggle-status]").dataset.value == "unread") { if (!setToRead || currentEntry.querySelector(":is(a, button)[data-toggle-status]").dataset.value === "unread") {
toggleEntryStatus(currentEntry, toasting); toggleEntryStatus(currentEntry, toasting);
} }
if (isListView() && currentEntry.classList.contains('current-item')) { if (isListView() && currentEntry.classList.contains('current-item')) {
@ -380,7 +380,7 @@ function openOriginalLink(openLinkInCurrentTab) {
const currentItem = document.querySelector(".current-item"); const currentItem = document.querySelector(".current-item");
// If we are not on the list of starred items, move to the next item // If we are not on the list of starred items, move to the next item
if (document.location.href != document.querySelector(':is(a, button)[data-page=starred]').href) { if (document.location.href !== document.querySelector(':is(a, button)[data-page=starred]').href) {
goToListItem(1); goToListItem(1);
} }
markEntryAsRead(currentItem); markEntryAsRead(currentItem);
@ -522,9 +522,9 @@ function goToListItem(offset) {
// By default adjust selection by offset // By default adjust selection by offset
let itemOffset = (i + offset + items.length) % items.length; let itemOffset = (i + offset + items.length) % items.length;
// Allow jumping to top or bottom // Allow jumping to top or bottom
if (offset == TOP) { if (offset === TOP) {
itemOffset = 0; itemOffset = 0;
} else if (offset == BOTTOM) { } else if (offset === BOTTOM) {
itemOffset = items.length - 1; itemOffset = items.length - 1;
} }
const item = items[itemOffset]; const item = items[itemOffset];
@ -595,7 +595,7 @@ function findEntry(element) {
} }
function handleConfirmationMessage(linkElement, callback) { function handleConfirmationMessage(linkElement, callback) {
if (linkElement.tagName != 'A' && linkElement.tagName != "BUTTON") { if (linkElement.tagName !== 'A' && linkElement.tagName !== "BUTTON") {
linkElement = linkElement.parentNode; linkElement = linkElement.parentNode;
} }

View file

@ -57,7 +57,7 @@ document.addEventListener("DOMContentLoaded", () => {
onClick("#webauthn-delete", () => { webauthnHandler.removeAllCredentials(); }); onClick("#webauthn-delete", () => { webauthnHandler.removeAllCredentials(); });
const registerButton = document.getElementById("webauthn-register"); const registerButton = document.getElementById("webauthn-register");
if (registerButton != null) { if (registerButton !== null) {
registerButton.disabled = false; registerButton.disabled = false;
onClick("#webauthn-register", () => { onClick("#webauthn-register", () => {
@ -66,13 +66,13 @@ document.addEventListener("DOMContentLoaded", () => {
} }
const loginButton = document.getElementById("webauthn-login"); const loginButton = document.getElementById("webauthn-login");
if (loginButton != null) { if (loginButton !== null) {
const abortController = new AbortController(); const abortController = new AbortController();
loginButton.disabled = false; loginButton.disabled = false;
onClick("#webauthn-login", () => { onClick("#webauthn-login", () => {
const usernameField = document.getElementById("form-username"); const usernameField = document.getElementById("form-username");
if (usernameField != null) { if (usernameField !== null) {
abortController.abort(); abortController.abort();
webauthnHandler.login(usernameField.value).catch(err => WebAuthnHandler.showErrorMessage(err)); webauthnHandler.login(usernameField.value).catch(err => WebAuthnHandler.showErrorMessage(err));
} }
@ -108,7 +108,7 @@ document.addEventListener("DOMContentLoaded", () => {
handleEntryStatus("next", event.target, true); handleEntryStatus("next", event.target, true);
}, true); }, true);
onAuxClick("a[data-original-link='true']", (event) => { onAuxClick("a[data-original-link='true']", (event) => {
if (event.button == 1) { if (event.button === 1) {
handleEntryStatus("next", event.target, true); handleEntryStatus("next", event.target, true);
} }
}, true); }, true);

View file

@ -17,7 +17,7 @@ class KeyboardHandler {
return; return;
} }
if (key != "Enter") { if (key !== "Enter") {
event.preventDefault(); event.preventDefault();
} }

View file

@ -149,7 +149,7 @@ class WebAuthnHandler {
} }
catch (err) { catch (err) {
// Swallow aborted conditional logins // Swallow aborted conditional logins
if (err instanceof DOMException && err.name == "AbortError") { if (err instanceof DOMException && err.name === "AbortError") {
return; return;
} }
WebAuthnHandler.showErrorMessage(err); WebAuthnHandler.showErrorMessage(err);