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!: Remove deprecated context methods #17698
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
lib/linter/linter.js
Outdated
{} | ||
) | ||
); | ||
const BASE_TRAVERSAL_CONTEXT = {}; |
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.
Do we still need BASE_TRAVERSAL_CONTEXT
? Looks like we can just remove it now.
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.
Ah, right you are!
We should also remove deprecation warnings from the RuleTester: eslint/lib/rule-tester/rule-tester.js Lines 175 to 195 in 5454c22
|
Oops, yes. Removed from the tests but not |
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
|
||
}); | ||
|
||
describe("context.getAncestors()", () => { |
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.
Tests for context.getAncestors()
shouldn't be removed in this PR?
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.
It looks like getAncestors()
, getScope()
, getDeclaredVariables()
, and markVariableAsUsed()
don't actually have a separate issue tracking their removal, despite us announcing it.
So maybe I should remove those in this PR too?
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.
It's a subtask of #16999 (Phase 8: Removal of old APIs; just it seems that markVariableAsUsed()
was accidentally omitted from that list, and note that the list includes removing context.parserServices
as well) which is tracked in the v9 project.
Regardless, seems best and easiest for maintaining the alpha release to remove them as well in this PR 👍
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.
Ah good call, those subtasks are tricky to remember. I've updated the list to reflect reality and will add the rest into this PR.
Note: Linting is failed because |
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
This pull request was auto-closed due to inactivity. While we wish we could keep working on every request, we unfortunately don't have the bandwidth to continue here and need to focus on other things. You can resubmit this pull request if you would like to continue working on it. |
I've made a few updates, hopefully it can fix the lint failing: |
All merged now. I checked this branch locally and linting works now. There are just several lint errors and a merge conflict in package.json that should be fixed. |
Fixed merge conflicts and re-pushed the branch. |
seems there are a few linting errors that need to be fixed. |
Thanks. Fixed! |
Co-authored-by: 唯然 <weiran.zsd@outlook.com>
assert.strictEqual(suppressedMessages.length, 0); | ||
}); | ||
|
||
it("should expose parser services when using parseForESLint() and services are specified", () => { |
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.
I think we should keep tests with parserServices
as they're testing how Linter creates SourceCode objects based on parser features. We could just remove the assert.strictEqual(context.parserServices, context.sourceCode.parserServices)
line.
assert.strictEqual(suppressedMessages.length, 0); | ||
}); | ||
|
||
it("should use the same parserServices if source code object is reused", () => { |
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.
Same as the previous comment, I think we should keep this test here.
|
||
it("should expose parser services when using parseForESLint() and services are specified", () => { |
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.
Same as the previous comment, I think we should keep this test here.
|
||
it("should use the same parserServices if source code object is reused", () => { |
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.
Same as the previous comment, I think we should keep this test here.
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.
Just a tip if anyone else is going to review this: better use VS Code diff viewer for this file, as this diff here is pretty much unusable and the diff is not as large as it appears to be.
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Also updated |
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!
|
||
describe("when calling context.getScope", () => { |
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.
I just noticed that this set of tests wasn't copied into source-code tests, but we could do that in another PR.
}); | ||
}); | ||
|
||
describe("Variables and references", () => { |
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.
This set of tests also doesn't exist in source-code tests, though these look more like tests for eslint-scope than tests for linter.
* main: (25 commits) test: ensure that CLI tests run with FlatESLint (eslint#17884) fix!: Behavior of CLI when no arguments are passed (eslint#17644) docs: Update README Revert "feat!: Remove CodePath#currentSegments" (eslint#17890) feat!: Update shouldUseFlatConfig and CLI so flat config is default (eslint#17748) feat!: Remove CodePath#currentSegments (eslint#17756) chore: update dependency markdownlint-cli to ^0.38.0 (eslint#17865) feat!: deprecate no-new-symbol, recommend no-new-native-nonconstructor (eslint#17710) feat!: check for parsing errors in suggestion fixes (eslint#16639) feat!: assert suggestion messages are unique in rule testers (eslint#17532) feat!: `no-invalid-regexp` make allowConstructorFlags case-sensitive (eslint#17533) fix!: no-sequences rule schema correction (eslint#17878) feat!: Update `eslint:recommended` configuration (eslint#17716) feat!: drop support for string configurations in flat config array (eslint#17717) feat!: Remove `SourceCode#getComments()` (eslint#17715) feat!: Remove deprecated context methods (eslint#17698) feat!: Swap FlatESLint-ESLint, FlatRuleTester-RuleTester in API (eslint#17823) feat!: remove formatters except html, json(-with-metadata), and stylish (eslint#17531) feat!: Require Node.js `^18.18.0 || ^20.9.0 || >=21.1.0` (eslint#17725) fix: allow circular references in config (eslint#17752) ...
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Removed the deprecated methods on the
context
object.fixes #17520
Is there anything you'd like reviewers to focus on?