diff --git a/.eslintrc.json b/.eslintrc.json index d7ed3908e..324bc9666 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,13 +24,14 @@ "promise/no-promise-in-callback": "warn", "promise/no-callback-in-promise": "warn", - // TODO: Change all these to "error", or remove and use defaults. "react/display-name": "off", - "react/jsx-no-duplicate-props": "warn", - "react/jsx-no-target-blank": "warn", - "react/no-find-dom-node": "warn", - "react/no-unknown-property": "warn", - "react/prop-types": "off", + + // We'll keeping using this, as we'll switch over to Preact and we don't + // need to worry about deprecation. + "react/no-find-dom-node": "off", + + // TODO: Use default after fixing the errors. + "react/prop-types": "warn", "array-callback-return": "warn", "arrow-parens": ["warn", "always"], diff --git a/app.js b/app.js index 741dac93f..4e74062d5 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,12 @@ const path = require('path'); const helmet = require('helmet'); const compression = require('compression'); const cookieParser = require('cookie-parser'); -const {BASE_URL, BASE_PATH, MOUNT_PATH} = require('./url'); +const { + BASE_URL, + BASE_PATH, + MOUNT_PATH, + STATIC_URL, +} = require('./url'); const routes = require('./routes'); const debug = require('debug')('talk:app'); @@ -55,6 +60,7 @@ app.set('view engine', 'ejs'); app.locals.BASE_URL = BASE_URL; app.locals.BASE_PATH = BASE_PATH; app.locals.MOUNT_PATH = MOUNT_PATH; +app.locals.STATIC_URL = STATIC_URL; debug(`mounting routes on the ${MOUNT_PATH} path`); diff --git a/client/coral-admin/src/components/ActionButton.js b/client/coral-admin/src/components/ActionButton.js index b8778bef0..79fa2f182 100644 --- a/client/coral-admin/src/components/ActionButton.js +++ b/client/coral-admin/src/components/ActionButton.js @@ -28,7 +28,11 @@ const ActionButton = ({type = '', active, ...props}) => { }; ActionButton.propTypes = { - active: PropTypes.bool + active: PropTypes.bool, + type: PropTypes.oneOf(['APPROVE', 'REJECT']), + minimal: PropTypes.bool, + acceptComment: PropTypes.func, + rejectComment: PropTypes.func, }; export default ActionButton; diff --git a/client/coral-admin/src/components/ActionsMenu.js b/client/coral-admin/src/components/ActionsMenu.js index 6e236bf1c..25aee1fbc 100644 --- a/client/coral-admin/src/components/ActionsMenu.js +++ b/client/coral-admin/src/components/ActionsMenu.js @@ -58,6 +58,7 @@ class ActionsMenu extends React.Component { ActionsMenu.propTypes = { icon: PropTypes.string, + children: PropTypes.node, }; export default ActionsMenu; diff --git a/client/coral-admin/src/components/ActionsMenuItem.js b/client/coral-admin/src/components/ActionsMenuItem.js index 82dab96f0..d9497a6ce 100644 --- a/client/coral-admin/src/components/ActionsMenuItem.js +++ b/client/coral-admin/src/components/ActionsMenuItem.js @@ -1,9 +1,14 @@ import React from 'react'; import cn from 'classnames'; import {MenuItem} from 'react-mdl'; +import PropTypes from 'prop-types'; import styles from './ActionsMenu.css'; const ActionsMenuItem = (props) => ; +ActionsMenuItem.propTypes = { + className: PropTypes.string, +}; + export default ActionsMenuItem; diff --git a/client/coral-admin/src/components/AdminLogin.js b/client/coral-admin/src/components/AdminLogin.js index 5f9712127..be8dd8b09 100644 --- a/client/coral-admin/src/components/AdminLogin.js +++ b/client/coral-admin/src/components/AdminLogin.js @@ -105,7 +105,9 @@ AdminLogin.propTypes = { handleLogin: PropTypes.func.isRequired, passwordRequestSuccess: PropTypes.string, loginError: PropTypes.string, - recaptchaPublic: PropTypes.string + recaptchaPublic: PropTypes.string, + requestPasswordReset: PropTypes.func, + errorMessage: PropTypes.string, }; export default AdminLogin; diff --git a/client/coral-admin/src/components/CommentAnimatedEdit.js b/client/coral-admin/src/components/CommentAnimatedEdit.js index 2515d7d94..e24496138 100644 --- a/client/coral-admin/src/components/CommentAnimatedEdit.js +++ b/client/coral-admin/src/components/CommentAnimatedEdit.js @@ -2,8 +2,9 @@ import React from 'react'; import {murmur3} from 'murmurhash-js'; import {CSSTransitionGroup} from 'react-transition-group'; import styles from './CommentAnimatedEdit.css'; +import PropTypes from 'prop-types'; -export default ({children, body}) => { +const CommentBodyHighlighter = ({children, body}) => { return ( { ); }; + +CommentBodyHighlighter.propTypes = { + children: PropTypes.node, + body: PropTypes.string, +}; + +export default CommentBodyHighlighter; diff --git a/client/coral-admin/src/components/CommentBox.css b/client/coral-admin/src/components/CommentBox.css deleted file mode 100644 index 34c7ca6ef..000000000 --- a/client/coral-admin/src/components/CommentBox.css +++ /dev/null @@ -1,4 +0,0 @@ - -.textareaContainer { - width: 100%; -} diff --git a/client/coral-admin/src/components/CommentBox.js b/client/coral-admin/src/components/CommentBox.js deleted file mode 100644 index ce3438960..000000000 --- a/client/coral-admin/src/components/CommentBox.js +++ /dev/null @@ -1,35 +0,0 @@ - -import React from 'react'; -import styles from './CommentBox.css'; -import {Button} from 'react-mdl'; - -// Renders a comment box for creating a new comment -export default class CommentBox extends React.Component { - constructor (props) { - super(props); - this.state = {name: '', body: ''}; - this.onSubmit = this.onSubmit.bind(this); - } - - onSubmit () { - const {name, body} = this.state; - this.props.onSubmit({name, body}); - this.setState({body: '', name: ''}); - } - - render (props, {name, body}) { - return ( -
-
- - -
-
-