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

440
Vistas
eslint error Unary operator '++' used no-plusplus

I am getting error with my for loop if I used i++ in for loop

var foo = 0;
    foo++;
    
    var bar = 42;
    bar--;
    
    for (i = 0; i < 1; i++) {
        return;
    }
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

One option would be to replace i++ with i+=1

You can also turn that specific eslint rule off (either for the specific line, the file or global configuration). Please consider that this might be not recommended, especially at the file or line level.

The rule name you are looking for is no-plusplus.

Disable it globally

In your eslint config file add the following:

'no-plusplus': 'off' **OR** 'no-plusplus': 0

There is also an option to disable it only for the for loops:

 no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]

For further information you can check eslint no-plusplus docs

Disable it at the file level

At the top of your file add the following:

/* eslint-disable no-plusplus */

Disable it for the given line

Just before the for loop, add the following:

/* eslint-disable-next-line no-plusplus */
over 4 years ago · Santiago Trujillo Denunciar

0

I got solution of this problem

if we are use i++ in our code eslint give error. For avoiding this type of error we have to use

var foo = 0;
foo += 1;

var bar = 42;
bar -= 1;

for (i = 0; i < l; i += 1) {
    return;
}

Thanks

over 4 years ago · Santiago Trujillo Denunciar

0

As you can see this is a linting error. Either write the code like this,

foo += 1;

and

i += 1

Or turn that eslint rule off. (not a good idea);

over 4 years ago · Santiago Trujillo 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