Skip to content

test: switch to flat config mode in SourceCode tests #19953

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

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

mdjermanovic
Copy link
Member

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)

  • Updated all tests for SourceCode#getJSDocComment(). SourceCode#getScope(), SourceCode#getDeclaredVariables(), and SourceCode#markVariableAsUsed() methods to use Linter in flat config mode.
  • Updated one test for SourceCode#isGlobalReference() to use Linter in flat config mode. The other tests for this method were already using Linter in flat config mode.
  • Added test cases where Linter#verify() is called with a SourceCode instance (instead of source code text) in flat config mode to match existing test cases where Linter#verify() is called with a SourceCode 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?

@mdjermanovic mdjermanovic requested a review from a team as a code owner July 20, 2025 12:31
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jul 20, 2025
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label Jul 20, 2025
Copy link

netlify bot commented Jul 20, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 8967c61
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/687ce1adbafacc0008565e11

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@nzakas nzakas merged commit b7f7545 into main Jul 22, 2025
30 checks passed
@nzakas nzakas deleted the tests-flat-sourcecode branch July 22, 2025 15:10
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore This change is not user-facing
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

2 participants