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
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ node_modules/
npm-debug.log
yarn.lock
.eslintcache

# eslint-remote-tester
.cache-eslint-remote-tester
bmish marked this conversation as resolved.
Show resolved Hide resolved
eslint-remote-tester-results
55 changes: 55 additions & 0 deletions eslint-remote-tester.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

/** @type {import('eslint-remote-tester').Config} */
module.exports = {
bmish marked this conversation as resolved.
Show resolved Hide resolved
/** Repositories to scan */
repositories: [
// A few dozen top ESLint plugins.
'Intellicode/eslint-plugin-react-native',
'JoshuaKGoldberg/eslint-plugin-expect-type',
'SonarSource/eslint-plugin-sonarjs',
'avajs/eslint-plugin-ava',
'cypress-io/eslint-plugin-cypress',
'dangreenisrael/eslint-plugin-jest-formatting',
'ember-cli/eslint-plugin-ember',
'emberjs/eslint-plugin-ember-internal',
'eslint-community/eslint-plugin-eslint-plugin',
'eslint-community/eslint-plugin-n',
'eslint-community/eslint-plugin-promise',
'eslint-community/eslint-plugin-security',
'eslint-functional/eslint-plugin-functional',
'eslint/eslint',
'import-js/eslint-plugin-import',
'jest-community/eslint-plugin-jest',
'jest-community/eslint-plugin-jest-extended',
'jsx-eslint/eslint-plugin-jsx-a11y',
'jsx-eslint/eslint-plugin-react',
'lo1tuma/eslint-plugin-mocha',
'ota-meshi/eslint-plugin-regexp',
'platinumazure/eslint-plugin-qunit',
'sindresorhus/eslint-plugin-unicorn',
'square/eslint-plugin-square',
'storybookjs/eslint-plugin-storybook',
'testing-library/eslint-plugin-jest-dom',
'testing-library/eslint-plugin-testing-library',
'typescript-eslint/typescript-eslint',
],

/** Extensions of files under scanning */
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.


/** ESLint configuration */
eslintrc: {
bmish marked this conversation as resolved.
Show resolved Hide resolved
extends: ['plugin:eslint-plugin/all'],

overrides: [
{
files: ['*.ts', '*.mts', '*.cts'],
parser: '@typescript-eslint/parser',
},
],
},
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lint:js": "eslint --cache --ignore-pattern \"**/*.md\" .",
"lint:js-docs": "eslint --no-inline-config \"**/*.md\"",
"lint:package-json": "npmPkgJsonLint .",
"lint:remote": "eslint-remote-tester",
"release": "release-it",
"test": "nyc --all --check-coverage --include lib mocha tests --recursive",
"update:eslint-docs": "eslint-doc-generator"
Expand Down Expand Up @@ -63,6 +64,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unicorn": "^44.0.0",
"eslint-remote-tester": "^3.0.0",
"eslint-scope": "^7.1.1",
"espree": "^9.4.0",
"husky": "^8.0.1",
Expand Down