Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
Unexpected token "=" reported while running eslint on arrow functions

I have a JavaScript class and inside it I have an async method which looks like below.

class ABC {
    func = async () => { //----line 10
        //some code
    }
    func2 = () => { //----line 11
        //some code 
    }
}

When I run ESLint it's reporting one error. The application itself is working as expected.

unexpected token '=' at line 10 (& 11)

eslintrc.json

{
   "env":{
       "es2021":true
    }
}

What do I need to do in order to get rid of these lint errors and still keep these methods as arrow functions?

ESLint version: eslint :"^7.32.0"

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Upgrade to ESLint 8 and add this setting to your .eslintrc:

"parserOptions": {
  "ecmaVersion": 2022
}

Reason: you are using class fields. Support for class fields syntax in ESLint has been introduced with version 8.

Note that the specification of class fields, although already finalized in April 2021, will be published with ECMAScript 2022, expected next year.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda