the-simian / es6-plato Goto Github PK
View Code? Open in Web Editor NEWThis project forked from deedubs/es6-plato
JavaScript source code visualization, static analysis, and complexity tool
License: MIT License
This project forked from deedubs/es6-plato
JavaScript source code visualization, static analysis, and complexity tool
License: MIT License
The regex for the highlighter requires the format of non-es6 anonymous functions.
lib/assets/scripts/plato-file.js line 55, if the regex is changed to '(function\\s*)?(\\()[^()]*\\)' then it should cover old and new anonymous functions. (Not familiar with Github so don't know what I'm doing with making changes myself!)
Another bug in the report js appears to be the popups when hovering over highlighted function markers, if it's at the top of the code window then it's cut off, and it appears to be fairly irregular for what functions it actually shows up for in general.
It seems that there is an issue with some missing dependencies.
This is my environement:
I do this:
npm install --save-dev es6-plato
npm run complexity-report
I get this error: Failed to load plugin import: Cannot find module 'eslint-plugin-import'
I install the missing module and try again:
npm install --save-dev eslint-plugin-import
npm run complexity-report
then I get: Cannot find module 'babel-eslint'
I install the missing module and try again:
npm install --save-dev babel-eslint
npm run complexity-report
then it worked
😕 Could it be npm install
ignoring vulnerable dependencies? I see audit errors after installing but I didn't dig into them
It doesn't work anymore. I'm tired of looking at it.
SyntaxError: Unexpected token (112:13)
at Parser.pp$5.raise (./node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (./node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$9.jsxParseIdentifier (./node_modules/babylon/lib/index.js:7029:10)
at Parser.pp$9.jsxParseNamespacedName (./node_modules/babylon/lib/index.js:7040:19)
at Parser.pp$9.jsxParseElementName (./node_modules/babylon/lib/index.js:7055:19)
at Parser.pp$9.jsxParseOpeningElementAt (./node_modules/babylon/lib/index.js:7145:20)
at Parser.pp$9.jsxParseElementAt (./node_modules/babylon/lib/index.js:7169:29)
at Parser.pp$9.jsxParseElement (./node_modules/babylon/lib/index.js:7224:15)
at Parser.parseExprAtom (./node_modules/babylon/lib/index.js:7236:21)
at Parser.pp$3.parseExprSubscripts (./node_modules/babylon/lib/index.js:3494:19)
when it encounters Babel 7's shorthand of React.Fragment, <>
.
Thanks for the upgrade. However, I am getting the following error which is fixed by downgrading typhonjs-escomplex back to version 0.0.12.
$ ./node_modules/.bin/es6-plato -r -d ./report src/
lodash.templateSources[0]:15
((__t = ( report.complexity.aggregate.complexity.sloc.physical )) == null ? '' : __t) +
^
TypeError: Cannot read property 'sloc' of undefined
at eval (lodash.templateSources[0]:15:50)
at writeFileReport (/Users/.../node_modules/es6-plato/lib/plato.js:322:41)
at /Users/.../node_modules/es6-plato/lib/plato.js:174:6
at Array.forEach (<anonymous>)
at runReports (/Users/.../node_modules/es6-plato/lib/plato.js:111:9)
at /Users/.../node_modules/es6-plato/lib/plato.js:189:4
at /Users/.../node_modules/es6-plato/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16
at callback (/Users/.../node_modules/graceful-fs/polyfills.js:289:20)
at FSReqCallback.oncomplete (fs.js:166:5)
error Command failed with exit code 1.
I imagine there's a relatively easy way to make both these things happen as the project exists now, but without spending a lot of time digging through the code I'm not able to know if that's the case. Is there a way to make these things work in the project as it currently is?
Thanks very much for this really awesome project. Seriously what a godsend.
Seems like they're looking for help:
https://github.com/es-analysis/plato#needs-active-maintainer
If you do, I'd release your version as v2.0 since you have new calculations, etc.
Hello,
When using this to analyze source code for a Vue project, it fails on coming across a Webpack dynamic import.
With tools like ESLint, this is solvable by using babel-eslint as a parser.
Even though I have my ESLint config with babel-eslint plugged into Plato, I still get an Unexpected token
error.
This may be solvable by using the parser described by the ESLint options or potentially offering another way to provide one's own parser. Either that, or I am configuring it wrong.
It looks like the work done in #5 may support this, rather than using typhonjs for parsing which fails to parse dynamic imports.
Sorry - probably a really n00b issue but running this from the command line gives me:
/Users/paul/app/node_modules/es6-plato/lib/reporters/complexity/index.js:77
let functions = report.methods.concat(allClassMethods(report));
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/pblyth/projects/lti-fe-inbox-app/node_modules/es6-plato/lib/plato.js:30:15)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
This is my command:
node_modules/es6-plato/bin/plato -r -d complexity src
Any ideas?
We found that es6-plato can't recognize es6 object shorthand function, for example:
const obj = {
// recognized
foo: function() {}
};
const obj = {
// not recognize
foo() {}
}
Is that true, or we used es6-plato in wrong way?
es6-plato isn't pulling in the required dependencies, so far to get it to run i've had to install
eslint
eslint-plugin-react
babel-eslint
eslint-config-defaults
https://github.com/the-simian/es6-plato/releases
1.2.3 is the newest according to npmjs but there are also other tags.
Are these tags / releases from the original project? If so the first release of this project / fork should be the next one.
Hi!
The project seems promising however I cannot make it work on my ES6 code. I also added 'use strict'; and using ESlint.
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (..emitted..\plato.js:30:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
My npm is:
npm: '2.15.9',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '56.1',
modules: '46',
node: '4.6.1',
openssl: '1.0.2j',
uv: '1.9.1',
v8: '4.5.103.37',
zlib: '1.2.8'
***Update:
updated to node: '7.1.0',
now all I get is NaN everywhere and having issues with .reduce()
Error reading file src\client\application.js: TypeError: (options.globals || []).reduce is not a function
TypeError: (options.globals || []).reduce is not a function
at new Config (\node_modules\eslint\lib\config.js:211:44)
at CLIEngine.executeOnText (\node_modules\eslint\lib\cli-engine.js:741:28)
at lint (\node_modules\es6-plato\lib\reporters\eslint\index.js:49:23)
at Object.process (\node_modules\es6-plato\lib\reporters\eslint\index.js:6:16)
at processReporter (\node_modules\es6-plato\lib\plato.js:151:31)
at \node_modules\lodash\lodash.js:4977:15
at baseForOwn (\node_modules\lodash\lodash.js:3020:24)
at \node_modules\lodash\lodash.js:4946:18
at Function.forEach (\node_modules\lodash\lodash.js:9351:14)
at \node_modules\es6-plato\lib\plato.js:146:7
I'm getting a lot of lint errors in the report, and it's because plato is not picking up my .eslintrc
any thoughts?
It does not use the eslint configuration file .eslintrc.json
from the current working directory for eslint execution.
return nounDict[freq?.toLowerCase()];
the following javascript cannot be parsed.
I will try an update the packages to the latest versions.
I have the feeling it will fix it.
ta
I use this tool in my project, the library is a great work. But I found that latest eslint version in library is 4.1.0, and its latest version is 4.13.1. When i run plato in my project, it throws error because of the airbnb-base extends in my eslint config file. And it’s working fine when I update eslint to 4.10.0 or above. Could plato update eslint as well?
Here is the screenshot:
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
package.json
files, so that was left aloneIf you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Are there any plans to add code coverage for LCOV reports?
The last release was some time ago.
See v1.3.0...master
I realize the name you gave it makes perfect sense, but have you considered renaming it to Aristotle, since that's the name of Plato's best student?
You mentioned in an issue somewhere that you were able to simplify the original Plato code while updating it for ES6, so it seems fitting to me.
A low severity security advisory was opened against Lodash for prototype pollution: https://www.npmjs.com/advisories/1523
Updating to 4.17.17 should do the trick!
https://unpkg.com/browse/[email protected]/report/files/
Not sure why this is there. Is there a good reason? I can not see this in the repository.
Some of deep dependency of this package is the legacy.
(ex: core-js 1.2.7)
And some direct dependencies are a little old.
greenkeeper is pointing out it.
https://github.com/the-simian/es6-plato/branches/all
npm doesn't upgrade dependencies that specificated without range syntax.
Is this what you intended?
Maybe there is an oversight because I haven't touched the inside of this package.
If there's no ruin, upgraded dependencies are preferred (for me).
We really love es6-plato but it doesn't work with ?.
operators.
Is there any chance es6-plato gets updated?
warm regards
anything wrong with my command line ?
Thank you for your great job.
It seems that the latest v1.2.4
module (fixed #111) is not published on npm
yet.
Could you publish the latest version to npm
and release on GitHub
?
It would be great if this tool could be used in typescript projects. What would be required to make that possible?
It would be nice to be able to specify the extension used for input files.
Although I get that the standard extension is .js
in our case we used .es6
because we are migrating a big project from old js specification to es6 specification (so we have them side by side) and we chose to use that extension.
I think won't harm to pass that value as an extra argument.
makes sense?
I currently have the following camelcase rule in my .eslintrc file:
"camelcase": ["error", { "allow": ["^UNSAFE_"] }]
According to the eslint documentation, this is completely valid: https://eslint.org/docs/rules/camelcase#allow
But when I run es6plato I get the following error:
Error: .eslintrc: Configuration for rule "camelcase" is invalid: Value {"allow":["^UNSAFE_"]} should NOT have additional properties.
Is this intended to happen?
I get this on every file for some reason with v1.0.6.
In my case (website-checks with the refactor/modularize branch) does not show the linting errors (warnings).
Should es6-plato show them normally?
The eslintrc configuration feature from #27 is not yet accessible from the cli and documented.
Currently it seems Travis CI is not used:
https://github.com/the-simian/es6-plato/blob/master/.travis.yml
issue is documented here sindresorhus/globby#98
It causes:
path.js:39
throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at assertPath (path.js:39:11)
at Object.join (path.js:1157:7)
at getPath (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/dir-glob/index.js:6:41)
at globs.concat.map.x (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/dir-glob/index.js:47:59)
at Array.map ()
at module.exports.sync (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/dir-glob/index.js:47:33)
at globDirs (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/globby/index.js:58:9)
at getPattern (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/globby/index.js:61:64)
at globTasks.reduce (/Users/crmar/GitHub_Storage/direct-order-sales-updater/node_modules/globby/index.js:107:19)
at Array.reduce ()
to fix it es6-plato needs to point to globby 8.0.2
It makes not much sense to provide two lockfiles.
Use either package-lock.json or yarn.lock (these are out of sync).
When update package to 1.0.15(latest for now), i run script es6-plato -r -d report code-pieces/v1/*
in cli, then it throw the error env: node\r: No such file or directory
. It seems like problem is caused by difference of line ending between unix-like OS and Windows. After i changed line ending of es-plato.js from Windows to Unix manually in node_modules/.bin folder, the problem be fixed. But package still remains problem, could it be fixed?
similar issue in github
My OS: Mac OS Sierra 10.12.6
Based on glob, but adds a bunch of useful features and a nicer API.
Multiple Patterns
Negated Patterns
I want to exclude things like my.ponyfill.js
or something like that. from screwing up my extremely restrictive eslint.
It would be nice to see in the first chart data from CLOC (https://github.com/kentcdodds/cloc) in a chart similar to http://www.chartjs.org/samples/latest/charts/area/line-stacked.html
I am getting the error Configuration for rule "react/jsx-no-bind" is invalid: Value {"ignoreRefs":true,"allowArrowFunctions":true,"allowFunctions":false,"allowBind":false,"ignoreDOMComponents":true} should NOT have additional properties.
when trying to run this.
This seems to be fixed by upgrading eslint to version 6.
Could you please do this?
What would be involved in supporting ES7 features like the optional chaining operator?
https://npmjs.com/advisories/1065
Please upgrade to >=4.17.12
In the eslint reporter you're using the linter method directly which doesn't allow the use of plugins, parser, and a few other things that you can setup using the CLIEngine then calling executeOnText.
Documentation http://eslint.org/docs/developer-guide/nodejs-api
I'm going to have to work on this over the weekend for work since we're using flowtype, would you be open to a PR for this change?
Just wanted to double check because it would be a pretty major overhaul to the eslint reporter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.