Giter VIP home page Giter VIP logo

Comments (8)

dotnetCarpenter avatar dotnetCarpenter commented on May 21, 2024 1

--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.

jeffbski avatar jeffbski commented on May 21, 2024 1

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.

yowainwright avatar yowainwright commented on May 21, 2024

Hey @dotnetCarpenter! Your comment is being considered. I鈥檒l respond again soon.

from es-check.

yowainwright avatar yowainwright commented on May 21, 2024

@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.

yowainwright avatar yowainwright commented on May 21, 2024

Closing b/c of inactivity. Reach out if there is more feedback. 馃憣

from es-check.

dotnetCarpenter avatar dotnetCarpenter commented on May 21, 2024

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.

dotnetCarpenter avatar dotnetCarpenter commented on May 21, 2024

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.

yowainwright avatar yowainwright commented on May 21, 2024

@dotnetCarpenter thanks for looking 馃檹

from es-check.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.