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

284
Vistas
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 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