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
feat: add sourceCode
property to the rule context
#17107
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
tests/lib/linter/linter.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes LGTM, but maybe we should add a test to ensure that context.getSourceCode()
returns context.sourceCode
. Currently, getSourceCode()
is being heavily tested indirectly by dependencies that rely on its functionality, but if eventually these dependencies switch to use sourceCode
instead, then getSourceCode()
would remain uncovered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions I've updated the test cases to use assert.strictEqual(context.getSourceCode(), context.sourceCode);
sourceCode
to the rule contextsourceCode
property to the rule context
a0c8e6e
to
7172591
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Leaving open for others to review.
There are merge conflicts now. |
7172591
to
f8a6c80
Compare
@mdjermanovic I've rebased & resolved the conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending @mdjermanovic's latest suggestions.
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
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)
[x] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Refers #16999
This PR creates
context.sourceCode
and deprecatescontext.getSourceCode()
.Is there anything you'd like reviewers to focus on?
Did I miss any references?
I intentionally didn't update custom-rules-deprecated.md