Add "eqeqeq" eslint rule

This commit is contained in:
Guillaume Gomez 2022-05-27 22:30:19 +02:00
parent 3741a88ad7
commit 334f12c28e
3 changed files with 7 additions and 6 deletions

View file

@ -62,5 +62,6 @@ module.exports = {
"varsIgnorePattern": "^_"
}
],
"eqeqeq": "error",
}
};

View file

@ -97,12 +97,12 @@ function showMain() {
//
// So I guess you could say things are getting pretty interoperable.
function getVirtualKey(ev) {
if ("key" in ev && typeof ev.key != "undefined") {
if ("key" in ev && typeof ev.key !== "undefined") {
return ev.key;
}
const c = ev.charCode || ev.keyCode;
if (c == 27) {
if (c === 27) {
return "Escape";
}
return String.fromCharCode(c);

View file

@ -70,7 +70,7 @@ function printTab(nb) {
});
if (foundCurrentTab && foundCurrentResultSet) {
searchState.currentTab = nb;
} else if (nb != 0) {
} else if (nb !== 0) {
printTab(0);
}
}
@ -200,7 +200,7 @@ function initSearch(rawSearchIndex) {
* @return {boolean}
*/
function isPathStart(parserState) {
return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) == "::";
return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) === "::";
}
/**
@ -211,7 +211,7 @@ function initSearch(rawSearchIndex) {
* @return {boolean}
*/
function isReturnArrow(parserState) {
return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) == "->";
return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) === "->";
}
/**
@ -1726,7 +1726,7 @@ function initSearch(rawSearchIndex) {
crates = " in <select id=\"crate-search\"><option value=\"All crates\">" +
"All crates</option>";
for (const c of window.ALL_CRATES) {
crates += `<option value="${c}" ${c == filterCrates && "selected"}>${c}</option>`;
crates += `<option value="${c}" ${c === filterCrates && "selected"}>${c}</option>`;
}
crates += "</select>";
}