ES6 migrations
See original GitHub issueThis 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)
- In that note, use Object destructuring to import required components as needed
- Use you might not need lodash but don’t go overboard
- 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:
- Created 5 years ago
- Reactions:8
- Comments:57 (45 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.