Fix some linter warnings

This commit is contained in:
Chi Vinh Le
2017-09-18 18:56:52 +07:00
parent cd100a23cb
commit f19b333537
7 changed files with 12 additions and 50 deletions
+6 -5
View File
@@ -24,12 +24,13 @@
"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",
// 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": "off",
"array-callback-return": "warn",
@@ -1,4 +0,0 @@
.textareaContainer {
width: 100%;
}
@@ -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 (
<div>
<div class={`${styles.textareaContainer} mdl-textfield mdl-js-textfield`}>
<input type='text' value={name} onInput={this.linkState('name')} class='mdl-textfield__input' id='name' />
<label class='mdl-textfield__label' for='name'>Your name</label>
</div>
<div class={`${styles.textareaContainer} mdl-textfield mdl-js-textfield`}>
<textarea value={body} onInput={this.linkState('body')} class='mdl-textfield__input' type='text' rows='5' id='comment' />
<label class='mdl-textfield__label' for='comment'>Write your comment</label>
</div>
<Button onClick={this.onSubmit} raised>Post</Button>
</div>
);
}
}
@@ -183,7 +183,6 @@ export default class UserDetail extends React.Component {
key={comment.id}
user={user}
comment={comment}
selected={false}
suspectWords={suspectWords}
bannedWords={bannedWords}
actions={actionsMap[status]}
@@ -73,12 +73,12 @@ const CoralHeader = ({
<Menu target="menu-settings" align="right">
<MenuItem onClick={() => showShortcuts(true)}>{t('configure.shortcuts')}</MenuItem>
<MenuItem>
<a href="https://github.com/coralproject/talk/releases" target="_blank">
<a href="https://github.com/coralproject/talk/releases" target="_blank" rel="noopener noreferrer">
View latest version
</a>
</MenuItem>
<MenuItem>
<a href="https://coralproject.net/contribute.html#other-ideas-and-bug-reports" target="_blank">
<a href="https://coralproject.net/contribute.html#other-ideas-and-bug-reports" target="_blank" rel="noopener noreferrer">
Report a bug or give feedback
</a>
</MenuItem>
@@ -28,7 +28,8 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
{row.created_at}
</td>
<td className="mdl-data-table__cell--non-numeric">
<SelectField label={'Select me'} value={row.status || ''}
<SelectField
value={row.status || ''}
className={styles.selectField}
label={t('community.status')}
onChange={(status) => onCommenterStatusChange(row.id, status)}>
@@ -37,7 +38,8 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
</SelectField>
</td>
<td className="mdl-data-table__cell--non-numeric">
<SelectField label={'Select me'} value={row.roles[0] || ''}
<SelectField
value={row.roles[0] || ''}
className={styles.selectField}
label={t('community.role')}
onChange={(role) => onRoleChange(row.id, role)}>
@@ -150,7 +150,6 @@ class CommentBox extends React.Component {
return <div>
<CommentForm
defaultValue={this.props.defaultValue}
bodyInputId={isReply ? 'replyText' : 'commentText'}
bodyLabel={isReply ? t('comment_box.reply') : t('comment.comment')}
maxCharCount={maxCharCount}
charCountEnable={this.props.charCountEnable}