Home > database >  "Parsing Error: unexpected token function" on Async Function with a recent Node version
"Parsing Error: unexpected token function" on Async Function with a recent Node version

Time:08-21

I am working on a side project, using node and firebase.

I can create regular functions and cloud functions, but when I try to create an async one like this :

 async function getApartments(){...}

I have this error : "ESLint: Parsing error: Unexpected token function"

I saw on others posts (here) this can be linked to using Async functions on an old version of node, but since I'm on a recent version of node (17.8) I really don't understand the problem.

Thanks in advance,

CodePudding user response:

Good morning, Do you use eslint ? if yes ->

{
"parserOptions": {
    "ecmaVersion": 2017 @see https://eslint.org/docs/latest/user-guide/configuring/language-options
}
  • Related