test: switch to flat config mode in SourceCode
tests
#19953
Merged
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.
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
[ ] Add something to the core
[x] Other, please explain:
Updates JS SourceCode tests to use
Linter
in flat config mode instead of eslintrc mode. We'd need to do this sooner or later since the eslintrc mode will be removed in ESLint v10.What changes did you make? (Give an overview)
SourceCode#getJSDocComment()
.SourceCode#getScope()
,SourceCode#getDeclaredVariables()
, andSourceCode#markVariableAsUsed()
methods to useLinter
in flat config mode.SourceCode#isGlobalReference()
to useLinter
in flat config mode. The other tests for this method were already usingLinter
in flat config mode.Linter#verify()
is called with aSourceCode
instance (instead of source code text) in flat config mode to match existing test cases whereLinter#verify()
is called with aSourceCode
instance in eslintrc config mode. I left the eslintrc test in as they're testing this specific functionality rather than SourceCode methods. Those three tests are the only test in this file that will still use eslintrc mode, and they should just be removed in ESLint v10 as this PR adds their equivalents in flat config mode.Is there anything you'd like reviewers to focus on?