Bug 1439142 - Fix eslint errors for complexity and no-compare-against-boolean-literals in calendar. r=philipp

This commit is contained in:
MakeMyDay 2018-02-17 23:09:02 +01:00
Родитель 970280b100
Коммит ca6a4253e0
10 изменённых файлов: 25 добавлений и 26 удалений

Просмотреть файл

@ -26,7 +26,7 @@ module.exports = {
"comma-style": [2, "last"],
// We should get better at complexity, but at the moment it is what it is
"complexity": [2, 81],
"complexity": [2, 90],
// Enforce curly brace conventions for all control statements.
"curly": 2,

Просмотреть файл

@ -283,8 +283,7 @@ var calendarController = {
newStart = cal.dtz.getDefaultStartDate(currentView().selectedDay);
}
createEventWithDialog(getSelectedCalendar(), newStart,
null, null, null,
newStart.isDate == true);
null, null, null, newStart.isDate);
break;
}
case "calendar_modify_event_command":

Просмотреть файл

@ -179,7 +179,7 @@ function calendarListTooltipShowing(event) {
}
}
setElementValue("calendar-list-tooltip", tooltipText, "label");
return (tooltipText != false);
return (tooltipText !== false);
}
/**

Просмотреть файл

@ -53,7 +53,7 @@ var taskDetailsView = {
}
let priority = 0;
if (item.calendar.getProperty("capabilities.priority.supported") != false) {
if (item.calendar.getProperty("capabilities.priority.supported")) {
priority = parseInt(item.priority, 10);
}
displayElement("calendar-task-details-priority-label", priority > 0);

Просмотреть файл

@ -411,7 +411,7 @@
modeIndex = collapsedModes.indexOf(this.currentMode);
collapsedInMode = modeIndex > -1;
}
if (aVisible === true && pushModeCollapsedAttribute == false) {
if (aVisible === true && !pushModeCollapsedAttribute) {
display = (aVisible === true) && (!collapsedInMode);
}

Просмотреть файл

@ -466,7 +466,7 @@
<destructor><![CDATA[
ChromeUtils.import("resource://gre/modules/Services.jsm");
if (this.mObservesComposite == true) {
if (this.mObservesComposite) {
cal.view.getCompositeCalendar(window).removeObserver(this);
}
@ -1023,13 +1023,13 @@
<method name="_setFreeBusy">
<parameter name="aFreeBusy"/>
<body><![CDATA[
if (aFreeBusy == true) {
if (this.mObservesComposite == false) {
if (aFreeBusy) {
if (!this.mObservesComposite) {
cal.view.getCompositeCalendar(window).addObserver(this);
this.mObservesComposite = true;
this.getItems();
}
} else if (this.mObservesComposite == true) {
} else if (this.mObservesComposite) {
cal.view.getCompositeCalendar(window).removeObserver(this);
this.mObservesComposite = false;
}

Просмотреть файл

@ -115,7 +115,7 @@ Extractor.prototype = {
setLanguage: function() {
let path;
if (this.fixedLang == true) {
if (this.fixedLang) {
if (this.checkBundle(this.fallbackLocale)) {
cal.LOG("[calExtract] Fixed locale was used to choose " +
this.fallbackLocale + " patterns.");
@ -848,11 +848,11 @@ Extractor.prototype = {
/**
* Guesses end time from list of guessed datetimes relative to start time
*
* @param start start time to consider when guessing
* @param isTask whether start time should be guessed for task or event
* @return datetime object for end time
* @param start start time to consider when guessing
* @param doGuessStart whether start time should be guessed for task or event
* @return datetime object for end time
*/
guessEnd: function(start, isTask) {
guessEnd: function(start, doGuessStart) {
let guess = {};
let endTimes = this.collected.filter(val => val.relation == "end");
let durations = this.collected.filter(val => val.relation == "duration");
@ -869,14 +869,14 @@ Extractor.prototype = {
let wMinuteNA = wMinute.filter(val => val.ambiguous === undefined);
// first set non-ambiguous dates
let pos = isTask == true ? 0 : wDayNA.length - 1;
let pos = doGuessStart ? 0 : wDayNA.length - 1;
if (wDayNA.length != 0) {
guess.year = wDayNA[pos].year;
guess.month = wDayNA[pos].month;
guess.day = wDayNA[pos].day;
// then ambiguous dates
} else if (wDay.length != 0) {
pos = isTask == true ? 0 : wDay.length - 1;
pos = doGuessStart ? 0 : wDay.length - 1;
guess.year = wDay[pos].year;
guess.month = wDay[pos].month;
guess.day = wDay[pos].day;
@ -884,7 +884,7 @@ Extractor.prototype = {
// then non-ambiguous times
if (wMinuteNA.length != 0) {
pos = isTask == true ? 0 : wMinuteNA.length - 1;
pos = doGuessStart ? 0 : wMinuteNA.length - 1;
guess.hour = wMinuteNA[pos].hour;
guess.minute = wMinuteNA[pos].minute;
if (guess.day == null || guess.day == start.day) {
@ -900,7 +900,7 @@ Extractor.prototype = {
}
// and ambiguous times
} else if (wMinute.length != 0) {
pos = isTask == true ? 0 : wMinute.length - 1;
pos = doGuessStart ? 0 : wMinute.length - 1;
guess.hour = wMinute[pos].hour;
guess.minute = wMinute[pos].minute;
if (guess.day == null || guess.day == start.day) {
@ -966,7 +966,7 @@ Extractor.prototype = {
guess.minute = null;
}
if (guess.year != null && guess.minute == null && isTask) {
if (guess.year != null && guess.minute == null && doGuessStart) {
guess.hour = 0;
guess.minute = 0;
}

Просмотреть файл

@ -515,7 +515,7 @@ function onCancel(aIframeId, aPreventClose) {
// the "Save Event" dialog. Don't allow closing the dialog if
// the main window is being closed but the tabs in it are not.
if (!gWarning && aPreventClose != true) {
if (!gWarning && !aPreventClose) {
sendMessage({ command: "closeWindowOrTab", iframeId: aIframeId });
}
return !gWarning;
@ -752,7 +752,7 @@ function loadDialog(aItem) {
? false // default value as most common within organizations
: (undiscloseProp == "TRUE");
// disable checkbox, if notifyCheckbox is not checked
undiscloseCheckbox.disabled = (notifyCheckbox.checked == false);
undiscloseCheckbox.disabled = !notifyCheckbox.checked;
}
// this may also be a server exposed calendar property from exchange servers - if so, this
// probably should overrule the client-side config option

Просмотреть файл

@ -325,7 +325,7 @@ function invokeEventDialog(controller, clickBox, body) {
eventController.waitFor(() => {
return iframe.contentWindow.onLoad &&
iframe.contentWindow.onLoad.hasLoaded == true;
iframe.contentWindow.onLoad.hasLoaded;
}, "event-dialog did not load in time", 10000);
// We can't use a full mozmill controller on an iframe, but we need
@ -534,7 +534,7 @@ function handleNewCalendarWizard(wizard, name, data = undefined) {
data.network.offline = true;
}
wizard.check(wizardId("cache"), data.network.offline);
wizard.waitFor(() => dlgButton("next").disabled == false);
wizard.waitFor(() => !dlgButton("next").disabled);
dlgButton("next").doCommand();
} else {
// local calendar is default
@ -559,7 +559,7 @@ function handleNewCalendarWizard(wizard, name, data = undefined) {
data.eMail = "none";
}
menulistSelect(wizardId("email-identity-menulist"), data.eMail, wizard);
wizard.waitFor(() => dlgButton("next").disabled == false);
wizard.waitFor(() => !dlgButton("next").disabled);
dlgButton("next").doCommand();
// finish

Просмотреть файл

@ -122,7 +122,7 @@ function verify(controller, dates, timezones, times) {
if (day != undefined && day == -1) {
viewForward(controller, 1);
}
controller.assertJS(found == true);
controller.assertJS(found);
}
}
}