Skip to content

Commit

Permalink
Add prop-type validations for components (#57)
Browse files Browse the repository at this point in the history
Add prop-type validations for components
  • Loading branch information
tterb authored Nov 12, 2019
2 parents 4263089 + 056a7dd commit ca8db7c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/CommentCount.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { insertScript, removeScript, debounce, shallowComparison } from './utils';

const queueResetCount = debounce(() => {
Expand Down Expand Up @@ -51,3 +52,12 @@ export class CommentCount extends React.Component {
);
}
}

CommentCount.propTypes = {
shortname: PropTypes.string.isRequired,
config: PropTypes.shape({
identifier: PropTypes.string,
url: PropTypes.string,
title: PropTypes.string,
}).isRequired,
};
9 changes: 9 additions & 0 deletions src/CommentEmbed.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';

const RADIX_BASE = 36;

Expand Down Expand Up @@ -31,3 +32,11 @@ CommentEmbed.defaultProps = {
width: 420,
height: 320,
};

CommentEmbed.propTypes = {
commentId: PropTypes.string.isRequired,
showMedia: PropTypes.bool,
showParentComment: PropTypes.bool,
width: PropTypes.number,
height: PropTypes.number,
};
11 changes: 11 additions & 0 deletions src/DiscussionEmbed.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { insertScript, removeScript, shallowComparison } from './utils';

export class DiscussionEmbed extends React.Component {
Expand Down Expand Up @@ -71,3 +72,13 @@ export class DiscussionEmbed extends React.Component {
);
}
}

DiscussionEmbed.propTypes = {
shortname: PropTypes.string.isRequired,
config: PropTypes.shape({
identifier: PropTypes.string,
url: PropTypes.string,
title: PropTypes.string,
onNewComment: PropTypes.func,
}).isRequired,
};

0 comments on commit ca8db7c

Please sign in to comment.