From 4f051953b45fb2e5ea446834c4d271963985e084 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 18 Oct 2021 14:51:53 +0700 Subject: [PATCH] Limit concurrency of linting Trying to work around #599 --- index.js | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 2675f9d1..7a04199e 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ import {isEqual} from 'lodash-es'; import micromatch from 'micromatch'; import arrify from 'arrify'; import slash from 'slash'; +import pMap from 'p-map'; import { parseOptions, getIgnores, @@ -80,9 +81,8 @@ const lintFile = async (filePath, options) => runEslint( const lintFiles = async (patterns, options) => { const files = await globFiles(patterns, options); - const reports = await Promise.all( - files.map(filePath => lintFile(filePath, options)), - ); + // TODO: Try to increase the concurrency in the future with some more testing. + const reports = await pMap(files, filePath => lintFile(filePath, options), {concurrency: 1}); const report = mergeReports(reports.filter(({isIgnored}) => !isIgnored)); diff --git a/package.json b/package.json index 0f55e1c1..7299bb9d 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "meow": "^10.1.1", "micromatch": "^4.0.4", "open-editor": "^3.0.0", + "p-map": "^4.0.0", "prettier": "^2.4.1", "semver": "^7.3.5", "slash": "^4.0.0",