10

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?

sak_to
  • 399
  • 4
  • 13

2 Answers2

7

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.

overlordhammer
  • 1,303
  • 11
  • 17
  • 1
    But doesn't Esprima parse ES6 just as well? – Bergi Aug 30 '15 at 10:36
  • 1
    You are right I missed some part of the explanation for the sake of simplicity, the long story is a little more complicated since he made the **replace** in a Plato **dependency** tree, the top level library it depends is named **escomplex-js** that is wrapper over a non longer maintained library named *escomplex* original version was relaying in an **old esprima version**, some other guy already made half of the job but forgot to enable all es6 options for espree **deedubs** fixed all the es6 problems on this fork as far as I understand, it's been working for me so far so go. – overlordhammer Aug 30 '15 at 10:51
3

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.

the_5imian
  • 887
  • 4
  • 7
  • Thanks for the reply. That looks awesome, I'll check it out. For anyone following this, we ended up going with [SonarQube](https://sonarqube.com/). – sak_to Oct 14 '16 at 13:58
  • 1
    @sak_to Would you accept this answer? This is a maintained fork of the answer you accepted, which seems to be not maintained anymore. – GG. Feb 25 '18 at 18:17