GithubHelp home page GithubHelp logo

Comments (3)

koshic avatar koshic commented on June 19, 2024 1

@olsonpm, eslint-plugin-import has no parser, eslint has it. And eslint supports top-level await without any issues. Could you please provide a more details / steps to reproduce?

Generally speaking, it's ok to fix some library a bit to provide compatibility with popular tools, but we need to understand the root cause.

from esmock.

olsonpm avatar olsonpm commented on June 19, 2024 1

looks like I needed to add ecmaVersion: 2022 or later so you were right, it had to do with my configuration of the eslint parser.

I haven't encountered this issue before I think because typically eslint rules are specific to a projects' own files. Looks like the import plugin parses other module's files (necessarily of course), which then means the parser configuration needs to support other library's code.

Sorry for the noise

from esmock.

olsonpm avatar olsonpm commented on June 19, 2024

Here's a reproduction

$ git clone [email protected]:olsonpm/repro.git
$ cd repro
$ git checkout esmock-issue-288
$ npm ci
$ npx eslint index.mjs

/path/to/repro/index.mjs
  1:20  error    Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171)  import/namespace
  1:20  error    Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171)  import/default
  1:20  warning  Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171)  import/no-named-as-default
  1:20  warning  Parse errors in imported module 'esmock': Cannot use keyword 'await' outside an async function (2:8171)  import/no-named-as-default-member

✖ 4 problems (2 errors, 2 warnings)

I'll look into the parser detail you mention to better understand the issue


edit: okay I fixed the repro and updated the error text

from esmock.

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.