Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions client/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ env:
mocha: true

rules:
### Variables
no-undef: 2
no-unused-vars: [2, { vars: all, args: none }]

### Stylistic issues
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
space-before-function-paren: [1, "never"]
no-underscore-dangle: 0

### Imports
# Can't do next one because of alias in webpack
import/no-unresolved: 0
Expand All @@ -36,25 +26,3 @@ rules:

# https://github.com/eslint/eslint/issues/6876 SFC's marked as invalid
new-cap: 0

### React
jsx-quotes: [1, prefer-double]
react/display-name: 0
react/jsx-boolean-value: [1, always]
react/jsx-curly-spacing: [1, never]
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
react/jsx-no-undef: 2
react/jsx-sort-prop-types: 0
react/jsx-sort-props: 0
react/jsx-uses-react: 2
react/jsx-uses-vars: 2
react/no-danger: 0
react/no-did-mount-set-state: 1
react/no-did-update-set-state: 0
react/no-multi-comp: 2
react/no-unknown-property: 2
react/prop-types: 1
react/react-in-jsx-scope: 2
react/self-closing-comp: 2
react/sort-comp: 0 # Should be 1. `statics` should be on top.
react/jsx-wrap-multilines: 2
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ export default class CommentForm extends BaseComponent {
};

_.bindAll(this, [
'_handleSelect',
'_handleChange',
'_handleSubmit',
'_resetAndFocus',
'handleSelect',
'handleChange',
'handleSubmit',
'resetAndFocus',
]);
}

