Giter VIP home page Giter VIP logo

Comments (5)

jimmynotjim avatar jimmynotjim commented on June 26, 2024

This is a pretty good read on arrow functions and I can get behind the How Much Use Is There for Arrow Functions? section (it also happens to match with how we've used them so far).

https://www.sitepoint.com/es6-arrow-functions-new-fat-concise-syntax-javascript/

from development.

mistergone avatar mistergone commented on June 26, 2024

Arrow Functions

It'd be cool if we could use them everywhere they outline in @jimmynotjim 's link above, but I think it makes sense that we consider this a transition period, since we're still writing ES5 in most places (right?), which means "I think we can encourage it without making it a must-do for now."

I'm more interested in pushing for us to use class for functions which are class objects, which I think actually makes code clearer. I'm torn on whether => makes code clearer or not (when applied in the "use it everywhere else" way described in the article). I do think they make code cleaner when used in callbacks of other functions, however.

But...

As mentioned in the original post, I'm not sure where and when we're using ES6.

from development.

anselmbradford avatar anselmbradford commented on June 26, 2024

We chatted about constants in mattermost 11/8 and I added:

I would generally view the ALL_CAPS as being for simple concrete values that get passed around in a program and wouldn't make sense to replace with var, like const NUM_OF_PLANETS = 8.
I would avoid caps for complex objects or at least consider that carefully, since those can be changed. So for imported modules I would const gulp = require( 'gulp' ); or creating instances, const notification = new Notification(). Also, a local variable within a method, where it would work fine as a var too, I would probably leave it without caps:

function thisDoesGreatStuff() {
  const msg = 'it worked';
  return msg;
}

In the above msg could easily be marked as var, it's just an efficiency thing (I presume) internally that it's const, but it's not a concrete value that's passed around, it's just used in that single method.
Anyway, that's loosy goosy guidance not really backed up but much more than my coding preferences.

I realize I'm violating that in const COMMON_UGLIFY_CONFIG = new UglifyWebpackPlugin(…) too

But the intention there is the UglifyWebpackPlugin instance is not to be modified or have its methods accessed after it is created

from development.

cfarm avatar cfarm commented on June 26, 2024

what @mistergone said

As mentioned in the original post, I'm not sure where and when we're using ES6.

would be cool if folks who've written es6 can post links to the code here so we can see what we're working with. for example i know cfgov-refresh uses es6 in gulp tasks:

https://github.com/cfpb/cfgov-refresh/tree/master/gulp/tasks

from development.

jimmynotjim avatar jimmynotjim commented on June 26, 2024

Completed in #177

from development.

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.