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

Update: space-unary-ops uses astUtils.canTokensBeAdjacent (fixes #9907) #9906

Merged
merged 2 commits into from Feb 1, 2018

Conversation

platinumazure
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Tell us about your environment

  • ESLint Version: 4.16.x / master
  • Node Version: 8.9.3
  • npm Version: 4.1.1

What parser (default, Babel-ESLint, etc.) are you using?

Default

Please show your full configuration:

(See demo link below)

What did you do? Please include the actual source code causing the issue.

See demo.

What did you expect to happen?

Every UnaryExpression, NewExpression, YieldExpression, and AwaitExpression should be flagged as invalid. It is possible to remove the spaces between the unary word operator and the next token.

What actually happened? Please include the actual, raw output from ESLint.

No linting errors.

What changes did you make? (Give an overview)

Changed special-case ObjectExpression check (which seemed to be used as a check for whether the next token was {) to instead use astUtils.canTokensBeAdjacent, which generalizes the logic and allows the rule to work correctly with ( and [ tokens.

Is there anything you'd like reviewers to focus on?

Not really.

@platinumazure platinumazure changed the title Update: Use astUtils.canTokensBeAdjacent in space-unary-ops Update: Use astUtils.canTokensBeAdjacent in space-unary-ops (fixes #9907) Jan 29, 2018
@platinumazure platinumazure changed the title Update: Use astUtils.canTokensBeAdjacent in space-unary-ops (fixes #9907) Update: space-unary-ops uses astUtils.canTokensBeAdjacent (fixes #9907) Jan 29, 2018
@platinumazure
Copy link
Member Author

@gyandeeps @not-an-aardvark Ended up throwing in some doc changes to avoid doing another force-push (as part of fixing the PR merge message). Hopefully nothing controversial but feel free to review again if you like. Thanks!

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

3 participants