Giter Club home page Giter Club logo

Comments (7)

NickColley avatar NickColley commented on July 17, 2024 2

In terms of actual style, I'd propose that we use the more immutable functional methods for data manipulation where possible.

Making use of ES5 .map() .filter() .reduce() .concat() .

Related:

from gds-way.

maxf avatar maxf commented on July 17, 2024 1

And voila: #119
Readable version: https://gist.github.com/maxf/b6ae33e35eb56e58df40d51a8759470a

from gds-way.

NickColley avatar NickColley commented on July 17, 2024

Not a comment about what style of JavaScript we recommend but a proposal for the upper limit of new JavaScript features we support.

I'd propose the following:

This means avoiding transpiling entirely, and use only features natively available.

See https://zeit.co/blog/next#data-fetching-is-up-to-the-developer

"Our stance of what features we transpile (like async/await) can be summed up as: we target V8's capabilities. Since our goal is code-sharing between server and client, this gives us great performance when executing the code on Node and developing on Chrome or Brave, for example."

from gds-way.

jonheslop avatar jonheslop commented on July 17, 2024

We definitely need to expand the Node.js style guide to have a section on preferred JavaScript coding styles.

@Nooshu shared this link to a repo of best practices a couple of weeks back and we could just wholesale appropriate a lot of it as our own opinions.

We could enforce these opinions with an even more opinionated linter than Standard such as xo.

For instance xo prefers const over var (unless a let is appropriate) and also => vs function.

Right now on Pay we’re still on node 6.11.12 so we’re not doing any async/await stuff so I dunno what we’d say about that stuff.

from gds-way.

maxcbc avatar maxcbc commented on July 17, 2024

I can't find the article now, it was by Google or Mozilla.
But their argument for writing async/await was that they intend to optimise the implementation heavily in future so while it may be slower now, in future it will be the fastest way to handle async.

from gds-way.

maxf avatar maxf commented on July 17, 2024

I think I'll try and write something up, maybe during the next firebreak.

from gds-way.

danielroseman avatar danielroseman commented on July 17, 2024

Max's PR was merged, closing.

from gds-way.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.