From 87fa5f58534281aadd9bdf624f9b8384cfe66c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Tue, 27 Oct 2020 16:57:37 +0100 Subject: [PATCH] Scripts: Teach all the tools to skip `vendor` folder (#26450) --- packages/jest-preset-default/CHANGELOG.md | 41 ++++++++++--------- packages/jest-preset-default/jest-preset.js | 6 ++- packages/scripts/CHANGELOG.md | 4 ++ packages/scripts/README.md | 12 +++--- packages/scripts/config/.eslintignore | 1 + .../scripts/config/.npmpackagejsonlintignore | 1 + packages/scripts/config/.stylelintignore | 1 + 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/packages/jest-preset-default/CHANGELOG.md b/packages/jest-preset-default/CHANGELOG.md index e7169b2d72bc8..7784387497505 100644 --- a/packages/jest-preset-default/CHANGELOG.md +++ b/packages/jest-preset-default/CHANGELOG.md @@ -2,31 +2,34 @@ ## Unreleased +### Enhancements + +- Ignore `/vendor` folder when searching for tests. + ## 6.0.0 (2020-04-15) ### Breaking Changes -- The peer `jest` dependency has been updated from requiring `>=24` to requiring `>=25` (see [Breaking Changes](https://jestjs.io/blog/2020/01/21/jest-25), [#20766](https://github.com/WordPress/gutenberg/pull/20766)). -- This package requires now `node` v10.0.0 or later ([#20766](https://github.com/WordPress/gutenberg/pull/20766)). +- The peer `jest` dependency has been updated from requiring `>=24` to requiring `>=25` (see [Breaking Changes](https://jestjs.io/blog/2020/01/21/jest-25), [#20766](https://github.com/WordPress/gutenberg/pull/20766)). +- This package requires now `node` v10.0.0 or later ([#20766](https://github.com/WordPress/gutenberg/pull/20766)). ## 5.4.0 (2020-02-04) ### Bug Fixes -- Use `require.resolve()` instead of `` to resolve `jest` config files according to the NodeJS lookup algorithm. ([#19957](https://github.com/WordPress/gutenberg/pull/19957)) +- Use `require.resolve()` instead of `` to resolve `jest` config files according to the NodeJS lookup algorithm. ([#19957](https://github.com/WordPress/gutenberg/pull/19957)) ## 5.3.1 (2020-01-01) ### Bug Fixes -- Fix preset file extension for inclusion in NPM deployments. ([#19306](https://github.com/WordPress/gutenberg/pull/19306)). +- Fix preset file extension for inclusion in NPM deployments. ([#19306](https://github.com/WordPress/gutenberg/pull/19306)). ## 5.3.0 (2019-12-20) ### New Features -- Added support to collapse or omit successful test results from Travis CI builds ([#16744](https://github.com/WordPress/gutenberg/issues/16744)) - +- Added support to collapse or omit successful test results from Travis CI builds ([#16744](https://github.com/WordPress/gutenberg/issues/16744)) ## 5.2.0 (2019-11-15) @@ -34,29 +37,29 @@ ### Bug Fixes -- Add `wordpress` folder to the list of ignored paths ([#17296](https://github.com/WordPress/gutenberg/pull/17296)). +- Add `wordpress` folder to the list of ignored paths ([#17296](https://github.com/WordPress/gutenberg/pull/17296)). ## 5.0.0 (2019-08-29) ### Breaking Changes -- Files with `.spec.js` suffix are no longer matched as test files by default. +- Files with `.spec.js` suffix are no longer matched as test files by default. ### New Features -- Align `testMatch` config option with Jest and allow test files with `.ts` suffix. +- Align `testMatch` config option with Jest and allow test files with `.ts` suffix. ## 4.0.0 (2019-03-06) ### Breaking Changes -- The bundled `jest` dependency has been updated from requiring `^23.6.0` to requiring `^24.1.0` (see [Breaking Changes](https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#breaking-changes), [#13922](https://github.com/WordPress/gutenberg/pull/13922)). -- The bundled `jest-enzyme` dependency has been removed completely ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). +- The bundled `jest` dependency has been updated from requiring `^23.6.0` to requiring `^24.1.0` (see [Breaking Changes](https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#breaking-changes), [#13922](https://github.com/WordPress/gutenberg/pull/13922)). +- The bundled `jest-enzyme` dependency has been removed completely ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). ### Internal -- The bundled `enzyme` dependency has been updated from requiring `^3.7.0` to requiring `^3.9.0` ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). -- The bundled `enzyme-adapter-react-16` dependency has been updated from requiring `^1.6.0` to requiring `^1.10.0` ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). +- The bundled `enzyme` dependency has been updated from requiring `^3.7.0` to requiring `^3.9.0` ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). +- The bundled `enzyme-adapter-react-16` dependency has been updated from requiring `^1.6.0` to requiring `^1.10.0` ([#13922](https://github.com/WordPress/gutenberg/pull/13922)). ## 3.0.3 (2018-11-20) @@ -68,27 +71,27 @@ ### Breaking Change -- Remove coverage support. +- Remove coverage support. ## 2.0.0 (2018-07-12) ### Breaking Change -- Updated code to work with Babel 7 ([#7832](https://github.com/WordPress/gutenberg/pull/7832)) +- Updated code to work with Babel 7 ([#7832](https://github.com/WordPress/gutenberg/pull/7832)) ### Internal -- Moved `@WordPress/packages` repository to `@WordPress/gutenberg` ([#7805](https://github.com/WordPress/gutenberg/pull/7805)) +- Moved `@WordPress/packages` repository to `@WordPress/gutenberg` ([#7805](https://github.com/WordPress/gutenberg/pull/7805)) ## 1.0.6 (2018-05-18) ### Polish -- Fix: Standardized `package.json` format ([#119](https://github.com/WordPress/packages/pull/119)) +- Fix: Standardized `package.json` format ([#119](https://github.com/WordPress/packages/pull/119)) ## 1.0.5 (2018-03-22) ### Polish -- Docs: Wrap filename in backticks ([#89](https://github.com/WordPress/packages/pull/89)) -- Add `jest-preset` keyword to `jest-preset-default` package ([#92](https://github.com/WordPress/packages/pull/92)) +- Docs: Wrap filename in backticks ([#89](https://github.com/WordPress/packages/pull/89)) +- Add `jest-preset` keyword to `jest-preset-default` package ([#92](https://github.com/WordPress/packages/pull/92)) diff --git a/packages/jest-preset-default/jest-preset.js b/packages/jest-preset-default/jest-preset.js index 9e601fbff0d47..20b1b361c0e5e 100644 --- a/packages/jest-preset-default/jest-preset.js +++ b/packages/jest-preset-default/jest-preset.js @@ -21,7 +21,11 @@ module.exports = { '**/test/*.[jt]s', '**/?(*.)test.[jt]s', ], - testPathIgnorePatterns: [ '/node_modules/', '/wordpress/' ], + testPathIgnorePatterns: [ + '/node_modules/', + '/vendor/', + '/wordpress/', + ], timers: 'fake', transform: { '^.+\\.[jt]sx?$': require.resolve( 'babel-jest' ), diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 738c6c3ba7316..e03942d30f827 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Enhancements + +- Ignore `/vendor` folder when searching for files to lint or format. + ## 12.1.0 (2020-07-07) ### Enhancements diff --git a/packages/scripts/README.md b/packages/scripts/README.md index 4e5bf733e431d..c7d53397300e6 100644 --- a/packages/scripts/README.md +++ b/packages/scripts/README.md @@ -150,7 +150,7 @@ This is how you execute the script with presented setup: When you run commands similar to the `npm run format:js:src` example above, you can provide a file, a directory, or `glob` syntax or any combination of them. -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. ### `lint-js` @@ -174,7 +174,7 @@ This is how you execute the script with presented setup: When you run commands similar to the `npm run lint:js:src` example above, you can provide a file, a directory, or `glob` syntax or any combination of them. See [more examples](https://eslint.org/docs/user-guide/command-line-interface). -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. #### Advanced information @@ -202,7 +202,7 @@ This is how you execute those scripts using the presented setup: When you run commands similar to the `npm run lint:pkg-json:src` example above, you can provide one or multiple directories to scan as well. See [more examples](https://github.com/tclindner/npm-package-json-lint/blob/HEAD/README.md#examples). -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. #### Advanced information @@ -226,7 +226,7 @@ This is how you execute the script with presented setup: - `npm run lint:md:docs` - lints markdown files in the entire project’s directories. -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. #### Advanced information @@ -250,7 +250,7 @@ This is how you execute the script with presented setup: - `npm run lint:md:js` - lints markdown files in the entire project’s directories. -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. #### Advanced information @@ -278,7 +278,7 @@ This is how you execute the script with presented setup: When you run commands similar to the `npm run lint:css:src` example above, be sure to include the quotation marks around file globs. This ensures that you can use the powers of [globby](https://github.com/sindresorhus/globby) (like the `**` globstar) regardless of your shell. See [more examples](https://github.com/stylelint/stylelint/blob/HEAD/docs/user-guide/cli.md#examples). -By default, files located in `build` and `node_modules` folders are ignored. +By default, files located in `build`, `node_modules`, `vendor` and `wordpress` folders are ignored. #### Advanced information diff --git a/packages/scripts/config/.eslintignore b/packages/scripts/config/.eslintignore index 86ad1b8cdc7b8..75ad663918bf1 100644 --- a/packages/scripts/config/.eslintignore +++ b/packages/scripts/config/.eslintignore @@ -1,3 +1,4 @@ build node_modules +vendor wordpress diff --git a/packages/scripts/config/.npmpackagejsonlintignore b/packages/scripts/config/.npmpackagejsonlintignore index c551598526f04..56ae824ca8a55 100644 --- a/packages/scripts/config/.npmpackagejsonlintignore +++ b/packages/scripts/config/.npmpackagejsonlintignore @@ -1,4 +1,5 @@ # By default, all `node_modules` are ignored. build +vendor wordpress diff --git a/packages/scripts/config/.stylelintignore b/packages/scripts/config/.stylelintignore index c551598526f04..56ae824ca8a55 100644 --- a/packages/scripts/config/.stylelintignore +++ b/packages/scripts/config/.stylelintignore @@ -1,4 +1,5 @@ # By default, all `node_modules` are ignored. build +vendor wordpress