Skip to content

Commit

Permalink
(chore) Use standalone proptypes (#5988)
Browse files Browse the repository at this point in the history
* upgrade deps

* run codemod

* update storybook
  • Loading branch information
MaxBittker authored Aug 30, 2017
1 parent f41ecd3 commit 3935302
Show file tree
Hide file tree
Showing 250 changed files with 1,553 additions and 1,087 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"node-libs-browser": "0.5.3",
"platformicons": "0.1.1",
"po-catalog-loader": "^1.2.0",
"prop-types": "^15.5.10",
"query-string": "2.4.2",
"raven-js": "3.16.1",
"react": "15.3.2",
Expand Down Expand Up @@ -84,7 +85,9 @@
"snapshot": "build-storybook && PERCY_TOKEN=$STORYBOOK_PERCY_TOKEN PERCY_PROJECT=$STORYBOOK_PERCY_PROJECT percy-storybook --widths=375,1280"
},
"jest": {
"snapshotSerializers": ["enzyme-to-json/serializer"],
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/tests/js/helpers/importStyleMock.js",
"integration-docs-platforms": "<rootDir>/tests/fixtures/_platforms.json"
Expand All @@ -102,9 +105,9 @@
},
"devDependencies": {
"@percy-io/react-percy-storybook": "^1.0.2",
"@storybook/addon-actions": "3.2.0",
"@storybook/addon-info": "3.2.0",
"@storybook/react": "3.2.0",
"@storybook/addon-actions": "^3.2.0",
"@storybook/addon-info": "^3.2.0",
"@storybook/react": "^3.2.0",
"babel-eslint": "7.1.1",
"babel-jest": "^19.0.0",
"chai": "3.4.1",
Expand Down
7 changes: 4 additions & 3 deletions src/sentry/static/sentry/app/components/actionOverlay.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 OrganizationState from '../mixins/organizationState';
import {t} from '../locale';
Expand All @@ -6,12 +7,12 @@ import LoadingIndicator from '../components/loadingIndicator';

const ActionOverlay = React.createClass({
propTypes: {
actionId: React.PropTypes.string.isRequired,
isLoading: React.PropTypes.bool
actionId: PropTypes.string.isRequired,
isLoading: PropTypes.bool
},

contextTypes: {
router: React.PropTypes.object.isRequired
router: PropTypes.object.isRequired
},

mixins: [OrganizationState],
Expand Down
9 changes: 5 additions & 4 deletions src/sentry/static/sentry/app/components/activity/feed.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 ApiMixin from '../../mixins/apiMixin';
Expand All @@ -10,10 +11,10 @@ import {logException} from '../../utils/logging';

const ActivityFeed = React.createClass({
propTypes: {
endpoint: React.PropTypes.string,
query: React.PropTypes.object,
renderEmpty: React.PropTypes.func,
pagination: React.PropTypes.bool
endpoint: PropTypes.string,
query: PropTypes.object,
renderEmpty: PropTypes.func,
pagination: PropTypes.bool
},

mixins: [ApiMixin],
Expand Down
13 changes: 7 additions & 6 deletions src/sentry/static/sentry/app/components/activity/item.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import marked from 'marked';
import PropTypes from 'prop-types';
import React from 'react';

import {CommitLink} from '../../views/releases/releaseCommits';
Expand All @@ -14,10 +15,10 @@ import {t, tn, tct} from '../../locale';

const ActivityItem = React.createClass({
propTypes: {
clipHeight: React.PropTypes.number,
defaultClipped: React.PropTypes.bool,
item: React.PropTypes.object.isRequired,
orgId: React.PropTypes.string.isRequired
clipHeight: PropTypes.number,
defaultClipped: PropTypes.bool,
item: PropTypes.object.isRequired,
orgId: PropTypes.string.isRequired
},

getDefaultProps() {
Expand Down Expand Up @@ -55,9 +56,9 @@ const ActivityItem = React.createClass({
let issue = item.issue;

let issueLink = issue
? (<IssueLink orgId={orgId} projectId={project.slug} issue={issue}>
? <IssueLink orgId={orgId} projectId={project.slug} issue={issue}>
{issue.shortId}
</IssueLink>)
</IssueLink>
: null;

switch (item.type) {
Expand Down
9 changes: 5 additions & 4 deletions src/sentry/static/sentry/app/components/activity/note.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 TimeSince from '../../components/timeSince';
Expand All @@ -8,10 +9,10 @@ import marked from '../../utils/marked';

const Note = React.createClass({
propTypes: {
author: React.PropTypes.object.isRequired,
item: React.PropTypes.object.isRequired,
onEdit: React.PropTypes.func.isRequired,
onDelete: React.PropTypes.func.isRequired
author: PropTypes.object.isRequired,
item: PropTypes.object.isRequired,
onEdit: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired
},

canEdit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import PropTypes from 'prop-types';
import React from 'react';

import Note from './note';
import NoteInput from './noteInput';

const NoteContainer = React.createClass({
propTypes: {
group: React.PropTypes.object.isRequired,
item: React.PropTypes.object.isRequired,
author: React.PropTypes.object.isRequired,
onDelete: React.PropTypes.func.isRequired,
sessionUser: React.PropTypes.object.isRequired,
memberList: React.PropTypes.array.isRequired
group: PropTypes.object.isRequired,
item: PropTypes.object.isRequired,
author: PropTypes.object.isRequired,
onDelete: PropTypes.func.isRequired,
sessionUser: PropTypes.object.isRequired,
memberList: PropTypes.array.isRequired
},

getInitialState() {
Expand Down
11 changes: 6 additions & 5 deletions src/sentry/static/sentry/app/components/activity/noteInput.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 marked from 'marked';

Expand All @@ -20,11 +21,11 @@ function makeDefaultErrorJson() {

const NoteInput = React.createClass({
propTypes: {
item: React.PropTypes.object,
group: React.PropTypes.object.isRequired,
onFinish: React.PropTypes.func,
memberList: React.PropTypes.array.isRequired,
sessionUser: React.PropTypes.object.isRequired
item: PropTypes.object,
group: PropTypes.object.isRequired,
onFinish: PropTypes.func,
memberList: PropTypes.array.isRequired,
sessionUser: PropTypes.object.isRequired
},

mixins: [PureRenderMixin, ApiMixin],
Expand Down
11 changes: 6 additions & 5 deletions src/sentry/static/sentry/app/components/alertMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import PropTypes from 'prop-types';
import React from 'react';
import AlertActions from '../actions/alertActions';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import {t} from '../locale';

const AlertMessage = React.createClass({
propTypes: {
alert: React.PropTypes.shape({
id: React.PropTypes.string,
message: React.PropTypes.string.isRequired,
type: React.PropTypes.oneOf(['success', 'error', 'warning']),
url: React.PropTypes.string
alert: PropTypes.shape({
id: PropTypes.string,
message: PropTypes.string.isRequired,
type: PropTypes.oneOf(['success', 'error', 'warning']),
url: PropTypes.string
})
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';

function ToastIndicator({type, children}) {
Expand All @@ -11,7 +12,7 @@ function ToastIndicator({type, children}) {
}

ToastIndicator.propTypes = {
type: React.PropTypes.string.isRequired
type: PropTypes.string.isRequired
};

export default ToastIndicator;
3 changes: 2 additions & 1 deletion src/sentry/static/sentry/app/components/assigneeSelector.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 ReactDOM from 'react-dom';
import Reflux from 'reflux';
Expand All @@ -17,7 +18,7 @@ import {t} from '../locale';

const AssigneeSelector = React.createClass({
propTypes: {
id: React.PropTypes.string.isRequired
id: PropTypes.string.isRequired
},

mixins: [
Expand Down
11 changes: 6 additions & 5 deletions src/sentry/static/sentry/app/components/avatar.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 $ from 'jquery';
import MD5 from 'crypto-js/md5';
Expand All @@ -6,11 +7,11 @@ import UserLetterAvatar from '../components/userLetterAvatar';

const Avatar = React.createClass({
propTypes: {
user: React.PropTypes.object,
size: React.PropTypes.number,
default: React.PropTypes.string,
title: React.PropTypes.string,
gravatar: React.PropTypes.bool
user: PropTypes.object,
size: PropTypes.number,
default: PropTypes.string,
title: PropTypes.string,
gravatar: PropTypes.bool
},

getDefaultProps() {
Expand Down
7 changes: 4 additions & 3 deletions src/sentry/static/sentry/app/components/avatarCropper.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';

import AlertActions from '../actions/alertActions';
import {t} from '../locale';

const AvatarCropper = React.createClass({
propTypes: {
user: React.PropTypes.object.isRequired,
updateDataUrlState: React.PropTypes.func.isRequired,
savedDataUrl: React.PropTypes.string
user: PropTypes.object.isRequired,
updateDataUrlState: PropTypes.func.isRequired,
savedDataUrl: PropTypes.string
},

getInitialState() {
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/static/sentry/app/components/avatarRadio.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 {t} from '../locale';

const AvatarRadio = React.createClass({
propTypes: {
user: React.PropTypes.object.isRequired,
updateUser: React.PropTypes.func.isRequired
user: PropTypes.object.isRequired,
updateUser: PropTypes.func.isRequired
},

OPTIONS: {
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/static/sentry/app/components/avatarSettings.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 AlertActions from '../actions/alertActions';
Expand All @@ -10,7 +11,7 @@ import {t} from '../locale';

const AvatarSettings = React.createClass({
propTypes: {
userId: React.PropTypes.number
userId: PropTypes.number
},

mixins: [ApiMixin],
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/static/sentry/app/components/badge.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import PropTypes from 'prop-types';
import React from 'react';

const Badge = React.createClass({
propTypes: {
text: React.PropTypes.string,
isNew: React.PropTypes.bool
text: PropTypes.string,
isNew: PropTypes.bool
},

render() {
Expand Down
29 changes: 15 additions & 14 deletions src/sentry/static/sentry/app/components/barChart.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import PropTypes from 'prop-types';
import React from 'react';
import StackedBarChart from '../components/stackedBarChart';

const BarChart = React.createClass({
propTypes: {
points: React.PropTypes.arrayOf(
React.PropTypes.shape({
x: React.PropTypes.number.isRequired,
y: React.PropTypes.number.isRequired,
label: React.PropTypes.string
points: PropTypes.arrayOf(
PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
label: PropTypes.string
})
),
interval: React.PropTypes.string,
height: React.PropTypes.number,
width: React.PropTypes.number,
placement: React.PropTypes.string,
label: React.PropTypes.string,
markers: React.PropTypes.arrayOf(
React.PropTypes.shape({
x: React.PropTypes.number.isRequired,
label: React.PropTypes.string
interval: PropTypes.string,
height: PropTypes.number,
width: PropTypes.number,
placement: PropTypes.string,
label: PropTypes.string,
markers: PropTypes.arrayOf(
PropTypes.shape({
x: PropTypes.number.isRequired,
label: PropTypes.string
})
)
},
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/static/sentry/app/components/broadcastModal.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 IconCloseLg from '../icons/icon-close-lg';
import ConfigStore from '../stores/configStore';
Expand Down Expand Up @@ -49,12 +50,12 @@ const ReleaseAnnouncement = ({close}) => {
};

ReleaseAnnouncement.propTypes = {
close: React.PropTypes.func.isRequired
close: PropTypes.func.isRequired
};

const BroadcastModal = React.createClass({
propTypes: {
closeBroadcast: React.PropTypes.func.isRequired
closeBroadcast: PropTypes.func.isRequired
},
mixins: [ApiMixin],

Expand Down
3 changes: 2 additions & 1 deletion src/sentry/static/sentry/app/components/buttons/button.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {PropTypes} from 'react';
import PropTypes from 'prop-types';
import React from 'react';
import {Link} from 'react-router';
import classNames from 'classnames';

Expand Down
11 changes: 6 additions & 5 deletions src/sentry/static/sentry/app/components/clippedBox.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import PropTypes from 'prop-types';
import React from 'react';
import ReactDOM from 'react-dom';
import {t} from '../locale';

const ClippedBox = React.createClass({
propTypes: {
title: React.PropTypes.string,
defaultClipped: React.PropTypes.bool,
clipHeight: React.PropTypes.number,
btnClassName: React.PropTypes.string,
btnText: React.PropTypes.string
title: PropTypes.string,
defaultClipped: PropTypes.bool,
clipHeight: PropTypes.number,
btnClassName: PropTypes.string,
btnText: PropTypes.string
},

getDefaultProps() {
Expand Down
Loading

0 comments on commit 3935302

Please sign in to comment.