Skip to content

Commit

Permalink
Limit concurrency of linting
Browse files Browse the repository at this point in the history
Trying to work around #599
  • Loading branch information
sindresorhus committed Oct 18, 2021
1 parent eefd88a commit ada5d04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: 4});

const report = mergeReports(reports.filter(({isIgnored}) => !isIgnored));

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ada5d04

Please sign in to comment.