krakenjs/nemo

Things that I think we can improve upon in code.

sainianubhav opened this issue · 1 comments

  1. Capitalize required or otherwise names, when new is required. e.g Glob in flow.js should be glob.
  2. If a name clashes with exported function, e.g.glob (required library) will clash with glob(); we should name imported variable xlib or xLib, e.g. globlib or globLib.
  3. Exports shuold be consistent. There are at least three ways we are exporting functions. Suggestion below.
  4. Convert promise based code to async/await one.
  5. Not using const x = function x(){} code structure. I am not sure if it helps. If anything, ESlint rules need tweaking to allow const to return value. Not every function needs to be function(){}.

Consistent Exports

function x() {

}

const y = Math.PI * 22/7;

module.exports = {
    x,
    y
};
grawk commented

Hi @sainianubhav. Thanks for the suggestions. We appreciate additional 👀 on the code. Perhaps it would make sense to capture this (and any other stylistic issues) in a style guide? I'm definitely open to a PR which includes a new markdown doc to that effect. Or, a global style guide for all "nemo" related modules could be added to https://github.com/paypal/nemo-docs ?