1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-07 01:16:28 +02:00

Fix deprecations (#88)

* Fix some optimization bailouts

* Use prop-types package

* Make error comp functional

* Remove unused css transition dep

* Remove unused immutability helper dep

* Align react versions in package.json
This commit is contained in:
Simen Bekkhus 2017-08-28 21:30:12 +02:00 committed by GitHub
parent 683ae7e6d8
commit b176d63f56
32 changed files with 93 additions and 95 deletions

View File

@ -39,14 +39,13 @@
"main": "./index.js", "main": "./index.js",
"dependencies": { "dependencies": {
"debug": "^2.2.0", "debug": "^2.2.0",
"immutability-helper": "^2.0.0",
"immutable": "^3.8.1", "immutable": "^3.8.1",
"normalize.css": "^5.0.0", "normalize.css": "^5.0.0",
"react": "^15.3.1", "prop-types": "^15.5.10",
"react-addons-css-transition-group": "^15.3.1", "react": "^15.6.1",
"react-dnd": "^2.1.4", "react-dnd": "^2.1.4",
"react-dnd-html5-backend": "^2.1.2", "react-dnd-html5-backend": "^2.1.2",
"react-dom": "^15.3.1", "react-dom": "^15.6.1",
"react-mdl": "^1.9.0", "react-mdl": "^1.9.0",
"react-modal": "^1.6.4", "react-modal": "^1.6.4",
"react-redux": "^4.4.5", "react-redux": "^4.4.5",
@ -77,7 +76,7 @@
"jest": "^20.0.4", "jest": "^20.0.4",
"node-sass": "^4.5.3", "node-sass": "^4.5.3",
"prettier": "^1.6.0", "prettier": "^1.6.0",
"react-test-renderer": "^15.4.2", "react-test-renderer": "^15.6.1",
"redux-devtools": "^3.3.1", "redux-devtools": "^3.3.1",
"sass-loader": "^6.0.6", "sass-loader": "^6.0.6",
"style-loader": "^0.18.2", "style-loader": "^0.18.2",

View File

@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { import {
Layout, Layout,
Drawer, Drawer,
@ -39,7 +40,7 @@ export default class App extends Component {
}; };
static contextTypes = { static contextTypes = {
router: React.PropTypes.object, router: PropTypes.object,
}; };
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {

View File

@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { DataTable, TableHeader } from 'react-mdl'; import { DataTable, TableHeader } from 'react-mdl';
class ClientStrategies extends Component { class ClientStrategies extends Component {

View File

@ -1,7 +1,6 @@
const React = require('react'); import React from 'react';
import styles from './common.scss'; import { Link } from 'react-router';
import {
const {
List, List,
ListItem, ListItem,
ListItemContent, ListItemContent,
@ -9,8 +8,8 @@ const {
Icon, Icon,
Switch, Switch,
MenuItem, MenuItem,
} = require('react-mdl'); } from 'react-mdl';
const { Link } = require('react-router'); import styles from './common.scss';
export { styles }; export { styles };

View File

@ -1,17 +1,12 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Snackbar, Icon } from 'react-mdl'; import { Snackbar, Icon } from 'react-mdl';
class ErrorComponent extends React.Component { const ErrorComponent = ({ errors, ...props }) => {
static propTypes = { const showError = errors.length > 0;
errors: PropTypes.array.isRequired, const error = showError ? errors[0] : undefined;
muteError: PropTypes.func.isRequired, const muteError = () => props.muteError(error);
};
render() {
const showError = this.props.errors.length > 0;
const error = showError ? this.props.errors[0] : undefined;
const muteError = () => this.props.muteError(error);
return ( return (
<Snackbar <Snackbar
action="Dismiss" action="Dismiss"
@ -23,7 +18,11 @@ class ErrorComponent extends React.Component {
<Icon name="question_answer" /> {error} <Icon name="question_answer" /> {error}
</Snackbar> </Snackbar>
); );
} };
}
ErrorComponent.propTypes = {
errors: PropTypes.array.isRequired,
muteError: PropTypes.func.isRequired,
};
export default ErrorComponent; export default ErrorComponent;

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { Switch, Chip, ListItem } from 'react-mdl'; import { Switch, Chip, ListItem } from 'react-mdl';
import Progress from './progress'; import Progress from './progress';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Card, CardTitle } from 'react-mdl'; import { Card, CardTitle } from 'react-mdl';
import FormComponent from './form'; import FormComponent from './form';

View File

@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Textfield, Switch } from 'react-mdl'; import { Textfield, Switch } from 'react-mdl';
import StrategiesSection from './strategies-section-container'; import StrategiesSection from './strategies-section-container';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Menu, MenuItem, IconButton } from 'react-mdl'; import { Menu, MenuItem, IconButton } from 'react-mdl';
class AddStrategy extends React.Component { class AddStrategy extends React.Component {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ConfigureStrategy from './strategy-configure'; import ConfigureStrategy from './strategy-configure';
import { DragDropContext } from 'react-dnd'; import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend'; import HTML5Backend from 'react-dnd-html5-backend';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { ProgressBar } from 'react-mdl'; import { ProgressBar } from 'react-mdl';
import StrategiesList from './strategies-list'; import StrategiesList from './strategies-list';
import AddStrategy from './strategies-add'; import AddStrategy from './strategies-add';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { import {
Textfield, Textfield,
Button, Button,

View File

@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Textfield, IconButton, Chip } from 'react-mdl'; import { Textfield, IconButton, Chip } from 'react-mdl';
export default class InputList extends Component { export default class InputList extends Component {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import Feature from './feature-list-item-component'; import Feature from './feature-list-item-component';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { import {
@ -26,11 +27,11 @@ export default class FeatureListComponent extends React.PureComponent {
fetchFeatureToggles: PropTypes.func.isRequired, fetchFeatureToggles: PropTypes.func.isRequired,
fetchFeatureMetrics: PropTypes.func.isRequired, fetchFeatureMetrics: PropTypes.func.isRequired,
updateSetting: PropTypes.func.isRequired, updateSetting: PropTypes.func.isRequired,
settings: React.PropTypes.object, settings: PropTypes.object,
}; };
static contextTypes = { static contextTypes = {
router: React.PropTypes.object, router: PropTypes.object,
}; };
componentDidMount() { componentDidMount() {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Grid, Cell, Icon, Chip, ChipContact } from 'react-mdl'; import { Grid, Cell, Icon, Chip, ChipContact } from 'react-mdl';
import Progress from './progress'; import Progress from './progress';
import { Link } from 'react-router'; import { Link } from 'react-router';

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './progress-styles.scss'; import styles from './progress-styles.scss';
class Progress extends Component { class Progress extends Component {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { import {
Tabs, Tabs,
Tab, Tab,

View File

@ -1,4 +1,5 @@
import React, { PropTypes, PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import style from './history.scss'; import style from './history.scss';

View File

@ -1,4 +1,5 @@
import React, { PropTypes, PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import style from './history.scss'; import style from './history.scss';

View File

@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import HistoryList from './history-list-container'; import HistoryList from './history-list-container';
class HistoryListToggle extends Component { class HistoryListToggle extends Component {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { import {
Textfield, Textfield,

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { import {
@ -13,7 +14,7 @@ import { HeaderTitle } from '../common';
class StrategiesListComponent extends Component { class StrategiesListComponent extends Component {
static contextTypes = { static contextTypes = {
router: React.PropTypes.object, router: PropTypes.object,
}; };
componentDidMount() { componentDidMount() {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Grid, Cell, List, ListItem, ListItemContent } from 'react-mdl'; import { Grid, Cell, List, ListItem, ListItemContent } from 'react-mdl';
import { AppsLinkList, TogglesLinkList } from '../common'; import { AppsLinkList, TogglesLinkList } from '../common';

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { hashHistory } from 'react-router'; import { hashHistory } from 'react-router';
import { Tabs, Tab, ProgressBar, Grid, Cell } from 'react-mdl'; import { Tabs, Tab, ProgressBar, Grid, Cell } from 'react-mdl';
import ShowStrategy from './show-strategy-component'; import ShowStrategy from './show-strategy-component';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Icon, Tooltip } from 'react-mdl'; import { Icon, Tooltip } from 'react-mdl';
export default class ShowUserComponent extends React.Component { export default class ShowUserComponent extends React.Component {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { Textfield, Button } from 'react-mdl'; import { Textfield, Button } from 'react-mdl';
import Modal from 'react-modal'; import Modal from 'react-modal';

View File

@ -1,4 +1,4 @@
const { throwIfNotSuccess } = require('./helper'); import { throwIfNotSuccess } from './helper';
const URI = 'api/admin/metrics/feature-toggles'; const URI = 'api/admin/metrics/feature-toggles';

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ApplicationEditComponent from '../../component/application/application-edit-container'; import ApplicationEditComponent from '../../component/application/application-edit-container';
const render = ({ params }) => ( const render = ({ params }) => (

View File

@ -1,4 +1,5 @@
import React, { PureComponent, PropTypes } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ViewFeatureToggle from '../../component/feature/view-container'; import ViewFeatureToggle from '../../component/feature/view-container';
export default class Features extends PureComponent { export default class Features extends PureComponent {

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import HistoryListToggle from '../../component/history/history-list-toggle-container'; import HistoryListToggle from '../../component/history/history-list-toggle-container';
const render = ({ params }) => ( const render = ({ params }) => (

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ShowStrategy from '../../component/strategies/strategy-details-container'; import ShowStrategy from '../../component/strategies/strategy-details-container';
const render = ({ params }) => ( const render = ({ params }) => (

View File

@ -1243,10 +1243,6 @@ center-align@^0.1.1:
align-text "^0.1.3" align-text "^0.1.3"
lazy-cache "^1.0.3" lazy-cache "^1.0.3"
chain-function@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc"
chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3" version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
@ -1829,7 +1825,7 @@ doctrine@^2.0.0:
esutils "^2.0.2" esutils "^2.0.2"
isarray "^1.0.0" isarray "^1.0.0"
dom-helpers@^3.0.0, dom-helpers@^3.2.0: dom-helpers@^3.0.0:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.2.1.tgz#3203e07fed217bd1f424b019735582fc37b2825a" resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.2.1.tgz#3203e07fed217bd1f424b019735582fc37b2825a"
@ -2793,12 +2789,6 @@ ignore@^3.3.3:
version "3.3.3" version "3.3.3"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d"
immutability-helper@^2.0.0:
version "2.2.3"
resolved "https://registry.yarnpkg.com/immutability-helper/-/immutability-helper-2.2.3.tgz#681a0ec9ba2a243b9898564e39623c83d9ce1985"
dependencies:
invariant "^2.2.0"
immutable@^3.8.1: immutable@^3.8.1:
version "3.8.1" version "3.8.1"
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2"
@ -4615,12 +4605,6 @@ rc@^1.1.7:
minimist "^1.2.0" minimist "^1.2.0"
strip-json-comments "~2.0.1" strip-json-comments "~2.0.1"
react-addons-css-transition-group@^15.3.1:
version "15.6.0"
resolved "https://registry.yarnpkg.com/react-addons-css-transition-group/-/react-addons-css-transition-group-15.6.0.tgz#69887cf6e4874d25cd66e22a699e29f0d648aba0"
dependencies:
react-transition-group "^1.2.0"
react-deep-force-update@^1.0.0: react-deep-force-update@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.0.1.tgz#f911b5be1d2a6fe387507dd6e9a767aa2924b4c7" resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.0.1.tgz#f911b5be1d2a6fe387507dd6e9a767aa2924b4c7"
@ -4646,7 +4630,7 @@ react-dom-factories@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/react-dom-factories/-/react-dom-factories-1.0.0.tgz#f43c05e5051b304f33251618d5bc859b29e46b6d" resolved "https://registry.yarnpkg.com/react-dom-factories/-/react-dom-factories-1.0.0.tgz#f43c05e5051b304f33251618d5bc859b29e46b6d"
react-dom@^15.3.1: react-dom@^15.6.1:
version "15.6.1" version "15.6.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470"
dependencies: dependencies:
@ -4713,7 +4697,7 @@ react-router@^3.0.0:
prop-types "^15.5.6" prop-types "^15.5.6"
warning "^3.0.0" warning "^3.0.0"
react-test-renderer@^15.4.2: react-test-renderer@^15.6.1:
version "15.6.1" version "15.6.1"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-15.6.1.tgz#026f4a5bb5552661fd2cc4bbcd0d4bc8a35ebf7e" resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-15.6.1.tgz#026f4a5bb5552661fd2cc4bbcd0d4bc8a35ebf7e"
dependencies: dependencies:
@ -4731,17 +4715,7 @@ react-transform-hmr@^1.0.3:
global "^4.3.0" global "^4.3.0"
react-proxy "^1.1.7" react-proxy "^1.1.7"
react-transition-group@^1.2.0: react@^15.6.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.0.tgz#b51fc921b0c3835a7ef7c571c79fc82c73e9204f"
dependencies:
chain-function "^1.0.0"
dom-helpers "^3.2.0"
loose-envify "^1.3.1"
prop-types "^15.5.6"
warning "^3.0.0"
react@^15.3.1:
version "15.6.1" version "15.6.1"
resolved "https://registry.yarnpkg.com/react/-/react-15.6.1.tgz#baa8434ec6780bde997cdc380b79cd33b96393df" resolved "https://registry.yarnpkg.com/react/-/react-15.6.1.tgz#baa8434ec6780bde997cdc380b79cd33b96393df"
dependencies: dependencies: