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

285
Visualizações
ESLint plugin (using ESLint API) async preprocess?

I'm trying my hand at upgrading a very old ESLint plugin to something more modern.
One of the problems is that in ESLint 8+, the API for getting config from a file is now async, so what was previously:

preprocess(text, filename) {
    const config = new CLIEngine({ useEslintrc: true }).getConfigForFile(path.resolve(filename));
   /* ... */
   return [preprocessed]
}

Is now:

async preprocess(text, filename) {
    const eslint = new ESLint();
    var config = await eslint.calculateConfigForFile(filename);
    /* ... */
    return [preprocessed]
}

The problem is that ESLint doesn't seem to expect the preprocess function to be async, so it ends up treating it as an array (which is its original return value) when it is in fact a Promise.

This could be easily solved by adding an await before whatever code calls for the preprocessor, but I'm not sure that's something I can configure (or can I? Please let me know if I can).

Is there any way to do what I'm trying to achieve? Can the preprocessor be called with await or can the config be retrieved synchronously?

Thanks in advance!

** UPDATE ** On their github, the eslint maintainers said what I'm looking to do isn't possible. I've instead elected to not use the config at all and find a different solution for my problem.

about 4 years ago · Juan Pablo Isaza
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