Open amitdahan opened 6 years ago
@amitdahan does this work es-check es5 --modules true '<files to be checked>'
?
No unfortunately that fails when it encounters the import
/export
token :(
@amitdahan hmmm...could you paste a code sample of what the transpiled code we're discussing looks like? Also, could you paste what transpiling config—like a babelrc
or tsconfig
?
To provide you with more context, here's a link to Acorn's Parser README.
https://gist.github.com/amitdahan/0a571323da388668d1b88649c2b9d435
Simple enough, use TypeScript to target ES5 with the exception of modules.
Tried using acorn --ecma5 --module dist/index.js
also and got basically the same result, so I'm guessing this is a limitation of acorn?
commonjs
instead of esnext
and transpile to es5 and do treeshaking. That is a note, not a how-to. I'm curious what we can do to resolve this sort of issue in es-check, though.
Requested Update
Allow validating code written in ES5 EXCEPT module imports/exports.
Why Is This Update Needed?
We're transpiling our code to ES5 but still use ES modules to allow for tree-shaking. We wanted to make sure our generated code is ES5 with the exception of the module syntax which will be handled by webpack in consuming projects (talking about an internal lib).
We need to somehow ignore import/export syntax while still ES5-check our code, if possible/makes sense to you guys.
Thanks a bunch!