skale-me / skale

High performance distributed data processing engine

Home Page:https://skale-me.github.io/skale

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modernize javascript syntax

mvertes opened this issue · comments

Apply coding rules as described in contributing:

  • Use arrow functions in mappers, filters, reducers and combiners
  • Use let and const in place of var
  • Use array or object destructuring to set variables from array or object: let [a, b] = [1, 2, 3]

This seems like it could be a huge task. Is there a game plan here ? I wouldn't mind helping out. Also is the plan to use babel? Or just convert the above mentioned?

First, thanks for participating.

The plan is to manually convert the whole engine code to modern syntax. As the core engine requires a modern JS runtime, there is no point to stick or maintain old syntax compatibility with babel. Talking about core engine code here, otherwise users are of course free to use whatever suit them.

This task can be performed incrementally, file by file, function by function. Each increment being quite simple. An increment can be:

  • convert trivial var xxx = require('xxx'); into const xxx = require('xxx'); at the start of file.
  • or In any one function, apply coding rules as above
  • then run the test suite: npm test
  • submit patch as a pull request, mentioning modernize syntax as per #210
  • if comfortable, a few increments can be submitted at once
  • skip any code or part which you are not comfortable or confident
  • feel free to improve tests as well, in tape-tests/which will shortly replace deprecated tests.

Each pull request will be reviewed carefully, and tests are being improved a lot (my focus right now).

A good place to start is lib/dataset.js. It's also a good entry point to understand the whole thing.

When most of code will be converted, I will do missing parts if necessary and rules will be added in eslint to warn against old practices.

Hey @mvertes I start to jump in on this today but got hung up in the installation. I ran npm install and got a peer dep warning of node-parquet@^0.2.4 which I then installed and I get Failed at the node-parquet@0.2.4 preinstall script. I also just went ahead and tried to run npm test assuming that might not be a huge issue. However I get Cannot find module './dep.js'

Any ideas? I don't have a ton of time to debug it right now so I thought I'd ask while I jump off to work on something else.

Just ignore warning about node-parquet, it's optional.
The cannot find module './dep.js' is not ok. What version of nodejs are you using ?
Advice: update to node version 8 or later, as it what is tested and validated in continuous integration.
Thanks

I'm on v8.1.4

Need to investigate this issue. In the mean-time rename test/0_require.js in test/0_require.js.notused, it should skip the related test

I fixed the issue with PR #217, tested with node6, node8 and node9 (node4 in progress)

👏 Working now, thanks.

Is it safe to use anything 6.4.0 column that is mark green (yes) for this refactor?

I assume you refer to node.green, then the answer is yes , 6.4.0 is the right one.

Oh ha sorry thought I pasted the link. But ya that's perfect. I'll get starter soon