Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xo is slow on eslint-plugin-unicorn project #510

Closed
fisker opened this issue Dec 21, 2020 · 3 comments
Closed

xo is slow on eslint-plugin-unicorn project #510

fisker opened this issue Dec 21, 2020 · 3 comments

Comments

@fisker
Copy link
Contributor

fisker commented Dec 21, 2020

I've locate problems, it's because

xo/index.js

Lines 100 to 105 in 0ec4b8c

const configFiles = (await Promise.all(
(await globby(
CONFIG_FILES.map(configFile => `**/${configFile}`),
{ignore: DEFAULT_IGNORES, gitignore: true, cwd: options.cwd}
)).map(async configFile => configExplorer.load(path.resolve(options.cwd, configFile)))
)).filter(Boolean);

searching xo config files, and eslint-plugin-unicorn has many files in test/integration/fixtures dir, and we can't set config search ignore dirs.

Questions:

  1. Why are we searching config files inside dirs? Shouldn't config file in cwd or above?
  2. Why don't we use cosmiconfig.search? Because it don't know how to mergeOptions?
@sindresorhus
Copy link
Member

Why are we searching config files inside dirs? Shouldn't config file in cwd or above?

I'm honestly not sure. It was added in: 0d63c64 Maybe there's some clue in there...

Why don't we use cosmiconfig.search? Because it don't know how to mergeOptions?

I don't have an answer for this either.


Maybe @pvdlg would be able to chime in.

@fisker
Copy link
Contributor Author

fisker commented Jul 20, 2021

The config searching logic also effect glob matching, if there is a xo.config.js file in subdir, xo won't format files outside that dir.

Run

node cli lib/*.js

on this project root dir, it won't match any file, because there are many config files in test/fixtures

@fisker
Copy link
Contributor Author

fisker commented Aug 7, 2021

I think we can close this now, it's much faster after #583, #510 (comment) also fixed by #583

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants