Skip to content

Add Linting #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 31, 2016
Merged

Add Linting #293

merged 5 commits into from
Dec 31, 2016

Conversation

claydiffrient
Copy link
Contributor

@claydiffrient claydiffrient commented Dec 31, 2016

Fixes #284

Changes proposed:

  • Use AirBnb's style guide with slight modifications for the code
  • Make sure that code maintains this style by running the linter as part of the TravisCI build

Acceptance Checklist:

  • All commits have been squashed to one.
  • The commit message follows the guidelines in CONTRIBUTING.md.
  • Documentation (README.md) and examples have been updated as needed.
  • If this is a code change, a spec testing the functionality has been added.
  • If the commit message has [changed] or [removed], there is an upgrade path above.

@claydiffrient
Copy link
Contributor Author

I haven't squashed the commits to make it easier to review, but can do so before merging.

Copy link
Collaborator

@diasbruno diasbruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome PR! Hope my comments make sense.

}
};
},
static afterClose = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be preferable to declare as function instead of assign a anonymous function to a variable?

static afterClose() {...}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, fixed.

handleKeyDown: function(event) {
if (event.keyCode == 9 /*tab*/) scopeTab(this.refs.content, event);
if (event.keyCode == 27 /*esc*/) {
handleKeyDown = (event) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare as function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it here doesn't work because we want the arrow functions binding. See section 5 of this blog post for more info.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing this. I completely forgot that arrow function are bounded to the current instance.

this.shouldClose = false;
},
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but same response as last time too :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

el.focus();
}, 0);
}
}

exports.markForFocusLater = function() {
exports.markForFocusLater = function markForFocusLater () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be written as...

export function markForFocusLater() { ... }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, I think export keyword must be enabled. So, it can be setup or keep the exports.markForFocusLater.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... can't believe I missed that. I'll fix it right up :)

Copy link
Collaborator

@diasbruno diasbruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 2 more comments, but I'll approve (just because I'm reviewing :) ) in case you want to address those comments later .


module.exports = findTabbableDescendants;
function findTabbableDescendants (element) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function findTabbableDescendants (element) {


module.exports = function(node, event) {
var tabbable = findTabbable(node);
module.exports = function scopeTab (node, event) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function scopeTab (node, event) {

This also does some signfiicant refactoring of the code
to appease the linter's pro-ES2015+ stance.

closes #289
closes #286
@claydiffrient
Copy link
Contributor Author

@diasbruno Alright... I've addressed all your changes :)

@claydiffrient claydiffrient merged commit 596f423 into master Dec 31, 2016
@claydiffrient claydiffrient deleted the linting branch December 31, 2016 21:49
diasbruno pushed a commit to diasbruno/react-modal that referenced this pull request Jun 13, 2017
* Add linting

* Make specs pass linter

* Make lib/helpers pass linter

* Make lib/components pass linter

This also does some signfiicant refactoring of the code
to appease the linter's pro-ES2015+ stance.

closes reactjs#289
closes reactjs#286

* Make travis run the lint task as well as specs

closes reactjs#284
@diasbruno diasbruno mentioned this pull request Jun 14, 2017
5 tasks
diasbruno pushed a commit to diasbruno/react-modal that referenced this pull request Jun 15, 2017
* Add linting

* Make specs pass linter

* Make lib/helpers pass linter

* Make lib/components pass linter

This also does some signfiicant refactoring of the code
to appease the linter's pro-ES2015+ stance.

closes reactjs#289
closes reactjs#286

* Make travis run the lint task as well as specs

closes reactjs#284
diasbruno pushed a commit to diasbruno/react-modal that referenced this pull request Jun 15, 2017
* Add linting

* Make specs pass linter

* Make lib/helpers pass linter

* Make lib/components pass linter

This also does some signfiicant refactoring of the code
to appease the linter's pro-ES2015+ stance.

closes reactjs#289
closes reactjs#286

* Make travis run the lint task as well as specs

closes reactjs#284
diasbruno pushed a commit that referenced this pull request Jun 15, 2017
* Add linting

* Make specs pass linter

* Make lib/helpers pass linter

* Make lib/components pass linter

This also does some signfiicant refactoring of the code
to appease the linter's pro-ES2015+ stance.

closes #289
closes #286

* Make travis run the lint task as well as specs

closes #284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants