Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: sourceCode#isSpaceBetweenTokens() checks non-adjacent tokens #12491
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
What changes did you make? (Give an overview)
I noticed that
I think it would make sense to only allow tokens that are adjacent as arguments, however, that would be a breaking change. This PR updates the logic so that it will check for any whitespace between tokens (including comments) between two given nodes or tokens. The only difference in behavior is the following two tests (two tokens with a string containing spaces between them is currently incorrectly being flagged as containing whitespace):
The rest of the tests cover the current behavior that already exists.
Is there anything you'd like reviewers to focus on?
Does this seem like the correct solution to the rest of the team?
On further reflection, I think that it would make sense to rename this method to
Would it make sense to make an RFC for this or just flag this for TSC discussion? Just to reiterate, the only change in behavior are the examples described above. Aside from that bug fix, this is adding tests and documentation for existing behavior.
EDIT: Please see #12519 for this proposal. This PR is now just the bug fix.