From e9e3f1db7db8b651262c5d87f608cbb0f2c01493 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Sun, 9 Apr 2017 18:29:45 +0200 Subject: [PATCH] Fixes depricated prop types, now we use separate npm package Resolves #8152 Auditors: @bsclifton @bbondy Test Plan: --- js/about/passwords.js | 7 ++++--- js/components/dialog.js | 13 +++++++------ js/components/dialogButton.js | 11 ++++++----- js/components/loginRequired.js | 3 ++- js/components/noScriptInfo.js | 5 +++-- js/components/siteInfo.js | 5 +++-- js/components/window.js | 3 ++- package.json | 1 + 8 files changed, 28 insertions(+), 20 deletions(-) diff --git a/js/about/passwords.js b/js/about/passwords.js index 4791367a1c5..019624645fe 100644 --- a/js/about/passwords.js +++ b/js/about/passwords.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const messages = require('../constants/messages') const Immutable = require('immutable') const aboutActions = require('./aboutActions') @@ -82,7 +83,7 @@ class SiteItem extends React.Component { } SiteItem.propTypes = { - site: React.PropTypes.string + site: PropTypes.string } class PasswordItem extends React.Component { @@ -161,8 +162,8 @@ class PasswordItem extends React.Component { } PasswordItem.propTypes = { - password: React.PropTypes.object, - id: React.PropTypes.number + password: PropTypes.object, + id: PropTypes.number } class AboutPasswords extends React.Component { diff --git a/js/components/dialog.js b/js/components/dialog.js index 1416b6b250f..2172fb7b9e8 100644 --- a/js/components/dialog.js +++ b/js/components/dialog.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const ImmutableComponent = require('./immutableComponent') const KeyCodes = require('../../app/common/constants/keyCodes') @@ -41,13 +42,13 @@ class Dialog extends ImmutableComponent { } Dialog.propTypes = { - children: React.PropTypes.oneOfType([ - React.PropTypes.element, - React.PropTypes.array + children: PropTypes.oneOfType([ + PropTypes.element, + PropTypes.array ]), - className: React.PropTypes.string, - isClickDismiss: React.PropTypes.bool, - onHide: React.PropTypes.func + className: PropTypes.string, + isClickDismiss: PropTypes.bool, + onHide: PropTypes.func } module.exports = Dialog diff --git a/js/components/dialogButton.js b/js/components/dialogButton.js index 2b527cda009..793273f6274 100644 --- a/js/components/dialogButton.js +++ b/js/components/dialogButton.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const ReactDOM = require('react-dom') const ImmutableComponent = require('./immutableComponent') @@ -30,11 +31,11 @@ class DialogButton extends ImmutableComponent { } DialogButton.propTypes = { - 'data-l10n-id': React.PropTypes.string, - onClick: React.PropTypes.func, - returnValue: React.PropTypes.bool, - returnValueCallback: React.PropTypes.func, - text: React.PropTypes.string + 'data-l10n-id': PropTypes.string, + onClick: PropTypes.func, + returnValue: PropTypes.bool, + returnValueCallback: PropTypes.func, + text: PropTypes.string } module.exports = DialogButton diff --git a/js/components/loginRequired.js b/js/components/loginRequired.js index 30dec3336cf..f5f0a2fce78 100644 --- a/js/components/loginRequired.js +++ b/js/components/loginRequired.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const Dialog = require('./dialog') const Button = require('./button') const appActions = require('../actions/appActions') @@ -99,5 +100,5 @@ class LoginRequired extends React.Component { } } -LoginRequired.propTypes = { frameProps: React.PropTypes.object } +LoginRequired.propTypes = { frameProps: PropTypes.object } module.exports = LoginRequired diff --git a/js/components/noScriptInfo.js b/js/components/noScriptInfo.js index 7142e7b0e06..997b9e3accb 100644 --- a/js/components/noScriptInfo.js +++ b/js/components/noScriptInfo.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const Immutable = require('immutable') const ImmutableComponent = require('./immutableComponent') const Dialog = require('./dialog') @@ -129,8 +130,8 @@ class NoScriptInfo extends ImmutableComponent { } NoScriptInfo.propTypes = { - frameProps: React.PropTypes.object, - onHide: React.PropTypes.func + frameProps: PropTypes.object, + onHide: PropTypes.func } module.exports = NoScriptInfo diff --git a/js/components/siteInfo.js b/js/components/siteInfo.js index 46d6d967b72..9a6574c1114 100644 --- a/js/components/siteInfo.js +++ b/js/components/siteInfo.js @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') +const PropTypes = require('prop-types') const ImmutableComponent = require('./immutableComponent') const cx = require('../lib/classSet') const {isPotentialPhishingUrl} = require('../lib/urlutil') @@ -228,8 +229,8 @@ class SiteInfo extends ImmutableComponent { } SiteInfo.propTypes = { - frameProps: React.PropTypes.object, - onHide: React.PropTypes.func + frameProps: PropTypes.object, + onHide: PropTypes.func } const styles = StyleSheet.create({ diff --git a/js/components/window.js b/js/components/window.js index 54ebb15f2ca..a2b4bc5d578 100644 --- a/js/components/window.js +++ b/js/components/window.js @@ -5,6 +5,7 @@ // Controller view which manages the top level immutable state for the app const React = require('react') +const PropTypes = require('prop-types') const Immutable = require('immutable') const windowStore = require('../stores/windowStore') const appStoreRenderer = require('../stores/appStoreRenderer') @@ -117,6 +118,6 @@ class Window extends React.Component { } } -Window.propTypes = { appState: React.PropTypes.object, frames: React.PropTypes.array, initWindowState: React.PropTypes.object } +Window.propTypes = { appState: PropTypes.object, frames: PropTypes.array, initWindowState: PropTypes.object } module.exports = Window diff --git a/package.json b/package.json index 20741c7cce8..a898610628d 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,7 @@ "normalize-url": "^1.7.0", "parse-torrent": "^5.8.1", "prettier-bytes": "^1.0.3", + "prop-types": "^15.5.6", "punycode": "^2.0.0", "qr-image": "3.2.0", "random-lib": "2.1.0",