From 2ed1ce60c6c29b5fe2ac20ae52cf192f7cb20eed Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Fri, 5 Dec 2025 15:55:47 +0200 Subject: [PATCH 1/6] dev: update dependencies and pipeline node versions --- .github/workflows/validate.yml | 4 +- package.json | 82 +++++++++++++++++----------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 58abad9c..cb18dd64 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -16,7 +16,7 @@ jobs: if: ${{ !contains(github.head_ref, 'all-contributors') }} strategy: matrix: - node: [18, 20] + node: [20, 22, 24] runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs @@ -68,7 +68,7 @@ jobs: - name: ⎔ Setup node uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 24 - name: 📥 Download deps uses: bahmutov/npm-install@v1 diff --git a/package.json b/package.json index 3d3d431c..258d067c 100644 --- a/package.json +++ b/package.json @@ -80,59 +80,59 @@ "react": ">=16.12.0" }, "dependencies": { - "@babel/runtime": "^7.24.5", - "compute-scroll-into-view": "^3.1.0", + "@babel/runtime": "^7.28.4", + "compute-scroll-into-view": "^3.1.1", "prop-types": "^15.8.1", - "react-is": "18.2.0", - "tslib": "^2.6.2" + "react-is": "19.2.1", + "tslib": "^2.8.1" }, "devDependencies": { - "@babel/helpers": "^7.24.5", + "@babel/helpers": "^7.28.4", "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", - "@cypress/webpack-preprocessor": "^6.0.1", - "@docusaurus/core": "3.3.2", - "@docusaurus/module-type-aliases": "3.3.2", - "@docusaurus/preset-classic": "3.3.2", - "@mdx-js/react": "^3.0.1", - "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-typescript": "^11.1.6", - "@testing-library/cypress": "^10.0.1", - "@testing-library/dom": "^10.1.0", - "@testing-library/jest-dom": "^6.4.5", - "@testing-library/preact": "^2.0.1", - "@testing-library/react": "^15.0.7", - "@testing-library/user-event": "^14.5.2", - "@types/jest": "^29.5.12", - "@types/react": "^18.3.2", - "@typescript-eslint/eslint-plugin": "^7.9.0", - "@typescript-eslint/parser": "^7.9.0", + "@cypress/webpack-preprocessor": "^7.0.2", + "@docusaurus/core": "3.9.2", + "@docusaurus/module-type-aliases": "3.9.2", + "@docusaurus/preset-classic": "3.9.2", + "@mdx-js/react": "^3.1.1", + "@rollup/plugin-babel": "^6.1.0", + "@rollup/plugin-commonjs": "^29.0.0", + "@rollup/plugin-typescript": "^12.3.0", + "@testing-library/cypress": "^10.1.0", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/preact": "^3.2.4", + "@testing-library/react": "^16.3.0", + "@testing-library/user-event": "^14.6.1", + "@types/jest": "^30.0.0", + "@types/react": "^19.2.7", + "@typescript-eslint/eslint-plugin": "^8.48.1", + "@typescript-eslint/parser": "^8.48.1", "babel-plugin-macros": "^3.1.0", "babel-plugin-no-side-effect-class-properties": "0.0.7", "babel-preset-react-native": "^4.0.1", "buble": "^0.20.0", - "cpy-cli": "^5.0.0", - "cross-env": "^7.0.3", - "cypress": "13.9.0", - "eslint": "^8.56.0", - "eslint-plugin-cypress": "^3.2.0", - "eslint-plugin-react": "7.34.1", - "flow-bin": "^0.236.0", + "cpy-cli": "^6.0.0", + "cross-env": "^10.1.0", + "cypress": "15.7.1", + "eslint": "^9.39.1", + "eslint-plugin-cypress": "^5.2.0", + "eslint-plugin-react": "7.37.5", + "flow-bin": "^0.293.0", "flow-coverage-report": "^0.8.0", "get-pkg-repo": "5.0.0", - "kcd-scripts": "^15.0.1", - "node-polyfill-webpack-plugin": "^3.0.0", + "kcd-scripts": "^16.0.0", + "node-polyfill-webpack-plugin": "^4.1.0", "npm-run-all": "^4.1.5", - "preact": "^10.22.0", - "prism-react-renderer": "^2.3.1", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-native": "^0.74.1", - "react-test-renderer": "18.2.0", - "serve": "^14.2.3", - "start-server-and-test": "^2.0.3", - "typescript": "^5.4.5" + "preact": "^10.28.0", + "prism-react-renderer": "^2.4.1", + "react": "19.2.1", + "react-dom": "19.2.1", + "react-native": "^0.82.1", + "react-test-renderer": "19.2.1", + "serve": "^14.2.5", + "start-server-and-test": "^2.1.3", + "typescript": "^5.9.3" }, "eslintConfig": { "parserOptions": { From 0ae033c2f6db940f637420fb0c70abc632412c68 Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Sun, 7 Dec 2025 15:09:19 +0200 Subject: [PATCH 2/6] revert to eslint v8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 258d067c..42a966fe 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "cpy-cli": "^6.0.0", "cross-env": "^10.1.0", "cypress": "15.7.1", - "eslint": "^9.39.1", + "eslint": "^8.57.0", "eslint-plugin-cypress": "^5.2.0", "eslint-plugin-react": "7.37.5", "flow-bin": "^0.293.0", From dd02285b1324fa1349df3630d391e43a92f7c00f Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Sun, 7 Dec 2025 15:09:45 +0200 Subject: [PATCH 3/6] change toThrowError --- src/hooks/__tests__/utils.test.js | 4 ++-- src/hooks/useCombobox/__tests__/getItemProps.test.js | 2 +- src/hooks/useCombobox/__tests__/utils.test.js | 2 +- .../__tests__/getSelectedItemProps.test.js | 2 +- src/hooks/useMultipleSelection/__tests__/utils.test.js | 2 +- src/hooks/useSelect/__tests__/getItemProps.test.js | 2 +- src/hooks/useSelect/__tests__/utils.test.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/__tests__/utils.test.js b/src/hooks/__tests__/utils.test.js index 204e2b38..05f399db 100644 --- a/src/hooks/__tests__/utils.test.js +++ b/src/hooks/__tests__/utils.test.js @@ -78,7 +78,7 @@ describe('utils', () => { expect(() => getItemAndIndex(undefined, undefined, [1, 2, 3], errorMessage), - ).toThrowError(errorMessage) + ).toThrow(errorMessage) }) test('returns index if item is passed', () => { @@ -137,7 +137,7 @@ describe('utils', () => { test('renders without error', () => { expect(() => { renderHook(() => useMouseAndTouchTracker(undefined, jest.fn(), [])) - }).not.toThrowError() + }).not.toThrow() }) test('adds and removes listeners to environment', () => { diff --git a/src/hooks/useCombobox/__tests__/getItemProps.test.js b/src/hooks/useCombobox/__tests__/getItemProps.test.js index d0472a93..f835c99d 100644 --- a/src/hooks/useCombobox/__tests__/getItemProps.test.js +++ b/src/hooks/useCombobox/__tests__/getItemProps.test.js @@ -17,7 +17,7 @@ describe('getItemProps', () => { test('throws error if no index or item has been passed', () => { const {result} = renderUseCombobox() - expect(result.current.getItemProps).toThrowError( + expect(result.current.getItemProps).toThrow( 'Pass either item or index to getItemProps!', ) }) diff --git a/src/hooks/useCombobox/__tests__/utils.test.js b/src/hooks/useCombobox/__tests__/utils.test.js index 8a27b174..98f9b270 100644 --- a/src/hooks/useCombobox/__tests__/utils.test.js +++ b/src/hooks/useCombobox/__tests__/utils.test.js @@ -4,6 +4,6 @@ describe('utils', () => { test('reducer throws error if called without proper action type', () => { expect(() => { reducer({}, {type: 'super-bogus'}) - }).toThrowError('Reducer called without proper action type.') + }).toThrow('Reducer called without proper action type.') }) }) diff --git a/src/hooks/useMultipleSelection/__tests__/getSelectedItemProps.test.js b/src/hooks/useMultipleSelection/__tests__/getSelectedItemProps.test.js index 86a9fe9e..58b0d286 100644 --- a/src/hooks/useMultipleSelection/__tests__/getSelectedItemProps.test.js +++ b/src/hooks/useMultipleSelection/__tests__/getSelectedItemProps.test.js @@ -17,7 +17,7 @@ describe('getSelectedItemProps', () => { test('throws error if no index or item has been passed', () => { const {result} = renderUseMultipleSelection() - expect(result.current.getSelectedItemProps).toThrowError( + expect(result.current.getSelectedItemProps).toThrow( 'Pass either item or index to getSelectedItemProps!', ) }) diff --git a/src/hooks/useMultipleSelection/__tests__/utils.test.js b/src/hooks/useMultipleSelection/__tests__/utils.test.js index 8a27b174..98f9b270 100644 --- a/src/hooks/useMultipleSelection/__tests__/utils.test.js +++ b/src/hooks/useMultipleSelection/__tests__/utils.test.js @@ -4,6 +4,6 @@ describe('utils', () => { test('reducer throws error if called without proper action type', () => { expect(() => { reducer({}, {type: 'super-bogus'}) - }).toThrowError('Reducer called without proper action type.') + }).toThrow('Reducer called without proper action type.') }) }) diff --git a/src/hooks/useSelect/__tests__/getItemProps.test.js b/src/hooks/useSelect/__tests__/getItemProps.test.js index 1231eedc..4f4b7750 100644 --- a/src/hooks/useSelect/__tests__/getItemProps.test.js +++ b/src/hooks/useSelect/__tests__/getItemProps.test.js @@ -18,7 +18,7 @@ describe('getItemProps', () => { test('throws error if no index or item has been passed', () => { const {result} = renderUseSelect() - expect(result.current.getItemProps).toThrowError( + expect(result.current.getItemProps).toThrow( 'Pass either item or index to getItemProps!', ) }) diff --git a/src/hooks/useSelect/__tests__/utils.test.ts b/src/hooks/useSelect/__tests__/utils.test.ts index 982a8bb0..e6bf063f 100644 --- a/src/hooks/useSelect/__tests__/utils.test.ts +++ b/src/hooks/useSelect/__tests__/utils.test.ts @@ -60,5 +60,5 @@ describe('getItemIndexByCharacterKey', () => { test('reducer throws error if called without proper action type', () => { expect(() => { reducer({}, {type: 'super-bogus'}) - }).toThrowError('Reducer called without proper action type.') + }).toThrow('Reducer called without proper action type.') }) From 444f594a6abaa9c208916aca47d397e65c8f848d Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Sun, 7 Dec 2025 15:15:08 +0200 Subject: [PATCH 4/6] revert some other versions too --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 42a966fe..1595dd5d 100644 --- a/package.json +++ b/package.json @@ -106,8 +106,8 @@ "@testing-library/user-event": "^14.6.1", "@types/jest": "^30.0.0", "@types/react": "^19.2.7", - "@typescript-eslint/eslint-plugin": "^8.48.1", - "@typescript-eslint/parser": "^8.48.1", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "babel-plugin-macros": "^3.1.0", "babel-plugin-no-side-effect-class-properties": "0.0.7", "babel-preset-react-native": "^4.0.1", From fb868b321ea20d67cccb3dd8946cf7ce136c9e6c Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Sun, 7 Dec 2025 15:36:03 +0200 Subject: [PATCH 5/6] fix prop types and outDir --- package.json | 3 ++- tsconfig.json | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1595dd5d..25a97948 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.6.1", "@types/jest": "^30.0.0", + "@types/prop-types": "^15.7.15", "@types/react": "^19.2.7", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", @@ -116,7 +117,7 @@ "cross-env": "^10.1.0", "cypress": "15.7.1", "eslint": "^8.57.0", - "eslint-plugin-cypress": "^5.2.0", + "eslint-plugin-cypress": "^3.6.0", "eslint-plugin-react": "7.37.5", "flow-bin": "^0.293.0", "flow-coverage-report": "^0.8.0", diff --git a/tsconfig.json b/tsconfig.json index 67a6c4dc..24d66f22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,6 @@ "module": "ESNext", "typeRoots": ["./typings", "./node_modules/@types"], "strictNullChecks": true, - "outDir": "dist", }, "include": [ "typings/**/*.d.ts", From a2858ab5ad3f42a57f906e1aa713f0ff5e562638 Mon Sep 17 00:00:00 2001 From: Silviu Alexandru Avram Date: Mon, 8 Dec 2025 11:51:11 +0200 Subject: [PATCH 6/6] fix tests and rollup --- rollup.config.js | 7 ++-- .../downshift.get-menu-props.js.snap | 2 -- src/__tests__/downshift.get-button-props.js | 6 +--- src/__tests__/downshift.get-menu-props.js | 4 +-- src/__tests__/downshift.misc.js | 33 ++++++++++++++----- tsconfig.json | 1 + tsconfig.preact.json | 6 ++++ 7 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 tsconfig.preact.json diff --git a/rollup.config.js b/rollup.config.js index e7c82b01..d3f971a0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,6 +3,9 @@ const {babel} = require('@rollup/plugin-babel') const typescript = require('@rollup/plugin-typescript') const config = require('kcd-scripts/dist/config/rollup.config') +const isPreact = process.env.BUILD_PREACT === 'true' +const tsconfig = isPreact ? 'tsconfig.preact.json' : 'tsconfig.json' + const babelPluginIndex = config.plugins.findIndex( plugin => plugin.name === 'babel', ) @@ -21,10 +24,10 @@ config.plugins[cjsPluginIndex] = commonjs({ }) if (typescriptPluginIndex === -1) { - config.plugins.push(typescript({tsconfig: 'tsconfig.json'})) + config.plugins.push(typescript({tsconfig})) } else { config.plugins[typescriptPluginIndex] = typescript({ - tsconfig: 'tsconfig.json', + tsconfig, }) } diff --git a/src/__tests__/__snapshots__/downshift.get-menu-props.js.snap b/src/__tests__/__snapshots__/downshift.get-menu-props.js.snap index f1485423..4c172f2d 100644 --- a/src/__tests__/__snapshots__/downshift.get-menu-props.js.snap +++ b/src/__tests__/__snapshots__/downshift.get-menu-props.js.snap @@ -1,5 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`not applying the ref prop results in an error 1`] = `downshift: The ref prop "ref" from getMenuProps was not applied correctly on your menu element.`; - -exports[`using a composite component and calling getMenuProps without a refKey results in an error 1`] = `downshift: The ref prop "ref" from getMenuProps was not applied correctly on your menu element.`; diff --git a/src/__tests__/downshift.get-button-props.js b/src/__tests__/downshift.get-button-props.js index b01fd7cb..2bdabf84 100644 --- a/src/__tests__/downshift.get-button-props.js +++ b/src/__tests__/downshift.get-button-props.js @@ -74,11 +74,7 @@ test('getToggleButtonProps returns all given props', () => { const Button = jest.fn(props =>