Add eqeqeq rule to not confuse == with ===

This commit is contained in:
Veeck
2020-04-21 15:13:06 +02:00
parent e510d279a2
commit 0c60d54c3f
4 changed files with 13 additions and 12 deletions

View File

@@ -14,6 +14,7 @@
} }
}, },
"rules": { "rules": {
"eqeqeq": "error",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-undef": "off", "no-undef": "off",
"no-unused-vars": "off" "no-unused-vars": "off"

View File

@@ -199,7 +199,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
// because the logic below will filter out any recurrences that don"t actually belong within // because the logic below will filter out any recurrences that don"t actually belong within
// our display range. // our display range.
// Would be great if there was a better way to handle this. // Would be great if there was a better way to handle this.
if (event.recurrences != undefined) if (event.recurrences !== undefined)
{ {
var pastMoment = moment(past); var pastMoment = moment(past);
var futureMoment = moment(future); var futureMoment = moment(future);
@@ -208,7 +208,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
{ {
// Only add dates that weren't already in the range we added from the rrule so that // Only add dates that weren't already in the range we added from the rrule so that
// we don"t double-add those events. // we don"t double-add those events.
if (moment(new Date(r)).isBetween(pastMoment, futureMoment) != true) if (moment(new Date(r)).isBetween(pastMoment, futureMoment) !== true)
{ {
dates.push(new Date(r)); dates.push(new Date(r));
} }
@@ -234,7 +234,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
startDate = moment(date); startDate = moment(date);
// For each date that we"re checking, it"s possible that there is a recurrence override for that one day. // For each date that we"re checking, it"s possible that there is a recurrence override for that one day.
if ((curEvent.recurrences != undefined) && (curEvent.recurrences[dateKey] != undefined)) if ((curEvent.recurrences !== undefined) && (curEvent.recurrences[dateKey] !== undefined))
{ {
// We found an override, so for this recurrence, use a potentially different title, start date, and duration. // We found an override, so for this recurrence, use a potentially different title, start date, and duration.
curEvent = curEvent.recurrences[dateKey]; curEvent = curEvent.recurrences[dateKey];
@@ -242,14 +242,14 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
duration = parseInt(moment(curEvent.end).format("x")) - parseInt(startDate.format("x")); duration = parseInt(moment(curEvent.end).format("x")) - parseInt(startDate.format("x"));
} }
// If there"s no recurrence override, check for an exception date. Exception dates represent exceptions to the rule. // If there"s no recurrence override, check for an exception date. Exception dates represent exceptions to the rule.
else if ((curEvent.exdate != undefined) && (curEvent.exdate[dateKey] != undefined)) else if ((curEvent.exdate !== undefined) && (curEvent.exdate[dateKey] !== undefined))
{ {
// This date is an exception date, which means we should skip it in the recurrence pattern. // This date is an exception date, which means we should skip it in the recurrence pattern.
showRecurrence = false; showRecurrence = false;
} }
endDate = moment(parseInt(startDate.format("x")) + duration, "x"); endDate = moment(parseInt(startDate.format("x")) + duration, "x");
if (startDate.format("x") == endDate.format("x")) { if (startDate.format("x") === endDate.format("x")) {
endDate = endDate.endOf("day"); endDate = endDate.endOf("day");
} }

View File

@@ -41,16 +41,16 @@ Module.register("updatenotification", {
var self = this; var self = this;
if (payload && payload.behind > 0) { if (payload && payload.behind > 0) {
// if we haven't seen info for this module // if we haven't seen info for this module
if(this.moduleList[payload.module] == undefined){ if(this.moduleList[payload.module] === undefined){
// save it // save it
this.moduleList[payload.module]=payload; this.moduleList[payload.module]=payload;
self.updateDom(2); self.updateDom(2);
} }
//self.show(1000, { lockString: self.identifier }); //self.show(1000, { lockString: self.identifier });
} else if (payload && payload.behind == 0){ } else if (payload && payload.behind === 0){
// if the module WAS in the list, but shouldn't be // if the module WAS in the list, but shouldn't be
if(this.moduleList[payload.module] != undefined){ if(this.moduleList[payload.module] !== undefined){
// remove it // remove it
delete this.moduleList[payload.module]; delete this.moduleList[payload.module];
self.updateDom(2); self.updateDom(2);
@@ -72,7 +72,7 @@ Module.register("updatenotification", {
// Override dom generator. // Override dom generator.
getDom: function () { getDom: function () {
var wrapper = document.createElement("div"); var wrapper = document.createElement("div");
if(this.suspended==false){ if(this.suspended === false){
// process the hash of module info found // process the hash of module info found
for(key of Object.keys(this.moduleList)){ for(key of Object.keys(this.moduleList)){
let m= this.moduleList[key]; let m= this.moduleList[key];
@@ -85,7 +85,7 @@ Module.register("updatenotification", {
icon.innerHTML = " "; icon.innerHTML = " ";
message.appendChild(icon); message.appendChild(icon);
var updateInfoKeyName = m.behind == 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE"; var updateInfoKeyName = m.behind === 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
var subtextHtml = this.translate(updateInfoKeyName, { var subtextHtml = this.translate(updateInfoKeyName, {
COMMIT_COUNT: m.behind, COMMIT_COUNT: m.behind,
@@ -93,7 +93,7 @@ Module.register("updatenotification", {
}); });
var text = document.createElement("span"); var text = document.createElement("span");
if (m.module == "default") { if (m.module === "default") {
text.innerHTML = this.translate("UPDATE_NOTIFICATION"); text.innerHTML = this.translate("UPDATE_NOTIFICATION");
subtextHtml = this.diffLink(m,subtextHtml); subtextHtml = this.diffLink(m,subtextHtml);
} else { } else {

View File

@@ -456,7 +456,7 @@ Module.register("weatherforecast",{
}); });
//If no rain this day return undefined so it wont be displayed for this day //If no rain this day return undefined so it wont be displayed for this day
if (daysForecasts.length == 0) { if (daysForecasts.length === 0) {
return undefined; return undefined;
} }