Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request? (put an "X" next to item)
[X] Add something to the core
I request to add
version
to the rule context.The
context.version
is useful in many cases. Below cases are examples, though this is too late.Check the behavior of directive comments
Since
4.7.0
,eslint-enable
's behavior was changed a bit (#9216 (comment)).eslint-plugin-eslint-comments plugin want to follow the change. It wants to detect the actual behavior on the ESLint which is running, but cannot know without the
context.version
.Check the behavior of auto-fixing.
Since
4.1.0
,fix
functions which are passed tocontext.report
can return an iterable object (includes an array) (#8101).I want to use it and to avoid critical error on
<4.1.0
, but rules cannot know whether thefix
functions can return an iterable object or not without thecontext.version
.Check the behavior of the location of problems.
Since
3.1.0
,loc
properties which are passed tocontext.report
can be{start: object, end: object}
to express the range of the problem (#6640).I had wanted to use it and to avoid critical error on
<3.1.0
, but rules could not know whether thecontext.report
accepts the range or not withoutcontext.version
.What changes did you make? (Give an overview)
This PR adds the
version
property into rule contexts.Is there anything you'd like reviewers to focus on?
Direction.