_handleSelect(selectedKey) {
handleSelect(selectedKey) {
this.setState({ formMode: selectedKey });
}

_handleChange() {
handleChange() {
let comment;

switch (this.state.formMode) {
Expand Down Expand Up @@ -71,15 +71,15 @@ export default class CommentForm extends BaseComponent {
this.setState({ comment });
}

_handleSubmit(e) {
handleSubmit(e) {
e.preventDefault();
const { actions } = this.props;
actions
.submitComment(this.state.comment)
.then(this._resetAndFocus);
.then(this.resetAndFocus);
}

_resetAndFocus() {
resetAndFocus() {
// Don't reset a form that didn't submit, this results in data loss
if (this.props.error) return;

Expand All @@ -104,11 +104,11 @@ export default class CommentForm extends BaseComponent {
ref.focus();
}

_formHorizontal() {
formHorizontal() {
return (
<div>
<hr />
<form className="commentForm form-horizontal" onSubmit={this._handleSubmit}>
<form className="commentForm form-horizontal" onSubmit={this.handleSubmit}>
<Input
type="text"
label="Name"
Expand All @@ -117,7 +117,7 @@ export default class CommentForm extends BaseComponent {
wrapperClassName="col-sm-10"
ref={node => { this.horizontalAuthorNode = node; }}
value={this.state.comment.author}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
<Input
Expand All @@ -128,7 +128,7 @@ export default class CommentForm extends BaseComponent {
wrapperClassName="col-sm-10"
ref={node => { this.horizontalTextNode = node; }}
value={this.state.comment.text}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
<div className="form-group">
Expand All @@ -146,18 +146,18 @@ export default class CommentForm extends BaseComponent {
);
}

_formStacked() {
formStacked() {
return (
<div>
<hr />
<form className="commentForm form" onSubmit={this._handleSubmit}>
<form className="commentForm form" onSubmit={this.handleSubmit}>
<Input
type="text"
label="Name"
placeholder="Your Name"
ref={node => { this.stackedAuthorNode = node; }}
value={this.state.comment.author}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
<Input
Expand All @@ -166,7 +166,7 @@ export default class CommentForm extends BaseComponent {
placeholder={textPlaceholder}
ref={node => { this.stackedTextNode = node; }}
value={this.state.comment.text}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
<input
Expand All @@ -180,11 +180,11 @@ export default class CommentForm extends BaseComponent {
);
}

_formInline() {
formInline() {
return (
<div>
<hr />
<form className="commentForm form" onSubmit={this._handleSubmit}>
<form className="commentForm form" onSubmit={this.handleSubmit}>
<Input label="Inline Form" wrapperClassName="wrapper">
<Row>
<Col xs={3}>
Expand All @@ -194,7 +194,7 @@ export default class CommentForm extends BaseComponent {
placeholder="Your Name"
ref={node => { this.inlineAuthorNode = node; }}
value={this.state.comment.author}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
</Col>
Expand All @@ -205,7 +205,7 @@ export default class CommentForm extends BaseComponent {
placeholder={textPlaceholder}
ref={node => { this.inlineTextNode = node; }}
value={this.state.comment.text}
onChange={this._handleChange}
onChange={this.handleChange}
disabled={this.props.isSaving}
/>
</Col>
Expand All @@ -224,7 +224,7 @@ export default class CommentForm extends BaseComponent {
);
}

_errorWarning() {
errorWarning() {
// If there is no error, there is nothing to add to the DOM
if (!this.props.error) return null;
return (
Expand All @@ -239,13 +239,13 @@ export default class CommentForm extends BaseComponent {
let inputForm;
switch (this.state.formMode) {
case 0:
inputForm = this._formHorizontal();
inputForm = this.formHorizontal();
break;
case 1:
inputForm = this._formStacked();
inputForm = this.formStacked();
break;
case 2:
inputForm = this._formInline();
inputForm = this.formInline();
break;
default:
throw new Error(`Unknown form mode: ${this.state.formMode}.`);
Expand All @@ -260,10 +260,10 @@ export default class CommentForm extends BaseComponent {
transitionEnterTimeout={300}
transitionLeaveTimeout={300}
>
{this._errorWarning()}
{this.errorWarning()}
</ReactCSSTransitionGroup>

<Nav bsStyle="pills" activeKey={this.state.formMode} onSelect={this._handleSelect}>
<Nav bsStyle="pills" activeKey={this.state.formMode} onSelect={this.handleSelect}>
<NavItem eventKey={0}>Horizontal Form</NavItem>
<NavItem eventKey={1}>Stacked Form</NavItem>
<NavItem eventKey={2}>Inline Form</NavItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default class CommentList extends BaseComponent {
constructor(props, context) {
super(props, context);
this.state = {};
_.bindAll(this, '_errorWarning');
_.bindAll(this, 'errorWarning');
}

_errorWarning() {
errorWarning() {
// If there is no error, there is nothing to add to the DOM
if (!this.props.error) return null;
return (
Expand Down Expand Up @@ -52,7 +52,7 @@ export default class CommentList extends BaseComponent {
transitionEnterTimeout={500}
transitionLeaveTimeout={500}
>
{this._errorWarning()}
{this.errorWarning()}
</ReactCSSTransitionGroup>

<ReactCSSTransitionGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class CommentScreen extends BaseComponent {
locationState: PropTypes.object,
};

_renderNotification() {
renderNotification() {
const { locationState } = this.props;

if (!locationState || !locationState.redirectFrom) return null;
Expand All @@ -30,7 +30,7 @@ export default class CommentScreen extends BaseComponent {

return (
<div>
{this._renderNotification()}
{this.renderNotification()}
<div>
<CommentBox
pollInterval={60000}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export default class SimpleCommentScreen extends BaseComponent {
submitCommentError: null,
};

_.bindAll(this, '_fetchComments', '_handleCommentSubmit');
_.bindAll(this, 'fetchComments', 'handleCommentSubmit');
}

componentDidMount() {
this._fetchComments();
this.fetchComments();
}

_fetchComments() {
fetchComments() {
return (
request
.get('comments.json', { responseType: 'json' })
Expand All @@ -36,7 +36,7 @@ export default class SimpleCommentScreen extends BaseComponent {
);
}

_handleCommentSubmit(comment) {
handleCommentSubmit(comment) {
this.setState({ isSaving: true });

const requestConfig = {
Expand Down Expand Up @@ -84,7 +84,7 @@ export default class SimpleCommentScreen extends BaseComponent {
</p>
<CommentForm
isSaving={this.state.isSaving}
actions={{ submitComment: this._handleCommentSubmit }}
actions={{ submitComment: this.handleCommentSubmit }}
error={this.state.submitCommentError}
cssTransitionGroupClassNames={cssTransitionGroupClassNames}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const initialState = {};

export default function railsContextReducer(state = initialState, action = null) {
export default function railsContextReducer(state = initialState) {
return state;
}