Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!