Skip to content

Commit

Permalink
Upgrading usage of prop-types to new package (#971)
Browse files Browse the repository at this point in the history
Upgrading usage of prop-types to new package
  • Loading branch information
luisrudge authored Apr 18, 2017
1 parent 6601bac commit dfad802
Show file tree
Hide file tree
Showing 33 changed files with 224 additions and 186 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@
"immutable": "^3.7.3",
"jsonp": "^0.2.0",
"password-sheriff": "^1.1.0",
"react": "^15.0.0 || ^16.0.0",
"react-addons-css-transition-group": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
"prop-types": "^15.5.7 || ^16.0.0",
"react": "^15.3.0 || ^16.0.0",
"react-addons-css-transition-group": "^15.3.0 || ^16.0.0",
"react-dom": "^15.3.0 || ^16.0.0",
"superagent": "^3.3.1",
"trim": "0.0.1",
"url-join": "^1.1.0"
Expand Down
21 changes: 11 additions & 10 deletions src/connection/database/login_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import EmailPane from '../../field/email/email_pane';
import UsernamePane from '../../field/username/username_pane';
Expand Down Expand Up @@ -72,14 +73,14 @@ export default class LoginPane extends React.Component {
}

LoginPane.propTypes = {
emailInputPlaceholder: React.PropTypes.string.isRequired,
forgotPasswordAction: React.PropTypes.string.isRequired,
i18n: React.PropTypes.object.isRequired,
instructions: React.PropTypes.any,
lock: React.PropTypes.object.isRequired,
passwordInputPlaceholder: React.PropTypes.string.isRequired,
showForgotPasswordLink: React.PropTypes.bool.isRequired,
showPassword: React.PropTypes.bool.isRequired,
usernameInputPlaceholder: React.PropTypes.string.isRequired,
usernameStyle: React.PropTypes.oneOf(["any", "email", "username"])
emailInputPlaceholder: PropTypes.string.isRequired,
forgotPasswordAction: PropTypes.string.isRequired,
i18n: PropTypes.object.isRequired,
instructions: PropTypes.any,
lock: PropTypes.object.isRequired,
passwordInputPlaceholder: PropTypes.string.isRequired,
showForgotPasswordLink: PropTypes.bool.isRequired,
showPassword: PropTypes.bool.isRequired,
usernameInputPlaceholder: PropTypes.string.isRequired,
usernameStyle: PropTypes.oneOf(["any", "email", "username"])
};
9 changes: 5 additions & 4 deletions src/connection/database/login_sign_up_tabs.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import { showLoginActivity, showSignUpActivity } from './actions';
import * as l from '../../core/index';
Expand Down Expand Up @@ -53,10 +54,10 @@ export default class LoginSignUpTabs extends React.Component {
}

LoginSignUpTabs.propTypes = {
lock: React.PropTypes.object.isRequired,
loginLabel: React.PropTypes.string.isRequired,
signUpLabel: React.PropTypes.string.isRequired,
signUpLink: React.PropTypes.string
lock: PropTypes.object.isRequired,
loginLabel: PropTypes.string.isRequired,
signUpLabel: PropTypes.string.isRequired,
signUpLink: PropTypes.string
};

class LoginSignUpTab extends React.Component {
Expand Down
11 changes: 6 additions & 5 deletions src/connection/database/mfa_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import MFACodePane from '../../field/mfa-code/mfa_code_pane';

Expand Down Expand Up @@ -29,9 +30,9 @@ export default class MFAPane extends React.Component {
}

MFAPane.propTypes = {
mfaInputPlaceholder: React.PropTypes.string.isRequired,
title: React.PropTypes.string.isRequired,
i18n: React.PropTypes.object.isRequired,
instructions: React.PropTypes.any,
lock: React.PropTypes.object.isRequired
mfaInputPlaceholder: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
i18n: PropTypes.object.isRequired,
instructions: PropTypes.any,
lock: PropTypes.object.isRequired
};
5 changes: 3 additions & 2 deletions src/connection/database/password_reset_confirmation.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import SuccessPane from '../../ui/box/success_pane';
import { closeLock } from '../../core/actions';
Expand Down Expand Up @@ -25,8 +26,8 @@ export default class PasswordResetConfirmation extends React.Component {
}

PasswordResetConfirmation.propTypes = {
closeHandler: React.PropTypes.func.isRequired,
lock: React.PropTypes.object.isRequired
closeHandler: PropTypes.func.isRequired,
lock: PropTypes.object.isRequired
};

export function renderPasswordResetConfirmation(m, props = {}) {
Expand Down
5 changes: 3 additions & 2 deletions src/connection/database/reset_password_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import PropTypes from 'prop-types';
import React from 'react';
import EmailPane from '../../field/email/email_pane';
import * as l from '../../core/index';

export default class ResetPasswordPane extends React.Component {
static propTypes = {
emailInputPlaceholder: React.PropTypes.string.isRequired,
lock: React.PropTypes.object.isRequired
emailInputPlaceholder: PropTypes.string.isRequired,
lock: PropTypes.object.isRequired
};

render() {
Expand Down
5 changes: 3 additions & 2 deletions src/connection/database/signed_up_confirmation.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import SuccessPane from '../../ui/box/success_pane';
import { closeLock } from '../../core/actions';
Expand Down Expand Up @@ -26,8 +27,8 @@ export default class SignedUpConfirmation extends React.Component {
}

SignedUpConfirmation.propTypes = {
closeHandler: React.PropTypes.func.isRequired,
lock: React.PropTypes.object.isRequired
closeHandler: PropTypes.func.isRequired,
lock: PropTypes.object.isRequired
};

export function renderSignedUpConfirmation(m, props = {}) {
Expand Down
11 changes: 6 additions & 5 deletions src/connection/enterprise/hrd_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import UsernamePane from '../../field/username/username_pane';
import PasswordPane from '../../field/password/password_pane';
Expand Down Expand Up @@ -35,9 +36,9 @@ export default class HRDPane extends React.Component {
}

HRDPane.propTypes = {
header: React.PropTypes.element,
i18n: React.PropTypes.object.isRequired,
model: React.PropTypes.object.isRequired,
passwordInputPlaceholder: React.PropTypes.string.isRequired,
usernameInputPlaceholder: React.PropTypes.string.isRequired
header: PropTypes.element,
i18n: PropTypes.object.isRequired,
model: PropTypes.object.isRequired,
passwordInputPlaceholder: PropTypes.string.isRequired,
usernameInputPlaceholder: PropTypes.string.isRequired
};
3 changes: 2 additions & 1 deletion src/core/error_screen.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import Screen from './screen';
import * as l from './index';
Expand All @@ -22,5 +23,5 @@ const ErrorPane = ({i18n}) => (


ErrorPane.propTypes = {
i18n: React.PropTypes.object.isRequired
i18n: PropTypes.object.isRequired
};
3 changes: 2 additions & 1 deletion src/core/loading_screen.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import Screen from './screen';
import { pinLoadingPane, unpinLoadingPane } from './actions';
Expand Down Expand Up @@ -36,5 +37,5 @@ class LoadingPane extends React.Component {
}

LoadingPane.propTypes = {
model: React.PropTypes.object.isRequired
model: PropTypes.object.isRequired
};
5 changes: 3 additions & 2 deletions src/core/signed_in_confirmation.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import SuccessPane from '../ui/box/success_pane';
import { closeLock } from './actions';
Expand Down Expand Up @@ -25,8 +26,8 @@ export default class SignedInConfirmation extends React.Component {
}

SignedInConfirmation.propTypes = {
closeHandler: React.PropTypes.func.isRequired,
lock: React.PropTypes.object.isRequired
closeHandler: PropTypes.func.isRequired,
lock: PropTypes.object.isRequired
};

export function renderSignedInConfirmation(lock, props = {}) {
Expand Down
7 changes: 4 additions & 3 deletions src/field/email/email_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import EmailInput from '../../ui/input/email_input';
import * as c from '../index';
Expand Down Expand Up @@ -48,7 +49,7 @@ export default class EmailPane extends React.Component {
}

EmailPane.propTypes = {
i18n: React.PropTypes.object.isRequired,
lock: React.PropTypes.object.isRequired,
placeholder: React.PropTypes.string.isRequired
i18n: PropTypes.object.isRequired,
lock: PropTypes.object.isRequired,
placeholder: PropTypes.string.isRequired
};
7 changes: 4 additions & 3 deletions src/field/mfa-code/mfa_code_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import MFACodeInput from '../../ui/input/mfa_code_input';
import * as c from '../index';
Expand Down Expand Up @@ -29,7 +30,7 @@ export default class MFACodePane extends React.Component {
}

MFACodePane.propTypes = {
i18n: React.PropTypes.object.isRequired,
lock: React.PropTypes.object.isRequired,
placeholder: React.PropTypes.string.isRequired
i18n: PropTypes.object.isRequired,
lock: PropTypes.object.isRequired,
placeholder: PropTypes.string.isRequired
};
13 changes: 7 additions & 6 deletions src/field/password/password_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import PasswordInput from '../../ui/input/password_input';
import * as c from '../index';
Expand Down Expand Up @@ -32,10 +33,10 @@ export default class PasswordPane extends React.Component {
}

PasswordPane.propTypes = {
i18n: React.PropTypes.object.isRequired,
lock: React.PropTypes.object.isRequired,
onChange: React.PropTypes.func,
placeholder: React.PropTypes.string.isRequired,
policy: React.PropTypes.string,
strengthMessages: React.PropTypes.object
i18n: PropTypes.object.isRequired,
lock: PropTypes.object.isRequired,
onChange: PropTypes.func,
placeholder: PropTypes.string.isRequired,
policy: PropTypes.string,
strengthMessages: PropTypes.object
};
7 changes: 4 additions & 3 deletions src/field/phone-number/phone_number_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import PhoneNumberInput from '../../ui/input/phone_number_input';

Expand Down Expand Up @@ -46,7 +47,7 @@ export default class PhoneNumberPane extends React.Component {
}

PhoneNumberPane.propTypes = {
instructions: React.PropTypes.element,
lock: React.PropTypes.object.isRequired,
placeholder: React.PropTypes.string.isRequired
instructions: PropTypes.element,
lock: PropTypes.object.isRequired,
placeholder: PropTypes.string.isRequired
};
15 changes: 8 additions & 7 deletions src/field/social/social_buttons_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import AuthButton from '../../ui/button/auth_button';
import * as l from '../../core/index';
Expand Down Expand Up @@ -61,13 +62,13 @@ export default class SocialButtonsPane extends React.Component {
}

SocialButtonsPane.propTypes = {
bigButtons: React.PropTypes.bool.isRequired,
instructions: React.PropTypes.any,
labelFn: React.PropTypes.func.isRequired,
lock: React.PropTypes.object.isRequired,
showLoading: React.PropTypes.bool.isRequired,
signUp: React.PropTypes.bool.isRequired,
disabled: React.PropTypes.bool,
bigButtons: PropTypes.bool.isRequired,
instructions: PropTypes.any,
labelFn: PropTypes.func.isRequired,
lock: PropTypes.object.isRequired,
showLoading: PropTypes.bool.isRequired,
signUp: PropTypes.bool.isRequired,
disabled: PropTypes.bool,
};

SocialButtonsPane.defaultProps = {
Expand Down
11 changes: 6 additions & 5 deletions src/field/username/username_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import UsernameInput from '../../ui/input/username_input';
import * as c from '../index';
Expand Down Expand Up @@ -61,11 +62,11 @@ export default class UsernamePane extends React.Component {
}

UsernamePane.propTypes = {
i18n: React.PropTypes.object.isRequired,
lock: React.PropTypes.object.isRequired,
placeholder: React.PropTypes.string.isRequired,
validateFormat: React.PropTypes.bool.isRequired,
usernameStyle: React.PropTypes.oneOf(["any", "email", "username"])
i18n: PropTypes.object.isRequired,
lock: PropTypes.object.isRequired,
placeholder: PropTypes.string.isRequired,
validateFormat: PropTypes.bool.isRequired,
usernameStyle: PropTypes.oneOf(["any", "email", "username"])
};

UsernamePane.defaultProps = {
Expand Down
11 changes: 6 additions & 5 deletions src/field/vcode/vcode_pane.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import VcodeInput from '../../ui/input/vcode_input';
import * as l from '../../core/index';
Expand Down Expand Up @@ -50,9 +51,9 @@ export default class VcodePane extends React.Component {
}

VcodePane.propTypes = {
instructions: React.PropTypes.element,
lock: React.PropTypes.object.isRequired,
placeholder: React.PropTypes.string.isRequired,
resendLabel: React.PropTypes.string.isRequired,
onRestart: React.PropTypes.func.isRequired
instructions: PropTypes.element,
lock: PropTypes.object.isRequired,
placeholder: PropTypes.string.isRequired,
resendLabel: PropTypes.string.isRequired,
onRestart: PropTypes.func.isRequired
};
11 changes: 6 additions & 5 deletions src/ui/box/button.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

const svgs = {
Expand All @@ -15,9 +16,9 @@ const IconButton = ({name, onClick, svg}) => (
);

IconButton.propTypes = {
name: React.PropTypes.string.isRequired,
onClick: React.PropTypes.func.isRequired,
svg: React.PropTypes.string.isRequired
name: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
svg: PropTypes.string.isRequired
};

// const createButton = name => {
Expand All @@ -39,13 +40,13 @@ export const CloseButton = ({onClick}) => (
);

CloseButton.propTypes = {
onClick: React.PropTypes.func.isRequired
onClick: PropTypes.func.isRequired
};

export const BackButton = ({onClick}) => (
<IconButton name="back" svg={svgs["back"]} onClick={onClick} />
);

BackButton.propTypes = {
onClick: React.PropTypes.func.isRequired
onClick: PropTypes.func.isRequired
};
Loading

0 comments on commit dfad802

Please sign in to comment.