• 
      

    Update server-side code to be more es6-ey

    Review Request #9541 — Created Jan. 26, 2018 and submitted

    Information

    student-sonar
    master
    4d18c72...

    Reviewers

    This change changes the server-side code in Sonar to use ES6 modules and
    more idiomatic and consistent syntax. The only thing left that's still
    using module.exports is lib/schema, which manipulates the exports at
    runtime (something ES6 modules can't do). A future refactor will address
    this.

    As part of this, I've updated the aws-sdk and memjs dependencies to
    get newer versions which support promises. This allows us to move
    entirely over to native promises, eliminating the Q library.

    Went through the various functionality of the server and verified that
    things work as expected.

    Description From Last Updated

    Col: 19 Missing 'new' prefix when invoking a constructor.

    reviewbotreviewbot

    Col: 25 Missing 'new' prefix when invoking a constructor.

    reviewbotreviewbot

    Col: 19 Missing 'new' prefix when invoking a constructor.

    reviewbotreviewbot

    Col: 19 Missing 'new' prefix when invoking a constructor.

    reviewbotreviewbot

    Col: 8 'https' is defined but never used.

    reviewbotreviewbot

    export default ? Your description says module.exports is only required for lib/schema. (Same below).

    brenniebrennie

    Is this a constructor (I see this.memoize). If so, why not use a class?

    brenniebrennie

    export default ?

    brenniebrennie

    export function init(mongoose) over module.exports ?

    brenniebrennie

    Is this a constructor? Why not use a class here?

    brenniebrennie
    Checks run (1 failed, 1 succeeded)
    flake8 passed.
    JSHint failed.

    JSHint

    david
    brennie
    1. 
        
    2. lib/api.js (Diff revision 2)
       
       
      Show all issues

      export default ? Your description says module.exports is only required for lib/schema. (Same below).

    3. lib/cache.js (Diff revision 2)
       
       
      Show all issues

      Is this a constructor (I see this.memoize). If so, why not use a class?

      1. It is a constructor. I theoretically could use a class but I want to think more about the server architecture so for now I don't want to touch it too much.

    4. lib/routes.js (Diff revision 2)
       
       
      Show all issues

      export default ?

    5. lib/schema.js (Diff revision 2)
       
       
      Show all issues

      export function init(mongoose) over module.exports ?

      1. This is the one that definitely can't.

    6. lib/slack.js (Diff revision 2)
       
       
      Show all issues

      Is this a constructor? Why not use a class here?

    7. 
        
    david
    brennie
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (22c2b70)