Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any code complexity metering tools that work well with ES6?

My project is ES6 (webpack + babel). Plato is great, but doesn't work with ES6 yet. I took a look at escomplex and the series of related packages, but it looks like the author is no longer maintaining this and it seems like it doesn't support ES6 anyways.

I'm using the ESLint complexity rule to at least warn me if there's an issue (it's set to warn at 6), but it's not the same as a pretty report.

Any suggestions?

like image 507
sak_to Avatar asked Aug 09 '15 23:08

sak_to


2 Answers

There is a fork created by deedubs that uses espree instead esprima. I've installed it and it runs on ES6 styled code like a charm, in order to install the fork version instead the default distro execute the following command:

npm install -g git+https://github.com/deedubs/es6-plato.git

Whenever you want to uninstall it just do it like you would do it with vanilla plato install by writing

npm uninstall plato

Here's a screenshot for a file report based on a ES6 code after installing the Plato forked version

enter image description here

It's been about 3 weeks since you asked the question so I am not sure if this will be still useful for you but I hope it can help others with the same problem we were facing on using this amazing tool.

like image 87
overlordhammer Avatar answered Nov 08 '22 04:11

overlordhammer


I published a version of plato that does this here: https://www.npmjs.com/package/es6-plato

  • updates lodash and dependencies
  • fixes some common bugs in plato
  • properly parses es6
  • this includes classes

npm install --save es6-plato

read the docs to use it with gulp, or via the js api.

like image 3
the_5imian Avatar answered Nov 08 '22 02:11

the_5imian