blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Move codebase to ES6

Open jankapunkt opened this issue 3 years ago • 15 comments

This would be a big task but I think there will be lots of benefits in terms of code-readability (especially with template-literals) and a few performance improvements either.

This could be also distributed to PR-per-package:

  • [ ] blaze
  • [ ] blaze-tools
  • [x] caching-html-compiler (PR: https://github.com/meteor/blaze/pull/390)
  • [ ] html-tools (PR: https://github.com/meteor/blaze/pull/385)
  • [ ] htmljs (PR: https://github.com/meteor/blaze/pull/385)
  • [ ] observe-sequence
  • [ ] spacebars
  • [ ] spacebars-compiler
  • [ ] spacebars-tests
  • [x] templating-compiler (PR: https://github.com/meteor/blaze/pull/389)
  • [ ] templating-runtime
  • [ ] templating-tools
  • [x] ui (PR: https://github.com/meteor/blaze/pull/391)

In an optimum there would be no changes to the functionality at all.

  • [x] PR for adding a linter: https://github.com/meteor/blaze/pull/382

jankapunkt avatar Apr 14 '22 07:04 jankapunkt

We could also go one step further and move to TypeScript. :smile:

StorytellerCZ avatar Apr 19 '22 20:04 StorytellerCZ

We could but I have no TS experience at all so to me it would take much more time to get into the ts thinking

jankapunkt avatar Apr 20 '22 06:04 jankapunkt

Alright let's take it step by step.

StorytellerCZ avatar Apr 20 '22 16:04 StorytellerCZ

I think a good starting point for moving towards TS would be to add type definitions at least, so intellisense can pick it up better.

jankapunkt avatar Apr 21 '22 06:04 jankapunkt

I'm willing to do this. I'm new to open source and this seems like a good issue to resolve. Is there anything that I must know about this project or anything else?

rashmod avatar Jul 18 '22 07:07 rashmod

Great @rashmod !!!

Please do one PR per package (Thie repo contains multiple packages). Since you are new it may be a good start by using a smaller package.

Another thing that's still not discussed is which linter we use cc @StorytellerCZ @denihs

jankapunkt avatar Jul 18 '22 13:07 jankapunkt

Okay, then I'll start with the smaller packages. But when you say convert to es6 are you just talking about changing the var to let const or anything more. I want to be more explicit about the scope of this thing before starting.

rashmod avatar Jul 19 '22 15:07 rashmod

I woul say use const and let and all newer Methods from Object / Array and String that became available since ES6 (where applicable).

Also favour destructuring and named parameters incl. parameter defaults where applicable.

Note: arrow functions should be used with care since there are many binding going in Blaze with functions using this a lot.

Don't worry, just start and we will review anyway. If there are things left to be improved etc. we will let you know and you will have enough support to get this done right 👍

jankapunkt avatar Jul 19 '22 19:07 jankapunkt

I will start working on this now. But @jankapunkt you were talking about the linter to use.....?

rashmod avatar Jul 20 '22 17:07 rashmod

I just checked and the main Meteor project uses the @quave/quave config (see their package.json) which is maintained by @filipenevola so I think we should also adapt to use it.

What do you think @StorytellerCZ @denihs

jankapunkt avatar Jul 20 '22 18:07 jankapunkt

No objection from me

denihs avatar Jul 22 '22 13:07 denihs

I'm having some issues while setting up the local env. I used nvm to change to node v14.20.0 and somehow installed meteor (faced many problems with this too). But when following the steps in the readme meteor npm install for setting local env I get the error saying package.json not found.

sidenote: my primary cli git bash does not work with meteor. "bash: meteor: command not found" even tho it works using PowerShell or cmd

rashmod avatar Jul 24 '22 15:07 rashmod

I am unfortunately only on Linux and MacOS so I cannot be of much help regarding windows setup. Have you checked the Meteor forums about these issues? IIRC there should be a few solved topics on windows issues regarding installation of Meteor.

Can anyone else help out here?

jankapunkt avatar Jul 24 '22 17:07 jankapunkt

The error I keep getting is that there is no package.json file. And according to my beginner-level understanding, you need a package.json to do npm install and stuff

rashmod avatar Jul 30 '22 07:07 rashmod

You need to move into the test-app directory. It contains the package.json file. The contribution.md file covers the commands you can use there. This is to separate the test project from the packages.

jankapunkt avatar Jul 30 '22 08:07 jankapunkt