diff --git a/.eslintignore b/.eslintignore index aeb55eda2b..198e9e5230 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,3 @@ /stats/ /storybook-static/ node_modules/ -/packages/recompose/ \ No newline at end of file diff --git a/examples/codesandbox/package.json b/examples/codesandbox/package.json index ea8533134c..0ffec2a6f0 100644 --- a/examples/codesandbox/package.json +++ b/examples/codesandbox/package.json @@ -30,7 +30,6 @@ "@nivo/parallel-coordinates": "0.86.0", "@nivo/pie": "0.86.0", "@nivo/radar": "0.86.0", - "@nivo/recompose": "0.86.0", "@nivo/sankey": "0.86.0", "@nivo/scales": "0.86.0", "@nivo/scatterplot": "0.86.0", diff --git a/packages/core/package.json b/packages/core/package.json index 9b9b0c6a14..f514fd297c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -21,7 +21,6 @@ "dist/" ], "dependencies": { - "@nivo/recompose": "workspace:*", "@nivo/tooltip": "workspace:*", "@react-spring/web": "9.4.5 || ^9.7.2", "@types/d3-shape": "^2.0.0", diff --git a/packages/recompose/README.md b/packages/recompose/README.md deleted file mode 100644 index 50195381cb..0000000000 --- a/packages/recompose/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# `@nivo/recompose` - -[![version](https://img.shields.io/npm/v/@nivo/recompose.svg?style=flat-square)](https://www.npmjs.com/package/@nivo/recompose) - -## Recompose - -![Recompose](https://raw.githubusercontent.com/plouc/nivo/master/packages/recompose/doc/recompose.png) diff --git a/packages/recompose/package.json b/packages/recompose/package.json deleted file mode 100644 index 1b8c77fc91..0000000000 --- a/packages/recompose/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@nivo/recompose", - "version": "0.86.0", - "keywords": [ - "nivo", - "react", - "recompose" - ], - "repository": { - "type": "git", - "url": "https://github.com/plouc/nivo.git", - "directory": "packages/recompose" - }, - "license": "MIT", - "author": { - "name": "Raphaƫl Benitte", - "url": "https://github.com/plouc" - }, - "main": "./dist/nivo-recompose.cjs.js", - "module": "./dist/nivo-recompose.es.js", - "types": "./dist/types/index.d.ts", - "files": [ - "README.md", - "LICENSE.md", - "dist/", - "!dist/tsconfig.tsbuildinfo" - ], - "dependencies": { - "@types/prop-types": "^15.7.2", - "@types/react-lifecycles-compat": "^3.0.1", - "prop-types": "^15.7.2", - "react-lifecycles-compat": "^3.0.4" - }, - "peerDependencies": { - "react": ">= 16.14.0 < 19.0.0" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/packages/recompose/src/compose.ts b/packages/recompose/src/compose.ts deleted file mode 100644 index 8e48cb7387..0000000000 --- a/packages/recompose/src/compose.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ComponentClass, ComponentType } from 'react' - -interface ComponentEnhancer { - (component: ComponentType): ComponentClass -} - -// eslint-disable-next-line @typescript-eslint/ban-types -export const compose = (...funcs: Function[]): ComponentEnhancer => - funcs.reduce>( - (a, b) => - (...args) => - a(b(...args)), - arg => arg as any - ) as ComponentEnhancer diff --git a/packages/recompose/src/defaultProps.ts b/packages/recompose/src/defaultProps.ts deleted file mode 100644 index d15d2817a6..0000000000 --- a/packages/recompose/src/defaultProps.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createFactory } from 'react' -import { setDisplayName } from './setDisplayName' -import { DefaultingInferableComponentEnhancer } from './types' -import { wrapDisplayName } from './wrapDisplayName' - -// eslint-disable-next-line @typescript-eslint/ban-types -export const defaultProps = - (props: T): DefaultingInferableComponentEnhancer => - (BaseComponent: any): any => { - const factory = createFactory(BaseComponent) - const DefaultProps = (ownerProps: any) => factory(ownerProps) - DefaultProps.defaultProps = props - if (process.env.NODE_ENV !== 'production') { - // @ts-ignore - return setDisplayName(wrapDisplayName(BaseComponent, 'defaultProps'))(DefaultProps) - } - return DefaultProps - } diff --git a/packages/recompose/src/getDisplayName.ts b/packages/recompose/src/getDisplayName.ts deleted file mode 100644 index 9925c0464f..0000000000 --- a/packages/recompose/src/getDisplayName.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ComponentType } from 'react' - -export const getDisplayName = (component: ComponentType | string): string | undefined => { - if (typeof component === 'string') { - return component - } - - if (!component) { - return undefined - } - - return component.displayName || component.name || 'Component' -} diff --git a/packages/recompose/src/index.ts b/packages/recompose/src/index.ts deleted file mode 100644 index f1e17fdf82..0000000000 --- a/packages/recompose/src/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from './getDisplayName' -export * from './pure' -export * from './setDisplayName' -export * from './setStatic' -export * from './shallowEqual' -export * from './shouldUpdate' -export * from './wrapDisplayName' -export * from './compose' -export * from './withPropsOnChange' -export * from './defaultProps' -export * from './withProps' -export * from './setPropTypes' -export * from './withState' diff --git a/packages/recompose/src/mapProps.ts b/packages/recompose/src/mapProps.ts deleted file mode 100644 index d18ad4a6cc..0000000000 --- a/packages/recompose/src/mapProps.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createFactory } from 'react' -import { setDisplayName } from './setDisplayName' -import { InferableComponentEnhancerWithProps, Mapper } from './types' -import { wrapDisplayName } from './wrapDisplayName' - -export const mapProps = - ( - propsMapper: Mapper - ): InferableComponentEnhancerWithProps => - (BaseComponent: any): any => { - const factory = createFactory(BaseComponent) - // @ts-ignore - const MapProps = (props: any) => factory(propsMapper(props)) - if (process.env.NODE_ENV !== 'production') { - return setDisplayName(wrapDisplayName(BaseComponent, 'mapProps'))(MapProps) - } - return MapProps - } diff --git a/packages/recompose/src/pure.ts b/packages/recompose/src/pure.ts deleted file mode 100644 index 80b5d4b71a..0000000000 --- a/packages/recompose/src/pure.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ComponentType } from 'react' -import { setDisplayName } from './setDisplayName' -import { shallowEqual } from './shallowEqual' -import { shouldUpdate } from './shouldUpdate' -import { wrapDisplayName } from './wrapDisplayName' - -export const pure = (component: ComponentType): ComponentType => { - const hoc = shouldUpdate((props, nextProps) => !shallowEqual(props, nextProps)) - - if (process.env.NODE_ENV !== 'production') { - // @ts-ignore - return setDisplayName(wrapDisplayName(component, 'pure'))(hoc(component)) - } - - // @ts-ignore - return hoc(component) -} diff --git a/packages/recompose/src/setDisplayName.ts b/packages/recompose/src/setDisplayName.ts deleted file mode 100644 index d1c8b81e8f..0000000000 --- a/packages/recompose/src/setDisplayName.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ComponentType } from 'react' -import { setStatic } from './setStatic' - -export const setDisplayName = ( - displayName: string -): (>(component: T) => T) => setStatic('displayName', displayName) diff --git a/packages/recompose/src/setPropTypes.ts b/packages/recompose/src/setPropTypes.ts deleted file mode 100644 index a9f05166e4..0000000000 --- a/packages/recompose/src/setPropTypes.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ComponentType, ValidationMap } from 'react' -import { setStatic } from './setStatic' - -export const setPropTypes =

( - propTypes: ValidationMap

-): (>(component: T) => T) => setStatic('propTypes', propTypes) diff --git a/packages/recompose/src/setStatic.ts b/packages/recompose/src/setStatic.ts deleted file mode 100644 index 3a204ae80d..0000000000 --- a/packages/recompose/src/setStatic.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ComponentType } from 'react' - -export const setStatic = - (key: string, value: any): (>(component: T) => T) => - BaseComponent => { - /* eslint-disable no-param-reassign */ - // @ts-expect-error there's no way to type this - BaseComponent[key] = value - /* eslint-enable no-param-reassign */ - return BaseComponent - } diff --git a/packages/recompose/src/shallowEqual.ts b/packages/recompose/src/shallowEqual.ts deleted file mode 100644 index 414b70a4b1..0000000000 --- a/packages/recompose/src/shallowEqual.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @providesModule shallowEqual - * @typechecks - */ - -/* eslint-disable no-self-compare */ - -const hasOwnProperty = Object.prototype.hasOwnProperty - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x: unknown, y: unknown): boolean { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - // Added the nonzero y check to make Flow happy, but it is redundant - return x !== 0 || y !== 0 || 1 / x === 1 / y - } - // Step 6.a: NaN == NaN - return x !== x && y !== y -} - -/** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ -export function shallowEqual( - objA: Record, - objB: Record -): boolean { - if (is(objA, objB)) { - return true - } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false - } - - const keysA = Object.keys(objA) - const keysB = Object.keys(objB) - - if (keysA.length !== keysB.length) { - return false - } - - // Test for A's keys different from B. - for (let i = 0; i < keysA.length; i++) { - if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { - return false - } - } - - return true -} diff --git a/packages/recompose/src/shouldUpdate.ts b/packages/recompose/src/shouldUpdate.ts deleted file mode 100644 index 37926eda45..0000000000 --- a/packages/recompose/src/shouldUpdate.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Component, createFactory } from 'react' -import { setDisplayName } from './setDisplayName' -import { InferableComponentEnhancer, PredicateDiff } from './types' -import { wrapDisplayName } from './wrapDisplayName' - -export const shouldUpdate = - >( - test: PredicateDiff - // eslint-disable-next-line @typescript-eslint/ban-types - ): InferableComponentEnhancer<{}> => - (BaseComponent: any): any => { - const factory = createFactory(BaseComponent) - class ShouldUpdate extends Component { - shouldComponentUpdate(nextProps: any) { - // @ts-expect-error not type-able - return test(this.props, nextProps) - } - - render() { - return factory(this.props) - } - } - - if (process.env.NODE_ENV !== 'production') { - return setDisplayName(wrapDisplayName(BaseComponent, 'shouldUpdate'))(ShouldUpdate) - } - return ShouldUpdate - } diff --git a/packages/recompose/src/types.ts b/packages/recompose/src/types.ts deleted file mode 100644 index f52892ab9e..0000000000 --- a/packages/recompose/src/types.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ComponentClass, ComponentType } from 'react' - -export type Mapper = (input: TInner) => TOuter - -export type PredicateDiff = (current: T, next: T) => boolean - -// Injects props and removes them from the prop requirements. -// Will not pass through the injected props if they are passed in during -// render. Also adds new prop requirements from TNeedsProps. -export interface InferableComponentEnhancerWithProps { -

(component: ComponentType

): ComponentClass< - Omit & TNeedsProps - > -} - -// Injects props and removes them from the prop requirements. -// Will not pass through the injected props if they are passed in during -// render. -export type InferableComponentEnhancer = InferableComponentEnhancerWithProps< - TInjectedProps, - // eslint-disable-next-line @typescript-eslint/ban-types - {} -> - -export type DefaultingInferableComponentEnhancer = - InferableComponentEnhancerWithProps> diff --git a/packages/recompose/src/utils/index.ts b/packages/recompose/src/utils/index.ts deleted file mode 100644 index 87300e575c..0000000000 --- a/packages/recompose/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './pick' diff --git a/packages/recompose/src/utils/pick.ts b/packages/recompose/src/utils/pick.ts deleted file mode 100644 index ab6ffb66a7..0000000000 --- a/packages/recompose/src/utils/pick.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const pick = (obj: Record, keys: string[]) => { - const result: Record = {} - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - // eslint-disable-next-line no-prototype-builtins - if (obj.hasOwnProperty(key)) { - result[key] = obj[key] - } - } - return result -} diff --git a/packages/recompose/src/withProps.ts b/packages/recompose/src/withProps.ts deleted file mode 100644 index bf7b2b5913..0000000000 --- a/packages/recompose/src/withProps.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { mapProps } from './mapProps' -import { setDisplayName } from './setDisplayName' -import { InferableComponentEnhancerWithProps, Mapper } from './types' -import { wrapDisplayName } from './wrapDisplayName' - -export const withProps = ( - createProps: TInner | Mapper -): InferableComponentEnhancerWithProps => { - const hoc = mapProps(props => ({ - ...(props as any), - // eslint-disable-next-line @typescript-eslint/ban-types - ...(typeof createProps === 'function' ? (createProps as Function)(props) : createProps), - })) - if (process.env.NODE_ENV !== 'production') { - return ((BaseComponent: any) => - setDisplayName(wrapDisplayName(BaseComponent, 'withProps'))(hoc(BaseComponent))) as any - } - return hoc as InferableComponentEnhancerWithProps -} diff --git a/packages/recompose/src/withPropsOnChange.ts b/packages/recompose/src/withPropsOnChange.ts deleted file mode 100644 index bf3d7a779b..0000000000 --- a/packages/recompose/src/withPropsOnChange.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Component, createFactory } from 'react' -import { polyfill } from 'react-lifecycles-compat' -import { setDisplayName } from './setDisplayName' -import { shallowEqual } from './shallowEqual' -import { InferableComponentEnhancerWithProps, Mapper, PredicateDiff } from './types' -import { pick } from './utils' -import { wrapDisplayName } from './wrapDisplayName' - -export const withPropsOnChange = - >( - shouldMapOrKeys: string[] | PredicateDiff, - propsMapper: Mapper - ): InferableComponentEnhancerWithProps => - (BaseComponent: any): any => { - const factory = createFactory(BaseComponent) - const shouldMap = - typeof shouldMapOrKeys === 'function' - ? shouldMapOrKeys - : (props: TOuter, nextProps: TOuter) => - !shallowEqual(pick(props, shouldMapOrKeys), pick(nextProps, shouldMapOrKeys)) - - class WithPropsOnChange extends Component { - state = { - computedProps: propsMapper(this.props), - prevProps: this.props, - } - - static getDerivedStateFromProps( - nextProps: TOuter, - prevState: WithPropsOnChange['state'] - ) { - if (shouldMap(prevState.prevProps, nextProps)) { - return { - computedProps: propsMapper(nextProps), - prevProps: nextProps, - } - } - - return { - prevProps: nextProps, - } - } - - render() { - return factory({ - ...this.props, - ...this.state.computedProps, - }) - } - } - - polyfill(WithPropsOnChange) - - if (process.env.NODE_ENV !== 'production') { - return setDisplayName(wrapDisplayName(BaseComponent, 'withPropsOnChange'))( - WithPropsOnChange - ) - } - - return WithPropsOnChange - } diff --git a/packages/recompose/src/withState.ts b/packages/recompose/src/withState.ts deleted file mode 100644 index 0c1b3b8dc8..0000000000 --- a/packages/recompose/src/withState.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { createFactory, Component } from 'react' -import { setDisplayName } from './setDisplayName' -import { InferableComponentEnhancerWithProps, Mapper } from './types' -import { wrapDisplayName } from './wrapDisplayName' - -type StateProps = { - [stateName in TStateName]: TState -} & { [stateUpdateName in TStateUpdaterName]: (state: TState) => TState } - -export const withState = - ( - stateName: TStateName, - stateUpdaterName: TStateUpdaterName, - initialState: TState | Mapper - ): InferableComponentEnhancerWithProps< - StateProps, - TOuter - > => - (BaseComponent: any): any => { - const factory = createFactory(BaseComponent) - class WithState extends Component { - state = { - stateValue: - typeof initialState === 'function' - ? // eslint-disable-next-line @typescript-eslint/ban-types - (initialState as Function)(this.props) - : initialState, - } - - updateStateValue = (updateFn: any, callback: any) => - this.setState( - ({ stateValue }: any) => ({ - stateValue: - typeof updateFn === 'function' ? updateFn(stateValue) : updateFn, - }), - callback - ) - - render() { - return factory({ - ...this.props, - [stateName]: this.state.stateValue, - [stateUpdaterName]: this.updateStateValue, - }) - } - } - - if (process.env.NODE_ENV !== 'production') { - return setDisplayName(wrapDisplayName(BaseComponent, 'withState'))(WithState) - } - return WithState - } diff --git a/packages/recompose/src/wrapDisplayName.ts b/packages/recompose/src/wrapDisplayName.ts deleted file mode 100644 index 8775e22dc7..0000000000 --- a/packages/recompose/src/wrapDisplayName.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ComponentType } from 'react' -import { getDisplayName } from './getDisplayName' - -export const wrapDisplayName = (BaseComponent: ComponentType, hocName: string): string => - `${hocName}(${getDisplayName(BaseComponent)})` diff --git a/packages/recompose/tests/compose.test.ts b/packages/recompose/tests/compose.test.ts deleted file mode 100644 index f1373cee60..0000000000 --- a/packages/recompose/tests/compose.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { compose } from '../src' - -test('compose composes from right to left', () => { - const double = (x: number) => x * 2 - const square = (x: number) => x * x - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose(square)(5)).toBe(25) - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose(square, double)(5)).toBe(100) - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose(double, square, double)(5)).toBe(200) -}) - -test('compose can be seeded with multiple arguments', () => { - const square = (x: number) => x * x - const add = (x: number, y: number) => x + y - expect(compose(square, add)(1, 2)).toBe(9) -}) - -test('compose returns the identity function if given no arguments', () => { - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose()(1, 2)).toBe(1) - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose()(3)).toBe(3) - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose()()).toBe(undefined) -}) - -test('compose returns the first function if given only one', () => { - const fn = (x: number) => x * x - // @ts-expect-error not entirely sure why ts is complaining tbh - expect(compose(fn)(3)).toBe(fn(3)) -}) diff --git a/packages/recompose/tests/defaultProps.test.tsx b/packages/recompose/tests/defaultProps.test.tsx deleted file mode 100644 index d51d207660..0000000000 --- a/packages/recompose/tests/defaultProps.test.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { shallow } from 'enzyme' -import { defaultProps } from '../src' - -test('defaultProps passes additional props to base component', () => { - const DoReMi = defaultProps({ 'data-so': 'do', 'data-la': 'fa' })('div') - expect(DoReMi.displayName).toBe('defaultProps(div)') - - const div = shallow().find('div') - expect(div.equals(

)).toBe(true) -}) - -test('defaultProps has lower precendence than props from owner', () => { - const DoReMi = defaultProps({ 'data-so': 'do', 'data-la': 'fa' })('div') - expect(DoReMi.displayName).toBe('defaultProps(div)') - - const div = shallow().find('div') - expect(div.equals(
)).toBe(true) -}) - -test('defaultProps overrides undefined owner props', () => { - const DoReMi = defaultProps({ 'data-so': 'do', 'data-la': 'fa' })('div') - expect(DoReMi.displayName).toBe('defaultProps(div)') - - const div = shallow().find('div') - expect(div.equals(
)).toBe(true) -}) diff --git a/packages/recompose/tests/getDisplayName.test.tsx b/packages/recompose/tests/getDisplayName.test.tsx deleted file mode 100644 index e038b5b4c2..0000000000 --- a/packages/recompose/tests/getDisplayName.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Component } from 'react' -import { getDisplayName } from '../src' - -test('getDisplayName gets the display name of a React component', () => { - class SomeComponent extends Component { - render() { - return
- } - } - - class SomeOtherComponent extends Component { - static displayName = 'CustomDisplayName' - render() { - return
- } - } - - function YetAnotherComponent() { - return
- } - - expect(getDisplayName(SomeComponent)).toBe('SomeComponent') - expect(getDisplayName(SomeOtherComponent)).toBe('CustomDisplayName') - expect(getDisplayName(YetAnotherComponent)).toBe('YetAnotherComponent') - expect(getDisplayName(() =>
)).toBe('Component') - expect(getDisplayName('div')).toBe('div') -}) diff --git a/packages/recompose/tests/setDisplayName.test.tsx b/packages/recompose/tests/setDisplayName.test.tsx deleted file mode 100644 index 792ec2b092..0000000000 --- a/packages/recompose/tests/setDisplayName.test.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import * as React from 'react' -import { setDisplayName } from '../src' - -test('setDisplayName sets a static property on the base component', () => { - const BaseComponent: React.ComponentType = () =>
- const NewComponent = setDisplayName('Foo')(BaseComponent) - expect(NewComponent.displayName).toBe('Foo') -}) diff --git a/packages/recompose/tests/setPropTypes.test.tsx b/packages/recompose/tests/setPropTypes.test.tsx deleted file mode 100644 index e234d2003d..0000000000 --- a/packages/recompose/tests/setPropTypes.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as React from 'react' -import * as PropTypes from 'prop-types' -import { setPropTypes } from '../src' - -test('setPropTypes sets a static property on the base component', () => { - const BaseComponent: React.ComponentType = () =>
- const NewComponent = setPropTypes({ foo: PropTypes.object })(BaseComponent) - - expect(NewComponent.propTypes).toEqual({ - foo: PropTypes.object, - }) -}) diff --git a/packages/recompose/tests/setStatic.test.tsx b/packages/recompose/tests/setStatic.test.tsx deleted file mode 100644 index 2ef56463d7..0000000000 --- a/packages/recompose/tests/setStatic.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as React from 'react' -import * as PropTypes from 'prop-types' -import { setStatic } from '../src' - -test('setStatic sets a static property on the base component', () => { - const BaseComponent: React.ComponentType = () =>
- const NewComponent = setStatic('propTypes', { foo: PropTypes.object })(BaseComponent) - - expect(NewComponent.propTypes).toEqual({ - foo: PropTypes.object, - }) -}) diff --git a/packages/recompose/tests/withProps.test.tsx b/packages/recompose/tests/withProps.test.tsx deleted file mode 100644 index 7815171ac2..0000000000 --- a/packages/recompose/tests/withProps.test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { shallow } from 'enzyme' -import { withProps } from '../src' - -test('withProps passes additional props to base component', () => { - // @ts-expect-error types need improving - const DoReMi = withProps({ 'data-so': 'do', 'data-la': 'fa' })('div') - expect(DoReMi.displayName).toBe('withProps(div)') - - const div = shallow().find('div') - expect(div.prop('data-so')).toBe('do') - expect(div.prop('data-la')).toBe('fa') -}) - -test('withProps takes precedent over owner props', () => { - // @ts-expect-error types need improving - const DoReMi = withProps({ 'data-so': 'do', 'data-la': 'fa' })('div') - - const div = shallow().find('div') - expect(div.prop('data-so')).toBe('do') - expect(div.prop('data-la')).toBe('fa') -}) - -test('withProps should accept function', () => { - const DoReMi = withProps(props => ({ - // @ts-expect-error types need improving - 'data-so': props['data-la'], - // @ts-expect-error types need improving - }))('div') - - const div = shallow().find('div') - expect(div.prop('data-so')).toBe('la') -}) diff --git a/packages/recompose/tests/wrapDisplayName.test.tsx b/packages/recompose/tests/wrapDisplayName.test.tsx deleted file mode 100644 index fc56b18aa7..0000000000 --- a/packages/recompose/tests/wrapDisplayName.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Component } from 'react' -import { wrapDisplayName } from '../src' - -test('wrapDisplayName wraps the display name of a React component with the name of an HoC, Relay-style', () => { - class SomeComponent extends Component { - render() { - return
- } - } - - expect(wrapDisplayName(SomeComponent, 'someHoC')).toBe('someHoC(SomeComponent)') -}) diff --git a/packages/recompose/tsconfig.json b/packages/recompose/tsconfig.json deleted file mode 100644 index 7dddf9f17c..0000000000 --- a/packages/recompose/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.types.json", - "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist/types", - "rootDir": "./src" - }, - "include": ["src/**/*"] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1043b20955..60d6a2df3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -706,9 +706,6 @@ importers: packages/core: dependencies: - '@nivo/recompose': - specifier: workspace:* - version: link:../recompose '@nivo/tooltip': specifier: workspace:* version: link:../tooltip @@ -1180,24 +1177,6 @@ importers: specifier: 18.2.0 version: 18.2.0 - packages/recompose: - dependencies: - '@types/prop-types': - specifier: ^15.7.2 - version: 15.7.4 - '@types/react-lifecycles-compat': - specifier: ^3.0.1 - version: 3.0.1 - prop-types: - specifier: ^15.7.2 - version: 15.8.1 - react: - specifier: 18.2.0 - version: 18.2.0 - react-lifecycles-compat: - specifier: ^3.0.4 - version: 3.0.4 - packages/sankey: dependencies: '@nivo/colors': @@ -7981,12 +7960,6 @@ packages: '@types/react': 18.2.0 dev: false - /@types/react-lifecycles-compat@3.0.1: - resolution: {integrity: sha512-4KiU5s1Go4xRbf7t6VxUUpBeN5PGjpjpBv9VvET4uiPHC500VNYBclU13f8ehHkHoZL39b2cfwHu6RzbV3b44A==} - dependencies: - '@types/react': 18.2.0 - dev: false - /@types/react-test-renderer@18.0.0: resolution: {integrity: sha512-C7/5FBJ3g3sqUahguGi03O79b8afNeSD6T8/GU50oQrJCU0bVCCGQHaGKUbg2Ce8VQEEqTw8/HiS6lXHHdgkdQ==} dependencies: @@ -21562,10 +21535,6 @@ packages: /react-is@18.2.0: resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} - /react-lifecycles-compat@3.0.4: - resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} - dev: false - /react-markdown@8.0.7(@types/react@18.2.0)(react@18.2.0): resolution: {integrity: sha512-bvWbzG4MtOU62XqBx3Xx+zB2raaFFsq4mYiAzfjXJMEz2sixgeAfraA3tvzULF02ZdOMUOKTBFFaZJDDrq+BJQ==} peerDependencies: diff --git a/tsconfig.monorepo.json b/tsconfig.monorepo.json index be1953255a..738a551ef3 100644 --- a/tsconfig.monorepo.json +++ b/tsconfig.monorepo.json @@ -19,7 +19,6 @@ // Utility packages { "path": "./packages/generators" }, - { "path": "./packages/recompose" }, // Charts now { "path": "./packages/bar" },