Browse Source

Enable react/prop-types eslint rule; add missing propTypes

Ben Vinegar 9 years ago
parent
commit
5b85130af7

+ 3 - 0
.eslintrc

@@ -132,6 +132,9 @@
     "react/no-did-mount-set-state": [2, "allow-in-func"], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
     "react/no-did-update-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md"
     "react/no-unknown-property": 2,  // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
+    "react/prop-types": [2, {
+      "ignore": ["className", "children", "location", "params"]
+    }],
     "react/react-in-jsx-scope": 2,   // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
     "react/self-closing-comp": 2,    // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
     "react/sort-comp": 2,            // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md

+ 7 - 0
src/sentry/static/sentry/app/components/activity/feed.jsx

@@ -9,6 +9,13 @@ import {t} from '../../locale';
 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
+  },
+
   mixins: [ApiMixin],
 
   getDefaultProps() {

+ 6 - 0
src/sentry/static/sentry/app/components/activity/item.jsx

@@ -12,6 +12,12 @@ import {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
+  },
 
   getDefaultProps() {
     return {

+ 9 - 1
src/sentry/static/sentry/app/components/activity/note.jsx

@@ -1,5 +1,6 @@
-import marked from 'marked';
 import React from 'react';
+
+import marked from 'marked';
 import TimeSince from '../../components/timeSince';
 import ConfigStore from '../../stores/configStore';
 import LinkWithConfirmation from '../../components/linkWithConfirmation';
@@ -11,6 +12,13 @@ marked.setOptions({
 });
 
 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,
+  },
+
   canEdit() {
     let user = ConfigStore.get('user');
     return user.isSuperuser || user.id === this.props.item.user.id;

+ 7 - 0
src/sentry/static/sentry/app/components/activity/noteContainer.jsx

@@ -4,6 +4,13 @@ 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
+  },
+
   getInitialState() {
     return {
       editing: false

+ 8 - 1
src/sentry/static/sentry/app/components/activity/noteInput.jsx

@@ -1,5 +1,6 @@
-import marked from 'marked';
 import React from 'react';
+import marked from 'marked';
+
 import ApiMixin from '../../mixins/apiMixin';
 import GroupStore from '../../stores/groupStore';
 import IndicatorStore from '../../stores/indicatorStore';
@@ -15,6 +16,12 @@ function makeDefaultErrorJson() {
 }
 
 const NoteInput = React.createClass({
+  propTypes: {
+    item: React.PropTypes.object,
+    group: React.PropTypes.object.isRequired,
+    onFinish: React.PropTypes.func
+  },
+
   mixins: [
     PureRenderMixin,
     ApiMixin

+ 4 - 2
src/sentry/static/sentry/app/components/alertMessage.jsx

@@ -5,8 +5,10 @@ import {t} from '../locale';
 
 const AlertMessage = React.createClass({
   propTypes: {
-    type: React.PropTypes.string,
-    message: React.PropTypes.string
+    className: React.PropTypes.string,
+    id: React.PropTypes.number.isRequired,
+    message: React.PropTypes.string.isRequired,
+    type: React.PropTypes.string
   },
 
   mixins: [PureRenderMixin],

+ 4 - 2
src/sentry/static/sentry/app/components/barChart.jsx

@@ -10,6 +10,9 @@ const BarChart = React.createClass({
       y: React.PropTypes.number.isRequired,
       label: React.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({
@@ -58,8 +61,7 @@ const BarChart = React.createClass({
       placement: 'bottom',
       points: [],
       markers: [],
-      width: null,
-      viewport: null
+      width: null
     };
   },
 

+ 2 - 1
src/sentry/static/sentry/app/components/clippedBox.jsx

@@ -5,7 +5,8 @@ import {t} from '../locale';
 const ClippedBox = React.createClass({
   propTypes: {
     title: React.PropTypes.string,
-    defaultClipped: React.PropTypes.bool
+    defaultClipped: React.PropTypes.bool,
+    clipHeight: React.PropTypes.number
   },
 
   getDefaultProps() {

+ 13 - 0
src/sentry/static/sentry/app/components/compactIssue.jsx

@@ -19,6 +19,12 @@ const Snooze = {
 
 
 const SnoozeAction = React.createClass({
+  propTypes: {
+    disabled: React.PropTypes.bool,
+    onSnooze: React.PropTypes.func.isRequired,
+    tooltip: React.PropTypes.string
+  },
+
   getInitialState() {
     return {
       isModalOpen: false
@@ -73,6 +79,13 @@ const SnoozeAction = React.createClass({
 });
 
 const CompactIssue = React.createClass({
+  propTypes: {
+    data: React.PropTypes.object,
+    id: React.PropTypes.string,
+    orgId: React.PropTypes.string,
+    statsPeriod: React.PropTypes.string
+  },
+
   mixins: [
     ApiMixin,
     Reflux.listenTo(GroupStore, 'onGroupChange')

Some files were not shown because too many files changed in this diff