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

chore: add eslint-remote-tester #335

Merged
merged 4 commits into from
Jan 9, 2023
Merged

chore: add eslint-remote-tester #335

merged 4 commits into from
Jan 9, 2023

Conversation

bmish
Copy link
Member

@bmish bmish commented Jan 3, 2023

This runs all our rules on top ESLint plugin repos to ensure that they don't crash. It's like smoke testing.

https://github.com/AriPerkkio/eslint-remote-tester

Copy link
Contributor

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

@MichaelDeBoey
Copy link
Member

CC @AriPerkkio Can you review this please?

@@ -0,0 +1,52 @@
'use strict';

const { getPathIgnorePattern } = require('eslint-remote-tester-repositories');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As repositories list is a custom one and not coming from eslint-remote-tester-repositories, I think this one could be removed. And the dependency itself.

Suggested change
const { getPathIgnorePattern } = require('eslint-remote-tester-repositories');

The default value of pathIgnorePattern is fine here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the repositories from eslint-remote-tester-repositories instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it seems that this setup runs tests against a small set of ESLint plugin repositories, as part of CI. This approach is good, and I think eslint-plugin-unicorn has similar setup. They also use a second smoke test workflow for a ~5 hour test run against randomly picked ~10k repositories.

So which ever approach is ok. Do you want to run these tests quickly for every CI run, or schedule them to run once a week for large set of repositories. Or both?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining both approaches.

I figured we could start by running against a set of ESLint plugins, since those repos are of course more relevant and likely to trigger our rules than any other random repository. The current set is small so it's quick to run during CI.

If there was a desire to run on a very large set of repos but less frequently, I'm fine with that too.

eslint-remote-tester.config.js Show resolved Hide resolved
eslint-remote-tester.config.js Outdated Show resolved Hide resolved
eslint-remote-tester.config.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
bmish and others added 2 commits January 4, 2023 09:13
Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>
extensions: ['js', 'mjs', 'cjs', 'ts', 'mts', 'cts'],

/** Optional boolean flag used to enable caching of cloned repositories. For CIs it's ideal to disable caching. Defaults to true. */
cache: false,
Copy link
Member Author

@bmish bmish Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AriPerkkio I was a bit confused by this cache option. I saw some other repos disabling it. Can I just let it use the default? Or why is the default value not sufficient?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag controls whether a cloned repository should be removed from file system after it was linted. The default value true is ideal for local development, where developer may have 100s of repositories cached in file system, and they keep linting against them after modifying rule implementation frequently. Cloning repositories is slow, so caching them makes testing fast. Default values of this tool are good for local development, so some changes may be required when targeting CIs.

In this case, as there are not that many repositories listed, it might be OK to leave this as true. Github CIs have 15-20GB file systems on free tier. When linting ~10K repositories, the caching must be disabled so that we don't run out of disk space after couple of hours.

.gitignore Outdated Show resolved Hide resolved
Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>
@MichaelDeBoey MichaelDeBoey changed the title Add eslint-remote-tester chore: add eslint-remote-tester Jan 4, 2023
@bmish bmish merged commit d72918d into main Jan 9, 2023
@bmish bmish deleted the eslint-remote-tester branch January 9, 2023 23:59
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

Successfully merging this pull request may close these issues.

None yet

4 participants