This repository was archived by the owner on Mar 23, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 507
This repository was archived by the owner on Mar 23, 2024. It is now read-only.
JSCS with fat arrow functions and airbnb style and JSX, ES6? #1237
Copy link
Copy link
Closed
Description
Has anybody gotten jscs to work with with fat arrow functions and airbnb? I get this message:
Missing newline after closing curly brace at ./assets/javascripts/CommentBox.jsx : 44 | var newComments = React.addons.update(oldComments, {$push: [newComment]}); 45 | this.setState({ajaxSending: false, data: newComments, formData: this.emptyFormData}); 46 | }, (xhr, status, err) => { -------------^ 47 | this.logError(xhr, status, err); 48 | this.setState({ajaxSending: false}); The problem is that jscs does not understand that the braces are within a function call.
Here's the full code for that method:
handleCommentSubmit: function() { // `setState` accepts a callback. To avoid (improbable) race condition, // `we'll send the ajax request right after we optimistically set the new // `state. var comment = this.state.formData; this.setState({ajaxSending: true}); $.ajax({ url: this.props.url, dataType: 'json', type: 'POST', data: {comment: comment} }).then(data => { // Server returns all data const newComment = data; const oldComments = this.state.data; var newComments = React.addons.update(oldComments, {$push: [newComment]}); this.setState({ajaxSending: false, data: newComments, formData: this.emptyFormData}); }, (xhr, status, err) => { this.logError(xhr, status, err); this.setState({ajaxSending: false}); }); }, My jscs file is:
{ "preset": "airbnb", "fileExtensions": [".js", ".jsx"], "excludeFiles": ["build/**", "node_modules/**"], "esprima": "esprima-fb" } I checked in the run here:
shakacode/react-webpack-rails-tutorial#26