dorellang / hunter

Hunter: a JavaScript reengineering platform.
MIT License
34 stars 3 forks source link

Support js files starting with shebang #9

Closed tinchodias closed 5 years ago

tinchodias commented 5 years ago

Maybe the esprima wrapper could ignore the first line in those cases. Link: https://esprima.readthedocs.io/en/latest/syntactic-analysis.html#handling-hashbang-shebang

tinchodias commented 5 years ago

I missed to report some projects to reproduce the issue. I have the following examples:

ranviermud/setup-bundles.js
madge/bin/cli.js
esprima/test/3rdparty/mootools-1.4.5.js
esprima/test/check-version.js
esprima/test/verify-line-ending.js
esprima/tools/generate-xhtml-entities.js
esprima/tools/fixupbundle.js
esprima/bin/esvalidate.js
esprima/bin/esparse.js
node-red/red.js

For the record, I used this command to help me to find them:

grep -rnw '.' -e "^#!" | grep "\.js:1" | grep -v "\\.git"
dorellang commented 5 years ago

Fixed with commit https://github.com/dorellang/hunter/commit/59fdaa53c8078c985475851268d5b2b485403521