Giter VIP home page Giter VIP logo

Comments (9)

the-simian avatar the-simian commented on September 24, 2024 1

@IcodeNet did @slapbox 's fix work? I am considering closing this one if its actually ok. If I don't hear back I'll assume its ok afterall

from es6-plato.

the-simian avatar the-simian commented on September 24, 2024 1

could be related to #108 , which was also about the "elvis operator"/ optional chaning

from es6-plato.

cxn-mkalinovits avatar cxn-mkalinovits commented on September 24, 2024

Do you have any luck with this?

from es6-plato.

Nantris avatar Nantris commented on September 24, 2024

Works for us under ESLint rules:

.eslintrc.js

  parser: '@babel/eslint-parser',
  parserOptions: {
    sourceType: 'module',
    ecmaVersion: 2021,
    allowImportExportEverywhere: true,
    ecmaFeatures: {
      jsx: true,
      impliedStrict: true,
    },
  },

and it might also be necessary to update your babel.config.js or equivalent file. I'm guessing the Babel parser is automatically using that file.

babel.config.js

  "plugins": [
    "@babel/plugin-proposal-optional-chaining",
  ]

Technically that ? is called the optional chaining operator.

If that doesn't do the trick I can look through our config a bit more to try to figure out if there's something we've added to handle this.

from es6-plato.

Nantris avatar Nantris commented on September 24, 2024

I've added a bit to that proposed remedy. I'm guessing that the babel.config.js file is utilized by the Babel parser, so be sure you have the @babel/plugin-proposal-optional-chaining installed and in your Babel config.

Whatever the issue, something in our config definitely fixes it and I'm happy to help anyone get it working.

The only thing in our codebase that really trips the parser up is that we use top level await.

from es6-plato.

the-simian avatar the-simian commented on September 24, 2024

@slapbox are you using rollup with that, or webpack 5? For a long time top level wasn't really worth supporting because even if you parsed it, couldn't use it. Decorators have also had a tumultuous history as well.

from es6-plato.

Nantris avatar Nantris commented on September 24, 2024

Webpack 5 here. Honestly it's still kind of a pain even for us, but less painful than writing self-executing async functions.

There's no way they were worth using before this year. You probably already know that [email protected] supports them via its "experiments.".

Strangely, for all the errors ES6-Plato throws while parsing code containing top level awaits, it still seems to complete fine. I need to check the output for one of those specific files when I can though and report back. We only use top-level in a couple files.

from es6-plato.

Nantris avatar Nantris commented on September 24, 2024

Hmmm... Our "fix" may not actually work. Looks like it still fails to parse those files. I'm honestly not sure how I could have overlooked it, but I can't get it working by moving backwards in our commit history so I have to assume human error here.

from es6-plato.

niefz avatar niefz commented on September 24, 2024

I fixed by replace "typhonjs-escomplex": "0.0.12" with "typhonjs-escomplex": "0.1.0". @slapbox

from es6-plato.

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.