Comments (8)
--module: Sets the parsing mode to "module". Is set to "script" otherwise.
@yowainwright Perhaps --module
should be added to either es-check or acorn usage within es-check?
from es-check.
I have created a PR which adds the ES module parsing capability using either --module true
at command line or "module": true
in .escheckrc. @dotnetCarpenter @yowainwright
from es-check.
Hey @dotnetCarpenter! Your comment is being considered. I鈥檒l respond again soon.
from es-check.
@dotnetCarpenter what happens when you try something like, es-check es7 ../src/**/*.mjs
?
If an optional module argument helps, would you want to add it to es-check? Read more here, within the acorns repository.
It would look something like something like this, es-check es6 modules ../src/**/*.mjs
.
from es-check.
Closing b/c of inactivity. Reach out if there is more feedback. 馃憣
from es-check.
es-check es7 ./src/**/*.mjs
:
ES-Check Error:
----
路 erroring file: ./src/utils/partial.mjs
路 error: SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
路 see the printed err.stack below for context
----
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
According to the README at acorn:
--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10: Sets the ECMAScript version to parse. Default is version 7.
The default is --ecma7
and ES2015 modules is in ECMA6, so it should be covered.
I'm using es-check
version 2.0.4
from es-check.
Strangely enough it seems to work in a simple example: https://gist.github.com/dotnetCarpenter/9e073526ad62068bdc2183a3459e42d0
But if I try the non-argument version on my real project I get:
ES-Check Error:
----
路 erroring file: ./src/utils/partial.mjs
路 error: SyntaxError: The keyword 'export' is reserved (1:0)
路 see the printed err.stack below for context
----
SyntaxError: The keyword 'export' is reserved (1:0)
at Parser.pp$4.raise (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2745:13)
at Parser.pp$3.checkUnreserved (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2675:10)
at Parser.pp$3.parseIdent (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2704:24)
at Parser.pp$3.parseExprAtom (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2120:19)
at Parser.pp$3.parseExprSubscripts (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2036:19)
at Parser.pp$3.parseMaybeUnary (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2013:17)
at Parser.pp$3.parseExprOps (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:1955:19)
at Parser.pp$3.parseMaybeConditional (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:1938:19)
at Parser.pp$3.parseMaybeAssign (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:1914:19)
at Parser.pp$3.parseExpression (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:1885:19)
at Parser.pp$1.parseStatement (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:809:45)
at Parser.pp$1.parseTopLevel (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:700:23)
at Parser.parse (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:545:15)
at Object.parse (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:3808:37)
at globbedFiles.forEach (/home/dotnet/.nvm/versions/node/v8.11.3/lib/node_modules/es-check/index.js:80:17)
at Array.forEach (<anonymous>)
PS. I get a lot of errors like the one above.
from es-check.
@dotnetCarpenter thanks for looking 馃檹
from es-check.
Related Issues (20)
- 'includes' pass check
- [feature request] wrapper command for "minimum ES version" for a file
- Update or remove dependency on cycle package HOT 1
- Quite mode doesn't work HOT 2
- update acorn version to latest HOT 5
- [issue]: terminal pipeline
- Object.assign() passes es5 check HOT 1
- Make --module,--allow-hash-bang, and `--verbose` flags HOT 4
- [Feature request] Entering a wrong ES version should fail
- Allowing validating ES5 code with module=true HOT 7
- es-check es5 does not catch Promise, Map, Set etc. HOT 3
- An in-range update of conventional-changelog-cli is breaking the build 馃毃 HOT 5
- Expose a JS API HOT 5
- ignore node_modules HOT 1
- Also test dependencies HOT 1
- Interpreting the output HOT 1
- Feature: Your code will run on 95% of all browsers
- bug HOT 2
- es-check fails on async arrow function HOT 2
- Command failed with exit code 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google 鉂わ笍 Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from es-check.