jquery / esprima

ECMAScript parsing infrastructure for multipurpose analysis
http://esprima.org
BSD 2-Clause "Simplified" License
7.06k stars 787 forks source link

import / export syntax not supported by CLI tool #1758

Open sbrl opened 7 years ago

sbrl commented 7 years ago

Hello,

I've been writing some ES6 modules, and I have been wanting to find a good ES6 validator to validate them with during my build process. I stumbled across this project, and gave it a try.

However, your CLI tool doesn't appear to support the import / export command:

user@local:~$ node_modules/.bin/esvalidate Utilities/Vector.js
Error: Line 228: Unexpected token

Here's that js file for reference: https://hastebin.com/kukebonupe.js

Thoughts?

ariya commented 7 years ago

The command-line tool does not support script vs module, it needs to be updated.

See also http://esprima.readthedocs.io/en/latest/syntactic-analysis.html#distinguishing-a-script-and-a-module.

adius commented 7 years ago

Any news?

Kronuz commented 7 years ago

In Python’s port of esprima (pip install esprima), I added —module as an option for that purpose