Bug 1280898 - Set up eslint for calendar files - enable radix rule. r?MakeMyDay

MozReview-Commit-ID: KIiWBIpS9x3

--HG--
extra : rebase_source : 2b3dab50c720cd48f98cd8243667a3d46b22b2b3
This commit is contained in:
eslint 2016-07-08 11:18:59 +02:00
Родитель d964091236
Коммит b1808c16c4
15 изменённых файлов: 28 добавлений и 25 удалений

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

@ -124,6 +124,9 @@
// Require a space immediately following the // in a line comment.
"spaced-comment": [2, "always"],
// Require use of the second argument for parseInt().
"radix": 2,
// Will enable these rules later
"keyword-spacing": 0,
"block-spacing": 0,

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

@ -653,7 +653,7 @@
configBox.setAttribute("hidden", "true");
this.mMinDuration = Components.classes["@mozilla.org/calendar/duration;1"]
.createInstance(Components.interfaces.calIDuration);
this.mMinDuration.minutes = parseInt(minSize/this.mPixPerMin);
this.mMinDuration.minutes = Math.trunc(minSize / this.mPixPerMin);
let theMin = this.mStartMin;
while (theMin < this.mEndMin) {

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

@ -52,7 +52,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this.mCurIndex = 0;
if (aCalendarCount) {
this.mCalendarCount = this.mCalendarCount + aCalendarCount;
this.mCalendarStep = parseInt(100 / this.mCalendarCount);
this.mCalendarStep = Math.trunc(100 / this.mCalendarCount);
}
this.mProgressMode = aProgressMode;
this.mStatusProgressPanel.removeAttribute("collapsed");
@ -94,7 +94,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
if (this.spinning == Components.interfaces.calIStatusObserver.DETERMINED_PROGRESS) {
if (!this.mCalendars[aCalendar.id] || this.mCalendars[aCalendar.id] === undefined) {
this.mCalendars[aCalendar.id] = true;
this.mStatusBar.value = (parseInt(this.mStatusBar.value) + this.mCalendarStep);
this.mStatusBar.value = parseInt(this.mStatusBar.value, 10) + this.mCalendarStep;
this.mCurIndex++;
let curStatus = calGetString("calendar", "gettingCalendarInfoDetail",
[this.mCurIndex, this.mCalendarCount]);

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

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

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

@ -159,7 +159,7 @@ function disableElementWithLock(elementId, lockId) {
if (element) {
if (!element.hasAttribute(lockId)) {
element.setAttribute(lockId, "true");
var n = parseInt(element.getAttribute("lock") || 0);
var n = parseInt(element.getAttribute("lock") || 0, 10);
element.setAttribute("lock", n + 1);
}
}
@ -184,7 +184,7 @@ function enableElementWithLock(elementId, lockId) {
if (element.hasAttribute(lockId)) {
element.removeAttribute(lockId);
var n = parseInt(element.getAttribute("lock") || 0) - 1;
var n = parseInt(element.getAttribute("lock") || 0, 10) - 1;
if (n > 0) {
element.setAttribute("lock", n);
} else {

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

@ -608,7 +608,7 @@
if (mailingList) {
let entries = this._getListEntries(mailingList);
if (entries.length > 0) {
let currentIndex = parseInt(input.id.substr(13));
let currentIndex = parseInt(input.id.substr(13), 10);
let template = document.getAnonymousElementByAttribute(this, "anonid", "item");
let currentNode = template.parentNode.childNodes[currentIndex];
this._fillListItemWithEntry(currentNode, entries[0], currentIndex);

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

@ -217,7 +217,7 @@ var TodayPane = {
} else {
// Keeping pressed next/previous day buttons causes days switching (with
// three levels higher speed after some commutations).
TodayPane.advance(parseInt(aDir));
TodayPane.advance(parseInt(aDir, 10));
TodayPane.switchCounter++;
let timeInterval = INITIAL_TIME;
if (TodayPane.switchCounter > 2 * ACCELERATE_COUNT_LIMIT) {
@ -247,7 +247,7 @@ var TodayPane = {
delete TodayPane.minidayTimer;
if (TodayPane.switchCounter == 0 && !TodayPane.minidayDrag.session) {
let dir = element.getAttribute('dir');
TodayPane.advance(parseInt(dir));
TodayPane.advance(parseInt(dir, 10));
}
}
if (element.id == "previous-day-button" ||
@ -293,7 +293,7 @@ var TodayPane = {
if (this.paneViews == null) {
return;
}
let index = parseInt(document.getElementById("today-pane-header").getAttribute("index"));
let index = parseInt(document.getElementById("today-pane-header").getAttribute("index"), 10);
index = index + aCycleForward;
let nViewLen = this.paneViews.length;
if (index >= nViewLen) {

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

@ -199,7 +199,7 @@
let years = document.getAnonymousElementByAttribute(this, "anonid", "years-popup").firstChild.childNodes;
let year = new Date(aDate);
let compFullYear = aDate.getFullYear();
year.setFullYear(Math.max(1, compFullYear - parseInt(years.length / 2, 10) + 1));
year.setFullYear(Math.max(1, compFullYear - Math.trunc(years.length / 2) + 1));
for (let i = 1; i < years.length - 1; i++) {
let curfullYear = year.getFullYear();
years[i].setAttribute("value", curfullYear);
@ -518,7 +518,7 @@
let calChunks = busyStr.split("\u001A");
for (let chunk of calChunks) {
let expr = chunk.split("=");
boxBusy[expr[0]] = parseInt(expr[1]);
boxBusy[expr[0]] = parseInt(expr[1], 10);
}
}

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

@ -241,7 +241,7 @@ calAlarm.prototype = {
if (aValue === null) {
this.mRepeat = null;
} else {
this.mRepeat = parseInt(aValue);
this.mRepeat = parseInt(aValue, 10);
if (isNaN(this.mRepeat)) {
throw Components.results.NS_ERROR_INVALID_ARG;
}

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

@ -661,7 +661,7 @@ function loadDialog(aItem) {
let percentCompleteInteger = 0;
let percentCompleteProperty = aItem.getProperty("PERCENT-COMPLETE");
if (percentCompleteProperty != null) {
percentCompleteInteger = parseInt(percentCompleteProperty);
percentCompleteInteger = parseInt(percentCompleteProperty, 10);
}
if (percentCompleteInteger < 0) {
percentCompleteInteger = 0;
@ -774,7 +774,7 @@ function loadDialog(aItem) {
}
// Priority, Privacy, Transparency
gConfig.priority = parseInt(aItem.priority);
gConfig.priority = parseInt(aItem.priority, 10);
gConfig.privacy = aItem.privacy;
gConfig.showTimeAs = aItem.getProperty("TRANSP");
@ -1382,7 +1382,7 @@ function saveDialog(item) {
var percentCompleteInteger = 0;
if (getElementValue("percent-complete-textbox") != "") {
percentCompleteInteger =
parseInt(getElementValue("percent-complete-textbox"));
parseInt(getElementValue("percent-complete-textbox"), 10);
}
if (percentCompleteInteger < 0) {
percentCompleteInteger = 0;
@ -2803,7 +2803,7 @@ function updateToDoStatus(aStatus, aCompletedDate=null) {
// date will get lost.
// remember the original values
let oldPercentComplete = parseInt(getElementValue("percent-complete-textbox"));
let oldPercentComplete = parseInt(getElementValue("percent-complete-textbox"), 10);
let oldCompletedDate = getElementValue("completed-date-picker");
// If the percent completed has changed to 100 or from 100 to another

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

@ -565,7 +565,7 @@ function rotatePriority() {
* @param {nsIDOMNode} aTarget Has the new priority in its "value" attribute
*/
function editPriority(aTarget) {
let newPriority = parseInt(aTarget.getAttribute("value"));
let newPriority = parseInt(aTarget.getAttribute("value"), 10);
editConfigState({ priority: newPriority });
}

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

@ -85,10 +85,10 @@ function textToDate(d) {
if (d[0] == 'Z') {
let strs = d.substr(2).split(":");
dval = parseInt(strs[0]);
dval = parseInt(strs[0], 10);
tz = strs[1].replace(/%:/g, ":").replace(/%%/g, "%");
} else {
dval = parseInt(d.substr(2));
dval = parseInt(d.substr(2), 10);
}
let date;

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

@ -279,7 +279,7 @@ function getWcapXmlErrno(xml) {
if (elem) {
elem = elem.item(0);
if (elem) {
return parseInt(elem.textContent);
return parseInt(elem.textContent, 10);
}
}
// some commands just respond with an empty calendar, no errno. WTF.
@ -290,7 +290,7 @@ function getWcapXmlErrno(xml) {
function getWcapIcalErrno(icalRootComp) {
var prop = icalRootComp.getFirstProperty("X-NSCP-WCAP-ERRNO");
if (prop) {
return parseInt(prop.value);
return parseInt(prop.value, 10);
}
// some commands just respond with an empty calendar, no errno. WTF.
// assume success:

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

@ -346,7 +346,7 @@ calWcapSession.prototype = {
sessionId = prop.value;
prop = icalRootComp.getFirstProperty("X-NSCP-RECURRENCE-BOUND");
if (prop) {
var val = parseInt(prop.value);
var val = parseInt(prop.value, 10);
if (!isNaN(val)) {
this_.recurrenceBound = val;
log("X-NSCP-RECURRENCE-BOUND:" + this_.recurrenceBound);
@ -443,7 +443,7 @@ calWcapSession.prototype = {
if (!prop) {
throw new Components.Exception("missing X-NSCP-WCAPVERSION!");
}
var wcapVersion = parseInt(prop.value);
var wcapVersion = parseInt(prop.value, 10);
if (wcapVersion < 3) {
var strVers = prop.value;
var vars = [this_.sessionUri.hostPort];

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

@ -96,7 +96,7 @@ function getPreviewForTask( toDoItem )
if (toDoItem.priority && toDoItem.priority != 0)
{
var priorityInteger = parseInt(toDoItem.priority);
var priorityInteger = parseInt(toDoItem.priority, 10);
var priorityString;
// These cut-offs should match calendar-event-dialog.js