Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
ESLint with Airbnb style guide does not work for all rules

Recently I started checking all various JavaScript style guides and I liked Airbnb the best.

However, when I configured ESLint with Airbnb style guide, I noticed that some rules defined in their docs are not checked at all. For example:

  1. Group all your consts and then group all your lets.
  2. Use shortcuts for booleans, but explicit comparisons for strings and numbers.
  3. Use // for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment unless it’s on the first line of a block.

So, if you take this code as an example:

const array = [1, 2, 3, 4, 5];
let foo = 'foo';
const bar = 'bar';

if (array.length) {
  console.log('Bar:', bar);
  // Chaniging foo
  foo = 'baz';
  console.log('Foo:', foo);
}

The linter should throw 3 errors:

  1. I didn't group all consts and then all lets, I defined them sequentially.
  2. I didn't use explicit comparation in if statement - array.length > 0.
  3. I didn't add new line before my comment.

However, linter does not throw any error.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Airbnb style guide is a recommendation on how to write code.
ESLint is a tool created by a separate team, specifically Nicholas C. Zakas in the first place.
So the recommendation utilizes ESLint to automate checks for some of the rules, but not all.

Some Airbnb style guide rules have trailing eslint: rule-name, which indicates if it is checked or not. All 3 rules from the topic don't have it.
Also there is a page that elaborates on new rules addition. It states: "As of 2020, we only accept rules related to new ECMAScript features. We prefer that new rules be implemented in plugins".

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda