From 1490bb62e33c55d765483c0ac565959c4ffc378e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Wed, 12 Jun 2024 14:30:34 +0300 Subject: [PATCH] Tests: Update `eslint-remote-tester` to v4 (#2376) --- .github/workflows/smoke-test.yml | 9 ++-- package.json | 6 +-- test/smoke/eslint-remote-tester.config.js | 36 ------------- test/smoke/eslint-remote-tester.config.mjs | 63 ++++++++++++++++++++++ 4 files changed, 69 insertions(+), 45 deletions(-) delete mode 100644 test/smoke/eslint-remote-tester.config.js create mode 100644 test/smoke/eslint-remote-tester.config.mjs diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 68e4352394..d8a56aa0cb 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -11,11 +11,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - - run: | - npm install - npm link - npm link eslint-plugin-unicorn - - uses: AriPerkkio/eslint-remote-tester-run-action@v4 + - run: npm install + - uses: AriPerkkio/eslint-remote-tester-run-action@v5 with: issue-title: "Results of weekly scheduled smoke test" - eslint-remote-tester-config: test/smoke/eslint-remote-tester.config.js + eslint-remote-tester-config: test/smoke/eslint-remote-tester.config.mjs diff --git a/package.json b/package.json index 054f432b51..8d17191171 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "lint:markdown": "markdownlint \"**/*.md\"", "lint:package-json": "npmPkgJsonLint .", "run-rules-on-codebase": "node ./test/run-rules-on-codebase/lint.mjs", - "smoke": "eslint-remote-tester --config ./test/smoke/eslint-remote-tester.config.js", + "smoke": "eslint-remote-tester --config ./test/smoke/eslint-remote-tester.config.mjs", "test": "npm-run-all --continue-on-error lint test:*", "test:js": "c8 ava" }, @@ -81,8 +81,8 @@ "eslint-doc-generator": "1.7.0", "eslint-plugin-eslint-plugin": "^6.1.0", "eslint-plugin-internal-rules": "file:./scripts/internal-rules/", - "eslint-remote-tester": "^3.0.1", - "eslint-remote-tester-repositories": "^1.0.1", + "eslint-remote-tester": "^4.0.0", + "eslint-remote-tester-repositories": "^2.0.0", "espree": "^10.0.1", "execa": "^8.0.1", "listr": "^0.14.3", diff --git a/test/smoke/eslint-remote-tester.config.js b/test/smoke/eslint-remote-tester.config.js deleted file mode 100644 index 7dbfba9971..0000000000 --- a/test/smoke/eslint-remote-tester.config.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -const {getRepositories, getPathIgnorePattern} = require('eslint-remote-tester-repositories'); - -module.exports = { - /** Repositories to scan */ - repositories: getRepositories({randomize: true}), - - /** Optional pattern used to exclude paths */ - pathIgnorePattern: getPathIgnorePattern(), - - /** Extensions of files under scanning */ - extensions: ['js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'vue'], - - /** Maximum amount of tasks ran concurrently */ - concurrentTasks: 3, - - /** Optional boolean flag used to enable caching of cloned repositories. For CIs it's ideal to disable caching. Defaults to true. */ - cache: false, - - /** Optional setting for log level. Valid values are verbose, info, warn, error. Defaults to verbose. */ - logLevel: 'info', - - /** ESLint configuration */ - eslintrc: { - root: true, - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - project: [], - }, - extends: ['plugin:unicorn/all'], - }, -}; diff --git a/test/smoke/eslint-remote-tester.config.mjs b/test/smoke/eslint-remote-tester.config.mjs new file mode 100644 index 0000000000..f9ca31aec0 --- /dev/null +++ b/test/smoke/eslint-remote-tester.config.mjs @@ -0,0 +1,63 @@ +import { + getRepositories, + getPathIgnorePattern, +} from 'eslint-remote-tester-repositories'; +import typescriptParser from '@typescript-eslint/parser'; +import vueParser from 'vue-eslint-parser'; +import eslintPluginUnicorn from '../../index.js'; + +/** @type {import('eslint-remote-tester').Config} */ +const config = { + /** Repositories to scan */ + repositories: getRepositories({randomize: true}), + + /** Optional pattern used to exclude paths */ + pathIgnorePattern: getPathIgnorePattern(), + + /** Extensions of files under scanning */ + extensions: ['js', 'cjs', 'mjs', 'ts', 'cts', 'mts', 'jsx', 'tsx', 'vue'], + + /** Maximum amount of tasks ran concurrently */ + concurrentTasks: 3, + + /** Optional boolean flag used to enable caching of cloned repositories. For CIs it's ideal to disable caching. Defaults to true. */ + cache: false, + + /** Optional setting for log level. Valid values are verbose, info, warn, error. Defaults to verbose. */ + logLevel: 'info', + + /** ESLint configuration */ + eslintConfig: [ + eslintPluginUnicorn.configs['flat/all'], + { + rules: { + // This rule crashing on replace string inside `jsx` or `Unicode escape sequence` + 'unicorn/string-content': 'off', + }, + }, + { + files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'], + languageOptions: { + parser: typescriptParser, + parserOptions: { + project: [], + }, + }, + }, + { + files: ['**/*.vue'], + languageOptions: { + parser: vueParser, + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaFeatures: { + jsx: true, + }, + project: [], + }, + }, + }, + ], +}; + +export default config;