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

176
Vistas
I'm getting ESLINT warnings when declaring more than one private class method in JS, why?

If I declare just one private method in a class then ESLINT compiles with no warnings, but... ESLINT emits one extra warning for each new private method I declare in that same class.

For instance, ESLINT emits 2 warnings for a classe declared like this:

class Clazz {
  #methodOne() { /*...*/ }
  #methodTwo() { /*...*/ }
  #methodThree() { /*...*/ }
}

ESLINT output:

WARNING  Compiled with 1 warning                                                                                                                                   10:14:26 PM

Module Warning (from ./node_modules/eslint-loader/index.js):

/Users/***/Clazz.js
  3:3  error  Duplicate name ''  no-dupe-class-members
  4:3  error  Duplicate name ''  no-dupe-class-members

✖ 2 problems (2 errors, 0 warnings)

I wonder if I'm doing something wrong or should I just ignore these warnings.


package.json:

{
  //...
  "eslint": "^6.7.2",
  "eslint-plugin-vue": "^6.2.2",
  "babel-eslint": "^10.1.0",
  "@vue/cli-plugin-eslint": "^3.1.1",
  //...
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I had the same problem and found a workaround. Define your private methods like this:

class Clazz {
  #methodOne = function() { /*...*/ }
  #methodTwo = function() { /*...*/ }
  #methodThree = function() { /*...*/ }
}

and the linter warnings/errors will go away.

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