Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/react-redux into …
Browse files Browse the repository at this point in the history
…add-size-limit
  • Loading branch information
aryaemami59 committed Jun 10, 2024
2 parents 4bac4b5 + 416114f commit fbeb82b
Show file tree
Hide file tree
Showing 8 changed files with 2,243 additions and 3,336 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
},
"settings": {
"import/ignore": ["react-native"],
"import/resolver": { "node": { "extensions": [".js", ".ts", ".tsx"] } },
"import/resolver": {
"typescript": { "extensions": [".js", ".ts", ".tsx"] }
},
"react": { "version": "detect" }
},
"overrides": [
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Lint
run: yarn lint

- name: Run test suite
run: yarn test

Expand Down
70 changes: 35 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,51 +64,51 @@
}
},
"dependencies": {
"@types/use-sync-external-store": "^0.0.3",
"use-sync-external-store": "^1.0.0"
"@types/use-sync-external-store": "^0.0.6",
"use-sync-external-store": "^1.2.2"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
"@babel/plugin-transform-react-display-name": "^7.12.1",
"@babel/plugin-transform-react-jsx": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-typescript": "^7.14.5",
"@microsoft/api-extractor": "^7.18.1",
"@reduxjs/toolkit": "^2.0.0-beta.4",
"@babel/cli": "^7.24.7",
"@babel/core": "^7.24.7",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-flow-strip-types": "^7.24.7",
"@babel/plugin-transform-react-display-name": "^7.24.7",
"@babel/plugin-transform-react-jsx": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@microsoft/api-extractor": "^7.47.0",
"@reduxjs/toolkit": "^2.2.5",
"@size-limit/file": "^11.1.4",
"@size-limit/webpack": "^11.1.4",
"@testing-library/jest-dom": "^6.3.0",
"@testing-library/react": "^14.1.2",
"@testing-library/react-hooks": "^8.0.1",
"@types/node": "^20.11.6",
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^16.0.0",
"@types/node": "^20.14.2",
"@types/prop-types": "^15.7.12",
"@types/react": "18.2.25",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"@types/react": "18.3.3",
"@types/react-dom": "^18.3.0",
"babel-eslint": "^10.1.0",
"codecov": "^3.8.0",
"cross-env": "^7.0.2",
"eslint": "^8.56.0",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-react": "^7.33.2",
"glob": "^7.1.6",
"jsdom": "^24.0.0",
"prettier": "^3.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-test-renderer": "18.0.0",
"redux": "^5.0.0",
"rimraf": "^3.0.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.2",
"jsdom": "^24.1.0",
"prettier": "^3.3.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-test-renderer": "18.3.1",
"redux": "^5.0.1",
"rimraf": "^5.0.7",
"size-limit": "^11.1.4",
"tsup": "^7.0.0",
"tsup": "7.0.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.12.0",
"vitest": "^1.6.0"
},
"packageManager": "yarn@4.1.0"
Expand Down
6 changes: 3 additions & 3 deletions test/hooks/useDispatch.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks'
import { renderHook } from '@testing-library/react'
import React from 'react'
import type { ProviderProps, ReactReduxContextValue } from 'react-redux'
import {
Expand Down Expand Up @@ -32,7 +32,7 @@ describe('React', () => {
const useCustomDispatch = createDispatchHook(nestedContext)
const { result } = renderHook(() => useDispatch(), {
// eslint-disable-next-line react/prop-types
wrapper: ({ children, ...props }: ProviderProps) => (
wrapper: ({ children, ...props }) => (
<ProviderMock {...props} store={store}>
<ProviderMock context={nestedContext} store={store2}>
{children}
Expand All @@ -45,7 +45,7 @@ describe('React', () => {

const { result: result2 } = renderHook(() => useCustomDispatch(), {
// eslint-disable-next-line react/prop-types
wrapper: ({ children, ...props }: ProviderProps) => (
wrapper: ({ children, ...props }) => (
<ProviderMock {...props} store={store}>
<ProviderMock context={nestedContext} store={store2}>
{children}
Expand Down
11 changes: 3 additions & 8 deletions test/hooks/useReduxContext.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
createReduxContextHook,
useReduxContext,
} from '@internal/hooks/useReduxContext'
import { renderHook } from '@testing-library/react-hooks'
import { renderHook } from '@testing-library/react'
import { createContext } from 'react'
import type { ReactReduxContextValue } from 'react-redux'

Expand All @@ -12,12 +12,9 @@ describe('React', () => {
it('throws if component is not wrapped in provider', () => {
const spy = vi.spyOn(console, 'error').mockImplementation(() => {})

const { result } = renderHook(() => useReduxContext())

expect(result.error?.message).toMatch(
expect(() => renderHook(() => useReduxContext())).toThrow(
/could not find react-redux context value/,
)

spy.mockRestore()
})
})
Expand All @@ -27,9 +24,7 @@ describe('React', () => {
const useCustomReduxContext = createReduxContextHook(customContext)
const spy = vi.spyOn(console, 'error').mockImplementation(() => {})

const { result } = renderHook(() => useCustomReduxContext())

expect(result.error?.message).toMatch(
expect(() => renderHook(() => useCustomReduxContext())).toThrow(
/could not find react-redux context value/,
)

Expand Down
7 changes: 2 additions & 5 deletions test/typetests/connect-options-and-issues.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,8 @@ describe('type tests', () => {
// Should be able to pass modern refs to a ForwardRefExoticComponent
const modernRef: React.Ref<string> | undefined = undefined
;<ConnectedForwardedFunctionalComponent ref={modernRef} />
// Should not be able to use legacy string refs
;<ConnectedForwardedFunctionalComponent
// @ts-expect-error
ref={''}
/>
// Should be able to use legacy string refs
;<ConnectedForwardedFunctionalComponent ref={''} />
// ref type should agree with type of the forwarded ref
;<ConnectedForwardedFunctionalComponent
// @ts-expect-error
Expand Down
2 changes: 1 addition & 1 deletion test/typetests/hooks.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('type tests', () => {

const state = untypedStore.getState()

expectTypeOf(state).toBeObject()
expectTypeOf(state).toBeUnknown()

const typedStore = useStore<TypedState, TypedAction>()

Expand Down
Loading

0 comments on commit fbeb82b

Please sign in to comment.