diff --git a/.github/workflows/node-4+.yml b/.github/workflows/node-4+.yml index 2861027de7..cbc44fe913 100644 --- a/.github/workflows/node-4+.yml +++ b/.github/workflows/node-4+.yml @@ -62,7 +62,7 @@ jobs: name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - after_install: npm install --no-save "eslint@${{ matrix.eslint }}" + after_install: npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.node-version >= 10 && '3' || '2' }}" skip-ls-check: true env: NPM_CONFIG_LEGACY_PEER_DEPS: true diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml new file mode 100644 index 0000000000..0720122928 --- /dev/null +++ b/.github/workflows/smoke-test.yml @@ -0,0 +1,28 @@ +name: Smoke test + +on: + schedule: + - cron: '0 0 * * SUN' + workflow_dispatch: + +jobs: + lint: + if: ${{ github.repository == 'yannickcr/eslint-plugin-react' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + - uses: ljharb/actions/node/install@main + name: 'nvm install lts/* && npm install' + with: + node-version: 'lts/*' + skip-ls-check: true + - run: | + npm link + npm link eslint-plugin-react + - uses: AriPerkkio/eslint-remote-tester-run-action@v1 + with: + issue-title: 'Results of weekly scheduled smoke test' + eslint-remote-tester-config: test/eslint-remote-tester.config.js diff --git a/.gitignore b/.gitignore index a7d00f359e..d4afc08a23 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ node_modules !tests/**/node_modules npm-debug.log sftp-config.json +eslint-remote-tester-results # Only apps should have lockfiles yarn.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 575df294e2..91f3ec919a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel * [Refactor] `utils/Components`: correct spelling and delete unused code ([#3026][] @ohhoney1) * [Docs] [`jsx-uses-react`], [`react-in-jsx-scope`]: document [`react/jsx-runtime`] config ([#3018][] @pkuczynski @ljharb) * [Docs] [`require-default-props`]: fix small typo ([#2994][] @evsasse) +* [Tests] add weekly scheduled smoke tests ([#2963][] @AriPerkkio) [#3038]: https://github.com/yannickcr/eslint-plugin-react/pull/3038 [#3036]: https://github.com/yannickcr/eslint-plugin-react/issues/3036 @@ -35,6 +36,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel [#2998]: https://github.com/yannickcr/eslint-plugin-react/pull/2998 [#2994]: https://github.com/yannickcr/eslint-plugin-react/pull/2994 [#2992]: https://github.com/yannickcr/eslint-plugin-react/pull/2992 +[#2963]: https://github.com/yannickcr/eslint-plugin-react/pull/2963 [#1617]: https://github.com/yannickcr/eslint-plugin-react/pull/1617 [#1547]: https://github.com/yannickcr/eslint-plugin-react/pull/1547 diff --git a/package.json b/package.json index 72a056d9d8..bdfb9f7cd1 100644 --- a/package.json +++ b/package.json @@ -46,13 +46,15 @@ "@types/eslint": "=7.2.10", "@types/estree": "^0.0.47", "@types/node": "^14.14.37", - "@typescript-eslint/parser": "^2.34.0", + "@typescript-eslint/parser": "^2.34.0 || ^3.10.1", "aud": "^1.1.5", "babel-eslint": "^8.2.6", "eslint": "^3 || ^4 || ^5 || ^6 || ^7", "eslint-config-airbnb-base": "^14.2.1", "eslint-plugin-eslint-plugin": "^2.3.0 || ^3.3.1", "eslint-plugin-import": "^2.23.4", + "eslint-remote-tester": "^1.3.0", + "eslint-remote-tester-repositories": "^0.0.2", "espree": "^3.5.4", "istanbul": "^0.4.5", "markdown-magic": "^2.0.0", diff --git a/test/eslint-remote-tester.config.js b/test/eslint-remote-tester.config.js new file mode 100644 index 0000000000..435248c259 --- /dev/null +++ b/test/eslint-remote-tester.config.js @@ -0,0 +1,39 @@ +'use strict'; + +const eslintRemoteTesterRepositories = require('eslint-remote-tester-repositories'); + +module.exports = { + repositories: eslintRemoteTesterRepositories.getRepositories({randomize: true}), + + pathIgnorePattern: eslintRemoteTesterRepositories.getPathIgnorePattern(), + + extensions: ['js', 'jsx', 'ts', 'tsx'], + + concurrentTasks: 3, + + logLevel: 'info', + + /** Optional boolean flag used to enable caching of cloned repositories. For CIs it's ideal to disable caching. Defauls to true. */ + cache: false, + + eslintrc: { + root: true, + env: { + es6: true + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + settings: { + react: { + version: '16.13.1' + } + }, + extends: ['plugin:react/all'] + } +}; diff --git a/tests/fixtures/version/detect-version-missing/node_modules/react/index.js b/tests/fixtures/version/detect-version-missing/node_modules/react/index.js new file mode 100644 index 0000000000..d21474f80f --- /dev/null +++ b/tests/fixtures/version/detect-version-missing/node_modules/react/index.js @@ -0,0 +1,5 @@ +'use strict'; + +const error = new Error(); +error.code = 'MODULE_NOT_FOUND'; +throw error; diff --git a/tests/fixtures/version/detect-version-missing/node_modules/react/package.json b/tests/fixtures/version/detect-version-missing/node_modules/react/package.json new file mode 100644 index 0000000000..cafc0f0bb5 --- /dev/null +++ b/tests/fixtures/version/detect-version-missing/node_modules/react/package.json @@ -0,0 +1,4 @@ +{ + "name": "react", + "main": "index.js" + } diff --git a/tests/fixtures/version/detect-version-missing/test.js b/tests/fixtures/version/detect-version-missing/test.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/util/version.js b/tests/util/version.js index f43c603f53..2114f9ce05 100644 --- a/tests/util/version.js +++ b/tests/util/version.js @@ -56,6 +56,8 @@ describe('Version', () => { }); it('assumes latest version if react is not installed', () => { + sinon.stub(context, 'getFilename').callsFake(() => path.resolve(base, 'detect-version-missing', 'test.js')); + assert.equal(versionUtil.testReactVersion(context, '999.999.999'), true); expectedErrorArgs = [ @@ -64,6 +66,8 @@ describe('Version', () => { }); it('warns only once for failure to detect react ', () => { + sinon.stub(context, 'getFilename').callsFake(() => path.resolve(base, 'detect-version-missing', 'test.js')); + assert.equal(versionUtil.testReactVersion(context, '999.999.999'), true); assert.equal(versionUtil.testReactVersion(context, '999.999.999'), true);