Skip to content
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

New: rest-spread-spacing rule (fixes #5391) #6278

Merged
merged 1 commit into from
Jun 1, 2016
Merged

New: rest-spread-spacing rule (fixes #5391) #6278

merged 1 commit into from
Jun 1, 2016

Conversation

kaicataldo
Copy link
Member

No description provided.

@eslintbot
Copy link

LGTM

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @nzakas, @scriptdaemon and @pedrottimark to be potential reviewers

@kaicataldo kaicataldo force-pushed the fixes5391 branch 2 times, most recently from e321743 to 8bf1df9 Compare May 30, 2016 01:46
return {
SpreadElement: function(node) {
var args = node.argument,
operator = sourceCode.getTokenBefore(args);
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to see a test for ...(foo).

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch, will update with the fix

@mysticatea
Copy link
Member

mysticatea commented May 30, 2016

As this comment mentioned, I think we should support rest elements and experimentalObjectRestSpread in this rule.

@kaicataldo
Copy link
Member Author

kaicataldo commented May 30, 2016

Missed that. Thanks - will update and report back.

@kaicataldo kaicataldo added the do not merge This pull request should not be merged yet label May 30, 2016
@eslintbot
Copy link

LGTM

@kaicataldo kaicataldo changed the title New: spread-spacing rule (fixes #5391) New: rest-spread-spacing rule (fixes #5391) May 30, 2016
@kaicataldo kaicataldo removed the do not merge This pull request should not be merged yet label May 30, 2016
@kaicataldo
Copy link
Member Author

Thanks for pointing that stuff out, @mysticatea :) Updated

operator = sourceCode.getTokenBefore(operator);
}

if (alwaysSpace && !sourceCode.isSpaceBetweenTokens(operator, args)) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "never" option of this rule is conflicting with the "always" option of space-in-parens rule: e.g. ...( foo ).
I think this should check spacing between operator and the next token of operator, as same as fix functions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense - updated once more!

@kaicataldo kaicataldo force-pushed the fixes5391 branch 2 times, most recently from a2b7155 to 4b17cc3 Compare May 30, 2016 04:32
@mysticatea
Copy link
Member

Thank you for great works!
LGTM.

(Though I cannot check documents!)

}]
},
{
code: "fn(... ( args ))",
Copy link
Member Author

Choose a reason for hiding this comment

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

Added tests to ensure compatibility with space-in-parens

@kaicataldo kaicataldo force-pushed the fixes5391 branch 2 times, most recently from 4532fe3 to 8ffe15e Compare May 30, 2016 04:53
@eslintbot
Copy link

LGTM

@eslintbot
Copy link

LGTM

@kaicataldo
Copy link
Member Author

@mysticatea Refactored and simplified this logic after changing to account for parens. Thanks again for reviewing 👍

@nzakas
Copy link
Member

nzakas commented Jun 1, 2016

Lgtm. Nice job!

@nzakas nzakas merged commit 1313804 into master Jun 1, 2016
@kaicataldo kaicataldo deleted the fixes5391 branch June 1, 2016 18:13
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants