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 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-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 1, 2019
@kaicataldo
Copy link
Member Author

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 added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion tsc agenda This issue will be discussed by ESLint's TSC at the next meeting and removed triage An ESLint team member will look at this issue soon labels Nov 1, 2019
@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 kaicataldo added the do not merge This pull request should not be merged yet label Nov 1, 2019
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion tsc agenda This issue will be discussed by ESLint's TSC at the next meeting labels Nov 9, 2019
@kaicataldo
Copy link
Member Author

This was accepted at yesterday's TSC meeting.

@kaicataldo kaicataldo force-pushed the deprecate-is-space-between-tokens branch from c48c806 to 0c632a0 Compare November 9, 2019 05:37
@kaicataldo kaicataldo removed the do not merge This pull request should not be merged yet label Nov 9, 2019
@@ -1789,6 +1789,339 @@ describe("SourceCode", () => {
});
});

describe("isSpaceBetween()", () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Duplicating the tests below for isSpaceBetweenTokens().

@kaicataldo
Copy link
Member Author

This has been rebased and is ready for review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants