Closed Bug 1280898 Opened 8 years ago Closed 8 years ago

Set up eslint for calendar files

Categories

(Calendar :: Build Config, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Fallen, Assigned: Fallen)

References

Details

Attachments

(71 files, 64 obsolete files)

(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
(deleted), text/x-review-board-request
MakeMyDay
: review+
Details
No description provided.
I would like to format our code with eslint. This will mess up blame for many files, but experience has shown that waiting for all lines to be changed during other patches will never happen.
Based on my experience with automated code and style checking tools in other projects I work on, I think this is a great idea. There will probably be a little pain in the beginning, but it is totally work it in the long run.
Attached patch Initial Rules and minimal automatic fixes - v1 (obsolete) (deleted) — Splinter Review
I don't expect a full code review as the amount of changes in this bug will not be easy to be reviewed. I will post a try run with all patches once I have everything uploaded.
Attachment #8763515 - Flags: review?(makemyday)
Attached patch Initial Rules and minimal automatic fixes - v2 (obsolete) (deleted) — Splinter Review
Missing .eslintrc added
Attachment #8763515 - Attachment is obsolete: true
Attachment #8763515 - Flags: review?(makemyday)
Attachment #8763516 - Flags: review?(makemyday)
Comment on attachment 8763516 [details] [diff] [review] Initial Rules and minimal automatic fixes - v2 Actually, due to the vast number of patches I think I am going to use mozreview for this bug.
Attachment #8763516 - Attachment is obsolete: true
Attachment #8763516 - Flags: review?(makemyday)
Attachment #8763529 - Flags: review?(makemyday)
Attachment #8763530 - Flags: review?(makemyday)
Attachment #8763531 - Flags: review?(makemyday)
Attachment #8763532 - Flags: review?(makemyday)
Attachment #8763533 - Flags: review?(makemyday)
Attachment #8763534 - Flags: review?(makemyday)
Attachment #8763535 - Flags: review?(makemyday)
Attachment #8763536 - Flags: review?(makemyday)
Attachment #8763537 - Flags: review?(makemyday)
Attachment #8763538 - Flags: review?(makemyday)
Attachment #8763539 - Flags: review?(makemyday)
Attachment #8763540 - Flags: review?(makemyday)
Attachment #8763541 - Flags: review?(makemyday)
Attachment #8763542 - Flags: review?(makemyday)
Attachment #8763543 - Flags: review?(makemyday)
Attachment #8763544 - Flags: review?(makemyday)
Attachment #8763545 - Flags: review?(makemyday)
Attachment #8763546 - Flags: review?(makemyday)
Attachment #8763547 - Flags: review?(makemyday)
Attachment #8763548 - Flags: review?(makemyday)
Attachment #8763549 - Flags: review?(makemyday)
Attachment #8763550 - Flags: review?(makemyday)
Attachment #8763551 - Flags: review?(makemyday)
Attachment #8763552 - Flags: review?(makemyday)
Attachment #8763553 - Flags: review?(makemyday)
Attachment #8763554 - Flags: review?(makemyday)
Attachment #8763555 - Flags: review?(makemyday)
Attachment #8763556 - Flags: review?(makemyday)
Attachment #8763557 - Flags: review?(makemyday)
Attachment #8763558 - Flags: review?(makemyday)
Phew, what a rush! I have created a try run here: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=fd2e033596d4 I'm also adding bug 1274728 as a dependency, because I had this one applied when working on the patches and removing it causes bitrot.
Depends on: 1274728
Ok, a few test failures. I'll take a look and keep you posted.
Depends on: 1098585
(In reply to MakeMyDay from bug 1274728 comment #11) > I haven't taken a look at the patches yet, but there are massive test > failures for that try build, including a timeout of the gdata xpcshell test > for bug 1280898. > > Apart from that, is there an option to exclude such mass changes from blame? > It will be probably useless after landing these patches for a longer time, > especially for that part of the code base that doesn't receive patches > frequently (so nearly everything...). I've got the test failures covered, hopefully this works better: <https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=5c0b78f4f13c>. It passes locally for me. There is no such option to exclude from blame. While it may be more annoying to skip through the changeset in blame, it is not impossible to get to the parent changeset and check blame again from there. I've set the user to "eslint <eslint@bugzilla.kewis.ch>" so it becomes more apparent when viewing annotations, and so that not everyone blames me :) I think the benefit outweighs the pain, personally I don't look at blame all too often but I want to fix style for every written patch. If some of the suggestions in https://www.mercurial-scm.org/wiki/BlamePlan are implemented (there is a MOSS grant for this afaik) then maybe we can retroactively skip blame for the final changeset. I can also squash the commits before pushing, this way there is only one revision to parent when browsing blame.
Thanks. Hopefully some if the blame feature will get implemented one day. There still seem some Mozmill failures around. Will the eslint checks be integrated in review (splinter/reviewboard), test, (try) builds or patch landing processes in any way? Or do we need that to run locally once in a while for auditing purposes?
(In reply to MakeMyDay from comment #39) > Thanks. Hopefully some if the blame feature will get implemented one day. > > There still seem some Mozmill failures around. Found them. For some reason using <field name="foo">{}</field> doesn't work, while <field name="foo">new Object()</field> does. I moved it into the constructor instead. There was also another issue with the occurrence prompt. Getting mozmill to run locally was pretty painful, but I think it will be good now: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=0095274932cf Due to the nature of this patch there may of course be some fallout not covered by tests. On the bright side, when we catch them through testing, we can write test to make sure it doesn't happen again. > Will the eslint checks be integrated in review (splinter/reviewboard), test, > (try) builds or patch landing processes in any way? Or do we need that to > run locally once in a while for auditing purposes? If we can get this to work, perfect. I fear it will not work out of the box, because our automation doesn't run using mach yet. See also bug 1280896. We'll have to run this ourselves, but the good thing is we won't have to specify each nit for new contributors during review but can ask them to run mach eslint calendar.
Attachment #8763867 - Flags: review?(makemyday)
Attachment #8763868 - Flags: review?(makemyday)
Attachment #8763869 - Flags: review?(makemyday)
Attachment #8763870 - Flags: review?(makemyday)
Attachment #8763871 - Flags: review?(makemyday)
Attachment #8763872 - Flags: review?(makemyday)
Attachment #8763873 - Flags: review?(makemyday)
Attachment #8763874 - Flags: review?(makemyday)
Attachment #8763875 - Flags: review?(makemyday)
Attachment #8763876 - Flags: review?(makemyday)
Attachment #8763877 - Flags: review?(makemyday)
Attachment #8763878 - Flags: review?(makemyday)
Attachment #8763879 - Flags: review?(makemyday)
Attachment #8763880 - Flags: review?(makemyday)
Attachment #8763881 - Flags: review?(makemyday)
Attachment #8763882 - Flags: review?(makemyday)
Attachment #8763883 - Flags: review?(makemyday)
Attachment #8763884 - Flags: review?(makemyday)
Attachment #8763885 - Flags: review?(makemyday)
Attachment #8763886 - Flags: review?(makemyday)
Attachment #8763887 - Flags: review?(makemyday)
Attachment #8763888 - Flags: review?(makemyday)
Attachment #8763889 - Flags: review?(makemyday)
Attachment #8763890 - Flags: review?(makemyday)
Attachment #8763891 - Flags: review?(makemyday)
Attachment #8763892 - Flags: review?(makemyday)
Attachment #8763893 - Flags: review?(makemyday)
Attachment #8763894 - Flags: review?(makemyday)
Attachment #8763895 - Flags: review?(makemyday)
Attachment #8763896 - Flags: review?(makemyday)
Attachment #8763529 - Attachment is obsolete: true
Attachment #8763529 - Flags: review?(makemyday)
Attachment #8763530 - Attachment is obsolete: true
Attachment #8763530 - Flags: review?(makemyday)
Attachment #8763531 - Attachment is obsolete: true
Attachment #8763531 - Flags: review?(makemyday)
Attachment #8763532 - Attachment is obsolete: true
Attachment #8763532 - Flags: review?(makemyday)
Attachment #8763533 - Attachment is obsolete: true
Attachment #8763533 - Flags: review?(makemyday)
Attachment #8763534 - Attachment is obsolete: true
Attachment #8763534 - Flags: review?(makemyday)
Attachment #8763535 - Attachment is obsolete: true
Attachment #8763535 - Flags: review?(makemyday)
Attachment #8763536 - Attachment is obsolete: true
Attachment #8763536 - Flags: review?(makemyday)
Attachment #8763537 - Attachment is obsolete: true
Attachment #8763537 - Flags: review?(makemyday)
Attachment #8763538 - Attachment is obsolete: true
Attachment #8763538 - Flags: review?(makemyday)
Attachment #8763539 - Attachment is obsolete: true
Attachment #8763539 - Flags: review?(makemyday)
Attachment #8763540 - Attachment is obsolete: true
Attachment #8763540 - Flags: review?(makemyday)
Attachment #8763541 - Attachment is obsolete: true
Attachment #8763541 - Flags: review?(makemyday)
Attachment #8763542 - Attachment is obsolete: true
Attachment #8763542 - Flags: review?(makemyday)
Attachment #8763543 - Attachment is obsolete: true
Attachment #8763543 - Flags: review?(makemyday)
Attachment #8763544 - Attachment is obsolete: true
Attachment #8763544 - Flags: review?(makemyday)
Attachment #8763545 - Attachment is obsolete: true
Attachment #8763545 - Flags: review?(makemyday)
Attachment #8763546 - Attachment is obsolete: true
Attachment #8763546 - Flags: review?(makemyday)
Attachment #8763547 - Attachment is obsolete: true
Attachment #8763547 - Flags: review?(makemyday)
Attachment #8763548 - Attachment is obsolete: true
Attachment #8763548 - Flags: review?(makemyday)
Attachment #8763549 - Attachment is obsolete: true
Attachment #8763549 - Flags: review?(makemyday)
Attachment #8763550 - Attachment is obsolete: true
Attachment #8763550 - Flags: review?(makemyday)
Attachment #8763551 - Attachment is obsolete: true
Attachment #8763551 - Flags: review?(makemyday)
Attachment #8763552 - Attachment is obsolete: true
Attachment #8763552 - Flags: review?(makemyday)
Attachment #8763553 - Attachment is obsolete: true
Attachment #8763553 - Flags: review?(makemyday)
Attachment #8763554 - Attachment is obsolete: true
Attachment #8763554 - Flags: review?(makemyday)
Attachment #8763555 - Attachment is obsolete: true
Attachment #8763555 - Flags: review?(makemyday)
Attachment #8763556 - Attachment is obsolete: true
Attachment #8763556 - Flags: review?(makemyday)
Attachment #8763557 - Attachment is obsolete: true
Attachment #8763557 - Flags: review?(makemyday)
Attachment #8763558 - Attachment is obsolete: true
Attachment #8763558 - Flags: review?(makemyday)
mozreview commenting needs some UI work :-P Try run passes now, at least with the same failures as on c-c. Let me know if I can do something to make review easier. You may also want to update your reviewboard profile and possibly set your bugzilla displayname to [:MakeMyDay], I had to enter you as a reviewer for each changeset manually because it didn't find your nickname.
Drive by comment, please forgive me for not using the mozreview tool as I'm not used to it. > diff --git a/calendar/lightning/content/messenger-overlay-sidebar.js b/calendar/lightning/content/messenger-overlay-sidebar.js > - var id = null; > - try { id = deck.selectedPanel.id } catch (e) { } > + let id = deck.selectedPanel && deck.selectedPanel.id; Does this has the same meaning as before, i.e. id holds the string value of deck.selectedPanel.id? With C++ background this looks like id is now a boolean variable. > diff --git a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml > let attendees = []; > let inputField; > > - for (let i = 1; inputField = this.getInputElement(i); i++) { > - if (inputField && inputField.value != "") { > - // the inputfield already has a reference to the attendee > - // object, we just need to fill in the name. > - let attendee = inputField.attendee.clone(); > - if (attendee.isOrganizer) { > - continue; > + for (let i = 1; true; i++) { > + let inputField = this.getInputElement(i); Problem if inputField is defined twice now? Once before and once inside the for loop?
(In reply to Stefan Sitter from comment #72) > Drive by comment, please forgive me for not using the mozreview tool as I'm > not used to it. No worries, I haven't used it more than 1-2 times myself and prefer the normal tools :) > > > diff --git a/calendar/lightning/content/messenger-overlay-sidebar.js b/calendar/lightning/content/messenger-overlay-sidebar.js > > - var id = null; > > - try { id = deck.selectedPanel.id } catch (e) { } > > + let id = deck.selectedPanel && deck.selectedPanel.id; > > Does this has the same meaning as before, i.e. id holds the string value of > deck.selectedPanel.id? With C++ background this looks like id is now a > boolean variable. It does, if the first variable is truthy, then it evaluates to the second. If not, then it evaluates to the falsy value of the first. It is similar to the let foo = maybeNull || "default"; syntax. > > > diff --git a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml > > let attendees = []; > > let inputField; >... > > + let inputField = this.getInputElement(i); > > Problem if inputField is defined twice now? Once before and once inside the > for loop? Ah yes. Not a big problem, the second variable shadows the first, but I should get rid of one. Will fix that in the next round of commits. Thanks for the comment!
Comment on attachment 8763867 [details] Bug 1280898 - Set up eslint for calendar files - initial rules and minimal automatic fixes. https://reviewboard.mozilla.org/r/59962/#review57278 Ok, here's the review for the first patch. If the remaining reviews don't take that long again, I would appreciate if you could merge all the patches before landing to keep blame usable. Hmm, the reviewboard seems not to provide as much context for comments as splinter - at least in the preview here. But there seems to be no option to move the anchor of the comment from with the preview. Let's see what bugzilla makes of it. ::: .eslintignore:45 (Diff revision 1) > +# preprocessed files > +calendar/base/content/dialogs/calendar-migration-dialog.js > +calendar/base/content/calendar-dnd-listener.js > + > +# temporary ignore until gsoc 2016 work is complete > +calendar/base/content/dialogs/calendar-event-dialog.js You also should exclude calendar-item-editing.js and calendar-summary-dialog.js (and maybe more depending on bug 1277972) for the same reason for now. ::: calendar/base/content/agenda-listbox.js:1080 (Diff revision 1) > .getInTimezone(agendaListbox.kDefaultTimezone) > .subtractDate(anow).inSeconds; > if (msuntillstart <= 0) { > - var msuntillend = complistItem.occurrence.endDate > + msuntillend = complistItem.occurrence.endDate > - .getInTimezone(agendaListbox.kDefaultTimezone) > + .getInTimezone(agendaListbox.kDefaultTimezone) > - .subtractDate(anow).inSeconds; > + .subtractDate(anow).inSeconds; can you fix the inconsitent indention here and for the msuntilstart block above? ::: calendar/base/content/dialogs/calendar-summary-dialog.js (Diff revision 1) > */ > function onLoad() { > var args = window.arguments[0]; > var item = args.calendarEvent; > item = item.clone(); // use an own copy of the passed item > - var calendar = item.calendar; as mentioned above it might make sense to exclude calendar-summary-dialog.js here due to GSoC. ::: calendar/base/src/calTimezoneService.js:795 (Diff revision 1) > ((standardStart < daylightStart > ? standardText + daylightText > : daylightText + standardText)+ > - (calProperties.GetStringFromName > - ("TZAlmostMatchesOSDifferAtMostAWeek"))); > + (calProperties.GetStringFromName( > + "TZAlmostMatchesOSDifferAtMostAWeek"))); > } else { you can remove the outer brackets here as well. ::: calendar/base/src/calTimezoneService.js (Diff revision 1) > } > var offsetString = (standardTZOffset+ > (!daylightTZOffset? "": "/"+daylightTZOffset)); > - var warningMsg = (calProperties.formatStringFromName > - ("WarningUsingGuessedTZ", > + var warningMsg = (calProperties.formatStringFromName("WarningUsingGuessedTZ", > + [tzId, offsetString, warningDetail, probableTZSource], 4)); > - [tzId, offsetString, warningDetail, again: outer brackets can be removed. ::: calendar/lightning/components/calItipProtocolHandler.js:13 (Diff revision 1) > var CI = Components.interfaces; > > var ITIP_HANDLER_MIMETYPE = "application/x-itip-internal"; > var ITIP_HANDLER_PROTOCOL = "moz-cal-handle-itip"; > +var NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001; > Why do you need to assign this here? Later you use Components.results.NS_ERROR_WONT_HANDLE_CONTENT anyway. ::: calendar/resources/content/publish.js:57 (Diff revision 1) > // Ask user to select the calendar that should be published. > // publishEntireCalendar() will be called again if OK is pressed > // in the dialog and the selected calendar will be passed in. > // Therefore return after openDialog(). > - var args = new Object(); > + let args = new Object(); > args.onOk = publishEntireCalendar; ou can switch to {} here, too.
Attachment #8763867 - Flags: review?(makemyday) → review+
Comment on attachment 8763868 [details] Bug 1280898 - Set up eslint for calendar files - enable block-scoped-var rule. https://reviewboard.mozilla.org/r/59964/#review57324 ::: calendar/base/content/calendar-daypicker.xml:89 (Diff revision 1) > var mainbox = > document.getAnonymousElementByAttribute( > this, "anonid", "mainbox"); > var numChilds = mainbox.childNodes.length; > - for (var i = 0; i < numChilds; i++) { > + for (let i = 0; i < numChilds; i++) { > var child = mainbox.childNodes[i]; Use let here. As mentioned on irc, please add a seperate changeset for the complete conversion of non-toplevel var to let. ::: calendar/base/content/calendar-daypicker.xml:93 (Diff revision 1) > - for (var i = 0; i < numChilds; i++) { > + for (let i = 0; i < numChilds; i++) { > var child = mainbox.childNodes[i]; > child.removeAttribute("checked"); > } > - for (i = 0; i < val.length; i++) { > + for (let i = 0; i < val.length; i++) { > var index = val[i] - 1 - this.weekStartOffset; let again.
Attachment #8763868 - Flags: review?(makemyday) → review+
Comment on attachment 8763869 [details] Bug 1280898 - Set up eslint for calendar files - enable comma-dangle,comma-spacing,comma-style rules. https://reviewboard.mozilla.org/r/59966/#review57328
Attachment #8763869 - Flags: review?(makemyday) → review+
Attachment #8763870 - Flags: review?(makemyday) → review+
Comment on attachment 8763870 [details] Bug 1280898 - Set up eslint for calendar files - enable curly rule. https://reviewboard.mozilla.org/r/59968/#review57332 Is there also a check to detect all missing let keywords in a for() like in most of the comments below? ::: calendar/base/content/calendar-multiday-view.xml:76 (Diff revision 1) > <parameter name="aAttr"/> > <parameter name="aVal"/> > <body><![CDATA[ > var needsrelayout = false; > if (aAttr == "orient") { > - if (this.getAttribute("orient") != aVal) > + if (this.getAttribute("orient") != aVal) { Just collapse this to let needsrelayout = (aAttr == "orien" && this.getAttribute("orient") != aVal); ::: calendar/base/content/calendar-multiday-view.xml:2336 (Diff revision 1) > <parameter name="aVal"/> > <body><![CDATA[ > var needsrelayout = false; > if (aAttr == "orient") { > - if (this.getAttribute("orient") != aVal) > + if (this.getAttribute("orient") != aVal) { > needsrelayout = true; once again ::: calendar/base/content/widgets/minimonth.xml:764 (Diff revision 1) > for (var endPrefix = 0; endPrefix < minLength; endPrefix++) { > var c = dayList[0][endPrefix]; > if (dayList.some(function(dayAbbr) { > return dayAbbr[endPrefix] != c; })) { > if (endPrefix > 0) { > - for (i = 0; i < dayList.length; i++) // trim prefix chars. > + for (i = 0; i < dayList.length; i++) { // trim prefix chars. for (let i = 0;.... ::: calendar/base/content/widgets/minimonth.xml:773 (Diff revision 1) > break; > } > } > } > // 3. trim each day abbreviation to 1 char if unique, else 2 chars. > for (i = 0; i < dayList.length; i++) { for (let i = 0; ... ::: calendar/base/content/widgets/minimonth.xml:775 (Diff revision 1) > } > } > // 3. trim each day abbreviation to 1 char if unique, else 2 chars. > for (i = 0; i < dayList.length; i++) { > var foundMatch = 1; > for (j = 0; j < dayList.length; j++) { for (let j = 0; ... ::: calendar/resources/content/publish.js (Diff revision 1) > } > > > -var publishingListener = > -{ > +var publishingListener = { > + QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIStreamListener]), > - QueryInterface: function(aIId, instance) There are some more occurrences of such QI definitions - see https://dxr.mozilla.org/comm-central/search?q=QueryInterface%3A+fun+path%3Acalendar%2F*&redirect=false Can you include the clean up for the others here, too, or should we file a separate bug for it? ::: calendar/test/mozmill/eventDialog/testEventDialog.js:219 (Diff revision 1) > eventBox.replace("rowNumber", "0").replace("columnNumber", "5"))); > controller.assertNodeNotExist(new elementslib.Lookup(controller.window.document, > eventBox.replace("rowNumber", "0").replace("columnNumber", "6"))); > > - for(row = 1; row < 5; row++) > - for(col = 0; col < 7; col++) > + for (row = 1; row < 5; row++) { > + for (col = 0; col < 7; col++) { for (let row = 1;... for (let col = 1;... ::: calendar/test/mozmill/shared-modules/calendar-utils.js:331 (Diff revision 1) > let calendarTree = (new elementslib.Lookup(controller.window.document, > '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/id("tabpanelcontainer")/' > + 'id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/id("calendar-panel")/' > + 'id("calendar-list-pane")/id("calendar-listtree-pane")/id("calendar-list-tree-widget")')) > .getNode(); > - for(i = 0; i < calendarTree.mCalendarList.length; i++) > + for (i = 0; i < calendarTree.mCalendarList.length; i++) { for (let i = 0;... ::: calendar/test/mozmill/views/testTaskView.js:43 (Diff revision 1) > let calendarTree = (new elementslib.Lookup(controller.window.document, > '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/id("tabpanelcontainer")/' > + 'id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/id("calendar-panel")/' > + 'id("calendar-list-pane")/id("calendar-listtree-pane")/id("calendar-list-tree-widget")')) > .getNode(); > - for(i = 0; i < calendarTree.mCalendarList.length; i++) > + for (i = 0; i < calendarTree.mCalendarList.length; i++) { for (let i = 0;...
Comment on attachment 8763871 [details] Bug 1280898 - Set up eslint for calendar files - enable key-spacing rule. https://reviewboard.mozilla.org/r/59970/#review57480 r- for now to get an updated patch. As discussed on irc the rule should be relaxed to only note about { foo : "bar"} but allow { foo: "bar" }
Attachment #8763871 - Flags: review?(makemyday) → review-
Comment on attachment 8763872 [details] Bug 1280898 - Set up eslint for calendar files - enable new-parens,no-array-constructor rule. https://reviewboard.mozilla.org/r/59972/#review57482
Attachment #8763872 - Flags: review?(makemyday) → review+
Comment on attachment 8763873 [details] Bug 1280898 - Set up eslint for calendar files - enable no-catch-shadow rule. https://reviewboard.mozilla.org/r/59974/#review57484
Attachment #8763873 - Flags: review?(makemyday) → review+
Comment on attachment 8763874 [details] Bug 1280898 - Set up eslint for calendar files - enable no-cond-assign rule. https://reviewboard.mozilla.org/r/59976/#review57486 ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:383 (Diff revision 1) > <getter><![CDATA[ > let attendees = []; > let inputField; > > - for (let i = 1; inputField = this.getInputElement(i); i++) { > - if (inputField && inputField.value != "") { > + for (let i = 1; true; i++) { > + let inputField = this.getInputElement(i); No let here. inputFied has already been declared outside of the for loop. ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:430 (Diff revision 1) > > <property name="organizer"> > <getter><![CDATA[ > let inputField; > - for (let i = 1; inputField = this.getInputElement(i); i++) { > - if (inputField && inputField.value != "") { > + for (let i = 1; true; i++) { > + let inputField = this.getInputElement(i); The same here.
Attachment #8763874 - Flags: review?(makemyday) → review+
Attachment #8763875 - Flags: review?(makemyday) → review+
Comment on attachment 8763875 [details] Bug 1280898 - Set up eslint for calendar files - enable no-debugger rule. https://reviewboard.mozilla.org/r/59978/#review57488
Attachment #8763876 - Flags: review?(makemyday) → review+
Comment on attachment 8763876 [details] Bug 1280898 - Set up eslint for calendar files - enable yoda rule. https://reviewboard.mozilla.org/r/59980/#review57490
Comment on attachment 8763877 [details] Bug 1280898 - Set up eslint for calendar files - enable no-new-object rule. https://reviewboard.mozilla.org/r/59982/#review57492
Attachment #8763877 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/59968/#review57332 Yes, this is no-undef. I will take care of that separately, it is a big one. > Just collapse this to > > let needsrelayout = (aAttr == "orien" && this.getAttribute("orient") != aVal); There is a separate rule for this (lonely-if), I will take care there. > for (let i = 0; ... > > ::: calendar/base/content/widgets/minimonth.xml:764 > (Diff revision 1) > > for (var endPrefix = 0; endPrefix < minLength; endPrefix++) { > > var c = dayList[0][endPrefix]; > > if (dayList.some(function(dayAbbr) { > > return dayAbbr[endPrefix] != c; })) { > > if (endPrefix > 0) { > > - for (i = 0; i < dayList.length; i++) // trim prefix chars. > > + for (i = 0; i < dayList.length; i++) { // trim prefix chars. > > for (let i = 0;.... i and j are defined further up, but for other issues with missing let you mentioned I will eventually introduce the no-undef rule. > There are some more occurrences of such QI definitions - see https://dxr.mozilla.org/comm-central/search?q=QueryInterface%3A+fun+path%3Acalendar%2F*&redirect=false > > Can you include the clean up for the others here, too, or should we file a separate bug for it? I'll take care of this in another bug
https://reviewboard.mozilla.org/r/59964/#review57324 > Use let here. As mentioned on irc, please add a seperate changeset for the complete conversion of non-toplevel var to let. Yes, will do this in a separate changeset
https://reviewboard.mozilla.org/r/59962/#review57278 > You also should exclude calendar-item-editing.js and calendar-summary-dialog.js (and maybe more depending on bug 1277972) for the same reason for now. I kind of hoped we could land the first gsoc patch before this one one and I would rebase, but if needed I can also ignore those files and keep those for later. > Why do you need to assign this here? Later you use Components.results.NS_ERROR_WONT_HANDLE_CONTENT anyway. Unfinished, good catch. Components.results.NS_ERROR_WONT_HANDLE_CONTENT is actually undefined, hence I introduce the variable, but looks like I didn't actually use it. > ou can switch to {} here, too. Will be taken care of in a later patch
https://reviewboard.mozilla.org/r/59976/#review57486 > No let here. inputFied has already been declared outside of the for loop. This is the issue ssitter mentioned, fixed locally.
Comment on attachment 8763878 [details] Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. https://reviewboard.mozilla.org/r/59984/#review57500 ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:347 (Diff revision 1) > input.removeAttribute("value"); > input.attendee = newAttendee; > > // set role and participation status > - //status.setAttribute("status", newAttendee.participationStatus); > - //role.setAttribute("role", newAttendee.role); > + // status.setAttribute("status", newAttendee.participationStatus); > + // role.setAttribute("role", newAttendee.role); These comments seem to be obsolete. ::: calendar/base/content/widgets/calendar-widgets.xml:688 (Diff revision 1) > let flavor = {}; > let data = {}; > // nsITransferable sucks when it comes to trying to add extra flavors. > // This will throw NS_ERROR_FAILURE, so as a workaround, we use the > // sourceNode property and get the event that way > - //transfer.getAnyTransferData(flavor, data, {}); > + // transfer.getAnyTransferData(flavor, data, {}); Can we make the extra indention 2 whitespaces instead of one in such cases? ::: calendar/base/src/calCalendarManager.js:335 (Diff revision 1) > db.beginTransactionAs(Components.interfaces.mozIStorageConnection.TRANSACTION_EXCLUSIVE); > try { > if (db.tableExists("cal_calendars_prefs")) { > // Check if we need to upgrade: > let version = this.getSchemaVersion(db); > - //cal.LOG("*** Calendar schema version is: " + version); > + // cal.LOG("*** Calendar schema version is: " + version); This seems to be a remainder of some debug code. Either remove the // or get rid of that line altogether. ::: calendar/base/src/calItemBase.js:463 (Diff revision 1) > (paramName in this.mPropertyParams[propName])); > }, > > - //void setPropertyParameter(in AString aPropertyName, > - // in AString aParameterName, > - // in AUTF8String aParameterValue); > + // void setPropertyParameter(in AString aPropertyName, > + // in AString aParameterName, > + // in AUTF8String aParameterValue); We should convert this kind of comments to /** * Sets a paramter for a given parameter * * @param AString aPropertyName * @param AString aParameterName * @param AUTF8String aParameterValue */ But maybe this is something for a separate bug. ::: calendar/base/src/calUtils.js:97 (Diff revision 1) > function getDateFormatter() { > return Components.classes["@mozilla.org/calendar/datetime-formatter;1"] > .getService(Components.interfaces.calIDateTimeFormatter); > } > > -/// @return the UTC timezone. > +// @return the UTC timezone. Only one whitespace after // ::: calendar/base/src/calUtils.js:105 (Diff revision 1) > UTC.mObject = getTimezoneService().UTC; > } > return UTC.mObject; > } > > -/// @return the floating timezone. > +// @return the floating timezone. Same here. ::: calendar/base/src/calUtils.js:1174 (Diff revision 1) > mInterfaces: null, > > // Iterating the inteface bag iterates the interfaces it contains > [Symbol.iterator]: function() { return this.mInterfaces[Symbol.iterator](); }, > > - /// internal: > + // internal: Only one whitespace after // ::: calendar/base/src/calUtils.js:1180 (Diff revision 1) > init: function calInterfaceBag_init(iid) { > this.mIid = iid; > this.mInterfaces = []; > }, > > - /// external: > + // external: here, too. ::: calendar/providers/ics/calICSCalendar.js:877 (Diff revision 1) > this.mCalendar.readOnly = true; > this.mCalendar.notifyError(aErrNo, aMessage); > } > }; > > -/*************************** > +/* Use /** here ::: calendar/providers/storage/calStorageCalendar.js:673 (Diff revision 1) > }); > }, > getItems_: function cSC_getItems_(aItemFilter, aCount, > aRangeStart, aRangeEnd, aListener) > { > - //var profStartTime = Date.now(); > + // var profStartTime = Date.now(); Debug code once again (further occurences down until line 766). If we think this is useful to have it in the code base, we probably should wrap it in an if (a.perf.debug.pref) {} block, otherwise we should consider to remove it. Maybe worth a separate bug. ::: calendar/providers/wcap/calWcapCalendar.js:8 (Diff revision 1) > * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > > Components.utils.import("resource://calendar/modules/calUtils.jsm"); > Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); > > -function calWcapCalendar(/*optional*/session, /*optional*/calProps) { > +function calWcapCalendar(/* optional */ session, /* optional */ calProps) { Can't we add a documentation block above mentioning that the params are optional? ::: calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js:139 (Diff revision 1) > > // delete it > // XXX somehow the event is selected at this point, this didn't use to be the case > // and can't be reproduced manually > - /*controller.click(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.EVENT_BOX, undefined, 1, 8)));*/ > + /* controller.click(new elementslib.Lookup(controller.window.document, > + calUtils.getEventBoxPath(controller, "day", calUtils.EVENT_BOX, undefined, 1, 8))); */ It looks this is a candidate for removal. ::: calendar/test/unit/test_items.js:262 (Diff revision 1) > let e = cal.createEvent(); > > e.alarmLastAck = cal.createDateTime("20120101T010101"); > > // Our items don't support this yet > - //equal(e.getProperty("X-MOZ-LASTACK"), "20120101T010101"); > + // equal(e.getProperty("X-MOZ-LASTACK"), "20120101T010101"); The same here. ::: calendar/test/unit/test_recur.js:36 (Diff revision 1) > let occurrences = event.recurrenceInfo.getOccurrences(start, end, 0, {}); > > // Check number of items > dump("Expected " + expected.length + " occurrences\n"); > dump("Got: " + recdates.map(x => x.toString()) + "\n"); > - //equal(recdates.length, expected.length); > + // equal(recdates.length, expected.length); ...and here
Attachment #8763878 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/59984/#review57500 > We should convert this kind of comments to > > /** > * Sets a paramter for a given parameter > * > * @param AString aPropertyName > * @param AString aParameterName > * @param AUTF8String aParameterValue > */ > > But maybe this is something for a separate bug. Yes, probably better in a separate bug > Use /** here /** is used for jsdoc-style comments specific to the identifier following it, which is not the case here. We use this comment to separate code into a new section. Therefore I will stick with /* > The same here. This actually looks like it is something to be supported in the future, might as well keep it in. > ...and here This one actually looks like it should be uncommented. Tests run through with it, so that is what I am doing.
Attachment #8763879 - Flags: review?(makemyday) → review+
Comment on attachment 8763879 [details] Bug 1280898 - Set up eslint for calendar files - enable radix rule. https://reviewboard.mozilla.org/r/59986/#review57506 ::: calendar/base/content/calendar-statusbar.js:97 (Diff revision 1) > } > if (this.spinning != Components.interfaces.calIStatusObserver.NO_PROGRESS) { > 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); The outer brackets shouldn't be needed here.
Comment on attachment 8763871 [details] Bug 1280898 - Set up eslint for calendar files - enable key-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59970/diff/1-2/
Attachment #8763871 - Flags: review- → review?(makemyday)
Attachment #8763867 - Attachment is obsolete: true
Attachment #8763868 - Attachment is obsolete: true
Attachment #8763869 - Attachment is obsolete: true
Attachment #8763870 - Attachment is obsolete: true
Attachment #8763872 - Attachment is obsolete: true
Attachment #8763873 - Attachment is obsolete: true
Attachment #8763874 - Attachment is obsolete: true
Attachment #8763875 - Attachment is obsolete: true
Attachment #8763876 - Attachment is obsolete: true
Attachment #8763877 - Attachment is obsolete: true
Attachment #8763878 - Attachment is obsolete: true
Attachment #8763879 - Attachment is obsolete: true
Attachment #8763880 - Attachment is obsolete: true
Attachment #8763880 - Flags: review?(makemyday)
Attachment #8763881 - Attachment is obsolete: true
Attachment #8763881 - Flags: review?(makemyday)
Attachment #8763882 - Attachment is obsolete: true
Attachment #8763882 - Flags: review?(makemyday)
Attachment #8763883 - Attachment is obsolete: true
Attachment #8763883 - Flags: review?(makemyday)
Attachment #8763884 - Attachment is obsolete: true
Attachment #8763884 - Flags: review?(makemyday)
Attachment #8763885 - Attachment is obsolete: true
Attachment #8763885 - Flags: review?(makemyday)
Attachment #8763886 - Attachment is obsolete: true
Attachment #8763886 - Flags: review?(makemyday)
Attachment #8763887 - Attachment is obsolete: true
Attachment #8763887 - Flags: review?(makemyday)
Attachment #8763888 - Attachment is obsolete: true
Attachment #8763888 - Flags: review?(makemyday)
Attachment #8763889 - Attachment is obsolete: true
Attachment #8763889 - Flags: review?(makemyday)
Attachment #8763890 - Attachment is obsolete: true
Attachment #8763890 - Flags: review?(makemyday)
Attachment #8763891 - Attachment is obsolete: true
Attachment #8763891 - Flags: review?(makemyday)
Attachment #8763892 - Attachment is obsolete: true
Attachment #8763892 - Flags: review?(makemyday)
Attachment #8763893 - Attachment is obsolete: true
Attachment #8763893 - Flags: review?(makemyday)
Attachment #8763894 - Attachment is obsolete: true
Attachment #8763894 - Flags: review?(makemyday)
Attachment #8763895 - Attachment is obsolete: true
Attachment #8763895 - Flags: review?(makemyday)
Attachment #8763896 - Attachment is obsolete: true
Attachment #8763896 - Flags: review?(makemyday)
Attachment #8765235 - Flags: review?(makemyday)
Attachment #8765236 - Flags: review?(makemyday)
Attachment #8765237 - Flags: review?(makemyday)
Attachment #8765238 - Flags: review?(makemyday)
Attachment #8765239 - Flags: review?(makemyday)
Attachment #8765240 - Flags: review?(makemyday)
Attachment #8765241 - Flags: review?(makemyday)
Attachment #8765242 - Flags: review?(makemyday)
Attachment #8765243 - Flags: review?(makemyday)
Attachment #8765244 - Flags: review?(makemyday)
Attachment #8765245 - Flags: review?(makemyday)
Attachment #8765246 - Flags: review?(makemyday)
Attachment #8765247 - Flags: review?(makemyday)
Attachment #8765248 - Flags: review?(makemyday)
Attachment #8765249 - Flags: review?(makemyday)
Attachment #8765250 - Flags: review?(makemyday)
Attachment #8765251 - Flags: review?(makemyday)
Attachment #8765252 - Flags: review?(makemyday)
Attachment #8765253 - Flags: review?(makemyday)
Attachment #8765254 - Flags: review?(makemyday)
Attachment #8765255 - Flags: review?(makemyday)
Attachment #8765256 - Flags: review?(makemyday)
Attachment #8765257 - Flags: review?(makemyday)
Attachment #8765258 - Flags: review?(makemyday)
Attachment #8765259 - Flags: review?(makemyday)
Attachment #8765260 - Flags: review?(makemyday)
Attachment #8765261 - Flags: review?(makemyday)
Attachment #8765262 - Flags: review?(makemyday)
Attachment #8765263 - Flags: review?(makemyday)
Attachment #8765264 - Flags: review?(makemyday)
Attachment #8765265 - Flags: review?(makemyday)
Attachment #8765266 - Flags: review?(makemyday)
Comment on attachment 8763871 [details] Bug 1280898 - Set up eslint for calendar files - enable key-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59970/diff/2-3/
Attachment #8765235 - Flags: review?(makemyday) → review+
Attachment #8765264 - Attachment is obsolete: true
Attachment #8765264 - Flags: review?(makemyday)
Attachment #8765265 - Attachment is obsolete: true
Attachment #8765265 - Flags: review?(makemyday)
Attachment #8765266 - Attachment is obsolete: true
Attachment #8765266 - Flags: review?(makemyday)
Sorry for the extra comments and work, reviewboard is giving me a hard time. Unfortunately it didn't hold its promise that pushing new patches with the same reviewbord id would retain r+, and I can't set them to r+ manually in any way. I considered folding the patches you've already reviewed as discussed, but this will complicate things for me in case there is bitrot so I'd rather fold everything at the end. For your convenience, here are the reviews you have already r+'d: https://reviewboard.mozilla.org/r/60668/ - initial and automatic https://reviewboard.mozilla.org/r/60670/ - block-scoped-var https://reviewboard.mozilla.org/r/60672/ - comma-dangle, comma-spacing, comma-style https://reviewboard.mozilla.org/r/60674/ - curly https://reviewboard.mozilla.org/r/60676/ - new-parens, no-array-constructor https://reviewboard.mozilla.org/r/60678/ - no-catch-shadow https://reviewboard.mozilla.org/r/60680/ - no-cond-assign https://reviewboard.mozilla.org/r/60682/ - no-debugger https://reviewboard.mozilla.org/r/60684/ - yoda https://reviewboard.mozilla.org/r/60686/ - no-new-object https://reviewboard.mozilla.org/r/60688/ - spaced-comment This patch was r- and is now fixed: https://reviewboard.mozilla.org/r/59970/ - key-spacing And this is the main URL for the review: https://reviewboard.mozilla.org/r/59692
Attachment #8765235 - Flags: review+ → review?(makemyday)
Comment on attachment 8765238 [details] Bug 1280898 - Set up eslint for calendar files - enable curly rule. https://reviewboard.mozilla.org/r/60674/#review57520
Attachment #8765238 - Flags: review+
Comment on attachment 8765237 [details] Bug 1280898 - Set up eslint for calendar files - enable comma-dangle,comma-spacing,comma-style rules. https://reviewboard.mozilla.org/r/60672/#review57518
Attachment #8765237 - Flags: review+
Comment on attachment 8765236 [details] Bug 1280898 - Set up eslint for calendar files - enable block-scoped-var rule. https://reviewboard.mozilla.org/r/60670/#review57516
Attachment #8765236 - Flags: review+
Comment on attachment 8765235 [details] Bug 1280898 - Set up eslint for calendar files - initial rules and minimal automatic fixes. https://reviewboard.mozilla.org/r/60668/#review57514
Attachment #8765235 - Flags: review+
Comment on attachment 8765239 [details] Bug 1280898 - Set up eslint for calendar files - enable new-parens,no-array-constructor rule. https://reviewboard.mozilla.org/r/60676/#review57524
Attachment #8765239 - Flags: review+
Comment on attachment 8765240 [details] Bug 1280898 - Set up eslint for calendar files - enable no-catch-shadow rule. https://reviewboard.mozilla.org/r/60678/#review57526
Attachment #8765240 - Flags: review+
Comment on attachment 8765241 [details] Bug 1280898 - Set up eslint for calendar files - enable no-cond-assign rule. https://reviewboard.mozilla.org/r/60680/#review57528
Attachment #8765241 - Flags: review+
Comment on attachment 8765242 [details] Bug 1280898 - Set up eslint for calendar files - enable no-debugger rule. https://reviewboard.mozilla.org/r/60682/#review57530
Attachment #8765242 - Flags: review+
Comment on attachment 8765243 [details] Bug 1280898 - Set up eslint for calendar files - enable yoda rule. https://reviewboard.mozilla.org/r/60684/#review57532
Attachment #8765243 - Flags: review+
Comment on attachment 8765244 [details] Bug 1280898 - Set up eslint for calendar files - enable no-new-object rule. https://reviewboard.mozilla.org/r/60686/#review57534
Attachment #8765244 - Flags: review+
Comment on attachment 8765245 [details] Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. https://reviewboard.mozilla.org/r/60688/#review57536
Attachment #8765245 - Flags: review+
Comment on attachment 8765246 [details] Bug 1280898 - Set up eslint for calendar files - enable radix rule. https://reviewboard.mozilla.org/r/60690/#review57538
Attachment #8765246 - Flags: review+
Ah I finally found the r+ button and fixed up the review status. Here is the main URL again for convenience: https://reviewboard.mozilla.org/r/59692
Attachment #8765235 - Flags: review?(makemyday)
Attachment #8765236 - Flags: review?(makemyday)
Attachment #8765237 - Flags: review?(makemyday)
Attachment #8765238 - Flags: review?(makemyday)
Attachment #8765239 - Flags: review?(makemyday)
Attachment #8765240 - Flags: review?(makemyday)
Attachment #8765241 - Flags: review?(makemyday)
Attachment #8765242 - Flags: review?(makemyday)
Attachment #8765243 - Flags: review?(makemyday)
Attachment #8765244 - Flags: review?(makemyday)
Attachment #8765245 - Flags: review?(makemyday)
Attachment #8765246 - Flags: review?(makemyday)
Comment on attachment 8765247 [details] Bug 1280898 - Set up eslint for calendar files - enable space-unary-ops rule. https://reviewboard.mozilla.org/r/60692/#review57540 ::: calendar/base/content/widgets/minimonth.xml:256 (Diff revision 1) > let offset; > switch (direction) { > case "reset": > let middleyear = years[Math.floor(years.length / 2)].getAttribute("value"); > if (current <= (years.length / 2)) { > - offset = - years[1].getAttribute("value") + 1; > + offset = -(years[1].getAttribute("value")) + 1; Why are the additional brackets needed here? Can we make this offset = 1 - years[1].getAttribute("value"); instead? ::: calendar/base/src/calFilter.js:461 (Diff revision 1) > !(due == null)); > } > > // Call the filter properties onfilter callback if set. The return value of the > // callback function will override the result of this function. > - if (props.onfilter && (typeof(props.onfilter) == "function")) { > + if (props.onfilter && (typeof props.onfilter == "function")) { Are the brackets around typeof props.onfilter == "function" needed? There are some more occurences of such below.
Attachment #8765247 - Flags: review?(makemyday) → review+
Attachment #8763871 - Flags: review?(makemyday) → review+
Comment on attachment 8763871 [details] Bug 1280898 - Set up eslint for calendar files - enable key-spacing rule. https://reviewboard.mozilla.org/r/59970/#review57542 ::: calendar/import-export/calOutlookCSVImportExport.js:11 (Diff revision 3) > Components.utils.import("resource://calendar/modules/calUtils.jsm"); > Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); > Components.utils.import("resource://gre/modules/Preferences.jsm"); > > var localeEn = { > - headTitle : "Subject", > + headTitle: "Subject", Huh, hardcoded strings in this file. Can you file a bug to make calOutlookCSVImportExport.js support i18n? ::: calendar/providers/ics/calICSCalendar.js:483 (Diff revision 3) > modifyItem: function (aNewItem, aOldItem, aListener) { > if (this.readOnly) { > throw calIErrors.CAL_IS_READONLY; > } > - this.queue.push({action:'modify', oldItem: aOldItem, > - newItem: aNewItem, listener:aListener}); > + this.queue.push({ action: 'modify', oldItem: aOldItem, > + newItem: aNewItem, listener: aListener}); We have inconsistent use of leading/trailing whitespaces in an object definition. Is there a general rule to fix this? Above you used this.queue.push({ foo: bar }); and below (which I think is what we should use) this.queue.push({foo: bar}); Here this is wrong anyway: this.queue.push({ foo: bar});
Attachment #8765248 - Flags: review?(makemyday) → review+
Comment on attachment 8765248 [details] Bug 1280898 - Set up eslint for calendar files - enable semi-spacing rule. https://reviewboard.mozilla.org/r/60694/#review57544
Comment on attachment 8765249 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unneeded-ternary rule. https://reviewboard.mozilla.org/r/60696/#review57546
Attachment #8765249 - Flags: review?(makemyday) → review+
Comment on attachment 8765250 [details] Bug 1280898 - Set up eslint for calendar files - enable no-multi-spaces rule. https://reviewboard.mozilla.org/r/60698/#review57548 In some edge cases this rule is imho not an improvement, but overall I'm fine with it. ::: calendar/base/content/agenda-listbox.js:844 (Diff revision 1) > function isEventListItem(aListItem) { > var isEventListItem = (aListItem != null); > if (isEventListItem) { > var localName = aListItem.localName; > - isEventListItem = ((localName == "agenda-richlist-item") || > - (localName == "agenda-allday-richlist-item")); > + isEventListItem = ((localName == "agenda-richlist-item") || > + (localName == "agenda-allday-richlist-item")); The inner brackets are not needed. ::: calendar/base/content/calendar-management.js:264 (Diff revision 1) > * "labeldelete" and "labelunsubscribe". > * > * @param aDeleteId The id of the menuitem to delete the calendar > */ > function setupDeleteMenuitem(aDeleteId, aCalendar) { > - let calendar = (aCalendar === undefined ? getSelectedCalendar() : aCalendar); > + let calendar = (aCalendar === undefined ? getSelectedCalendar() : aCalendar); The brackets are not needed here. ::: calendar/import-export/calOutlookCSVImportExport.js:171 (Diff revision 1) > - case locale.headAlarmDate: args.alarmDateIndex = i; knownIndxs++; break; > - case locale.headAlarmTime: args.alarmTimeIndex = i; knownIndxs++; break; > - case locale.headCategories: args.categoriesIndex = i; knownIndxs++; break; > - case locale.headDescription: args.descriptionIndex = i; knownIndxs++; break; > - case locale.headLocation: args.locationIndex = i; knownIndxs++; break; > - case locale.headPrivate: args.privateIndex = i; knownIndxs++; break; > + case locale.headAlarmDate: args.alarmDateIndex = i; knownIndxs++; break; > + case locale.headAlarmTime: args.alarmTimeIndex = i; knownIndxs++; break; > + case locale.headCategories: args.categoriesIndex = i; knownIndxs++; break; > + case locale.headDescription: args.descriptionIndex = i; knownIndxs++; break; > + case locale.headLocation: args.locationIndex = i; knownIndxs++; break; > + case locale.headPrivate: args.privateIndex = i; knownIndxs++; break; Can we here change this to separate lines for the operation for each case, please? ::: calendar/providers/wcap/calWcapCalendarItems.js:490 (Diff revision 1) > - case "TENTATIVE": params += "&status=2"; break; > + case "TENTATIVE": params += "&status=2"; break; > case "NEEDS-ACTION": params += "&status=3"; break; > - case "COMPLETED": params += "&status=4"; break; > - case "IN-PROCESS": params += "&status=5"; break; > - case "DRAFT": params += "&status=6"; break; > - case "FINAL": params += "&status=7"; break; > + case "COMPLETED": params += "&status=4"; break; > + case "IN-PROCESS": params += "&status=5"; break; > + case "DRAFT": params += "&status=6"; break; > + case "FINAL": params += "&status=7"; break; Here again, please change this to separate lines. ::: calendar/resources/content/datetimepickers/datetimepickers.xml:1803 (Diff revision 1) > for (var i = 1; i <= 3; i++) { > switch (Number(probeArray[i])) { > - case 2: this.twoDigitYear = true; // fall thru > - case 2002: this.yearIndex = i; break; > - case 3: this.monthIndex = i; break; > - case 4: this.dayIndex = i; break; > + case 2: this.twoDigitYear = true; // fall thru > + case 2002: this.yearIndex = i; break; > + case 3: this.monthIndex = i; break; > + case 4: this.dayIndex = i; break; The same here... ::: calendar/resources/content/datetimepickers/datetimepickers.xml:1825 (Diff revision 1) > for (var j = 1; j <= 3; j++) { > switch (Number(probeArray[j])) { > - case 2: this.twoDigitYear = true; // fall thru > - case 2002: this.yearIndex = j; break; > - case 4: this.dayIndex = j; break; > - default: this.monthIndex = j; break; > + case 2: this.twoDigitYear = true; // fall thru > + case 2002: this.yearIndex = j; break; > + case 4: this.dayIndex = j; break; > + default: this.monthIndex = j; break; ...and here. ::: calendar/test/mozmill/shared-modules/calendar-utils.js:9 (Diff revision 1) > > var MODULE_NAME = "calendar-utils"; > var MODULE_REQUIRES = ["window-helpers"]; > > -var os = {}; Components.utils.import('resource://mozmill/stdlib/os.js', os); > -var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame); > +var os = {}; Components.utils.import('resource://mozmill/stdlib/os.js', os); > +var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame); This should also be in separate lines.
Attachment #8765250 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/59970/#review57542 > Huh, hardcoded strings in this file. Can you file a bug to make calOutlookCSVImportExport.js support i18n? Greetings from the past :) bug 301750 > We have inconsistent use of leading/trailing whitespaces in an object definition. Is there a general rule to fix this? > > Above you used > > this.queue.push({ foo: bar }); > > and below (which I think is what we should use) > > this.queue.push({foo: bar}); > > Here this is wrong anyway: > > this.queue.push({ foo: bar}); Yes, this is object-curly-spacing. I'll take care of this in the patch for that rule.
https://reviewboard.mozilla.org/r/60692/#review57540 > Why are the additional brackets needed here? Can we make this > > offset = 1 - years[1].getAttribute("value"); > > instead? I wanted to keep the same format as before but make it more clear, but I am happy to change it as suggested.
https://reviewboard.mozilla.org/r/60698/#review57548 > The brackets are not needed here. In cases where the result if the ternary if is being assigned to a variable, I like to keep it because I believe it enhances readability. > Can we here change this to separate lines for the operation for each case, please? I think this unnecessarily explodes the content, when using separate lines the switch statement takes up my whole screen height. > This should also be in separate lines. I did this one though.
Depends on: 1282392
Attachment #8765252 - Flags: review?(makemyday) → review+
Comment on attachment 8765252 [details] Bug 1280898 - Set up eslint for calendar files - enable keyword-spacing rule. https://reviewboard.mozilla.org/r/60702/#review58230 ::: calendar/base/content/calendar-month-view.xml:95 (Diff revision 1) > var startTime = val.startDate.getInTimezone(timezone); > var endTime = val.endDate.getInTimezone(timezone); > var nextDay = parentDate.clone(); > nextDay.day++; > var comp = endTime.compare(nextDay); > - if(startTime.compare( parentDate) == -1 ) { > + if (startTime.compare( parentDate) == -1 ) { This should be compare(parentDate) ::: calendar/base/modules/calItipUtils.jsm:1057 (Diff revision 1) > // split up transport, if attendee undisclosure is requested > // and this is a message send by the organizer > - if((aItem.getProperty("X-MOZ-SEND-INVITATIONS-UNDISCLOSED") == "TRUE") && > + if ((aItem.getProperty("X-MOZ-SEND-INVITATIONS-UNDISCLOSED") == "TRUE") && > aMethod != "REPLY" && > aMethod != "REFRESH" && > aMethod != "COUNTER") { Can you add a whitespace indetation for the three aMethod lines and remove the brackets around the first comparison? ::: calendar/resources/content/mouseoverPreviews.js:55 (Diff revision 1) > * Called when a user hovers over a todo element and the text for the mouse over is changed. > */ > > function getPreviewForTask( toDoItem ) > { > - if( toDoItem ) > + if ( toDoItem ) Save one line here and remove the whitespaces within the brackets: if (toDoItem) { ::: calendar/resources/content/mouseoverPreviews.js:217 (Diff revision 1) > > > /** String for event status: (none), Tentative, Confirmed, or Cancelled **/ > function getEventStatusString(calendarEvent) > { > - switch( calendarEvent.status ) > + switch ( calendarEvent.status ) again... ::: calendar/resources/content/mouseoverPreviews.js:234 (Diff revision 1) > } > > /** String for todo status: (none), NeedsAction, InProcess, Cancelled, or Completed **/ > function getToDoStatusString(iCalToDo) > { > - switch( iCalToDo.status ) > + switch ( iCalToDo.status ) ...and again. ::: calendar/resources/content/publishDialog.js:49 (Diff revision 1) > > // call caller's on OK function > gOnOkFunction(gPublishObject, progressDialog); > document.getElementById( "calendar-publishwindow" ).getButton( "accept" ).setAttribute( "label", closeButtonLabel ); > document.getElementById( "calendar-publishwindow" ).setAttribute( "ondialogaccept", "closeDialog()" ); > - return( false ); > + return ( false ); return false; ::: calendar/test/mozmill/eventDialog/testEventDialog.js:172 (Diff revision 1) > checkTooltip(monthView, "0", "6", "3", startTime, endTime); > > // 31st of January is Saturday so there's four more full rows to check > let date = 4; > - for(row = 1; row < 5; row++){ > - for(col = 0; col < 7; col++){ > + for (row = 1; row < 5; row++){ > + for (col = 0; col < 7; col++){ Add a space between the closing bracket and the opening curly bracket: ++) { This is an issue for multiple changes belwo in this patch. Is there a separate rule for it? I haven't commented on further occurences, but all should be fixed.
Comment on attachment 8765253 [details] Bug 1280898 - Set up eslint for calendar files - enable no-spaced-func rule. https://reviewboard.mozilla.org/r/60704/#review58242 ::: calendar/base/src/calApplicationUtils.js:29 (Diff revision 1) > // XXX: We likely will want to do this using nsIURLs in the future to > // prevent sneaky nasty escaping issues, but this is fine for now. > if (!url.startsWith("http")) { > - Components.utils.reportError ("launchBrowser: " + > + Components.utils.reportError("launchBrowser: " + > "Invalid URL provided: " + url + > " Only http:// and https:// URLs are valid."); Fix indentation here. ::: calendar/providers/composite/calCompositeCalendar.js:389 (Diff revision 1) > if (enabledCalendars.length == 0) { > - aListener.onOperationComplete (this, > + aListener.onOperationComplete(this, > Components.results.NS_OK, > calIOperationListener.GET, > null, > null); indentation, again. ::: calendar/providers/composite/calCompositeCalendar.js:515 (Diff revision 1) > this.opGroup.notifyCompleted(); > - this.mRealListener.onOperationComplete (this, > + this.mRealListener.onOperationComplete(this, > aStatus, > calIOperationListener.GET, > null, > null); indentation again. ::: calendar/providers/memory/calMemoryCalendar.js:341 (Diff revision 1) > } > > - aListener.onGetResult (this.superCalendar, > + aListener.onGetResult(this.superCalendar, > Components.results.NS_OK, > iid, > null, 1, [item]); indentation. ::: calendar/providers/storage/calStorageCalendar.js:651 (Diff revision 1) > } > > - aListener.onGetResult (this.superCalendar, > + aListener.onGetResult(this.superCalendar, > Components.results.NS_OK, > item_iid, null, > 1, [item]); indentation, again.
Attachment #8765253 - Flags: review?(makemyday) → review+
Attachment #8765254 - Flags: review?(makemyday) → review+
Comment on attachment 8765254 [details] Bug 1280898 - Set up eslint for calendar files - enable no-shadow-restricted-names rule. https://reviewboard.mozilla.org/r/60706/#review58248 ::: calendar/base/content/calendar-ui-utils.js:23 (Diff revision 1) > */ > function setElementValue(aElement, aNewValue, aPropertyName) { > cal.ASSERT(aElement, "aElement"); > - var undefined; > > if (aNewValue !== undefined) { Wouldn't if (aNewValue) { be sufficient here?
https://reviewboard.mozilla.org/r/60702/#review58230 > This should be compare(parentDate) Will be fixed by space-in-parens rule > Save one line here and remove the whitespaces within the brackets: > > if (toDoItem) { Will be fixed by space-in-parens rule > return false; I've fixed this locally in the space-in-parens patch. > Add a space between the closing bracket and the opening curly bracket: > > ++) { > > This is an issue for multiple changes belwo in this patch. Is there a separate rule for it? I haven't commented on further occurences, but all should be fixed. Will fix this in a new patch enabling the space-before-blocks rule.
Comment on attachment 8765255 [details] Bug 1280898 - Set up eslint for calendar files - enable no-sequences rule. https://reviewboard.mozilla.org/r/60708/#review58250
Attachment #8765255 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/60706/#review58248 > Wouldn't > > if (aNewValue) { > > be sufficient here? No, there should be a difference between null and false afaik. I'd rather not change this too much as it could be cause for regression.
Comment on attachment 8765256 [details] Bug 1280898 - Set up eslint for calendar files - enable no-return-assign rule. https://reviewboard.mozilla.org/r/60710/#review58254
Attachment #8765256 - Flags: review?(makemyday) → review+
Comment on attachment 8765251 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable space-infix-ops rule. https://reviewboard.mozilla.org/r/60700/#review58670 r+, although I would prefer to not convert things to template literals. ::: calendar/base/content/calendar-multiday-view.xml:31 (Diff revision 1) > </xul:stack> > </content> > > <implementation> > <field name="mPixPerMin">0.6</field> > - <field name="mStartMin">0*60</field> > + <field name="mStartMin">0 * 60</field> Make this just 0. ::: calendar/base/content/calendar-multiday-view.xml:259 (Diff revision 1) > this.mSelectedItemIds = {}; > ]]></constructor> > > <!-- fields --> > <field name="mPixPerMin">0.6</field> > - <field name="mStartMin">0*60</field> > + <field name="mStartMin">0 * 60</field> The same here ::: calendar/base/content/calendar-multiday-view.xml:2751 (Diff revision 1) > <field name="mDateColumns">null</field> > <field name="mPixPerMin">0.6</field> > <field name="mMinPixelsPerMinute">0.1</field> > <field name="mSelectedDayCol">null</field> > <field name="mSelectedDay">null</field> > - <field name="mStartMin">0*60</field> > + <field name="mStartMin">0 * 60</field> 0 again.
Attachment #8765251 - Flags: review?(makemyday) → review+
Comment on attachment 8765257 [details] Bug 1280898 - Set up eslint for calendar files - enable padded-blocks rule. https://reviewboard.mozilla.org/r/60712/#review58672 Can we also have a rule to make any indentation being consistently 4 whitespaces? And one to remove function name in cases like let foo = function name() { and foo: function name() { so it gets to let foo = function () { and foo: function () { ::: calendar/base/content/calendar-multiday-view.xml:1996 (Diff revision 1) > } > if (this.mDayStartMin != aDayStartMin || > - this.mDayEndMin != aDayEndMin) { > + this.mDayEndMin != aDayEndMin) { > - > this.mDayStartMin = aDayStartMin; > this.mDayEndMin = aDayEndMin; Please adjust indentation here. ::: calendar/base/content/calendar-multiday-view.xml:2190 (Diff revision 1) > <method name="selectOccurrence"> > <parameter name="aItem"/> > <body><![CDATA[ > for (let itemBox of this.mItemBoxes) { > if (aItem && (itemBox.occurrence.hashId == aItem.hashId)) { > itemBox.selected = true; Same here. ::: calendar/base/content/calendar-multiday-view.xml:3794 (Diff revision 1) > } > if (this.mDayStartMin != aDayStartMin || > - this.mDayEndMin != aDayEndMin) { > + this.mDayEndMin != aDayEndMin) { > - > this.mDayStartMin = aDayStartMin; > this.mDayEndMin = aDayEndMin; here, too. ::: calendar/base/modules/calExtract.jsm:712 (Diff revision 1) > this.collected[outer].start && this.collected[outer].end && > this.collected[inner].start && this.collected[inner].end && > this.collected[inner].start >= this.collected[outer].start && > this.collected[inner].end <= this.collected[outer].end && > !(this.collected[inner].start == this.collected[outer].start && > this.collected[inner].end == this.collected[outer].end)) { Too much indentation here.
Attachment #8765257 - Flags: review?(makemyday) → review+
Attachment #8765258 - Flags: review?(makemyday) → review+
Comment on attachment 8765258 [details] Bug 1280898 - Set up eslint for calendar files - enable brace-style rule. https://reviewboard.mozilla.org/r/60714/#review58680
Comment on attachment 8765259 [details] Bug 1280898 - Set up eslint for calendar files - enable space-in-parens rule. https://reviewboard.mozilla.org/r/60716/#review58682 ::: calendar/base/content/agenda-listbox.js:391 (Diff revision 1) > return (!compItemDate.isDate || aCompItem.duration.days != 1); > } else if (aItem.endDate.compare(itemDateEndDate) == 0) { > // ending day of an all-day events spannig multiple days > return (!compItemDate.isDate || > (aCompItem.duration.days != 1 && > - aCompItem.startDate.compare(compItemDate) != 0 )); > + aCompItem.startDate.compare(compItemDate) != 0)); too much indentation here. ::: calendar/base/content/agenda-listbox.js:444 (Diff revision 1) > endDateToReturn.minute = 59; > endDateToReturn.second = 59; > } > endDate.isDate = true; > if (startDate.compare(endDate) != 0 && > - startDate.compare(periodStartDate) < 0 ) { > + startDate.compare(periodStartDate) < 0) { same here. ::: calendar/providers/caldav/calDavCalendar.js:2418 (Diff revision 1) > var aCalIdParts = aCalId.split(":"); > aCalIdParts[0] = aCalIdParts[0].toLowerCase(); > > if (aCalIdParts[0] != "mailto" > && aCalIdParts[0] != "http" > - && aCalIdParts[0] != "https" ) { > + && aCalIdParts[0] != "https") { Can we please move the && at the end of the previous lines? ::: calendar/resources/content/mouseoverPreviews.js:132 (Diff revision 1) > boxAppendBodySeparator(vbox); > } > boxAppendBody(vbox, description); > } > > - return ( vbox ); > + return (vbox); I guess the brackets can be removed here. ::: calendar/resources/content/mouseoverPreviews.js:192 (Diff revision 1) > if (description) { > boxAppendBodySeparator(vbox); > // display wrapped description lines, like body of message below headers > boxAppendBody(vbox, description); > } > - return ( vbox ); > + return (vbox); same here.
Attachment #8765259 - Flags: review?(makemyday) → review+
Comment on attachment 8765260 [details] Bug 1280898 - Set up eslint for calendar files - enable space-before-function-paren rule. https://reviewboard.mozilla.org/r/60718/#review58690 ::: calendar/base/src/calRecurrenceInfo.js:567 (Diff revision 1) > } else if (occurrenceMap[dateToRemoveKey]) { > // TODO PERF Theoretically we could use occurrence map > // to construct the array of occurrences. Right now I'm > // just using the occurrence map to skip the filter > // action if the occurrence isn't there anyway. > - dates = dates.filter(function (d) { return d.id.compare(dateToRemove) != 0; }); > + dates = dates.filter(function(d) { return d.id.compare(dateToRemove) != 0; }); use the same arrow function notation here as above
Attachment #8765260 - Flags: review?(makemyday) → review+
Attachment #8765261 - Flags: review?(makemyday) → review+
Comment on attachment 8765261 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unreachable rule. https://reviewboard.mozilla.org/r/60720/#review58694
Comment on attachment 8765262 [details] Bug 1280898 - Set up eslint for calendar files - enable semi rule. https://reviewboard.mozilla.org/r/60722/#review58704 ::: calendar/base/content/agenda-listbox.js:541 (Diff revision 1) > * @return True, if the items match with the above noted criteria. > */ > agendaListbox.isSameEvent = > function isSameEvent(aItem, aCompItem) { > return ((aItem.id == aCompItem.id) && > (aItem[calGetStartDateProp(aItem)].compare(aCompItem[calGetStartDateProp(aCompItem)]) == 0)); You can remove all of the surrounding brackets here. ::: calendar/base/content/agenda-listbox.js:554 (Diff revision 1) > */ > agendaListbox.isEventSelected = > function isEventSelected() { > var listItem = this.agendaListboxControl.selectedItem; > if (listItem) { > return (this.isEventListItem(listItem)); The same here. ::: calendar/base/content/agenda-listbox.js:844 (Diff revision 1) > function isEventListItem(aListItem) { > var isEventListItem = (aListItem != null); > if (isEventListItem) { > var localName = aListItem.localName; > isEventListItem = ((localName == "agenda-richlist-item") || > (localName == "agenda-allday-richlist-item")); again, not needed brackets. ::: calendar/base/content/calendar-extract.js:39 (Diff revision 1) > > // sort > let pref = "calendar.patterns.last.used.languages"; > let lastUsedLangs = Preferences.get(pref, ""); > > function createLanguageComptor(lastUsedLangs) { This must trigger a strict warning. Can you change this to let createLanguageComptor = function(lastUsedLangs) { Of cause with a trailing semicolon for the closing curly bracket then. ::: calendar/base/content/calendar-multiday-view.xml:1146 (Diff revision 1) > layerIndex = layerArray[index]; > if (!layerIndex) { > layerIndex = layerCounter++; > layerArray[index] = layerIndex; > } > - var offset = ((glob.totalCols - data.colSpan) % glob.totalCols) > + var offset = ((glob.totalCols - data.colSpan) % glob.totalCols); The outer brackets are obsolete here; ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:398 (Diff revision 1) > } > > attendee.role = this.getRoleElement(i).getAttribute("role"); > // attendee.participationStatus = this.getStatusElement(i).getAttribute("status"); > let userType = this.getUserTypeElement(i).getAttribute("cutype"); > - attendee.userType = (userType == "INDIVIDUAL" ? null : userType) // INDIVIDUAL is the default > + attendee.userType = (userType == "INDIVIDUAL" ? null : userType); // INDIVIDUAL is the default The brackets are obsolete here. ::: calendar/base/content/dialogs/calendar-properties-dialog.js:33 (Diff revision 1) > initRefreshInterval(); > > // Set up the cache field > let cacheBox = document.getElementById("cache"); > let canCache = (gCalendar.getProperty("cache.supported") !== false); > - let alwaysCache = (gCalendar.getProperty("cache.always")) > + let alwaysCache = (gCalendar.getProperty("cache.always")); Obsolete brackets in canCache and alwaysCache. ::: calendar/base/content/dialogs/calendar-properties-dialog.js:94 (Diff revision 1) > let value = getElementValue("calendar-refreshInterval-menulist"); > gCalendar.setProperty("refreshInterval", value); > } > > // Save cache options > - let alwaysCache = (gCalendar.getProperty("cache.always")) > + let alwaysCache = (gCalendar.getProperty("cache.always")); Brackets, again. ::: calendar/base/content/widgets/calendar-widgets.xml:387 (Diff revision 1) > <parameter name="aPushModeCollapsedAttribute"/> > <parameter name="aNotifyRefControl"/> > <body><![CDATA[ > - var notifyRefControl = ((aNotifyRefControl == null) || (aNotifyRefControl === true)) > + var notifyRefControl = ((aNotifyRefControl == null) || (aNotifyRefControl === true)); > var pushModeCollapsedAttribute = ((aPushModeCollapsedAttribute == null) > || (aPushModeCollapsedAttribute === true)); Brackets again: notifyRefControl and pushModeCollapsedAttribute ::: calendar/test/unit/test_alarm.js:508 (Diff revision 1) > function addTrigger() { addProp("TRIGGER", "-PT15M"); } > function addDescr() { addProp("DESCRIPTION", "TEST"); } > function addDuration() { addProp("DURATION", "-PT15M"); } > function addRepeat() { addProp("REPEAT", "1"); } > function addAttendee() { addProp("ATTENDEE", "mailto:horst"); } > function addAttachment() { addProp("ATTACH", "data:yeah"); } These function definitions should also be converted to anonymus functions assigned to variables to avoid strict warnings.
Attachment #8765262 - Flags: review?(makemyday) → review+
Comment on attachment 8765263 [details] Bug 1280898 - Set up eslint for calendar files - enable no-empty rule. https://reviewboard.mozilla.org/r/60724/#review58708 ::: calendar/base/src/calUtils.js:918 (Diff revision 1) > - var shouldLog = false; > + let shouldLog = Preferences.get("calendar.debug.log", false); > - try { > - shouldLog = Services.prefs.getBoolPref("calendar.debug.log"); > - } catch (ex) {} > - > if (!shouldLog) { You can make this just if (!Preferences.get("calendar.debug.log", false)) { return; } ::: calendar/test/unit/test_alarm.js:175 (Diff revision 1) > > try { > alarm.addAttachment(sound2); > do_throw("Adding a second attachment should fail for type AUDIO"); > - } catch (e) {} > + } catch (e) { > + // TODO looks like this test is disabled. Why? What do you mean with this and the above comment? If this is catched, these tests passed.
Attachment #8765263 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/60700/#review58670 I can accept that. I like them and I think they make strings more readable, but I am fine doing it separately. I've reverted the template string changes and used spaces.
https://reviewboard.mozilla.org/r/60712/#review58672 I am taking care of indent in another patch. I couldn't use eslint --fix due to https://github.com/eslint/eslint/issues/3845, but jscs --fix with the right rule seems to help me. Regarding the anonymous functions there is http://eslint.org/docs/rules/func-names but that only takes us half way. I'd rather do that when both options are supported.
https://reviewboard.mozilla.org/r/60716/#review58682 I will change the indent in a future changeset as mentioned. > Can we please move the && at the end of the previous lines? Will be fixed by http://eslint.org/docs/rules/operator-linebreak > I guess the brackets can be removed here. I'm reconsidering using http://eslint.org/docs/rules/no-extra-parens although there are some cases I am not happy with, I'll take care of that there.
https://reviewboard.mozilla.org/r/60722/#review58704 > You can remove all of the surrounding brackets here. As mentiond, will do in a separate rule. > This must trigger a strict warning. Can you change this to > > let createLanguageComptor = function(lastUsedLangs) { > > Of cause with a trailing semicolon for the closing curly bracket then. Will be fixed with the no-shadow and no-redeclare patch. > These function definitions should also be converted to anonymus functions assigned to variables to avoid strict warnings. I'd also rather do this separately, as it has nothing to do with the semi rule.
https://reviewboard.mozilla.org/r/60724/#review58708 > What do you mean with this and the above comment? If this is catched, these tests passed. do_throw() actually thows an exception, so the catch block will also catch that one and ignore it.
Attachment #8769117 - Flags: review?(makemyday)
Attachment #8769118 - Flags: review?(makemyday)
Attachment #8769119 - Flags: review?(makemyday)
Attachment #8769120 - Flags: review?(makemyday)
Attachment #8769121 - Flags: review?(makemyday)
Attachment #8769122 - Flags: review?(makemyday)
Attachment #8769123 - Flags: review?(makemyday)
Attachment #8769124 - Flags: review?(makemyday)
Attachment #8769125 - Flags: review?(makemyday)
Attachment #8769126 - Flags: review?(makemyday)
Attachment #8769127 - Flags: review?(makemyday)
Attachment #8769128 - Flags: review?(makemyday)
Attachment #8769129 - Flags: review?(makemyday)
Attachment #8769130 - Flags: review?(makemyday)
Attachment #8769131 - Flags: review?(makemyday)
Attachment #8769132 - Flags: review?(makemyday)
Attachment #8769133 - Flags: review?(makemyday)
Attachment #8769134 - Flags: review?(makemyday)
Attachment #8769135 - Flags: review?(makemyday)
Attachment #8769136 - Flags: review?(makemyday)
Attachment #8769137 - Flags: review?(makemyday)
Attachment #8769138 - Flags: review?(makemyday)
Attachment #8769139 - Flags: review?(makemyday)
Attachment #8769140 - Flags: review?(makemyday)
Attachment #8769141 - Flags: review?(makemyday)
Attachment #8769142 - Flags: review?(makemyday)
Attachment #8769143 - Flags: review?(makemyday)
Attachment #8769144 - Flags: review?(makemyday)
Attachment #8769145 - Flags: review?(makemyday)
Attachment #8769146 - Flags: review?(makemyday)
Attachment #8769147 - Flags: review?(makemyday)
Attachment #8769148 - Flags: review?(makemyday)
Attachment #8765235 - Flags: review+ → review?(makemyday)
Attachment #8765236 - Flags: review+ → review?(makemyday)
Attachment #8765237 - Flags: review+ → review?(makemyday)
Attachment #8765238 - Flags: review+ → review?(makemyday)
Attachment #8765239 - Flags: review+ → review?(makemyday)
Attachment #8765240 - Flags: review+ → review?(makemyday)
Attachment #8765241 - Flags: review+ → review?(makemyday)
Attachment #8765242 - Flags: review+ → review?(makemyday)
Attachment #8765243 - Flags: review+ → review?(makemyday)
Attachment #8765244 - Flags: review+ → review?(makemyday)
Attachment #8765245 - Flags: review+ → review?(makemyday)
Attachment #8765246 - Flags: review+ → review?(makemyday)
Comment on attachment 8765235 [details] Bug 1280898 - Set up eslint for calendar files - initial rules and minimal automatic fixes. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60668/diff/1-2/
Comment on attachment 8765236 [details] Bug 1280898 - Set up eslint for calendar files - enable block-scoped-var rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60670/diff/1-2/
Comment on attachment 8765237 [details] Bug 1280898 - Set up eslint for calendar files - enable comma-dangle,comma-spacing,comma-style rules. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60672/diff/1-2/
Comment on attachment 8765238 [details] Bug 1280898 - Set up eslint for calendar files - enable curly rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60674/diff/1-2/
Comment on attachment 8763871 [details] Bug 1280898 - Set up eslint for calendar files - enable key-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59970/diff/3-4/
Comment on attachment 8765239 [details] Bug 1280898 - Set up eslint for calendar files - enable new-parens,no-array-constructor rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60676/diff/1-2/
Comment on attachment 8765240 [details] Bug 1280898 - Set up eslint for calendar files - enable no-catch-shadow rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60678/diff/1-2/
Comment on attachment 8765241 [details] Bug 1280898 - Set up eslint for calendar files - enable no-cond-assign rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60680/diff/1-2/
Comment on attachment 8765242 [details] Bug 1280898 - Set up eslint for calendar files - enable no-debugger rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60682/diff/1-2/
Comment on attachment 8765243 [details] Bug 1280898 - Set up eslint for calendar files - enable yoda rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60684/diff/1-2/
Comment on attachment 8765244 [details] Bug 1280898 - Set up eslint for calendar files - enable no-new-object rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60686/diff/1-2/
Comment on attachment 8765245 [details] Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60688/diff/1-2/
Comment on attachment 8765246 [details] Bug 1280898 - Set up eslint for calendar files - enable radix rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60690/diff/1-2/
Comment on attachment 8765247 [details] Bug 1280898 - Set up eslint for calendar files - enable space-unary-ops rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60692/diff/1-2/
Comment on attachment 8765248 [details] Bug 1280898 - Set up eslint for calendar files - enable semi-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60694/diff/1-2/
Comment on attachment 8765249 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unneeded-ternary rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60696/diff/1-2/
Comment on attachment 8765250 [details] Bug 1280898 - Set up eslint for calendar files - enable no-multi-spaces rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60698/diff/1-2/
Comment on attachment 8765251 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable space-infix-ops rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60700/diff/1-2/
Comment on attachment 8765252 [details] Bug 1280898 - Set up eslint for calendar files - enable keyword-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60702/diff/1-2/
Comment on attachment 8765253 [details] Bug 1280898 - Set up eslint for calendar files - enable no-spaced-func rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60704/diff/1-2/
Comment on attachment 8765254 [details] Bug 1280898 - Set up eslint for calendar files - enable no-shadow-restricted-names rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60706/diff/1-2/
Comment on attachment 8765255 [details] Bug 1280898 - Set up eslint for calendar files - enable no-sequences rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60708/diff/1-2/
Comment on attachment 8765256 [details] Bug 1280898 - Set up eslint for calendar files - enable no-return-assign rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60710/diff/1-2/
Comment on attachment 8765257 [details] Bug 1280898 - Set up eslint for calendar files - enable padded-blocks rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60712/diff/1-2/
Comment on attachment 8765258 [details] Bug 1280898 - Set up eslint for calendar files - enable brace-style rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60714/diff/1-2/
Comment on attachment 8765259 [details] Bug 1280898 - Set up eslint for calendar files - enable space-in-parens rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60716/diff/1-2/
Comment on attachment 8765260 [details] Bug 1280898 - Set up eslint for calendar files - enable space-before-function-paren rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60718/diff/1-2/
Comment on attachment 8765261 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unreachable rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60720/diff/1-2/
Comment on attachment 8765262 [details] Bug 1280898 - Set up eslint for calendar files - enable semi rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60722/diff/1-2/
Comment on attachment 8765263 [details] Bug 1280898 - Set up eslint for calendar files - enable no-empty rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60724/diff/1-2/
Comment on attachment 8765267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-shadow and no-redeclare rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60732/diff/1-2/
Comment on attachment 8765268 [details] Bug 1280898 - Set up eslint for calendar files - enable var-only-toplevel rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60734/diff/1-2/
Comment on attachment 8765269 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unused-vars rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60736/diff/1-2/
Almost all done that I wanted to do, here is my todo list. I am considering adding the rules we will not be using in .eslintrc but set to 0, this way it will be easy to run a script that compares which eslint rules have been added or removed when upgrading eslint. Another issue I'd like to bring up is what we discussed earlier regarding squashing. I totally agree that squashing would make blame easier and there is definitely overlap between these patches, but on the other hand, finding regressions caused by these patches will become much harder if everything is squashed. Therefore, I would like do push them separately. What do you think? I've already set the author to "eslint <eslint@bugzilla.kewis.ch>" for most patches (the latest ones I forgot, but they are updated locally), so ideally in blame you will just see "eslint" as the author and can easily skip through those changesets in hgweb. coming up for this bug ====================== // Enforce a maximum number of statements allowed per line "max-statements-per-line": [2, { "max": 2 }], // Disallow arrow functions where they could be confused with comparisons "no-confusing-arrow": 2, // Disallow Unnecessary Nested Blocks "no-lone-blocks": 2, // Disallow use of this/super before calling super() in constructors "no-this-before-super": 2, // Enforce consistent indentation (4-space) // TODO do this very last, also requires fixing xbl preprocessor "indent": [2, 4], not for this bug ================ // Disallow Functions in Loops // TODO lots of regression-risky changes "no-loop-func": 2, // Disallow use of |undefined| variable // TODO lots of regression-risky changes "no-undefined": 2, // Suggest using template literals instead of string concatenation // TODO 1300+ occurrences // https://github.com/eslint/eslint/issues/6620 "prefer-template": 2, // Maximum length of a line. // TODO too many such lines to handle, maybe also consider 100 as max. "max-len": [2, 90, 2, {"ignoreUrls": true, "ignorePattern": "data:image\/|\\s*require\\s*\\(|^\\s*loader\\.lazy|-\\*-"}], // Limit Cyclomatic Complexity // TODO not that bad, only 15 cases. But could require some refactoring "complexity": [2, 35], // Disallow use of undeclared variables unless mentioned in a /*global */ // block. // TODO requires many changes and keeping track of globals "no-undef": 2, // Require Camelcase // TODO many changes required, also false positives "camelcase": 2, consider these rules, not sure yet ================================== // Enforce minimum identifier length "id-length": [2, 4], // Enforce a maximum depth that blocks can be nested "max-depth": [2, 4], // Disallow lexical declarations in case/default clauses "no-case-declarations": 2, // Require empty lines around comments "lines-around-comment": 2, rules we won't use ================== arrow-body-style "arrow-parens": [2, "as-needed"], callback-return default-case eqeqeq func-style global-require guard-for-in handle-callback-err id-blacklist id-match // use camelcase instead init-declarations jsx-quotes max-lines max-nested-callbacks max-params max-statements newline-per-chained-call no-alert no-bitwise no-console no-continue no-empty-function no-eval no-func-assign no-implicit-coercion no-implicit-globals no-inline-comments no-magic-numbers no-mixed-requires no-new-func no-new-require no-path-concat no-plusplus no-process-env no-process-exit no-proto no-prototype-builtins no-restricted-globals no-restricted-imports no-restricted-modules no-restricted-syntax no-sync no-ternary no-throw-literal no-underscore-dangle no-warning-comments one-var-declaration-per-line one-var operator-assignment prefer-const prefer-reflect require-yield sort-imports sort-vars strict vars-on-top wrap-regex no-eq-null no-script-url "no-extra-label": 2, // XXX taken care of by no-labels "no-label-var": 2, // XXX taken care of by no-labels "newline-before-return": 2, "newline-after-var": [2, "always"], "new-cap": [2, { "capIsNewExceptions": ["ID", "QueryInterface"] }], // XXX most of our classes use lowercase (e.g. calDateTime "no-else-return": 2, // XXX makes code less readable in some situations "no-use-before-define": [2, "nofunc"], // XXX doesn't work well well with our code structure "no-invalid-this": 2, // XXX this causes strict mode errors "prefer-rest-params": 2, // XXX Use of arguments mostly to pass on to other functions, valid use case "object-shorthand": 2. // XXX I don't think we are ready for this yet, reiterate with ES6 classes
needinfo for top of comment 237, what do you think about adding unused rules and not squashing?
Flags: needinfo?(makemyday)
Attachment #8769263 - Flags: review?(makemyday)
Attachment #8769264 - Flags: review?(makemyday)
Attachment #8769265 - Flags: review?(makemyday)
Attachment #8769266 - Flags: review?(makemyday)
Attachment #8769267 - Flags: review?(makemyday)
Comment on attachment 8769117 [details] Bug 1280898 - Set up eslint for calendar files - enable object-curly-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63080/diff/1-2/
Comment on attachment 8769118 [details] Bug 1280898 - Set up eslint for calendar files - enable various working rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63082/diff/1-2/
Comment on attachment 8769119 [details] Bug 1280898 - Set up eslint for calendar files - enable array-bracket-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63084/diff/1-2/
Comment on attachment 8769120 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unused-expressions rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63086/diff/1-2/
Comment on attachment 8769121 [details] Bug 1280898 - Set up eslint for calendar files - enable no-inner-declarations rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63088/diff/1-2/
Comment on attachment 8769122 [details] Bug 1280898 - Set up eslint for calendar files - enable dot-location rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63090/diff/1-2/
Comment on attachment 8769123 [details] Bug 1280898 - Set up eslint for calendar files - enable no-caller rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63092/diff/1-2/
Comment on attachment 8769124 [details] Bug 1280898 - Set up eslint for calendar files - enable no-fallthrough rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63094/diff/1-2/
Comment on attachment 8769125 [details] Bug 1280898 - Set up eslint for calendar files - enable no-floating-decimal rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63096/diff/1-2/
Comment on attachment 8769126 [details] Bug 1280898 - Set up eslint for calendar files - enable space-before-blocks rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63098/diff/1-2/
Comment on attachment 8769127 [details] Bug 1280898 - Set up eslint for calendar files - enable operator-linebreak rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63100/diff/1-2/
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63102/diff/1-2/
Comment on attachment 8769129 [details] Bug 1280898 - Set up eslint for calendar files - enable quotes rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63104/diff/1-2/
Comment on attachment 8769130 [details] Bug 1280898 - Set up eslint for calendar files - enable no-lonely-if rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63106/diff/1-2/
Comment on attachment 8769131 [details] Bug 1280898 - Set up eslint for calendar files - enable no-multiple-empty-lines rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63108/diff/1-2/
Comment on attachment 8769132 [details] Bug 1280898 - Set up eslint for calendar files - enable accessor-pairs rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63110/diff/1-2/
Comment on attachment 8769133 [details] Bug 1280898 - Set up eslint for calendar files - enable block-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63112/diff/1-2/
Comment on attachment 8769134 [details] Bug 1280898 - Set up eslint for calendar files - enable computed-property-spacing rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63114/diff/1-2/
Comment on attachment 8769135 [details] Bug 1280898 - Set up eslint for calendar files - enable consistent-this and no-useless-call rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63116/diff/1-2/
Comment on attachment 8769136 [details] Bug 1280898 - Set up eslint for calendar files - enable dot-notation rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63118/diff/1-2/
Comment on attachment 8769137 [details] Bug 1280898 - Set up eslint for calendar files - enable func-names rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63120/diff/1-2/
Comment on attachment 8769138 [details] Bug 1280898 - Set up eslint for calendar files - enable object-property-newline rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63122/diff/1-2/
Comment on attachment 8769139 [details] Bug 1280898 - Set up eslint for calendar files - enable object-curly-newline rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63124/diff/1-2/
Comment on attachment 8769140 [details] Bug 1280898 - Set up eslint for calendar files - enable no-whitespace-before-property rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63126/diff/1-2/
Comment on attachment 8769141 [details] Bug 1280898 - Set up eslint for calendar files - enable no-useless-escape rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63128/diff/1-2/
Comment on attachment 8769142 [details] Bug 1280898 - Set up eslint for calendar files - enable no-mixed-operators rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63130/diff/1-2/
Comment on attachment 8769143 [details] Bug 1280898 - Set up eslint for calendar files - enable no-useless-concat rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63132/diff/1-2/
Comment on attachment 8769144 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unmodified-loop-condition rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63134/diff/1-2/
Comment on attachment 8769145 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-arrow-callback rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63136/diff/1-2/
Comment on attachment 8769146 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-spread rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63138/diff/1-2/
Comment on attachment 8769147 [details] Bug 1280898 - Set up eslint for calendar files - enable quote-props rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63140/diff/1-2/
Comment on attachment 8769148 [details] Bug 1280898 - Set up eslint for calendar files - enable no-negated-condition rule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63142/diff/1-2/
Ok, just the indent rule missing now for this bug. Sorry for the extra bugspam!
Sorry I missed your request in that flood of bugmails. (In reply to Philipp Kewisch [:Fallen] from comment #237) > Almost all done that I wanted to do, here is my todo list. I am considering > adding the rules we will not be using in .eslintrc but set to 0, this way it > will be easy to run a script that compares which eslint rules have been > added or removed when upgrading eslint. Ok for me if we move that to a separate section with an according comment. > Another issue I'd like to bring up is what we discussed earlier regarding > squashing. I totally agree that squashing would make blame easier and there > is definitely overlap between these patches, but on the other hand, finding > regressions caused by these patches will become much harder if everything is > squashed. Therefore, I would like do push them separately. What do you > think? I've already set the author to "eslint <eslint@bugzilla.kewis.ch>" > for most patches (the latest ones I forgot, but they are updated locally), > so ideally in blame you will just see "eslint" as the author and can easily > skip through those changesets in hgweb. I reconsider what I said about squashing. But using an eslint user would be still appreciated. And due to the amount of patches, you should consider to land them not all at a time but distribute landing over several days to have several nightlies for bisecting. Is the order visible in RB the one you need for landing, so I can prioritize reviews to support this? > consider these rules, not sure yet > ================================== > > // Enforce minimum identifier length > "id-length": [2, 4], I'm in favour to not use this. > // Enforce a maximum depth that blocks can be nested > "max-depth": [2, 4], We should do this only if it's limited to a reasonable amount of changes. > // Disallow lexical declarations in case/default clauses > "no-case-declarations": 2, This we should take. > // Require empty lines around comments > "lines-around-comment": 2, I prefer to not have this rule.
Flags: needinfo?(makemyday)
(In reply to [:MakeMyDay] from comment #277) > > I am considering > > adding the rules we will not be using in .eslintrc but set to 0, this way it > > will be easy to run a script that compares which eslint rules have been > > added or removed when upgrading eslint. > > Ok for me if we move that to a separate section with an according comment. Sure thing, will add a changeset for this after a few more reviews to bundle it with potential issues. > I reconsider what I said about squashing. But using an eslint user would be > still appreciated. And due to the amount of patches, you should consider to > land them not all at a time but distribute landing over several days to have > several nightlies for bisecting. Is the order visible in RB the one you need > for landing, so I can prioritize reviews to support this? Yes, the order in RB is exactly the order the patches apply in, from top to bottom. I can start landing some of the r+ patches soon. I will make sure they have the eslint user. > > > > consider these rules, not sure yet > > ================================== > > > > // Enforce minimum identifier length > > "id-length": [2, 4], > > I'm in favour to not use this. I've already done this, but with the following config, most notably minimum length 3. The result is some hard to understand identifiers actually getting sensible names, and aside from that mostly changing |dt| to |date|, |tz| to |timezone| and |op| to |operation|. If you don't like the replacements, I could add dt, tz and op to the exceptions list, but I think it is quite ok with the replacements. // Enforce minimum identifier length "id-length": [2, { "min": 3, "exceptions": [ /* sorting */ "a", "b", /* exceptions */ "e", "ex", /* loop indices */ "i", "j", "k", "n", /* coordinates */ "x", "y", /* regexes */ "re", /* known words */ "rc", "id", "OS", "os", "db", /* mail/calendar words */ "to", "cc", /* Components */ "Ci", "Cc", "Cu", "Cr", ] }], > > > // Enforce a maximum depth that blocks can be nested > > "max-depth": [2, 4], > > We should do this only if it's limited to a reasonable amount of changes. This turns out to be unreasonable, it was hard to find a sensible maximum depth value that worked for all files. Limiting the line length some time in the future would probably solve this too though. > > > // Disallow lexical declarations in case/default clauses > > "no-case-declarations": 2, > > This we should take. Done > > > // Require empty lines around comments > > "lines-around-comment": 2, > > I prefer to not have this rule. I agree, it did not improve readability.
Attachment #8765267 - Flags: review?(makemyday) → review+
Comment on attachment 8765267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-shadow and no-redeclare rule. https://reviewboard.mozilla.org/r/60732/#review61770 Can you please always change function argument names to the aSomeName pattern whenever you touch them? There are multiple of such cases in this patch.
Comment on attachment 8765268 [details] Bug 1280898 - Set up eslint for calendar files - enable var-only-toplevel rule. https://reviewboard.mozilla.org/r/60734/#review61778 When landing the patches, please make sure to land this in a way that it gets part of a separate Daily compared to the patches before and after this. Apart from that, is there a vice-versa-rule to make sure we have no let on top level? ::: calendar/base/content/calendar-multiday-view.xml:942 (Diff revision 2) > curItemInfo.layoutStart.compare(latestItemEnd) != -1) { > // We're done with this current blob because item starts > // after the last event in the current blob ended. > blobs.push({blob: currentBlob, totalCols: colEndArray.length}); > > - // Reset our variables > + // Reset our letiables Replace all doesn't work always ;-) ::: calendar/base/content/calendar-task-view.js:25 (Diff revision 2) > .getService(Components.interfaces.calIDateTimeFormatter); > > function displayElement(id, flag) { > setBooleanAttribute(id, "hidden", !flag); > return flag; > } Can you move the function on top of dateFormatter please to avoid a strict error? ::: calendar/base/content/calendar-views.js:97 (Diff revision 2) > aUseParentItems, > aDoNotConfirm) { > startBatchTransaction(); > - var recurringItems = {}; > + let recurringItems = {}; > > function getSavedItem(aItemToDelete) { To avoid a strict warning, can you make this let getSavedItem = function (aItemToDelete) { ::: calendar/base/content/dialogs/calendar-dialog-utils.js:489 (Diff revision 2) > */ > function updateLink() { > - var itemUrlString = window.calendarItem.getProperty("URL") || ""; > - var linkCommand = document.getElementById("cmd_toggle_link"); > + let itemUrlString = window.calendarItem.getProperty("URL") || ""; > + let linkCommand = document.getElementById("cmd_toggle_link"); > > function hideOrShow(aBool) { let hideOrShow = function (aBool) { ::: calendar/base/content/import-export.js:334 (Diff revision 2) > itemArray.push(item); > } > } > }; > > function getItemsFromCal(aCal) { Change this to let getItemsFromCal = function (aCal) ::: calendar/providers/caldav/calDavCalendar.js:2120 (Diff revision 2) > * > * @param aNameSpaceList List of available namespaces > */ > checkPrincipalsNameSpace: function caldav_checkPrincipalsNameSpace(aNameSpaceList, aChangeLogListener) { > - var thisCalendar = this; > + let thisCalendar = this; > function doesntSupportScheduling() { let doesntSupportScheduling = function () { ::: calendar/providers/ics/calICSCalendar.js:675 (Diff revision 2) > return (a.lastmodified - b.lastmodified); > }); > // And delete the oldest files, and keep the desired number of > // old backups > - var i; > + let i; > for (i = 0; i < filteredFiles.length - numBackupFiles; ++i) { for (let i = 0;... ::: calendar/providers/wcap/calWcapSession.js:712 (Diff revision 2) > }, > > issueNetworkRequest: function calWcapSession_issueNetworkRequest( > request, respFunc, dataConvFunc, wcapCommand, params) { > - var this_ = this; > + let this_ = this; > function getSessionId_resp(err, sessionId) { let getSessionId_resp = function (err, sessionId) { ::: calendar/resources/content/datetimepickers/datetimepickers.xml:57 (Diff revision 2) > this.mRelativeDates = [ > {word: cal.calGetString("calendar", "today").toLowerCase(), offset: 0}, > {word: cal.calGetString("calendar", "yesterday").toLowerCase(), offset: -1}, > {word: cal.calGetString("calendar", "tomorrow").toLowerCase(), offset: 1}]; > - var i; > + let i; > for (i = 1; i <= 7; i++) { for (let i = 1; i <= 7; i++) {
Attachment #8765268 - Flags: review?(makemyday) → review+
Comment on attachment 8765269 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unused-vars rule. https://reviewboard.mozilla.org/r/60736/#review61780 You're removing two varibales here which are used later on. Please cross check this. As you've fixed some tests, I would appreciate you do a try run before pushing. ::: calendar/base/content/dialogs/calendar-event-dialog-timezone.js:3 (Diff revision 2) > /* This Source Code Form is subject to the terms of the Mozilla Public > * License, v. 2.0. If a copy of the MPL was not distributed with this > - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > +* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ Don't remove the leading whitespace here. ::: calendar/base/content/widgets/calendar-list-tree.xml:925 (Diff revision 2) > - let calendar = this.getCalendar(aRow); > - > switch (aCol.element.getAttribute("anonid")) { > case "calendarname-treecol": > return this.getCalendar(aRow).name; > } Can you make this if (aCol.element.getAttribute("anonid") == "calendarname-treecol") { return this.getCalendar(aRow).name; } else { return ""; } or return (...) ? this.getCalendar(aRow).name : ""; ::: calendar/base/content/widgets/calendar-widgets.xml:688 (Diff revision 2) > // nsITransferable sucks when it comes to trying to add extra flavors. > // This will throw NS_ERROR_FAILURE, so as a workaround, we use the > // sourceNode property and get the event that way > + // let flavor = {}; > + // let data = {}; > // transfer.getAnyTransferData(flavor, data, {}); As getAnyTransferData isn't used in calendar-widgets.xml at all, you can remove the entire comment bloack here. ::: calendar/base/src/calTimezoneService.js (Diff revision 2) > } > return this.mStringArray[this.mIndex++]; > } > }; > > -var g_stringBundle = null; g_stringBundle is used within the prototype definition. ::: calendar/providers/caldav/calDavCalendar.js (Diff revision 2) > > let delListener2 = { > onStreamComplete: function caldav_dDI_del2_onStreamComplete(aLoader, aContext, aStatus, aResultLength, aResult) { > let request = aLoader.request.QueryInterface(Components.interfaces.nsIHttpChannel); > let listenerStatus = Components.results.NS_OK; > - let listenerDetail = aItem; Don't remove listenerDetail here, is used later on. ::: calendar/resources/content/publish.js (Diff revision 2) > -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ There much more of such lines in the code base. We should remove all of them.
Attachment #8765269 - Flags: review?(makemyday) → review+
Comment on attachment 8769117 [details] Bug 1280898 - Set up eslint for calendar files - enable object-curly-spacing rule. https://reviewboard.mozilla.org/r/63080/#review61782 ::: calendar/test/unit/head_consts.js:218 (Diff revision 2) > function do_load_timezoneservice(callback) { > do_test_pending(); > - cal.getTimezoneService().startup({onResult: function() { > + cal.getTimezoneService().startup({ onResult: function() { > do_test_finished(); > callback(); > - }}); > + } }); The } }); looks a little odd. Can make this cal.getTimezoneService().startup({ onResult: function() { do_test_finished(); callback(); } }); ::: calendar/test/unit/head_consts.js:226 (Diff revision 2) > function do_load_calmgr(callback) { > do_test_pending(); > - cal.getCalendarManager().startup({onResult: function() { > + cal.getCalendarManager().startup({ onResult: function() { > do_test_finished(); > callback(); > - }}); > + } }); The same here. ::: calendar/test/unit/test_freebusy_service.js:117 (Diff revision 2) > QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calIFreeBusyProvider, Components.interfaces.calIOperation]), > getFreeBusyIntervals: function(aCalId, aStart, aEnd, aTypes, aListener) { > - Services.tm.currentThread.dispatch({run: function() { > + Services.tm.currentThread.dispatch({ run: function() { > dump("Cancelling freebusy query..."); > op.cancel(); > - }}, Components.interfaces.nsIEventTarget.DISPATCH_NORMAL); > + } }, Components.interfaces.nsIEventTarget.DISPATCH_NORMAL); Here again. ::: calendar/test/unit/test_gdata_provider.js:505 (Diff revision 2) > gServer.start(); > - cal.getTimezoneService().startup({onResult: function() { > + cal.getTimezoneService().startup({ onResult: function() { > run_next_test(); > do_test_finished(); > - }}); > - }}); > + } }); > + } }); and here. ::: calendar/test/unit/test_search_service.js:104 (Diff revision 2) > QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICalendarSearchProvider, Components.interfaces.calIOperation]), > searchForCalendars: function(aStr, aHint, aMax, aListener) { > - Services.tm.currentThread.dispatch({run: function() { > + Services.tm.currentThread.dispatch({ run: function() { > dump("Cancelling search..."); > op.cancel(); > - }}, Components.interfaces.nsIEventTarget.DISPATCH_NORMAL); > + } }, Components.interfaces.nsIEventTarget.DISPATCH_NORMAL); and once again.
Attachment #8769117 - Flags: review?(makemyday) → review+
Comment on attachment 8769118 [details] Bug 1280898 - Set up eslint for calendar files - enable various working rule. https://reviewboard.mozilla.org/r/63082/#review61784
Attachment #8769118 - Flags: review?(makemyday) → review+
Comment on attachment 8769119 [details] Bug 1280898 - Set up eslint for calendar files - enable array-bracket-spacing rule. https://reviewboard.mozilla.org/r/63084/#review61786
Attachment #8769119 - Flags: review?(makemyday) → review+
Comment on attachment 8769120 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unused-expressions rule. https://reviewboard.mozilla.org/r/63086/#review61794
Attachment #8769120 - Flags: review?(makemyday) → review+
Comment on attachment 8769121 [details] Bug 1280898 - Set up eslint for calendar files - enable no-inner-declarations rule. https://reviewboard.mozilla.org/r/63088/#review61796 ::: calendar/providers/wcap/calWcapSession.js:981 (Diff revision 2) > - params += ("&dtend=" + zRangeEnd); > - params += "&fmt-out=text%2Fxml"; > - > - // cannot use stringToXml here, because cs 6.3 returns plain nothing > + // cannot use stringToXml here, because cs 6.3 returns plain nothing > - // on invalid user freebusy requests. WTF. > + // on invalid user freebusy requests. WTF. > - function stringToXml_(session, data) { > + function stringToXml_(session, data) { make this let stringXML_ = function(session, data) { to avoid a strict warning.
Attachment #8769121 - Flags: review?(makemyday) → review+
Comment on attachment 8769122 [details] Bug 1280898 - Set up eslint for calendar files - enable dot-location rule. https://reviewboard.mozilla.org/r/63090/#review61798
Attachment #8769122 - Flags: review?(makemyday) → review+
Attachment #8769123 - Flags: review?(makemyday) → review+
Comment on attachment 8769123 [details] Bug 1280898 - Set up eslint for calendar files - enable no-caller rule. https://reviewboard.mozilla.org/r/63092/#review61800
Attachment #8769124 - Flags: review?(makemyday) → review+
Comment on attachment 8769124 [details] Bug 1280898 - Set up eslint for calendar files - enable no-fallthrough rule. https://reviewboard.mozilla.org/r/63094/#review61802
Comment on attachment 8769125 [details] Bug 1280898 - Set up eslint for calendar files - enable no-floating-decimal rule. https://reviewboard.mozilla.org/r/63096/#review61804
Attachment #8769125 - Flags: review?(makemyday) → review+
Comment on attachment 8769126 [details] Bug 1280898 - Set up eslint for calendar files - enable space-before-blocks rule. https://reviewboard.mozilla.org/r/63098/#review61806
Attachment #8769126 - Flags: review?(makemyday) → review+
Comment on attachment 8769127 [details] Bug 1280898 - Set up eslint for calendar files - enable operator-linebreak rule. https://reviewboard.mozilla.org/r/63100/#review61808 Not related, but I stumbled upon it: why are the eventDialog test currently excluded from being run on automation? ::: calendar/base/content/dialogs/calendar-dialog-utils.js:382 (Diff revision 2) > */ > function getCurrentCalendar() { > let calendarNode = document.getElementById("item-calendar"); > - return (calendarNode && calendarNode.selectedItem ? > - calendarNode.selectedItem.calendar : > - window.calendarItem.calendar); > + return (calendarNode && calendarNode.selectedItem > + ? calendarNode.selectedItem.calendar > + : window.calendarItem.calendar); maybe we should add two or six more whitrespaces in such cases.
Attachment #8769127 - Flags: review?(makemyday) → review+
Attachment #8769128 - Flags: review?(makemyday) → review-
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. https://reviewboard.mozilla.org/r/63102/#review61810 This rule does not produce good results in each case. Especially if -= or += operators are involved or in cases like return a == b && c == d ? foo : bar; would a parentheses would make it easier to get logical blocks at a glance. Maybe we can use some exceptions here. I r- it for now to discuss this. In general I think we should use that rule as we get rid of all the let foo = (bar); cases and other obscure uses of parentheses with it, but I would appreaciate if we can relax this rule a bit. ::: calendar/base/content/dialogs/calendar-event-dialog-reminder.js:56 (Diff revision 2) > let firstAvailableItem; > let actionNodes = document.getElementById("reminder-actions-menupopup").childNodes; > for (let actionNode of actionNodes) { > - let shouldHide = (!(actionNode.value in allowedActionsMap) || > + let shouldHide = !(actionNode.value in allowedActionsMap) || > (actionNode.hasAttribute("provider") && > - actionNode.getAttribute("provider") != calendar.type)); > + actionNode.getAttribute("provider") != calendar.type); There's one whitespace to much indention for line 55 and 56. ::: calendar/base/content/dialogs/calendar-event-dialog-reminder.js:412 (Diff revision 2) > */ > function onRemoveReminder() { > let listbox = document.getElementById("reminder-listbox"); > let listitem = listbox.selectedItem; > - let newSelection = (listitem ? listitem.nextSibling || > - listitem.previousSibling : null); > + let newSelection = listitem ? listitem.nextSibling || > + listitem.previousSibling : null; Can you make this let newSelection = listitem ? listitem.nextSibling || listitem.previousSibling : null; ::: calendar/base/content/dialogs/calendar-event-dialog-timezone.js:19 (Diff revision 2) > let args = window.arguments[0]; > window.time = args.time; > window.onAcceptCallback = args.onOk; > > - let tzProvider = (args.calendar.getProperty("timezones.provider") || > - cal.getTimezoneService()); > + let tzProvider = args.calendar.getProperty("timezones.provider") || > + cal.getTimezoneService(); One whitespace less, please. ::: calendar/base/content/widgets/calendar-widgets.xml:349 (Diff revision 2) > let collapsedModes = this.getAttribute("collapsedinmodes").split(","); > - return (!collapsedModes.includes(lMode)); > + return !collapsedModes.includes(lMode); > ]]></body> > </method> > > <method name="setModeAttribute"> Please remove the trailing whitespace here. ::: calendar/base/modules/calItipUtils.jsm:842 (Diff revision 2) > * > * @param aItipItem ItipItem to derive a new one from > * @param aItems List of items to be contained in the new itipItem > * @param aProps List of properties to be different in the new itipItem > */ > - getModifiedItipItem: function cal_getModifiedItipItem(aItipItem, aItems, aProps) { > + getModifiedItipItem: function cal_getModifiedItipItem(aItipItem, aItems=[], aProps) { Shouldn't that be (aItipItem, aItems = [], aProps) ? ::: calendar/base/src/calWeekInfoService.js:103 (Diff revision 2) > - let offset = (Preferences.get("calendar.week.start", 0) - aDate.weekday); > + let offset = Preferences.get("calendar.week.start", 0) - aDate.weekday; > if (offset > 0) { > - date.day -= (7 - offset); > + date.day -= 7 - offset; > } else { > date.day += offset; > } This makes it worse, imho. Wouldn't let offset = Preferences.get("calendar.week.start", 0) - aDate.weekday; date.day += offset; if (offset > 0) { date.day -= 7; } be more readable? ::: calendar/import-export/calMonthGridPrinter.js:182 (Diff revision 2) > this.setupWeek(document, weekContainer, weekStart, mainMonth, dayTable); > } > > // Now insert the month into the page container, sorting by date (and therefore by month) > function compareDates(a, b) { > - return (!a || !b) ? -1 : a.compare(b); > + return !a || !b ? -1 : a.compare(b); Hmm. Such a result is probably more a loss than a gain of readability. Maybe we can use a line break here for structuring. ::: calendar/import-export/calWeekPrinter.js:135 (Diff revision 2) > } > } > > // Now insert the week into the week container, sorting by date (and therefore week number) > function compareDates(a, b) { > - return (!a || !b) ? -1 : a.compare(b); > + return !a || !b ? -1 : a.compare(b); Here again.
Attachment #8769129 - Flags: review?(makemyday) → review+
Comment on attachment 8769129 [details] Bug 1280898 - Set up eslint for calendar files - enable quotes rule. https://reviewboard.mozilla.org/r/63104/#review62664 In general this rule is a good improvement, however in cases with concating strings this leads to odd results (but this is hard to vaoid in each case): let foo = "some text" + ' that includes a "double quoted" text,' + " before there's some other text" + ' and again a "double quoted" text'; ::: calendar/.eslintrc:362 (Diff revision 2) > > // Restricts the use of parentheses to only where they are necessary > "no-extra-parens": [2, "all", { "conditionalAssign": false, "returnAssign": false, "nestedBinaryExpressions": false }], > + > + // Double quotes should be used. > + "quotes": [2, "double", "avoid-escape"], From eslint.org: Deprecation notice: The avoid-escape option is a deprecated syntax and you should use the object form instead. [2, "double", {"avoidEscape": true}] ::: calendar/test/mozmill/eventDialog/testEventDialog.js:261 (Diff revision 2) > > // check date and time > // date-time string contains strings formatted in operating system language so check numeric values only > let dateTime = new elementslib.Lookup(controller.window.document, > '/id("messengerWindow")/id("calendar-popupset")/id("itemTooltip")/' + > - '{"class":"tooltipBox"}/{"class":"tooltipHeaderGrid"}/[1]/[2]/[1]').getNode().textContent + ''; > + '{"class":"tooltipBox"}/{"class":"tooltipHeaderGrid"}/[1]/[2]/[1]').getNode().textContent + ""; Is the trailing "" needed here?
Comment on attachment 8769130 [details] Bug 1280898 - Set up eslint for calendar files - enable no-lonely-if rule. https://reviewboard.mozilla.org/r/63106/#review63258 ::: calendar/base/content/calendar-multiday-view.xml:1650 (Diff revision 2) > ignore = true; > } > - } else { > + } else if (orient == "horizontal") { > if (Math.abs(event.screenX - dragState.origLoc) < 3) { > ignore = true; > } This looks just like the half-way. Can you make this let orient = col.getAttribute("orient"); let position = orient == "vertical" ? event.screenY : event.screenX; if (Math.abs(position - dragState.origLoc) < 3) { ignore = true; }
Attachment #8769130 - Flags: review?(makemyday) → review+
Comment on attachment 8769131 [details] Bug 1280898 - Set up eslint for calendar files - enable no-multiple-empty-lines rule. https://reviewboard.mozilla.org/r/63108/#review63268
Attachment #8769131 - Flags: review?(makemyday) → review+
Attachment #8769132 - Flags: review?(makemyday) → review+
Comment on attachment 8769132 [details] Bug 1280898 - Set up eslint for calendar files - enable accessor-pairs rule. https://reviewboard.mozilla.org/r/63110/#review63270
Comment on attachment 8769133 [details] Bug 1280898 - Set up eslint for calendar files - enable block-spacing rule. https://reviewboard.mozilla.org/r/63112/#review63272
Attachment #8769133 - Flags: review?(makemyday) → review+
Comment on attachment 8769134 [details] Bug 1280898 - Set up eslint for calendar files - enable computed-property-spacing rule. https://reviewboard.mozilla.org/r/63114/#review63274
Attachment #8769134 - Flags: review?(makemyday) → review+
Attachment #8769135 - Flags: review?(makemyday) → review+
Comment on attachment 8769135 [details] Bug 1280898 - Set up eslint for calendar files - enable consistent-this and no-useless-call rule. https://reviewboard.mozilla.org/r/63116/#review63340 ::: calendar/base/modules/calProviderUtils.jsm:539 (Diff revision 2) > } > } > } > > - let this_ = this; > - function takeOverIfNotPresent(oldPref, newPref, dontDeleteOldPref) { > + let takeOverIfNotPresent = (oldPref, newPref, dontDeleteOldPref) => { > + let val = calMgr.getCalendarPref_(this, oldPref); With respect to dxr, takeOverIfNotPresent is only called without dontDeleteOldPref, so we should have migrated the prefs already since that was implemented. So it should be save to get rid of that old migration code now. Can you file a bug for this?
Comment on attachment 8769136 [details] Bug 1280898 - Set up eslint for calendar files - enable dot-notation rule. https://reviewboard.mozilla.org/r/63118/#review63342
Attachment #8769136 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/60734/#review61778 There is no vice-versa rule. Toplevel let is actually ok, it just means something different. IIRC it means that the variable is local to the file, even if loaded into a shared global (like const). > let hideOrShow = function (aBool) { Moved this to the top of the function instead
https://reviewboard.mozilla.org/r/60736/#review61780 > Can you make this > > if (aCol.element.getAttribute("anonid") == "calendarname-treecol") { > return this.getCalendar(aRow).name; > } else { > return ""; > } > > or > > return (...) ? this.getCalendar(aRow).name : ""; I;d rather keep this as is, given getCellText can be called with multiple columns, if we add one it would be easier this way. > There much more of such lines in the code base. We should remove all of them. We can do so in a different changeset, I don't want to cram them into this one.
https://reviewboard.mozilla.org/r/63080/#review61782 > The } }); looks a little odd. Can make this > > cal.getTimezoneService().startup({ > onResult: function() { > do_test_finished(); > callback(); > } > }); This is taken care of later in object-curly-spacing
Comment on attachment 8769137 [details] Bug 1280898 - Set up eslint for calendar files - enable func-names rule. https://reviewboard.mozilla.org/r/63120/#review63346 While revieweing this, I noticed several naming patterns for internal methods and properties like _foo: fucntion() {}, foo_: function() {}, doFoo: function() {} respectively mBar: null, m_bar: null, _bar: null, bar_: null Can we unify this, too? ::: calendar/base/modules/calIteratorUtils.jsm:114 (Diff revision 2) > * > * @param aComponent The component to iterate given the above rules. > * @param aCompType The type of item to iterate. > * @return The iterator that yields all items. > */ > - calendarComponentIterator: function* cal_ical_calendarComponentIterator(aComponent, aCompType) { > + calendarComponentIterator: function* (aComponent, aCompType) { Is this intended to have a whitespace between function in the opening parenthesis if its function* instead of function? Or just an oversight of the other rule? ::: calendar/base/modules/calUtils.jsm:964 (Diff revision 2) > return function this_() { > if (!("mService" in this_)) { > this_.mService = Components.classes[id].getService(iface); > shutdownCleanup(this_, "mService"); > } > return this_.mService; Can you rename this_ here to something else?
Attachment #8769137 - Flags: review?(makemyday) → review+
Comment on attachment 8769138 [details] Bug 1280898 - Set up eslint for calendar files - enable object-property-newline rule. https://reviewboard.mozilla.org/r/63122/#review63354
Attachment #8769138 - Flags: review?(makemyday) → review+
Comment on attachment 8769139 [details] Bug 1280898 - Set up eslint for calendar files - enable object-curly-newline rule. https://reviewboard.mozilla.org/r/63124/#review63356
Attachment #8769139 - Flags: review?(makemyday) → review+
Comment on attachment 8769140 [details] Bug 1280898 - Set up eslint for calendar files - enable no-whitespace-before-property rule. https://reviewboard.mozilla.org/r/63126/#review63358
Attachment #8769140 - Flags: review?(makemyday) → review+
Comment on attachment 8769141 [details] Bug 1280898 - Set up eslint for calendar files - enable no-useless-escape rule. https://reviewboard.mozilla.org/r/63128/#review63364
Attachment #8769141 - Flags: review?(makemyday) → review+
Attachment #8769142 - Flags: review?(makemyday) → review+
Comment on attachment 8769142 [details] Bug 1280898 - Set up eslint for calendar files - enable no-mixed-operators rule. https://reviewboard.mozilla.org/r/63130/#review63366
Comment on attachment 8769143 [details] Bug 1280898 - Set up eslint for calendar files - enable no-useless-concat rule. https://reviewboard.mozilla.org/r/63132/#review63368
Attachment #8769143 - Flags: review?(makemyday) → review+
Comment on attachment 8769144 [details] Bug 1280898 - Set up eslint for calendar files - enable no-unmodified-loop-condition rule. https://reviewboard.mozilla.org/r/63134/#review63370
Attachment #8769144 - Flags: review?(makemyday) → review+
https://reviewboard.mozilla.org/r/63102/#review61810 I've made some changes to this patch to only remove certain cases, I've kept it for ?: and for += etc. If we want to make more changes I'd suggest we add another patch at the end of the queue, it was a pretty big pain to revert some of these. > Shouldn't that be (aItipItem, aItems = [], aProps) ? No, it is common to have default args without spaces. Also the reason I didn't actually enable the space-infix-ops rule, and there a bug for eslint to fix it. > This makes it worse, imho. Wouldn't > > let offset = Preferences.get("calendar.week.start", 0) - aDate.weekday; > date.day += offset; > if (offset > 0) { > date.day -= 7; > } > > be more readable? Sure, done.
https://reviewboard.mozilla.org/r/63104/#review62664 Yeah, hard to avoid. We could use template strings or escape quotes instead, but I don't think it is worth the effort.
https://reviewboard.mozilla.org/r/63116/#review63340 > With respect to dxr, takeOverIfNotPresent is only called without dontDeleteOldPref, so we should have migrated the prefs already since that was implemented. So it should be save to get rid of that old migration code now. Can you file a bug for this? Filed bug 1288969
https://reviewboard.mozilla.org/r/63120/#review63346 We can certainly, but I wouldn't want to do this without an eslint rule. I don't think there is a rule available, so we'd have to write our own. id-match is the only one I found that does any kind of matching. I can imagine that eslint folks may be interested in rules that allow defining a regex for other tokens like class members or arguments, but it may be hard to write the rule in a way that it catches enough situations. I can file an issue for this another day, I have this in mind for both the aArgs and mMember cases. > Is this intended to have a whitespace between function in the opening parenthesis if its function* instead of function? Or just an oversight of the other rule? This is intended, see generator-star-spacing > Can you rename this_ here to something else? This should be taken care of in consistent-this.
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. https://reviewboard.mozilla.org/r/63102/#review63416
Attachment #8769128 - Flags: review-
Comment on attachment 8769145 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-arrow-callback rule. https://reviewboard.mozilla.org/r/63136/#review65230 r+ with comments considered. ::: calendar/base/content/calendar-multiday-view.xml:3544 (Diff revision 2) > occMap[i] = true; > } > } > } > > - return this.mDateColumns.filter(function(col) { > + return this.mDateColumns.filter(col => col.date.day in occMap); Can we please make the use of parentheses for arguments consistent (this spreads accross the patch, not just here)? we have () => { ... } () => foo == bar and (foo) => { ... } but foo => bar == 0 If possible, I would prefer to use the parentheses in this case, too, to visually separate the arguments more from the function body: (foo) => bar == 0 ::: calendar/providers/wcap/calWcapCalendarItems.js:290 (Diff revision 2) > } > atts = atts.concat([]); > atts.sort(attendeeSort); > - return atts.map(self.encodeAttendee, self).join(";"); > - } > + return atts.map(this.encodeAttendee, this).join(";"); > + }; > function encodeCategories(cats) { I think this will cause a strict warning. If you convert the above function endodeAttendees, you should to do this also for all of the subsequent functions like encodeCategories and getPrivacy, too, or move those you don't want to convert to the top.
Attachment #8769145 - Flags: review?(makemyday) → review+
Comment on attachment 8769146 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-spread rule. https://reviewboard.mozilla.org/r/63138/#review65232 ::: calendar/base/modules/calAsyncUtils.jsm:23 (Diff revision 2) > var promisifyProxyHandler = { > promiseOperation: function(target, name, args) { > let deferred = PromiseUtils.defer(); > let listener = cal.async.promiseOperationListener(deferred); > args.push(listener); > - target[name].apply(target, args); > + target[name](...args); Things like that need definitely to be explicitely documented in the style guide. The meaning of ... is not quite obvious by the syntax and if you're not following all the ES6 changes, you're probably wondering what that means. And there's no easy way to search for it on MDN, if don't know what you have to look for.
Attachment #8769146 - Flags: review?(makemyday) → review+
Comment on attachment 8769147 [details] Bug 1280898 - Set up eslint for calendar files - enable quote-props rule. https://reviewboard.mozilla.org/r/63140/#review65234
Attachment #8769147 - Flags: review?(makemyday) → review+
Attachment #8769148 - Flags: review?(makemyday) → review+
Comment on attachment 8769148 [details] Bug 1280898 - Set up eslint for calendar files - enable no-negated-condition rule. https://reviewboard.mozilla.org/r/63142/#review65236
Comment on attachment 8769263 [details] Bug 1280898 - Set up eslint for calendar files - enable max-statements-per-line rule. https://reviewboard.mozilla.org/r/63224/#review65238
Attachment #8769263 - Flags: review?(makemyday) → review+
Comment on attachment 8769264 [details] Bug 1280898 - Set up eslint for calendar files - enable no-confusing-arrow and no-this-before-super rule. https://reviewboard.mozilla.org/r/63226/#review65240
Attachment #8769264 - Flags: review?(makemyday) → review+
Comment on attachment 8769265 [details] Bug 1280898 - Set up eslint for calendar files - enable no-lone-blocks rule. https://reviewboard.mozilla.org/r/63228/#review65242
Attachment #8769265 - Flags: review?(makemyday) → review+
Comment on attachment 8769266 [details] Bug 1280898 - Set up eslint for calendar files - enable id-length rule. https://reviewboard.mozilla.org/r/63230/#review65244 r+ with comments considered. ::: calendar/base/backend/icaljs/calDateTime.js:70 (Diff revision 1) > this.innerObject.fromData({ > - year: yr, > - month: mo + 1, > - day: dy, > - hour: hr, > - minute: mi, > + year: year, > + monthnth: month + 1, > + day: day, > + hour: hour, > + minutenute: minute, something went wrong here. It should be month: month + 1, minute: minute, ::: calendar/base/content/calendar-item-editing.js:541 (Diff revision 1) > // XXX Why? I think its ok to ask also for exceptions. > type = MODIFY_OCCURRENCE; > } else { > // Prompt the user. Setting modal blocks the dialog until it is closed. We > // use rv to pass our return value. > - let rv = { value: CANCEL, item: aItem, action: aAction }; > + let returnValue = { value: CANCEL, item: aItem, action: aAction }; I would prefer to add rv to the exception list. ::: calendar/base/content/calendar-task-editing.js:29 (Diff revision 1) > > /** > * Set the currently observed calendar, removing listeners to any old > * calendar set and adding listeners to the new one. > */ > - set observedCalendar(v) { > + set observedCalendar(calendar) { Can you make this aCalendar please? ::: calendar/base/content/calendar-views.xml:98 (Diff revision 1) > this.refresh(); > return; > } > aDate = aDate.getInTimezone(this.timezone); > - let d1 = getWeekInfoService().getStartOfWeek(aDate); > - let d2 = d1.clone(); > + let wkstart = getWeekInfoService().getStartOfWeek(aDate); > + let wkend = wkstart.clone(); Make this weekStart and weekEnd, please. ::: calendar/base/content/calendar-views.xml:191 (Diff revision 1) > // adjusted for the day the week starts on and the number > // of previous weeks we're supposed to display. > - let d1 = getWeekInfoService().getStartOfWeek(aDate); > - d1.day -= 7 * Preferences.get("calendar.previousweeks.inview", 0); > + let daystart = getWeekInfoService().getStartOfWeek(aDate); > + daystart.day -= 7 * Preferences.get("calendar.previousweeks.inview", 0); > // The last day we're supposed to show > - let d2 = d1.clone(); > + let dayend = daystart.clone(); Make this dayStart and dayEnd. ::: calendar/base/content/dialogs/calendar-event-dialog-recurrence.js:513 (Diff revision 1) > */ > function splitRecurrenceRules(recurrenceInfo) { > let ritems = recurrenceInfo.getRecurrenceItems({}); > let rules = []; > let exceptions = []; > - for (let r of ritems) { > + for (let recItem of ritems) { Can you make this consistent? let rItem of rItems or let reqItem of reqItems ::: calendar/base/content/import-export.js:25 (Diff revision 1) > */ > function loadEventsFromFile(aCalendar) { > const nsIFilePicker = Components.interfaces.nsIFilePicker; > > - let fp = Components.classes["@mozilla.org/filepicker;1"] > + let picker = Components.classes["@mozilla.org/filepicker;1"] > .createInstance(nsIFilePicker); Indentation ::: calendar/base/content/import-export.js:62 (Diff revision 1) > contractids.push(contractid); > currentListLength++; > } > } > > - let rv = fp.show(); > + let returnval = picker.show(); again: rv ::: calendar/base/content/import-export.js:258 (Diff revision 1) > contractids.push(contractid); > currentListLength++; > } > } > > - let rv = fp.show(); > + let returnval = picker.show(); again: rv ::: calendar/base/modules/calAuthUtils.jsm:244 (Diff revision 1) > .QueryInterface(Components.interfaces.nsIProtocolHandler); > port = handler.defaultPort; > } > hostRealm.passwordRealm = aChannel.URI.host + ":" + port + " (" + aAuthInfo.realm + ")"; > > - let pw = this.getPasswordInfo(hostRealm); > + let pwinfo = this.getPasswordInfo(hostRealm); Please make this pwInfo. ::: calendar/base/modules/calExtract.jsm:148 (Diff revision 1) > } > } else { > let spellclass = "@mozilla.org/spellchecker/engine;1"; > let mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine; > - let sp = Components.classes[spellclass] > + let spellchecker = Components.classes[spellclass] > - .getService(mozISpellCheckingEngine); > + .getService(mozISpellCheckingEngine); Indentation ::: calendar/base/modules/calExtract.jsm:1100 (Diff revision 1) > - getPositionsFor: function(s, name, count) { > + getPositionsFor: function(str, name, count) { > let positions = []; > let re = /#(\d)/g; > let match; > let i = 0; > - while ((match = re.exec(s))) { > + while ((match = re.exec(str))) { Can't you spare one set of parentheses here? ::: calendar/base/modules/calRecurrenceUtils.jsm:378 (Diff revision 1) > let ritems = recurrenceInfo.getRecurrenceItems({}); > let rules = []; > let exceptions = []; > - for (let r of ritems) { > - if (r.isNegative) { > - exceptions.push(r); > + for (let ritem of ritems) { > + if (ritem.isNegative) { > + exceptions.push(rtem); this must be ritem. ::: calendar/base/src/calFilter.js:141 (Diff revision 1) > clone: function() { > - let cl = new calFilterProperties(); > + let cloned = new calFilterProperties(); > let props = ["start", "end", "due", "status", "category", "occurrences", "onfilter"]; > props.forEach(function(prop) { > - cl[prop] = this[prop]; > + cloned[prop] = this[prop]; > }, this); Shouldn't that also be an arrow function? ::: calendar/base/src/calUtils.js:1305 (Diff revision 1) > } > }, > > - remove: function(op) { > - if (op) { > - this.mSubOperations = this.mSubOperations.filter(op_ => op.id != op_.id); > + remove: function(operation) { > + if (operation) { > + this.mSubOperations = this.mSubOperations.filter(operation_ => operation.id != operation_.id); Please use aOperation instead of operation_: add: function(aOperation) { if (aOperation && aOperation.isPending) { this.mSubOperations.push(aOperation); } }, remove: function(aOperation) { if (aOperation) { this.mSubOperations = this.mSubOperations.filter(operation => aOperation.id != operation.id); } }, ::: calendar/providers/storage/calStorageHelpers.jsm:47 (Diff revision 1) > * kept floating. > * > * @param dt The calIDateTime to convert. > * @return The possibly converted calIDateTime. > */ > -function getInUtcOrKeepFloating(dt) { > +function getInUtcOrKeepFloating(date) { Please update the param name in the doc block. It would be even better, if you make use of the valid-jsdoc rule. ::: calendar/providers/wcap/calWcapCalendarItems.js:203 (Diff revision 1) > }; > > calWcapCalendar.prototype.getInvitedAttendee = function(item) { > let att = getAttendeeByCalId(item.getAttendees({}), this.calId); > if (!att) { // try to find mail address > - let ar = this.session.getUserPreferences("X-NSCP-WCAP-PREF-mail"); > + let prefMail = this.session.getUserPreferences("X-NSCP-WCAP-PREF-mail"); Not related to this patch, but this case mixture in the x-prop looks strange. Shouldn't that be all upper case? ::: calendar/providers/wcap/calWcapSession.js:826 (Diff revision 1) > return prefs; > }, > > get defaultAlarmStart() { > let alarmStart = null; > - let ar = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmStart"); > + let alarmStartPref = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmStart"); Again such a case mixture in an x-prop. ::: calendar/providers/wcap/calWcapSession.js:841 (Diff revision 1) > getDefaultAlarmEmails: function(out_count) { > let ret = []; > - let ar = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmEmail"); > - if (ar.length > 0 && ar[0].length > 0) { > - for (let i of ar) { > + let alarmEmail = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmEmail"); > + if (alarmEmail.length > 0 && alarmEmail[0].length > 0) { > + for (let i of alarmEmail) { > ret = ret.concat(i.split(/[;,]/).map(String.trim)); Use something different but i here. ::: calendar/test/mozmill/shared-modules/calendar-utils.js:72 (Diff revision 1) > * @param controller - Mozmill window controller > * @param attendees - whether there are attendees that can be notified or not > */ > function handleParentDeletion(controller, attendees) { > - let md = new modalDialog.modalDialog(controller.window); > - md.start((dialog) => { > + let dialog = new modalDialog.modalDialog(controller.window); > + dialog.start((dlgController) => { Can you make this dialogController like in the function above? ::: calendar/test/unit/test_hashedarray.js:82 (Diff revision 1) > * @param itemCreator (optional) Function to create a new item for the > * array. > */ > function testRemoveModify(har, testItems, postprocessFunc, itemAccessor, itemCreator) { > postprocessFunc = postprocessFunc || function(a, b) { return [a, b]; }; > itemCreator = itemCreator || (title => hashedCreateItem(title)); Can't you spare a set of parentheses here?
Attachment #8769266 - Flags: review?(makemyday) → review+
Attachment #8769267 - Flags: review?(makemyday) → review-
Comment on attachment 8769267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-case-declarations rule. https://reviewboard.mozilla.org/r/63232/#review65248 Can you please extend/modify the changes for this patch: - Please make the use of curly brackets with a switch block consistent for all cases. If they're required for a single case, it should be added for all of them. - Switch blocks with a single case (or multiple cases than join the single case code) should be transformed to an if block to avoid not neccessary indentation. As this applies to nearly every change in this patch, I set this to r- to get this done.
Comment on attachment 8769145 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-arrow-callback rule. https://reviewboard.mozilla.org/r/63136/#review65230 > Can we please make the use of parentheses for arguments consistent (this spreads accross the patch, not just here)? > > we have > > () => { > ... > } > > () => foo == bar > > and > > (foo) => { > ... > } > > but > > foo => bar == 0 > > > If possible, I would prefer to use the parentheses in this case, too, to visually separate the arguments more from the function body: > > (foo) => bar == 0 I'd really prefer to skip the extra brackets in some cases and leave this to preference. Especially for |arr.filter(x => x + 1)| I think it remains very much readable this way.
Comment on attachment 8769146 [details] Bug 1280898 - Set up eslint for calendar files - enable prefer-spread rule. https://reviewboard.mozilla.org/r/63138/#review65232 > Things like that need definitely to be explicitely documented in the style guide. The meaning of ... is not quite obvious by the syntax and if you're not following all the ES6 changes, you're probably wondering what that means. And there's no easy way to search for it on MDN, if don't know what you have to look for. I know this is hard to search for and if we do update the style guide on the wiki I am fine with mentioning this, but otoh Javascript evolves, and if you really want to figure it out you will. If you run mach eslint using .apply() instead, you will get an error "prefer-spread" and can google that rule to figure out what the spread operator is, or you just search for "what is the meaning of three dots javascript".
Comment on attachment 8769266 [details] Bug 1280898 - Set up eslint for calendar files - enable id-length rule. https://reviewboard.mozilla.org/r/63230/#review65244 > something went wrong here. It should be > > month: month + 1, > minute: minute, Thanks for noticing. I found out about the later on, it should be fixed locally. > Can't you spare one set of parentheses here? No, extra parens are needed here since it is an assignment in the while. > this must be ritem. Great catch, I didn't see that, nor did tests. > Shouldn't that also be an arrow function? Not changing this in the id-length patch. Maybe another time or in a later patch. > Please update the param name in the doc block. It would be even better, if you make use of the valid-jsdoc rule. I would love to, but is is a lot of work :) This issue fixed anyway. > Not related to this patch, but this case mixture in the x-prop looks strange. Shouldn't that be all upper case? This is some wcap thing I won't touch. We may even consider moving wcap to an out-of-tree extension to remove some complexity. > Can't you spare a set of parentheses here? I think that would be confusing given the right side is an arrow function.
Comment on attachment 8769267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-case-declarations rule. https://reviewboard.mozilla.org/r/63232/#review65248 I'm not particularly happy about this because I despise the brackets in case statements and only did this one because it makes sense to keep the case declarations local. I do understand the desire to keep it consistent though. I'm taking care of this, reluctantly.
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. https://reviewboard.mozilla.org/r/63102/#review74598 r+ provided you take case of the comments below. I'm fine if do this in a separate patch in this bug on top of all other achnges to avoid bitrotting other patches by that. Most of the comments refer to one pattern you repeatedly use, which makes inappropriate changes. You convert var a = (foo == bar) ? some : thing; to var a = (foo == bar ? some : thing); (appears also for returning instead of assigning a variable). If this is from an auto fix from eslint, the rule should be adapted to avoid this. ::: calendar/base/content/agenda-listbox.js:390 (Diff revision 3) > - return (!compItemDate.isDate || aCompItem.duration.days != 1); > + return !compItemDate.isDate || aCompItem.duration.days != 1; > } else if (aItem.endDate.compare(itemDateEndDate) == 0) { > // ending day of an all-day events spannig multiple days > - return (!compItemDate.isDate || > + return !compItemDate.isDate || > - (aCompItem.duration.days != 1 && > + (aCompItem.duration.days != 1 && > - aCompItem.startDate.compare(compItemDate) != 0)); > + aCompItem.startDate.compare(compItemDate) != 0); reduce the indentation by one here ::: calendar/base/content/calendar-multiday-view.xml:750 (Diff revision 3) > // need to be created for a span. > for (let column of layer) { > let innerColumn = createXULElement("box"); > innerColumn.setAttribute("orient", orient); > > - let colFlex = column.specialSpan ? (columnCount * column.specialSpan) : 1; > + let colFlex = column.specialSpan ? columnCount * column.specialSpan : 1; Can we move columnCount * column.specialSpan to a separate variable here? ::: calendar/base/content/calendar-multiday-view.xml:1316 (Diff revision 3) > lastCol.nextSibling.fgboxes.box.removeAttribute("dragging"); > } > } > > // set shadow boxes size for every part of the occurrence > - let firstShadowSize = (aCurrentShadows == 1) ? aEnd - aStart : this.mEndMin - aStart; > + let firstShadowSize = (aCurrentShadows == 1 ? aEnd - aStart : this.mEndMin - aStart); What is the purpose of this parentheses? As aStart is subtracted anyway here, we probably can just make this let firstShadowSize = aCurrentShadows == 1 ? aEnd : this.mEndMin; firstShadowSize -= aStart; ::: calendar/base/content/calendar-task-tree.xml:195 (Diff revision 3) > let tree = document.getAnonymousNodes(this)[0]; > let treecols = tree.getElementsByTagNameNS(tree.namespaceURI, "treecol"); > for (let i = 0; i < treecols.length; i++) { > if (treecols[i].getAttribute("hidden") != "true") { > let content = treecols[i].getAttribute("itemproperty"); > - visible += (visible.length > 0) ? " " + content : content; > + visible += (visible.length > 0 ? " " + content : content); Again, what is the purpose of the outer parentheses here? This make it worse. I'm still in favour of the previous style, but if you want to get rid of it, please do it completely. Alternately, you can just make it if (visible.length > 0) { content = " " + content; } visible += content; ::: calendar/base/content/calendar-task-tree.xml:245 (Diff revision 3) > let index = tree.currentIndex; > if (tree.view && tree.view.selection) { > // If the current index is not selected, then ignore > index = (tree.view.selection.isSelected(index) ? index : -1); > } > - return (index < 0) ? null : this.mTaskArray[index]; > + return (index < 0 ? null : this.mTaskArray[index]); Once again: remove the embracing parentheses. ::: calendar/base/content/calendar-ui-utils.js:89 (Diff revision 3) > * @param aAttribute The name of the attribute > * @param aValue The boolean value > * @return Returns aValue (for chaining) > */ > function setBooleanAttribute(aXulElement, aAttribute, aValue) { > - setElementValue(aXulElement, (aValue ? "true" : false), aAttribute); > + setElementValue(aXulElement, aValue ? "true" : false, aAttribute); Not related to this change, but this is really an ugly type mixture. Shouldn't that be "false"? ::: calendar/base/content/calendar-view-core.xml:351 (Diff revision 3) > clearTimeout(this.editingTimer); > this.editingTimer = null; > } > > if (this.calendarView && this.calendarView.controller) { > - let item = (event.ctrlKey) ? this.mOccurrence.parentItem : this.mOccurrence; > + let item = (event.ctrlKey ? this.mOccurrence.parentItem : this.mOccurrence); And once again: remove that outer parentheses. ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:246 (Diff revision 3) > // Make the commonName appear in quotes if it contains a > // character that could confuse the header parser > if (cn.search(/[,;<>@]/) != -1) { > cn = '"' + cn + '"'; > } > - inputValue = (inputValue.length) ? cn + ' <' + inputValue + '>' : cn; > + inputValue = (inputValue.length ? cn + ' <' + inputValue + '>' : cn); And again: remove the perentheses here. ::: calendar/base/content/dialogs/calendar-event-dialog-attendees.xml:457 (Diff revision 3) > > <method name="_resolveListByName"> > <parameter name="value"/> > <body><![CDATA[ > let entries = MailServices.headerParser.makeFromDisplayAddress(value); > - return (entries.length) ? this._findListInAddrBooks(entries[0].name) : null; > + return (entries.length ? this._findListInAddrBooks(entries[0].name) : null); Same here: remove the outer parentheses. ::: calendar/base/content/dialogs/calendar-summary-dialog.js:132 (Diff revision 3) > > let role = organizer.role || "REQ-PARTICIPANT"; > let ut = organizer.userType || "INDIVIDUAL"; > let ps = organizer.participationStatus || "NEEDS-ACTION"; > - let orgName = (organizer.commonName && organizer.commonName.length) > - ? organizer.commonName : organizer.toString(); > + let orgName = (organizer.commonName && organizer.commonName.length > + ? organizer.commonName : organizer.toString()); And again: remove the outer parentheses. ::: calendar/base/content/widgets/calendar-widgets.xml:385 (Diff revision 3) > <method name="setVisible"> > <parameter name="aVisible"/> > <parameter name="aPushModeCollapsedAttribute"/> > <parameter name="aNotifyRefControl"/> > <body><![CDATA[ > - let notifyRefControl = ((aNotifyRefControl == null) || (aNotifyRefControl === true)); > + let notifyRefControl = (aNotifyRefControl == null || aNotifyRefControl === true); again: remove the parentheses. ::: calendar/base/modules/calItipUtils.jsm:1032 (Diff revision 3) > let itipItem = Components.classes["@mozilla.org/calendar/itip-item;1"] > .createInstance(Components.interfaces.calIItipItem); > itipItem.init(cal.getSerializedItem(aSendItem)); > itipItem.responseMethod = aMethod; > itipItem.targetCalendar = aSendItem.calendar; > - itipItem.autoResponse = ((autoResponse && autoResponse.value) ? Components.interfaces.calIItipItem.AUTO > + itipItem.autoResponse = (autoResponse && autoResponse.value ? Components.interfaces.calIItipItem.AUTO again: no embracing parentheses ::: calendar/base/src/calIcsParser.js:243 (Diff revision 3) > // In future, maybe make them available through an interface method > // so this UI code can be removed from the parser, and caller can > // choose whether to alert, or show user the problem items and ask > // for fixes, or something else. > - let msg = (calGetString("calendar", "unknownTimezoneInItem", > + let msg = calGetString("calendar", "unknownTimezoneInItem", > [tzid, item.title, cal.getDateFormatter().formatDateTime(dt)]) + reduce the intendation here by one. ::: calendar/base/src/calIcsParser.js:244 (Diff revision 3) > // so this UI code can be removed from the parser, and caller can > // choose whether to alert, or show user the problem items and ask > // for fixes, or something else. > - let msg = (calGetString("calendar", "unknownTimezoneInItem", > + let msg = calGetString("calendar", "unknownTimezoneInItem", > [tzid, item.title, cal.getDateFormatter().formatDateTime(dt)]) + > - "\n" + item.icalString); > + "\n" + item.icalString; align the intendation here with the lines before - this is not a separate argument. ::: calendar/base/src/calItemBase.js:235 (Diff revision 3) > // boolean hasSameIds(in calIItemBase aItem); > hasSameIds: function cIB_hasSameIds(that) { > - return (that && this.id == that.id && > + return that && this.id == that.id && > (this.recurrenceId == that.recurrenceId || // both null > (this.recurrenceId && that.recurrenceId && > - this.recurrenceId.compare(that.recurrenceId) == 0))); > + this.recurrenceId.compare(that.recurrenceId) == 0)); Reduce the indentation for this and the two lines above by one. ::: calendar/import-export/calMonthGridPrinter.js:182 (Diff revision 3) > this.setupWeek(document, weekContainer, weekStart, mainMonth, dayTable); > } > > // Now insert the month into the page container, sorting by date (and therefore by month) > function compareDates(a, b) { > - return (!a || !b) ? -1 : a.compare(b); > + return (!a || !b ? -1 : a.compare(b)); once again: please remove the embracing parentheses. ::: calendar/import-export/calWeekPrinter.js:135 (Diff revision 3) > } > } > > // Now insert the week into the week container, sorting by date (and therefore week number) > function compareDates(a, b) { > - return (!a || !b) ? -1 : a.compare(b); > + return (!a || !b ? -1 : a.compare(b)); and again: please remove the embracing parentheses. ::: calendar/itip/calItipEmailTransport.js:51 (Diff revision 3) > > sendItems: function cietSI(aCount, aRecipients, aItipItem) { > if (this.mHasXpcomMail) { > cal.LOG("sendItems: Sending Email..."); > let items = this._prepareItems(aItipItem); > - return (items === false) > + return (items === false once again: please remove the embracing parentheses - here I would prefer if you make it: if (items === false) { return false; } else { return this._sendXpcomMail(aRecipients, items.subject, items.body, aItipItem); }; ::: calendar/itip/calItipEmailTransport.js:87 (Diff revision 3) > subject = summary; > } else { > let seq = item.getProperty("SEQUENCE"); > - let subjectKey = (seq && seq > 0) > + let subjectKey = (seq && seq > 0 > ? "itipRequestUpdatedSubject" > - : "itipRequestSubject"; > + : "itipRequestSubject"); gaian: please remove the parentheses. ::: calendar/lightning/modules/ltnInvitationUtils.jsm:319 (Diff revision 3) > /** > * Compares both documents for elements related to the given name > * @param {String} aElement part of the element id within the html template > */ > function _compareElement(aElement) { > - let element = (aElement == 'attendee') ? aElement + 's' : aElement; > + let element = (aElement == 'attendee' ? aElement + 's' : aElement); gaian: please remove the parentheses. ::: calendar/resources/content/datetimepickers/datetimepickers.xml:458 (Diff revision 3) > if (date) { > this.update(date, aRefresh); > } else { > // Invalid date, revert to previous date. > - this.kTextBox.value = (this.mValue == "forever") ? this.mForeverStr > - : this.formatDate(this.mValue); > + this.kTextBox.value = (this.mValue == "forever" ? this.mForeverStr > + : this.formatDate(this.mValue)); once again: please remove the parentheses.
Attachment #8769128 - Flags: review?(makemyday) → review+
Comment on attachment 8769267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-case-declarations rule. https://reviewboard.mozilla.org/r/63232/#review74602 r+, although I would have appreciated if we convert switch blocks with effectively one case to an if block to save some indentations. ::: calendar/base/src/calTimezoneService.js:768 (Diff revision 2) > switch (probableTZScore) { > - case 0: > + case 0: { > - cal.WARN(calProperties.GetStringFromName("warningUsingFloatingTZNoMatch")); > + cal.WARN(calProperties.GetStringFromName("warningUsingFloatingTZNoMatch")); > - break; > + break; > - case 1: case 2: > + } > + case 1: case 2: { Can we make this case 1: case 2: {
Attachment #8769267 - Flags: review?(makemyday) → review+
Comment on attachment 8780247 [details] Bug 1280898 - Set up eslint for calendar files - enable indent rule. https://reviewboard.mozilla.org/r/70958/#review74604 r+ with the below comments considered. Most of the mozmill test code still has an inappropriate indenation after this patch, but it should be straight forward to fix this (see comments below). Apart from that, I have the impression that the linter doesn't work properly on JS code in XML files. There are a lot of things that should have been fixed be previous patches from this bug. But maybe this is just because those haven't been updated after review. In any case, we should cross check that once this bug has been fully landed. ::: calendar/base/content/calendar-base-view.xml:49 (Diff revision 1) > <field name="mToggleStatusFlag"><![CDATA[ > ({ > - WorkdaysOnly: 1, > - TasksInView: 2, > + WorkdaysOnly: 1, > + TasksInView: 2, > - ShowCompleted: 4, > + ShowCompleted: 4, > }) The outer parenthesis should be removed here. ::: calendar/base/content/calendar-base-view.xml:59 (Diff revision 1) > - calView: this, > + calView: this, > - observe: function(subj, topic, pref) { > + observe: function(subj, topic, pref) { > - this.calView.handlePreference(subj, topic, pref); > + this.calView.handlePreference(subj, topic, pref); > - return; > + return; > - } > + } > }) The same here. ::: calendar/base/content/calendar-common-sets.js:698 (Diff revision 1) > return calendarController.isCommandEnabled("calendar_delete_focused_item_command"); > case "cmd_fullZoomReduce": > case "cmd_fullZoomEnlarge": > case "cmd_fullZoomReset": > - return calendarController.isInMode("calendar") && > + return calendarController.isInMode("calendar") && > currentView().supportsZoom; Can you please align currentView with calendarController here? ::: calendar/base/content/calendar-item-bindings.xml:32 (Diff revision 1) > class="headline" > xbl:inherits="align"/> > <xul:label anonid="item-datetime-value"/> > </content> > <implementation> > <field name="mItem">null</field> Please remove the trailing whitespace here. ::: calendar/base/content/calendar-menus.xml:129 (Diff revision 1) > <xul:menuitem id="priority-1-menuitem" > type="checkbox" > label="&priority.level.high;" > accesskey="&priority.level.high.accesskey;" > command="calendar_priority-1_command" > observes="calendar_priority-1_command"/> Please align the further attributes with id. This applies also for the three items above. ::: calendar/base/content/calendar-menus.xml:130 (Diff revision 1) > type="checkbox" > label="&priority.level.high;" > accesskey="&priority.level.high.accesskey;" > command="calendar_priority-1_command" > observes="calendar_priority-1_command"/> > <children/> Please remove the trailing whitespaces. ::: calendar/base/content/calendar-multiday-view.xml:2757 (Diff revision 1) > - // No need to animate if the indicator should not be shown. > + // No need to animate if the indicator should not be shown. > - return; > + return; > } > > // Helper function to save some duplicate code > function setFlashingAttribute(aBox) { Did the patch to get rid of the function names didn't consider functions in method definitions in xml files. Can you make this an arrow function assigned to setFlashingAttribute? To avoid additional load on this bug, we should cross check on this once this bug has landed and take care in a follow-up bug. Is there already a follow up bug so we can collect those remaining todos? ::: calendar/base/content/calendar-multiday-view.xml:3720 (Diff revision 1) > > // get the width/height of the scrollbox scrollbar > let scrollbox = document.getAnonymousElementByAttribute( > this, "anonid", "scrollbox"); > let propertyValue = scrollbox.boxObject.firstChild > .boxObject[propertyName]; Can you make this a one line item? ::: calendar/base/content/calendar-statusbar.js:13 (Diff revision 1) > > /** > * This code might change soon if we support Thunderbird's activity manager. > * NOTE: The naming "Meteors" is historical. > */ > - let gCalendarStatusFeedback = { > +let gCalendarStatusFeedback = { Doesn't that need to be var because it's on top level? If so, this probably need to be fixed already in the patch in which you enforce let to braek functionality when landing patches incrementally. ::: calendar/base/content/calendar-task-tree.xml:1191 (Diff revision 1) > <method name="updateFilter"> > <parameter name="aFilter"/> > <body><![CDATA[ > - this.mFilter.selectedDate = agendaListbox.today && agendaListbox.today.start ? > + this.mFilter.selectedDate = agendaListbox.today && agendaListbox.today.start ? > - agendaListbox.today.start : now(); > + agendaListbox.today.start : now(); > I think we can spare that line. ::: calendar/base/content/dialogs/calendar-invitations-list.xml:73 (Diff revision 1) > <field name="mCalendarItem">null</field> > <field name="mInitialParticipationStatus">null</field> > <field name="mParticipationStatus">null</field> > > <property name="mStrings"> > - <getter>return { > + <getter> This should be <getter><![CDATA[ ... ]]></getter> ::: calendar/base/content/widgets/minimonth.xml:1101 (Diff revision 1) > > <method name="selectDate"> > <parameter name="aDate"/> > <parameter name="aMainDate"/> > <body><![CDATA[ > if (!aMainDate || (aDate < this._getStartDate(aMainDate) || aDate > this._getEndDate(aMainDate))) { remove the parentheses with the condition here, it's pointless. ::: calendar/base/modules/calExtract.jsm:713 (Diff revision 1) > this.collected[outer].start && this.collected[outer].end && > this.collected[inner].start && this.collected[inner].end && > this.collected[inner].start >= this.collected[outer].start && > this.collected[inner].end <= this.collected[outer].end && > !(this.collected[inner].start == this.collected[outer].start && > this.collected[inner].end == this.collected[outer].end)) { reduce the indentaion here by two. ::: calendar/base/src/calCalendarManager.js:889 (Diff revision 1) > "readOnly", > "imip.identity.key" > ]; > for (let prop of propsToCopy) { > - newCal.setProperty(prop, > + newCal.setProperty(prop, > - aCalendar.getProperty(prop)); > + aCalendar.getProperty(prop)); we probably can make this better a one line item. ::: calendar/lightning/content/suite-overlay-sidebar.js:24 (Diff revision 1) > - return; > + return; > - } > + } > > - [["CustomizeTaskActionsToolbar", "task-actions-toolbox"], > + [["CustomizeTaskActionsToolbar", "task-actions-toolbox"], > - ["CustomizeCalendarToolbar", "calendar-toolbox"], > + ["CustomizeCalendarToolbar", "calendar-toolbox"], > ["CustomizeTaskToolbar", "task-toolbox"]].forEach((eIDs) => { You're missing to indentation here. To save some space in the following lines, maybe it makes sense to first define a const and apply foreach in a second step. ::: calendar/providers/gdata/content/gdata-list-tree.xml:164 (Diff revision 1) > </method> > > <method name="isContainerEmpty"> > <parameter name="aRow"/> > <body><![CDATA[ > - return ((aRow == this.mCalendarHeaderIndex && > + return ((aRow == this.mCalendarHeaderIndex && Remove the outer parentheses here. ::: calendar/providers/wcap/calWcapCalendar.js:137 (Diff revision 1) > case "itip.disableRevisionChecks": > return true; > case "capabilities.timezones.floating.supported": > case "capabilities.timezones.UTC.supported": > case "capabilities.attachments.supported": > case "capabilities.alarms.popup.supported": // CS cannot store X-props reliably please move this comment to the next line along with the others. ::: calendar/providers/wcap/calWcapCalendarItems.js:1107 (Diff revision 1) > -// if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_DECLINED) > + // if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_DECLINED) > -// compstate += ";REPLY-DECLINED"; > + // compstate += ";REPLY-DECLINED"; > -// if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_ACCEPTED) > + // if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_ACCEPTED) > -// compstate += ";REPLY-ACCEPTED"; > + // compstate += ";REPLY-ACCEPTED"; > -// if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_COMPLETED) > + // if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_COMPLETED) > -// compstate += ";REQUEST-COMPLETED"; > + // compstate += ";REQUEST-COMPLETED"; If this code is not needed, we should remove it instead of commenting it out. ::: calendar/providers/wcap/calWcapCalendarItems.js:1352 (Diff revision 1) > } else if (isParent(item)) { > log("replayChangesOn(): deleted item " + item.id, this); > if (this.offlineStorage) { > this.offlineStorage.deleteItem(item, writeListener); > } > } else { // modify parent instead of please move that comment to the next line. ::: calendar/providers/wcap/calWcapSession.js:427 (Diff revision 1) > } > } > if (err) { > if (checkErrorCode(err, calIErrors.OPERATION_CANCELLED)) { > throw err; > } else { // soft error; request denied etc. again, please move the comment to the next line. ::: calendar/resources/content/datetimepickers/datetimepickers.xml:310 (Diff revision 1) > - // format succeeded, safe to set value > + // format succeeded, safe to set value > - let dateChanged = true; > + let dateChanged = true; > - if (this.valueValid) { > + if (this.valueValid) { > - dateChanged = (this.mValue.getDate() != aValue.getDate()) || > + dateChanged = (this.mValue.getDate() != aValue.getDate()) || > - (this.mValue.getMonth() != aValue.getMonth()) || > + (this.mValue.getMonth() != aValue.getMonth()) || > - (this.mValue.getFullYear() != aValue.getFullYear()); > + (this.mValue.getFullYear() != aValue.getFullYear()); Remove the parentheses around the comparisions here. ::: calendar/resources/content/datetimepickers/datetimepickers.xml:411 (Diff revision 1) > > - <constructor> > + <constructor><![CDATA[ > - <![CDATA[ > - this.mForeverStr = calGetString("calendar-event-dialog", "eventRecurrenceForeverLabel"); > + this.mForeverStr = calGetString("calendar-event-dialog", "eventRecurrenceForeverLabel"); > - document.getAnonymousElementByAttribute(this, "anonid", "menuitemForever") > + document.getAnonymousElementByAttribute(this, "anonid", "menuitemForever") > - .setAttribute("label", this.mForeverStr); > + .setAttribute("label", this.mForeverStr); increase indentation here. ::: calendar/resources/content/datetimepickers/datetimepickers.xml:433 (Diff revision 1) > - if (date) { > + if (date) { > - this.update(date, aRefresh); > + this.update(date, aRefresh); > - } else { > + } else { > - // Invalid date, revert to previous date. > + // Invalid date, revert to previous date. > - this.kTextBox.value = (this.mValue == "forever" ? this.mForeverStr > + this.kTextBox.value = (this.mValue == "forever" ? this.mForeverStr > - : this.formatDate(this.mValue)); > + : this.formatDate(this.mValue)); Remove the embracing parentheses. ::: calendar/test/mozmill/eventDialog/testEventDialog.js:25 (Diff revision 1) > }; > > var testEventDialog = function() { > - // paths > + // paths > - let monthView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let monthView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + Increase the indentaion here - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js:76 (Diff revision 1) > - // create new event > + // create new event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, 8)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, 8)), 1, 1); > - controller.waitFor(() => mozmill.utils.getWindows("Calendar:EventDialog").length > 0, sleep); > + controller.waitFor(() => mozmill.utils.getWindows("Calendar:EventDialog").length > 0, sleep); > - let event = new mozmill.controller.MozMillController(mozmill.utils > + let event = new mozmill.controller.MozMillController(mozmill.utils > - .getWindows("Calendar:EventDialog")[0]); > + .getWindows("Calendar:EventDialog")[0]); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/eventDialog/testUTF8.js:27 (Diff revision 1) > - controller.click(new elementslib.ID(controller.window.document, "calendar-tab-button")); > + controller.click(new elementslib.ID(controller.window.document, "calendar-tab-button")); > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > > - // create new event > + // create new event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, 8))); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, 8))); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testAnnualRecurrence.js:28 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, startYear, 1, 1); > + calUtils.goToDate(controller, startYear, 1, 1); > > - // create yearly recurring all-day event > + // create yearly recurring all-day event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.ALLDAY, undefined, 1, undefined))); > + calUtils.getEventBoxPath(controller, "day", calUtils.ALLDAY, undefined, 1, undefined))); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testBiweeklyRecurrence.js:25 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2009, 1, 31); > + calUtils.goToDate(controller, 2009, 1, 31); > > - // create biweekly event > + // create biweekly event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testDailyRecurrence.js:25 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2009, 1, 1); > + calUtils.goToDate(controller, 2009, 1, 1); > > - // create daily event > + // create daily event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testLastDayOfMonthRecurrence.js:25 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2008, 1, 31); // start with a leap year > + calUtils.goToDate(controller, 2008, 1, 31); // start with a leap year > > - // create monthly recurring event > + // create monthly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testWeeklyNRecurrence.js:26 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2009, 1, 5); > + calUtils.goToDate(controller, 2009, 1, 5); > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testWeeklyUntilRecurrence.js:28 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2009, 1, 5); // Monday > + calUtils.goToDate(controller, 2009, 1, 5); // Monday > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrence/testWeeklyWithExceptionRecurrence.js:27 (Diff revision 1) > - calUtils.switchToView(controller, "day"); > + calUtils.switchToView(controller, "day"); > - calUtils.goToDate(controller, 2009, 1, 5); > + calUtils.goToDate(controller, 2009, 1, 5); > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testAnnualRecurrence.js:33 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create yearly recurring all-day event > + // create yearly recurring all-day event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.ALLDAY, undefined, 1, undefined))); > + calUtils.getEventBoxPath(controller, "day", calUtils.ALLDAY, undefined, 1, undefined))); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testBiweeklyRecurrence.js:32 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create biweekly event > + // create biweekly event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testDailyRecurrence.js:32 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create daily event > + // create daily event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js:32 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create monthly recurring event > + // create monthly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js:33 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js:34 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js:34 (Diff revision 1) > - return view.orient == "horizontal"; > + return view.orient == "horizontal"; > - }); > + }); > > - // create weekly recurring event > + // create weekly recurring event > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, hour)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/shared-modules/calendar-utils.js:153 (Diff revision 1) > * @param day - 1-based index of a day > */ > function goToDate(controller, year, month, day) { > - let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + > - 'id("minimonth-pane")/{"align":"center"}/id("calMinimonthBox")/id("calMinimonth")/'; > + 'id("minimonth-pane")/{"align":"center"}/id("calMinimonthBox")/id("calMinimonth")/'; Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/shared-modules/timezone-utils.js:15 (Diff revision 1) > - prefs.preferences.setPref("calendar.timezone.local", timezone); > + prefs.preferences.setPref("calendar.timezone.local", timezone); > } > > function verify(controller, dates, timezones, times) { > - let dayView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let dayView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/testLocalICS.js:108 (Diff revision 1) > function handleNewCalendarWizard(wizard) { > - let docEl = wizard.window.document.documentElement; > + let docEl = wizard.window.document.documentElement; > > - // choose network calendar > + // choose network calendar > - let remoteOption = new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > + let remoteOption = new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > - '{"pageid":"initialPage"}/id("calendar-type")/{"value":"remote"}'); > + '{"pageid":"initialPage"}/id("calendar-type")/{"value":"remote"}'); We should make this let remoteOption = new elementslib.Lookup( wizard.window.document, '/id("calendar-wizard")/ {"pageid":"initialPage"}/id("calendar-type")/{"value":"remote"}' ); ::: calendar/test/mozmill/testLocalICS.js:115 (Diff revision 1) > - wizard.radio(remoteOption); > + wizard.radio(remoteOption); > - docEl.getButton("next").doCommand(); > + docEl.getButton("next").doCommand(); > > - // choose ical > + // choose ical > - let icalOption = new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > + let icalOption = new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > - '{"pageid":"locationPage"}/[1]/[1]/[0]/id("calendar-format")/{"value":"ics"}'); > + '{"pageid":"locationPage"}/[1]/[1]/[0]/id("calendar-format")/{"value":"ics"}'); The same pattern here. ::: calendar/test/mozmill/testLocalICS.js:122 (Diff revision 1) > - wizard.radio(icalOption); > + wizard.radio(icalOption); > - // enter location > + // enter location > - wizard.type(new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > + wizard.type(new elementslib.Lookup(wizard.window.document, '/id("calendar-wizard")/' + > - '{"pageid":"locationPage"}/[1]/[1]/{"align":"center"}/id("calendar-uri")/' + > + '{"pageid":"locationPage"}/[1]/[1]/{"align":"center"}/id("calendar-uri")/' + > - 'anon({"class":"textbox-input-box"})/anon({"anonid":"input"})'), > + 'anon({"class":"textbox-input-box"})/anon({"anonid":"input"})'), > - uri); > + uri); and here. ::: calendar/test/mozmill/testTodayPane.js:25 (Diff revision 1) > }; > > var testTodayPane = function() { > - // paths > + // paths > - let panels = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let panels = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/'; > + 'id("tabpanelcontainer")/'; Please increase the indentation here and in the following assignments. ::: calendar/test/mozmill/testTodayPane.js:41 (Diff revision 1) > - // open calendar view > + // open calendar view > - controller.click(new elementslib.ID(controller.window.document, "calendar-tab-button")); > + controller.click(new elementslib.ID(controller.window.document, "calendar-tab-button")); > - controller.waitThenClick(new elementslib.ID(controller.window.document, "calendar-day-view-button")); > + controller.waitThenClick(new elementslib.ID(controller.window.document, "calendar-day-view-button")); > > - // go to today and verify date > + // go to today and verify date > - controller.waitThenClick(new elementslib.Lookup(controller.window.document, miniMonth + > + controller.waitThenClick(new elementslib.Lookup(controller.window.document, miniMonth + Insufficient indentaion here. Like in the other test, this should be transformed to controller.waitThenClick(new elementslib.Lookup( controller.window.document, miniMonth + '{"align":"center"}/id("calMinimonthBox")/id("calMinimonth")/' + 'anon({"anonid":"minimonth-header"})/anon({"anonid":"today-button"})' )); This applies also for all other controller actions in this file, so I don't mark them separately. ::: calendar/test/mozmill/testTodayPane.js:240 (Diff revision 1) > > var getIsoDate = function() { > - let date = new Date(); > + let date = new Date(); > - let year = date.getFullYear(); > + let year = date.getFullYear(); > - let month = (date.getMonth() < 9) ? "0" + (date.getMonth() + 1) : (date.getMonth() + 1); > - let day = (date.getDate() < 10) ? "0" + date.getDate() : date.getDate(); > + let month = (date.getMonth() < 9 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1); > + let day = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()); Remove the embracing parentheses here and in the line above. ::: calendar/test/mozmill/timezoneTests/test2.js:28 (Diff revision 1) > > - // create daily recurring events in all timezones > + // create daily recurring events in all timezones > - let time = new Date(); > + let time = new Date(); > - for (let i = 0; i < timezones.length; i++) { > + for (let i = 0; i < timezones.length; i++) { > - controller.doubleClick(new elementslib.Lookup(controller.window.document, > + controller.doubleClick(new elementslib.Lookup(controller.window.document, > - calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, i + 8)), 1, 1); > + calUtils.getEventBoxPath(controller, "day", calUtils.CANVAS_BOX, undefined, 1, i + 8)), 1, 1); For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/views/testDayView.js:23 (Diff revision 1) > var testDayView = function() { > - let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > + let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > - .getService(Components.interfaces.nsIScriptableDateFormat); > + .getService(Components.interfaces.nsIScriptableDateFormat); > - // paths > + // paths > - let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/views/testMonthView.js:23 (Diff revision 1) > var testMonthView = function() { > - let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > + let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > - .getService(Components.interfaces.nsIScriptableDateFormat); > + .getService(Components.interfaces.nsIScriptableDateFormat); > - // paths > + // paths > - let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/views/testMultiweekView.js:23 (Diff revision 1) > var testMultiWeekView = function() { > - let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > + let dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"] > - .getService(Components.interfaces.nsIScriptableDateFormat); > + .getService(Components.interfaces.nsIScriptableDateFormat); > - // paths > + // paths > - let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let miniMonth = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/id("ltnSidebar")/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/views/testTaskView.js:24 (Diff revision 1) > // mozmill doesn't support trees yet, therefore completed checkbox and line-through style are not > // checked > var testTaskView = function() { > - // paths > + // paths > - let taskView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let taskView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/mozmill/views/testWeekView.js:30 (Diff revision 1) > - let weekView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > + let weekView = '/id("messengerWindow")/id("tabmail-container")/id("tabmail")/' + > - 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + > + 'id("tabpanelcontainer")/id("calendarTabPanel")/id("calendarContent")/' + > - 'id("calendarDisplayDeck")/id("calendar-view-box")/id("view-deck")/id("week-view")/'; > + 'id("calendarDisplayDeck")/id("calendar-view-box")/id("view-deck")/id("week-view")/'; > - let eventDialog = '/id("calendar-event-dialog")/id("event-grid")/id("event-grid-rows")/'; > + let eventDialog = '/id("calendar-event-dialog")/id("event-grid")/id("event-grid-rows")/'; > - let eventBox = weekView + 'anon({"anonid":"mainbox"})/anon({"anonid":"scrollbox"})/' + > + let eventBox = weekView + 'anon({"anonid":"mainbox"})/anon({"anonid":"scrollbox"})/' + > - 'anon({"anonid":"daybox"})/[4]/anon({"anonid":"boxstack"})/anon({"anonid":"topbox"})/' + > + 'anon({"anonid":"daybox"})/[4]/anon({"anonid":"boxstack"})/anon({"anonid":"topbox"})/' + Again missing indentation - for this file the above comments on mozmill tests apply as well - I spare further line by line comments here. ::: calendar/test/unit/test_alarmservice.js:202 (Diff revision 1) > > // test multiple alarms on an item > [item, alarm] = createEventWithAlarm(aCalendar, date, date); > [["-PT1H", EXPECT_FIRED], ["-PT15M", EXPECT_FIRED], ["PT1H", EXPECT_TIMER], > ["PT7H", EXPECT_NONE], ["P7D", EXPECT_NONE]].forEach(([offset, expected]) => { > - alarm = createAlarmFromDuration(offset); > + alarm = createAlarmFromDuration(offset); This indenation was ok before, so revert the change here. ::: calendar/test/unit/test_ics.js:27 (Diff revision 1) > id: "20041119T052239Z-1000472-1-5c0746bb-Oracle", > priority: 0, > status: "CONFIRMED" > }, > ics: "BEGIN:VCALENDAR\n" + > "PRODID:-//ORACLE//NONSGML CSDK 9.0.5 - CalDAVServlet 9.0.5//EN\n" + Increase the indenation here make the string parts aligned to each other. ::: calendar/test/unit/test_ics_service.js:51 (Diff revision 1) > "ATTACH;ENCODING=BASE64;FMTTYPE=text/calendar;FILENAME=test.ics:http://example.com/test.ics", > { formatType: "text/calendar", encoding: "BASE64" }, > { FILENAME: "test.ics" }); > equal(attach.uri.spec, "http://example.com/test.ics"); > > checkComp(cal.createAttendee.bind(cal), Move cal.createAttendee.bind(cal) to a new line here. ::: calendar/test/unit/test_ics_service.js:122 (Diff revision 1) > checkProp(svc.createIcalPropertyFromString.bind(svc), > "ATTACH;ENCODING=BASE64;FMTTYPE=text/calendar;FILENAME=test.ics:http://example.com/test.ics", > { value: "http://example.com/test.ics", propertyName: "ATTACH" }, > { ENCODING: "BASE64", FMTTYPE: "text/calendar", FILENAME: "test.ics" }); > > checkProp(svc.createIcalPropertyFromString.bind(svc), Either move svc.createIcalPropertyFromString.bind(svc) to a new line here and apply the same pattern to the checkProp above or leave it with the previous indenation here.
Attachment #8780247 - Flags: review?(makemyday) → review+
Now, that this is the last patch in my queue for this bug, that hadn't been reviewed, I would like to encourage you to get fully landed this bug within the next week or two. We probably should try to stop landing patches for that period to limit the effort for debitrotting these patches, but we shouldn't do for longer given that there's not too much time left before 5.4 will move to Aurora. If that is not achivable, we should consider to move that to the next cycle, even if this means to start this work once again. What do you think?
Flags: needinfo?(philipp)
Comment on attachment 8765235 [details] Bug 1280898 - Set up eslint for calendar files - initial rules and minimal automatic fixes. https://reviewboard.mozilla.org/r/60668/#review74608 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765235 - Flags: review?(makemyday) → review+
Comment on attachment 8765236 [details] Bug 1280898 - Set up eslint for calendar files - enable block-scoped-var rule. https://reviewboard.mozilla.org/r/60670/#review74610 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765236 - Flags: review?(makemyday) → review+
Comment on attachment 8765237 [details] Bug 1280898 - Set up eslint for calendar files - enable comma-dangle,comma-spacing,comma-style rules. https://reviewboard.mozilla.org/r/60672/#review74612 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765237 - Flags: review?(makemyday) → review+
Comment on attachment 8765238 [details] Bug 1280898 - Set up eslint for calendar files - enable curly rule. https://reviewboard.mozilla.org/r/60674/#review74614 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765238 - Flags: review?(makemyday) → review+
Comment on attachment 8765239 [details] Bug 1280898 - Set up eslint for calendar files - enable new-parens,no-array-constructor rule. https://reviewboard.mozilla.org/r/60676/#review74616 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765239 - Flags: review?(makemyday) → review+
Comment on attachment 8765240 [details] Bug 1280898 - Set up eslint for calendar files - enable no-catch-shadow rule. https://reviewboard.mozilla.org/r/60678/#review74618 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765240 - Flags: review?(makemyday) → review+
Comment on attachment 8765241 [details] Bug 1280898 - Set up eslint for calendar files - enable no-cond-assign rule. https://reviewboard.mozilla.org/r/60680/#review74620 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765241 - Flags: review?(makemyday) → review+
Comment on attachment 8765242 [details] Bug 1280898 - Set up eslint for calendar files - enable no-debugger rule. https://reviewboard.mozilla.org/r/60682/#review74622 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765242 - Flags: review?(makemyday) → review+
Comment on attachment 8765243 [details] Bug 1280898 - Set up eslint for calendar files - enable yoda rule. https://reviewboard.mozilla.org/r/60684/#review74624 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765243 - Flags: review?(makemyday) → review+
Comment on attachment 8765244 [details] Bug 1280898 - Set up eslint for calendar files - enable no-new-object rule. https://reviewboard.mozilla.org/r/60686/#review74626 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765244 - Flags: review?(makemyday) → review+
Comment on attachment 8765245 [details] Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. https://reviewboard.mozilla.org/r/60688/#review74628 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765245 - Flags: review?(makemyday) → review+
Comment on attachment 8765246 [details] Bug 1280898 - Set up eslint for calendar files - enable radix rule. https://reviewboard.mozilla.org/r/60690/#review74630 Setting r+ once based on previously granted r+ to get this out of my bmo review queue.
Attachment #8765246 - Flags: review?(makemyday) → review+
First few batches of pushes: https://hg.mozilla.org/comm-central/rev/b1be8f5e02be - initial rules and minimal automatic fixes https://hg.mozilla.org/comm-central/rev/236b9899c452 - enable block-scoped-var rule https://hg.mozilla.org/comm-central/rev/d56d63967713 - enable comma-dangle,comma-spacing,comma-style rules https://hg.mozilla.org/comm-central/rev/505ce0057efd - enable curly rule https://hg.mozilla.org/comm-central/rev/4d3dd4462739 - enable key-spacing rule https://hg.mozilla.org/comm-central/rev/8a5d2bba2e62 - enable new-parens,no-array-constructor rule https://hg.mozilla.org/comm-central/rev/4c4b09ab1aba - enable no-catch-shadow rule https://hg.mozilla.org/comm-central/rev/2aef50e1aa9d - enable no-cond-assign rule https://hg.mozilla.org/comm-central/rev/d3828809e827 - enable no-debugger rule https://hg.mozilla.org/comm-central/rev/12f82fc35c28 - enable yoda rule https://hg.mozilla.org/comm-central/rev/239f769da6b3 - enable no-new-object rule (accidentally pushed these without changing r? to r=) https://hg.mozilla.org/comm-central/rev/7b2fedd2dee9 - enable spaced-comment rule https://hg.mozilla.org/comm-central/rev/d4ec82bf6586 - enable radix rule https://hg.mozilla.org/comm-central/rev/7f270a7f4b6f - enable space-unary-ops rule https://hg.mozilla.org/comm-central/rev/c2c1106c90a8 - enable semi-spacing rule https://hg.mozilla.org/comm-central/rev/caff8e7186a8 - enable no-unneeded-ternary rule https://hg.mozilla.org/comm-central/rev/bd2023dedb86 - enable no-multi-spaces rule https://hg.mozilla.org/comm-central/rev/aa60248fbd50 - (almost) enable space-infix-ops rule https://hg.mozilla.org/comm-central/rev/eb767f75b68d - enable keyword-spacing rule. r=MakeMyDay https://hg.mozilla.org/comm-central/rev/86e89f2ac31f - enable no-spaced-func rule. r=MakeMyDay https://hg.mozilla.org/comm-central/rev/0ead2b008b01 - enable no-shadow-restricted-names rule. r=MakeMyDay https://hg.mozilla.org/comm-central/rev/8e11c757437b - enable no-sequences rule. r=MakeMyDay https://hg.mozilla.org/comm-central/rev/4b47cfc70df3 - enable no-return-assign rule. r=MakeMyDay and that is about all the energy I have this evening. I've tested mozmill/xpcshell for each of these pushes. Tinderbox builds will help us if something is broken.
Flags: needinfo?(philipp)
Sorry, one push failed to compile due to bug 1272893 which had M-C and C-C parts. You pushed while the M-C part had landed, but not the C-C part. My push afterwards should have fixed that.
Oh, lucky me ;-) Thanks for the heads up and for landing the c-c patch. Looks like everything is in order again now.
Next batch of landings: https://hg.mozilla.org/comm-central/rev/a7312b12f00f - enable padded-blocks rule https://hg.mozilla.org/comm-central/rev/332b96ae958e - enable brace-style rule https://hg.mozilla.org/comm-central/rev/d67d30c8c222 - enable space-in-parens rule https://hg.mozilla.org/comm-central/rev/f3dc3e4a87d4 - enable space-before-function-paren rule https://hg.mozilla.org/comm-central/rev/626c889fd092 - enable no-unreachable rule https://hg.mozilla.org/comm-central/rev/42fb631fc841 - enable semi rule https://hg.mozilla.org/comm-central/rev/305102c9bedd - enable no-empty rule https://hg.mozilla.org/comm-central/rev/fd02e757b142 - enable no-shadow and no-redeclare rule https://hg.mozilla.org/comm-central/rev/7063147fed66 - enable var-only-toplevel rule https://hg.mozilla.org/comm-central/rev/377282fc615d - enable no-unused-vars rule https://hg.mozilla.org/comm-central/rev/377282fc615d - enable no-unused-vars rule https://hg.mozilla.org/comm-central/rev/096b191f8462 - enable object-curly-spacing rule https://hg.mozilla.org/comm-central/rev/553bba9bac61 - enable various working rule https://hg.mozilla.org/comm-central/rev/c764e438746e - enable array-bracket-spacing rule https://hg.mozilla.org/comm-central/rev/3e5200802c51 - enable no-unused-expressions rule https://hg.mozilla.org/comm-central/rev/ef04fc4b8a5b - enable no-inner-declarations rule https://hg.mozilla.org/comm-central/rev/64dbe94fb4c8 - enable dot-location rule https://hg.mozilla.org/comm-central/rev/ae8573bfa22a - enable no-caller rule https://hg.mozilla.org/comm-central/rev/8af7d1e8ec53 - enable no-fallthrough rule https://hg.mozilla.org/comm-central/rev/622481dcc6bb - enable no-floating-decimal rule https://hg.mozilla.org/comm-central/rev/c4a3561ecc3f - enable space-before-blocks rule
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. https://reviewboard.mozilla.org/r/63102/#review74598 No, this was actually on purpose, I prefer putting them around the whole expression and find the parens around the condition slightly confusing. I'm not yet sure how to resolve this, I'll think about it. > Can we move columnCount * column.specialSpan to a separate variable here? I think it looks fine as is, no need for an extra variable. > Not related to this change, but this is really an ugly type mixture. Shouldn't that be "false"? setElementValue is special. false means to remove the attribute, "false" means set it to false. It is magic, and I agree it is a tad confusing. > align the intendation here with the lines before - this is not a separate argument. Threw in an extra variable and shifted the concat around, should look better now.
Do you really need so many pushes for this? Can't you push it all at once. It's all JS changes, so it doesn't need to be recompiled.
Yes, as many separate pushes as possible are intended here to be able to limit potential regressions of these patches based on tinderbox builds.
(In reply to Philipp Kewisch [:Fallen] from comment #423) > > No, this was actually on purpose, I prefer putting them around the whole > expression and find the parens around the condition slightly confusing. I'm > not yet sure how to resolve this, I'll think about it. This is something we definitely want to avoid - we had another rule to explicitely get rid of the pointless surrounding parentheses earlier. Thanks for starting to land this stuff, btw.
Comment on attachment 8769128 [details] Bug 1280898 - Set up eslint for calendar files - (almost) enable no-extra-parens rule. https://reviewboard.mozilla.org/r/63102/#review74598 > What is the purpose of this parentheses? As aStart is subtracted anyway here, we probably can just make this > > let firstShadowSize = aCurrentShadows == 1 ? aEnd : this.mEndMin; > firstShadowSize -= aStart; I went for let firstShadowSize = (aCurrentShadows == 1 ? aEnd : this.mEndMin) - aStart; (where the parens actually make sense) > Again, what is the purpose of the outer parentheses here? This make it worse. I'm still in favour of the previous style, but if you want to get rid of it, please do it completely. > > Alternately, you can just make it > > if (visible.length > 0) { > content = " " + content; > } > visible += content; I went for removing the parens in most cases, unless the condition is more complex > And again: remove the outer parentheses. Reverted this one since the condition is harder to read.
Comment on attachment 8769267 [details] Bug 1280898 - Set up eslint for calendar files - enable no-case-declarations rule. https://reviewboard.mozilla.org/r/63232/#review74602 I believe most such single-case blocks are in places where enumerations are used, I think it makes sense there. I'd rather keep it as is for now.
Comment on attachment 8780247 [details] Bug 1280898 - Set up eslint for calendar files - enable indent rule. https://reviewboard.mozilla.org/r/70958/#review74604 I will split out all the mozmill changes into a separate bug, since I made more than just a few indent changes. I'll leave the mozmill changes as they were before for this patch. The comments below on mozmill are relevant for that bug and can be ignored here. > The outer parenthesis should be removed here. Removing the outer parens here triggers a bug in the xml binding. Unfortunately we have to keep them here for fields to work. > Please remove the trailing whitespace here. eslint doesn't catch this kind of error. What they do for xml files is use a (mozilla-written) preprocessor that turns it into JS, which eslint processes normally. The only thing that is retained is the "null" part. Anyway, issue fixed. > Please align the further attributes with id. This applies also for the three items above. Done, issues not caught for the same reason. > Did the patch to get rid of the function names didn't consider functions in method definitions in xml files. > > Can you make this an arrow function assigned to setFlashingAttribute? > > To avoid additional load on this bug, we should cross check on this once this bug has landed and take care in a follow-up bug. Is there already a follow up bug so we can collect those remaining todos? The function itself is fine, aside from the fact that strict mode like them at the top. The rule that exists removes function names in cases where it is not needed, e.g. in an object, { foo: function foo() {} } I've decided to move the function toplevel here, I think it looks better than the let assignment. > Doesn't that need to be var because it's on top level? If so, this probably need to be fixed already in the patch in which you enforce let to braek functionality when landing patches incrementally. var-only-toplevel means var cannot be used within functions and other non-toplevel scope, but it doesn't mean let on toplevel is disallowed. let on toplevel is supposed to not create a property on the global object, which seems to not work as described. I'm changing this to var. > This should be > > <getter><![CDATA[ > ... > ]]></getter> This is actually not a CDATA block on purpose, since the body contains entities that should be expanded. > You're missing to indentation here. To save some space in the following lines, maybe it makes sense to first define a const and apply foreach in a second step. Done, also did some destructuring to save the first let line. > Remove the outer parentheses here. Fixed. Also found a typo here, but will do that in a separate changeset. > If this code is not needed, we should remove it instead of commenting it out. I'd rather leave this as is, maybe it is actually useful for the few devs still using WCAP. We should also consider moving WCAP to a non-tree extension and finding a maintainer for it (in a different bug) > For this file the above comments on mozmill tests apply as well - I spare further line by line comments here. For this and all other files I went with increasing all 6 space indent to 8 space. There were a few situations where I manually aligned the lines with the start of the function parameters, but I don't think it looks much better this way. > We should make this > > let remoteOption = new elementslib.Lookup( > wizard.window.document, > '/id("calendar-wizard")/ {"pageid":"initialPage"}/id("calendar-type")/{"value":"remote"}' > ); I'm not very happy about the indent and wrapping in the mozmill files, but I'm not going to change everything here. Ideally I'd like to: let lookup = (sel) => new elementsLib.Lookup(wizard.window.document, sel); ... let remoteOption = lookup('/id("calendar-wizard")/{"pageid":"initialPage"}/id("calendar-type")/{"value":"remote"}'); or maybe even take rest params and join on slash. I've made the change as you mentioned for now. > and here. Did this one too, but kept the string concat because the line is so long. > Move cal.createAttendee.bind(cal) to a new line here. I don't find this useful, I'd prefer keeping it on the function line. I've modified all checkComp to look the same now.
https://hg.mozilla.org/comm-central/rev/12957589835a - enable operator-linebreak rule https://hg.mozilla.org/comm-central/rev/9bb63b34413f - (almost) enable no-extra-parens rule https://hg.mozilla.org/comm-central/rev/3d474ac6379c - enable quotes rule https://hg.mozilla.org/comm-central/rev/ff506e40c3a2 - enable no-lonely-if rule https://hg.mozilla.org/comm-central/rev/2f2abb3fd4c9 - enable no-multiple-empty-lines rule https://hg.mozilla.org/comm-central/rev/3795d24fc794 - enable accessor-pairs rule https://hg.mozilla.org/comm-central/rev/7e687a2148fe - enable block-spacing rule https://hg.mozilla.org/comm-central/rev/a404e55737c5 - enable computed-property-spacing rule https://hg.mozilla.org/comm-central/rev/34e6d6fe6fb7 - enable consistent-this and no-useless-call rule https://hg.mozilla.org/comm-central/rev/a53c49ed8ab3 - enable dot-notation rule https://hg.mozilla.org/comm-central/rev/5e136b6a5e3e - enable func-names rule https://hg.mozilla.org/comm-central/rev/289338a394d3 - enable object-property-newline rule https://hg.mozilla.org/comm-central/rev/eb06da45670c - enable object-curly-newline rule https://hg.mozilla.org/comm-central/rev/a67fcf52bf1f - enable no-whitespace-before-property rule https://hg.mozilla.org/comm-central/rev/54ba39e11001 - enable no-useless-escape rule https://hg.mozilla.org/comm-central/rev/f9a68cf569d3 - enable no-mixed-operators rule https://hg.mozilla.org/comm-central/rev/aa2a09835126 - enable no-useless-concat rule https://hg.mozilla.org/comm-central/rev/d0755bd52da8 - enable no-unmodified-loop-condition rule https://hg.mozilla.org/comm-central/rev/e6a3cd0ad1e0 - enable prefer-arrow-callback rule https://hg.mozilla.org/comm-central/rev/b5c1c8200552 - enable prefer-spread rule https://hg.mozilla.org/comm-central/rev/69ec77254bf4 - enable quote-props rule https://hg.mozilla.org/comm-central/rev/b4abc816a8b4 - enable no-negated-condition rule https://hg.mozilla.org/comm-central/rev/0f801095088a - enable max-statements-per-line rule https://hg.mozilla.org/comm-central/rev/64c067e440d6 - enable no-confusing-arrow and no-this-before-super rule https://hg.mozilla.org/comm-central/rev/0f9a99fba7f3 - enable no-lone-blocks rule https://hg.mozilla.org/comm-central/rev/311e2a727825 - enable id-length rule https://hg.mozilla.org/comm-central/rev/880d5e4d567c - enable no-case-declarations rule https://hg.mozilla.org/comm-central/rev/2d001923cb98 - enable indent rule and that concludes the checkins for this bug! That you for all the hard and tiring work in getting this landed. We've paved the way to keeping calendar code clean, I think this is a great win! I'll have to go through and find the followup bugs tomorrow, please go ahead and file any you may have in mind. I know there are some followup bugs in mach eslint for me to take care of before you can sensibly run it, right now I am testing with eslint without mach and the plugin manually installed globally. I can imagine we have also set the record for the calendar bug with most comments.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Depends on: 1303606
Target Milestone: --- → 5.3
Depends on: 1303619
Depends on: 1303626
Depends on: 1298879
Depends on: 1304102
Depends on: 1304881
Depends on: 1309199
Depends on: 1309883
Depends on: 1331265
Depends on: 1355007
Depends on: 1373308
Depends on: 1384587
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: