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

Docs: add note and example for extending the range of fix (refs #13706) #13748

Merged
merged 2 commits into from Oct 9, 2021

Conversation

mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Oct 10, 2020

Prerequisites checklist

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

[X] Documentation update
[ ] 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:

refs #13706

This PR adds a note about extending the range of a fix in the working-with-rules document, and an example based on #13706 (comment).

This PR also adds tests to confirm and ensure that empty insertions around a surrounding range can be used to extend fix to that range, per the example.

This is useful if a rule needs to prevent other fixes in the surrounding range in the same pass.

What changes did you make? (Give an overview)

Updated working-with-rules.md and added the tests.

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

@mdjermanovic mdjermanovic added the chore This change is not user-facing label Oct 10, 2020
@fisker
Copy link
Contributor

fisker commented Oct 10, 2020

Should we recommend this somewhere in the doc?

@mdjermanovic mdjermanovic added core Relates to ESLint's core APIs and features documentation Relates to ESLint's documentation evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed chore This change is not user-facing labels Oct 12, 2020
@mdjermanovic mdjermanovic changed the title Chore: add tests for extending fix ranges (refs #13706) Docs: add note and example for extending the range of fix (refs #13706) Oct 12, 2020
@mdjermanovic
Copy link
Member Author

mdjermanovic commented Oct 12, 2020

Should we recommend this somewhere in the doc?

Makes sense to me, updated working-with-rules.

@sindresorhus
Copy link
Contributor

sindresorhus commented Oct 13, 2020

Since this implementation detail is being documented, it means ESLint has to preserve the behavior, so why not instead expose a specific method for this instead? There's clearly a need for it.

nzakas
nzakas approved these changes Sep 10, 2021
Copy link
Member

@nzakas nzakas left a comment

LGTM

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 core Relates to ESLint's core APIs and features documentation Relates to ESLint's documentation evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants