From a783a0258291c0e5769bde8d013f285c2780b92c Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Fri, 14 Sep 2018 13:07:56 +1200 Subject: [PATCH] First pass at proptypes --- client/src/components/GridField/GridFieldTable.js | 7 ++++--- .../src/components/GridFieldActions/GridFieldActions.js | 3 ++- client/src/components/TimeField/TimeField.js | 9 +++++---- client/src/containers/Form/Form.js | 3 ++- .../lib/dependency-injection/tests/loadComponent-test.js | 5 +++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/client/src/components/GridField/GridFieldTable.js b/client/src/components/GridField/GridFieldTable.js index 66e0fad70..92c28e75f 100644 --- a/client/src/components/GridField/GridFieldTable.js +++ b/client/src/components/GridField/GridFieldTable.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import PropTypes from 'prop-types'; class GridFieldTable extends Component { /** @@ -54,9 +55,9 @@ class GridFieldTable extends Component { } GridFieldTable.propTypes = { - data: React.PropTypes.object, - header: React.PropTypes.object, - rows: React.PropTypes.array, + data: PropTypes.object, + header: PropTypes.object, + rows: PropTypes.array, }; export default GridFieldTable; diff --git a/client/src/components/GridFieldActions/GridFieldActions.js b/client/src/components/GridFieldActions/GridFieldActions.js index d954a2d0d..462f8d942 100644 --- a/client/src/components/GridFieldActions/GridFieldActions.js +++ b/client/src/components/GridFieldActions/GridFieldActions.js @@ -4,6 +4,7 @@ import GridFieldDropdownAction from './GridFieldDropdownAction'; import ActionMenu from '../ActionMenu/ActionMenu'; import classnames from 'classnames'; import PropTypes from 'prop-types'; +import PropTypes from 'prop-types'; class GridFieldActions extends PureComponent { constructor(props) { @@ -96,7 +97,7 @@ const actionShape = GridFieldDropdownAction.propTypes; actionShape.group = PropTypes.string; GridFieldActions.propTypes = PropTypes.arrayOf( - React.PropTypes.shape(actionShape) + PropTypes.shape(actionShape) ).isRequired; export default GridFieldActions; diff --git a/client/src/components/TimeField/TimeField.js b/client/src/components/TimeField/TimeField.js index 7826f952b..4aff51dfb 100644 --- a/client/src/components/TimeField/TimeField.js +++ b/client/src/components/TimeField/TimeField.js @@ -4,6 +4,7 @@ import { Component as DateField } from '../DateField/DateField'; import moment from 'moment'; import modernizr from 'modernizr'; import i18n from 'i18n'; +import PropTypes from 'prop-types'; const localFormat = 'LT'; @@ -53,10 +54,10 @@ class TimeField extends DateField { } TimeField.propTypes = { - lang: React.PropTypes.string, - modernizr: React.PropTypes.object, - data: React.PropTypes.shape({ - html5: React.PropTypes.boolean, + lang: PropTypes.string, + modernizr: PropTypes.object, + data: PropTypes.shape({ + html5: PropTypes.boolean, }), }; diff --git a/client/src/containers/Form/Form.js b/client/src/containers/Form/Form.js index 4155e1dcf..b9da0fcff 100644 --- a/client/src/containers/Form/Form.js +++ b/client/src/containers/Form/Form.js @@ -2,6 +2,7 @@ import React from 'react'; import { reduxForm } from 'redux-form'; import { inject } from 'lib/Injector'; import getFormState from 'lib/getFormState'; +import PropTypes from 'prop-types'; const InjectableForm = (props) => { const FormComponent = props.formComponent; @@ -14,7 +15,7 @@ const InjectableForm = (props) => { }; InjectableForm.propTypes = { - formComponent: React.PropTypes.func.isRequired, + formComponent: PropTypes.func.isRequired, }; const InjectedForm = inject( diff --git a/client/src/lib/dependency-injection/tests/loadComponent-test.js b/client/src/lib/dependency-injection/tests/loadComponent-test.js index 1c0c85419..d3e06fb7d 100644 --- a/client/src/lib/dependency-injection/tests/loadComponent-test.js +++ b/client/src/lib/dependency-injection/tests/loadComponent-test.js @@ -4,6 +4,7 @@ import React from 'react'; import ReactTestUtils from 'react-addons-test-utils'; import { createStore } from 'redux'; +import PropTypes from 'prop-types'; const mockStore = createStore(state => state); @@ -34,8 +35,8 @@ jest.mock('../provideInjector', () => function mockInjector(Injected) { } MockedInjector.childContextTypes = { - injector: React.PropTypes.shape({ - get: React.PropTypes.func, + injector: PropTypes.shape({ + get: PropTypes.func, }), };