Skip to content

Commit

Permalink
Remove prop-types
Browse files Browse the repository at this point in the history
  • Loading branch information
anajavi committed Dec 17, 2021
1 parent 45b6417 commit 27e24b7
Show file tree
Hide file tree
Showing 41 changed files with 19 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
"rules": {
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"react/prop-types": "warn",
"react/prop-types": "off",
"prefer-object-spread": "warn",
"react-hooks/rules-of-hooks": "error",
"react/jsx-no-constructed-context-values": "error"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ npm install --save react-jsx-highcharts
# or react-jsx-highmaps

# And the peer dependencies
npm install --save react react-dom prop-types highcharts@^9.0.0
npm install --save react react-dom highcharts@^9.0.0
```

## Licensing
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@ let config = {
'@babel/react'
]
};
if (ENV !== 'test') {
config.plugins.push('transform-react-remove-prop-types');
}

module.exports = config;
25 changes: 6 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@testing-library/react": "^12.1.2",
"@types/react": "^17.0.33",
"babel-loader": "^8.2.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"cross-env": "^7.0.3",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -31,7 +30,6 @@
"highcharts": "^9.3.0",
"jest": "^27.3.1",
"prettier": "^2.4.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-jsx-highcharts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ React JSX Highcharts also enables you to write your _own_ Highcharts components,

You'll need the peer dependencies too

`npm install --save react react-dom prop-types highcharts@^9.0.0`
`npm install --save react react-dom highcharts@^9.0.0`

## Licensing

Expand Down
3 changes: 1 addition & 2 deletions packages/react-jsx-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
"peerDependencies": {
"highcharts": "^8.0.0 || ^9.0.0",
"react": "^16.8.6 || ^17.0.0",
"react-dom": "^16.8.6 || ^17.0.0",
"prop-types": "^15.0.0"
"react-dom": "^16.8.6 || ^17.0.0"
},
"browserslist": [
"ie >= 11"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useRef, useEffect, memo } from 'react';
import PropTypes from 'prop-types';
import { v4 as uuid } from 'uuid';
import { logModuleErrorMessage } from '../../utils/warnings';
import useChart from '../UseChart';
Expand Down Expand Up @@ -38,10 +37,6 @@ const Annotation = memo(props => {
return null;
});

Annotation.propTypes = {
id: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
};

Annotation.displayName = 'Annotation';

export default Annotation;
9 changes: 0 additions & 9 deletions packages/react-jsx-highcharts/src/components/Axis/Axis.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as React from 'react';
import { useEffect, useState, useRef } from 'react';
import PropTypes from 'prop-types';
import { v4 as uuid } from 'uuid';
import AxisContext from '../AxisContext';
import { getNonEventHandlerProps, getEventsConfig } from '../../utils/events';
import { validAxisTypes } from '../../utils/propTypeValidators';
import useModifiedProps from '../UseModifiedProps';
import useChart from '../UseChart';
import createProvidedAxis from './createProvidedAxis';
Expand Down Expand Up @@ -91,11 +89,4 @@ const createAxis = (chart, props, dynamicAxis) => {
return axis;
};

Axis.propTypes = {
type: validAxisTypes,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
children: PropTypes.node,
dynamicAxis: PropTypes.bool
};

export default Axis;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { useEffect } from 'react';
import PropTypes from 'prop-types';
import Series from '../Series';
import useChart from '../UseChart';

Expand All @@ -13,7 +12,5 @@ const BarSeries = props => {

return <Series {...props} type="bar" />;
};
BarSeries.propTypes = {
id: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
};

export default BarSeries;
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as React from 'react';
import { useState, useEffect, useRef, useLayoutEffect } from 'react';
import PropTypes from 'prop-types';
import ChartContext from '../ChartContext';
import usePrevious from '../UsePrevious';
import { validChartTypes } from '../../utils/propTypeValidators';
import createProvidedChart from './createProvidedChart';

const noop = c => c;
Expand Down Expand Up @@ -124,9 +122,4 @@ const initHighcharts = (props, domNode) => {
return myChart;
};

BaseChart.propTypes = {
chartCreationFunc: PropTypes.func.isRequired,
chartType: validChartTypes.isRequired
};

export default BaseChart;
15 changes: 0 additions & 15 deletions packages/react-jsx-highcharts/src/components/Chart/Chart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useRef, memo } from 'react';
import PropTypes from 'prop-types';
import { getNonEventHandlerProps } from '../../utils/events';
import useModifiedProps from '../UseModifiedProps';
import useChart from '../UseChart';
Expand Down Expand Up @@ -43,20 +42,6 @@ const updateChart = (config, chart) => {
chart.needsRedraw();
};

Chart.propTypes = {
type: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
onAddSeries: PropTypes.func,
onAfterPrint: PropTypes.func,
onBeforePrint: PropTypes.func,
onClick: PropTypes.func,
onLoad: PropTypes.func,
onRedraw: PropTypes.func,
onRender: PropTypes.func,
onSelection: PropTypes.func
};

Chart.displayName = 'Chart';

export default Chart;
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import PropTypes from 'prop-types';

import useChartUpdate from '../UseChartUpdate';

const Credits = ({ enabled = true, ...restProps }) => {
Expand All @@ -16,7 +14,4 @@ const updateCredits = (chart, config) => {
chart.addCredits(config, true);
};

Credits.propTypes = {
enabled: PropTypes.bool
};
export default Credits;
5 changes: 0 additions & 5 deletions packages/react-jsx-highcharts/src/components/Debug/Debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect } from 'react';
import PropTypes from 'prop-types';
import useChart from '../UseChart';

const Debug = ({ varName = 'chart' }) => {
Expand All @@ -20,8 +19,4 @@ const Debug = ({ varName = 'chart' }) => {
return null;
};

Debug.propTypes = {
varName: PropTypes.string
};

export default Debug;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { useMemo } from 'react';
import PropTypes from 'prop-types';
import HighchartsChart from '../HighchartsChart';
import Chart from '../Chart';
import XAxis from '../XAxis';
Expand Down Expand Up @@ -88,14 +87,4 @@ const HighchartsSparkline = ({
);
};

HighchartsSparkline.propTypes = {
height: PropTypes.number,
width: PropTypes.number,
margin: PropTypes.array,
style: PropTypes.object,
plotOptions: PropTypes.object,
series: PropTypes.node,
children: PropTypes.node
};

export default HighchartsSparkline;
4 changes: 0 additions & 4 deletions packages/react-jsx-highcharts/src/components/Legend/Legend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { memo } from 'react';
import PropTypes from 'prop-types';
import useChartUpdate from '../UseChartUpdate';

const Legend = memo(({ children = null, enabled = true, ...restProps }) => {
Expand All @@ -16,9 +15,6 @@ const updateLegend = (chart, config) => {
chart.update({ legend: config }, false);
};

Legend.propTypes = {
enabled: PropTypes.bool
};
Legend.displayName = 'Legend';

export default Legend;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, memo } from 'react';
import PropTypes from 'prop-types';
import useModifiedProps from '../UseModifiedProps';
import useChart from '../UseChart';

Expand Down Expand Up @@ -31,13 +30,5 @@ const updateLoading = (config, chart) => {
chart.update({ loading: config }, true);
};

Loading.propTypes = {
isLoading: PropTypes.bool,
hideDuration: PropTypes.number,
labelStyle: PropTypes.object,
showDuration: PropTypes.number,
style: PropTypes.object
};

Loading.displayName = 'Loading';
export default Loading;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, memo } from 'react';
import PropTypes from 'prop-types';
import { log3DModuleErrorMessage } from '../../utils/warnings';
import useHighcharts from '../UseHighcharts';
import useChart from '../UseChart';
Expand Down Expand Up @@ -81,16 +80,6 @@ const update3dOptions = (chart, props) => {
chart.update(opts, true);
};

Options3d.propTypes = {
alpha: PropTypes.number,
axisLabelPosition: PropTypes.string,
beta: PropTypes.number,
depth: PropTypes.number,
fitToPlot: PropTypes.bool,
frame: PropTypes.object,
viewDistance: PropTypes.number
};

Options3d.displayName = 'Options3d';

export default Options3d;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { memo } from 'react';
import PropTypes from 'prop-types';
import PlotBandLineContext from '../PlotBandLineContext';
import usePlotBandLineLifecycle from './UsePlotBandLineLifecycle';

Expand All @@ -18,13 +17,5 @@ const PlotBand = memo(props => {
);
});

PlotBand.propTypes = {
id: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
from: PropTypes.any.isRequired,
to: PropTypes.any.isRequired,
color: PropTypes.string,
children: PropTypes.node
};

PlotBand.displayName = 'PlotBand';
export default PlotBand;
Loading

0 comments on commit 27e24b7

Please sign in to comment.