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

platinumazure commented Jan 28, 2018

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 force-pushed the space-unary-ops-fix branch from 1ea47cc to 8fd2841 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

This comment has been minimized.

Copy link
Member Author

platinumazure commented Jan 29, 2018

@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!

@platinumazure platinumazure merged commit dc80487 into master Feb 1, 2018
5 checks passed
5 checks passed
commit-message PR title follows commit message guidelines
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
@not-an-aardvark not-an-aardvark deleted the space-unary-ops-fix branch Feb 1, 2018
@renovate renovate bot mentioned this pull request Feb 14, 2018
@renovate renovate bot mentioned this pull request Mar 23, 2018
@eslint eslint bot locked and limited conversation to collaborators Aug 2, 2018
@eslint eslint bot added the archived due to age label Aug 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.