Convert some more code in js/views/ to ES6.

Review Request #8779 — Created Feb. 24, 2017 and submitted

Information

Review Board
release-3.0.x
d9514fb...

Reviewers

Everything in here is a straightforward syntax clean-up, with no functional
changes.

Ran js-tests.

Description From Last Updated

No closing </li>?

brenniebrennie

These are all defined on each loop, but never change. Let's pull them out, so we're not looking up localized …

chipx86chipx86

Let's update this to use .listenTo.

chipx86chipx86

Should we just rip this out? Or is this included for _super() prototype reasons, where otherwise we would run into …

brenniebrennie

Can we use .listenTo here?

chipx86chipx86

.listenTo

chipx86chipx86

Single quotes.

brenniebrennie

This could probably be one statement now.

chipx86chipx86

This still hoists to top of scope. We can do const showCommentDlg = function showCommentDlg() { ... } to avoid …

brenniebrennie

.listenTo

chipx86chipx86

.listenTo

chipx86chipx86

We only ever need to compute this once, so we could put it as a constant on the class or …

brenniebrennie

We only ever need to compute this once, so we could put it as a constant on the class or …

brenniebrennie

We only ever need to compute this once, so we could put it as a constant on the class or …

brenniebrennie

We only ever need to compute this once, so we could put it as a constant on the class or …

brenniebrennie

Col: 10 Missing semicolon.

reviewbotreviewbot

This doesn't align with the if above.

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/draftReviewBannerView.es6.js
        reviewboard/static/rb/js/views/collectionView.es6.js
        reviewboard/static/rb/js/views/commentDialogView.es6.js
        reviewboard/static/rb/js/views/commentIssueBarView.es6.js
        reviewboard/static/rb/js/views/fileAttachmentRevisionLabelView.es6.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/draftReviewBannerView.es6.js
        reviewboard/static/rb/js/views/collectionView.es6.js
        reviewboard/static/rb/js/views/commentDialogView.es6.js
        reviewboard/static/rb/js/views/commentIssueBarView.es6.js
        reviewboard/static/rb/js/views/fileAttachmentRevisionLabelView.es6.js
    
    
  2. 
      
brennie
  1. 
      
  2. Show all issues

    No closing </li>?

  3. reviewboard/static/rb/js/views/commentDialogView.es6.js (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Should we just rip this out?

    Or is this included for _super() prototype reasons, where otherwise we would run into infinite loops?

  4. Show all issues

    Single quotes.

  5. Show all issues

    This still hoists to top of scope. We can do const showCommentDlg = function showCommentDlg() { ... } to avoid hoisting and to keep the function name in stack traces, which is valuable.

  6. 
      
chipx86
  1. 
      
  2. Show all issues

    These are all defined on each loop, but never change. Let's pull them out, so we're not looking up localized strings more than we need to (the slowest part of this).

  3. Show all issues

    Let's update this to use .listenTo.

  4. Show all issues

    Can we use .listenTo here?

  5. Show all issues

    .listenTo

  6. Show all issues

    This could probably be one statement now.

    1. It can't, because $commentsList is used within the height calculation.

  7. Show all issues

    .listenTo

  8. Show all issues

    .listenTo

  9. 
      
david
Review request changed
Commit:
cdf6e03d898ad07baf81211156ee29b524a8bd62
07d85b90a8f8724924d8ca431e6cda0b235e52d4

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint failed.
PEP8 Style Checker internal error.
Pyflakes passed.

JSHint

brennie
  1. 
      
  2. Show all issues

    We only ever need to compute this once, so we could put it as a constant on the class or as a toplevel constant.

  3. Show all issues

    We only ever need to compute this once, so we could put it as a constant on the class or as a toplevel constant.

  4. Show all issues

    We only ever need to compute this once, so we could put it as a constant on the class or as a toplevel constant.

  5. Show all issues

    We only ever need to compute this once, so we could put it as a constant on the class or as a toplevel constant.

  6. Show all issues

    This doesn't align with the if above.

  7. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (01aa568)