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: deprecate sourceCode#isSpaceBetweenTokens() #12519

Merged
merged 1 commit into from Nov 10, 2019

Conversation

@kaicataldo
Copy link
Member

kaicataldo commented Nov 1, 2019

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

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

Please evaluate just the last commit. We should wait to merge this until after we land #12491. I'll rebase at that time. Adding the "do not merge" label until then.

What changes did you make? (Give an overview)
While working on #12491, noticed that sourceCode#isSpaceBetweenTokens() currently allows for nodes as well as tokens as arguments. I think that it would make sense to rename this method to isSpaceBetween() and leave the ability for it to check between nodes and tokens, as that's a useful behavior that is most likely being used by custom rules (since we use it in at least one of our core rules). We could deprecate isSpaceBetweenTokens() and leave it as an alias that calls through to isSpaceBetween() for the sake of backwards compatibility.

Is there anything you'd like reviewers to focus on?
Does this API make sense?

@eslint eslint bot added the triage label Nov 1, 2019
@kaicataldo
Copy link
Member Author

kaicataldo commented Nov 1, 2019

TSC Summary

While fixing a bug in in sourceCode#isSpaceBetweenTokens(), I noticed that the current documentation is incorrect, also making the name of the method not quite correct.

TSC Question

In addition to the bug fix/documentation corrections in #12491, I'd like to propose we deprecate sourceCode#isSpaceBetweenTokens() to in favor of sourceCode#isSpaceBetween(). This more accurately describes the behavior, as the method currently will check between nodes as well as tokens, and better matches the names of other sourceCode methods that check between nodes or tokens.

This PR currently deprecates sourceCode#isSpaceBetweenTokens() in a backwards compatible way, having it call through to the new method.

@kaicataldo kaicataldo changed the title Deprecate is space between tokens Update: depcrecate sourceCode#isSpaceBetweenTokens() Nov 1, 2019
@kaicataldo kaicataldo changed the title Update: depcrecate sourceCode#isSpaceBetweenTokens() Update: deprecate sourceCode#isSpaceBetweenTokens() Nov 1, 2019
@kaicataldo
Copy link
Member Author

kaicataldo commented Nov 9, 2019

This was accepted at yesterday's TSC meeting.

@kaicataldo kaicataldo force-pushed the deprecate-is-space-between-tokens branch from c48c806 to 0c632a0 Nov 9, 2019
@kaicataldo kaicataldo removed the do not merge label Nov 9, 2019
@@ -1789,6 +1789,339 @@ describe("SourceCode", () => {
});
});

describe("isSpaceBetween()", () => {

This comment has been minimized.

Copy link
@kaicataldo

kaicataldo Nov 9, 2019

Author Member

Duplicating the tests below for isSpaceBetweenTokens().

@kaicataldo
Copy link
Member Author

kaicataldo commented Nov 9, 2019

This has been rebased and is ready for review.

@ilyavolodin ilyavolodin merged commit 90305e0 into master Nov 10, 2019
19 checks passed
19 checks passed
Verify Files
Details
Test (ubuntu-latest, 13.x)
Details
Test (ubuntu-latest, 12.x)
Details
Test (ubuntu-latest, 10.x)
Details
Test (ubuntu-latest, 8.x)
Details
Test (ubuntu-latest, 8.10.0)
Details
Test (windows-latest, 12.x)
Details
Test (macOS-latest, 12.x)
Details
Browser Test
Details
commit-message Commit message follows guidelines
Details
continuous-integration Build #20191109.1 succeeded
Details
continuous-integration (Test on Node.js 10 (Linux)) Test on Node.js 10 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Linux)) Test on Node.js 12 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Windows)) Test on Node.js 12 (Windows) succeeded
Details
continuous-integration (Test on Node.js 12 (macOS)) Test on Node.js 12 (macOS) succeeded
Details
continuous-integration (Test on Node.js 8 (Linux)) Test on Node.js 8 (Linux) succeeded
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
wip This PR is no longer a work in progress
Details
@ilyavolodin ilyavolodin deleted the deprecate-is-space-between-tokens branch Nov 10, 2019
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.