question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This is something ~I plan on working on in the middle of May~ a bunch of people are helping out on! 😄

  • var -> let / const
  • _.includes(array) -> array.includes (dropping v4 support at the end of April makes this possible)
  • _.each(array) -> array.forEach
  • _.isArray(array) -> Array.isArray(array) - Only if it removes the necessity of requiring lodash in a specific file
  • _.isEmpty(array) -> array.length === 0 (or !array.length)
  • Remove other lodash dependencies as needed on a file-specific basis (the goal isn’t to purge lodash, it’s to reduce unnecessary requires of the large library)
  • remove usage of var self = this (arrow functions instead)
  • Use defaults (I’m not sure if this is applicable) (i.e. (a = 2, b = 2) => a + b)
  • Use template literals when possible

Checklist:

  • Arrow functions do not replace named functions
  • var -> const / let
  • Array.(includes / each / isEmpty / isArray) lodash usage minimized
  • Template literals
  • Import specific lodash modules instead of entire library

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:57 (45 by maintainers)

github_iconTop GitHub Comments

3reactions
kevinansfieldcommented, Jun 6, 2018

FYI, for anyone working on this there are numerous codemods available to automate a lot of the es6 transformation work. This article is a nice introduction to codemods https://medium.com/airbnb-engineering/turbocharged-javascript-refactoring-with-codemods-b0cae8b326b9

3reactions
kirrg001commented, Apr 30, 2018

FYI: We also have a couple of dependencies, which would need an ES6 update. I am not sure how much ES6 updates are required, but worth double checking.

e.g.

Let me know if you are interested in helping out there as well 🤠


Regarding the ES6 updates in Ghost. Dynamic routing was not merged yet and i would love to wait with the ES6 updates till then. As said, i’ll let you know, when you can start with ES6 PR’s for Ghost.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequelize - run migration with es6 and modules - Stack Overflow
So now I am trying to add a field to a model using the migration tool. I created the migration file in the...
Read more >
Snapshot-Based Migration of ES6 JavaScript | SpringerLink
In this paper, we analyze ES6 features such as block scopes, modules, and class syntax that were previously uncovered in app migration.
Read more >
es6-migrate - npm
es6 -migrate. JavaScript Style Guide Build Status. Convert AMD CoffeeScript to ES6 JavaScript. Tasks performed:.
Read more >
Migrations | Sequelize
With migrations you can transfer your existing database into another state and vice versa: Those state transitions are saved in migration files, ...
Read more >
Sequelize cli with ES6 - gists · GitHub
BTW it works like magic and I can't yet understand how it works, this is the first real method that lets me do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found