Giter VIP home page Giter VIP logo

es6-plato's Introduction

es6-plato's People

Contributors

1000i100 avatar alunny avatar codehearts avatar craig-davis avatar cstrnt avatar davidlinse avatar deedubs avatar ehmicky avatar greenkeeper[bot] avatar ilanbiala avatar jeremy-green avatar jfugett-engrade avatar jraller avatar jsoverson avatar jwarby avatar kunalkundaje avatar matthewkastor avatar mischah avatar nerdgore avatar niktekusho avatar nlindley avatar pedronauck avatar peterkc avatar the-simian avatar tjbaker avatar tk avatar tniswong avatar tomhicks-bsf avatar treyhunner avatar victor-homyakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

es6-plato's Issues

Reporter doesn't highlight es6 arrow functions and popups don't always appear

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.

Missing dependencies?

It seems that there is an issue with some missing dependencies.

This is my environement:

  • nodejs v8.11.4
  • npm v6.4.1

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

`SyntaxError: Unexpected token` when encountering React Fragment shorthand syntax

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, <>.

typhonjs-escomplex v0.1.0 causing errors

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.

Excluding files in gulp config and support for multi-level project structures?

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.

Fails on dynamic import

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.

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

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?

ES6 object shorthand function support

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?

untracked dependencies

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

Since it is called es6 and I am using es6 syntax why are let and others are not supported?

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

How to specify eslint config

I'm getting a lot of lint errors in the report, and it's because plato is not picking up my .eslintrc any thoughts?

Could eslint in plato be updated?

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:
image

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If 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.

More information on this issue

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 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Renaming the repo

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.

Typescript support

It would be great if this tool could be used in typescript projects. What would be required to make that possible?

Javascript file extension must be js(x)

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?

.eslintrc camelcase configuration error

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?

linting errors (eslint) not shown

In my case (website-checks with the refactor/modularize branch) does not show the linting errors (warnings).

Should es6-plato show them normally?

globby 8.0.1 dependency is broken

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

two lockfiles

It makes not much sense to provide two lockfiles.
Use either package-lock.json or yarn.lock (these are out of sync).

Can't run [email protected] in Unix-like OS in cli

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

image

Globby from Glob

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.

Upgrade eslint to v6

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?

ESLint use CLIEngine instead of Linter directly

@the-simian

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.