Skip to content

Add Linting - #293

Merged
claydiffrient merged 5 commits into
masterfrom
linting
Dec 31, 2016
Merged

Add Linting#293
claydiffrient merged 5 commits into
masterfrom
linting

Conversation

@claydiffrient

@claydiffrient claydiffrient commented Dec 31, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@diasbruno diasbruno left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread lib/components/ModalPortal.js Outdated
}
};
},
static afterClose = () => {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok.

Copy link
Copy Markdown
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.

handleContentMouseUp = () => {
this.shouldClose = false;
},
}

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:)

Comment thread lib/helpers/focusManager.js Outdated
}

exports.markForFocusLater = function() {
exports.markForFocusLater = function markForFocusLater () {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 :)

@diasbruno diasbruno left a comment

Copy link
Copy Markdown
Collaborator

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 .

Comment thread lib/helpers/tabbable.js
}

module.exports = findTabbableDescendants;
function findTabbableDescendants (element) {

Copy link
Copy Markdown
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) {

Comment thread lib/helpers/scopeTab.js Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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