dollarshaveclub / es-check

Checks the version of ES in JavaScript files with simple shell commands 🏆
https://github.com/yowainwright/es-check
MIT License
459 stars 38 forks source link

Also test dependencies #90

Open ghost opened 5 years ago

ghost commented 5 years ago

Requested Update

It would be handy if es-check could also check all required/imported files as well. I tried to run es-check es5 ./dist/index.js and it said it was no matching errors, but when I included my module in a react-app in complained that one of my dependencies was not in ES5.

Why Is This Update Needed?

To make sure the entire module and not a single file is in ES5.

Are There Examples Of This Requested Update Elsewhere?

Read about references issues here. Provide paragraph text responses to each header.

Artoria2e5 commented 5 years ago

depcheck has some magic inside that ends up generating a list of packages used. That may help.

But do note that knowing what packages are used is not enough, as not all files in a package are used when a module is imported. There has to be at least some parsing of their respective package.json to figure out the actual files to lint.

The fact that modules can be dynamically imported makes things even harder to deal with, as evidenced by "smart" code that chooses between a transpiled ES5 version and the original by some feature test with try/catch on a new Function(). Well, maybe we should just follow AMD and refuse to pick one on those.