Skip to content

fix(linter/plugins): rule tester default to module source type in ESLint compat mode#18195

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-18-fix_linter_plugins_rule_tester_default_to_module_source_type_in_eslint_compat_mode
Jan 18, 2026
Merged

fix(linter/plugins): rule tester default to module source type in ESLint compat mode#18195
graphite-app[bot] merged 1 commit intomainfrom
om/01-18-fix_linter_plugins_rule_tester_default_to_module_source_type_in_eslint_compat_mode

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 18, 2026

#18124 altered parsing behavior to default to script / module source type depending on whether the file contains ESM syntax (e.g. import declarations).

This broke a several hundred Oxlint JS plugins conformance tests, because ESLint's behavior is to treat files as module source type unless directed otherwise.

Fix these conformance tests by reverting the "parse based on content" behavior in RuleTester, when eslintCompat option is enabled.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-bug Category - Bug labels Jan 18, 2026
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the RuleTester to default to module source type when ESLint compatibility mode is enabled, aligning with ESLint's behavior. Previously, #18124 introduced "unambiguous" parsing (detecting source type from content), which broke several hundred Oxlint JS plugins conformance tests that expected ESLint's default module behavior.

Changes:

  • Added default source type of "module" in ESLint compatibility mode when no explicit source type is provided
  • Added constant EMPTY_LANGUAGE_OPTIONS to handle the case when languageOptions is null
  • Enhanced test coverage with dedicated tests for both default behaviors (with and without eslintCompat)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/oxlint/src-js/package/rule_tester.ts Added logic to default to "module" source type when eslintCompat is true and no explicit source type is set
apps/oxlint/test/rule_tester.test.ts Refactored and expanded tests to validate both unambiguous parsing (default) and module parsing (ESLint compat mode) behaviors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel self-assigned this Jan 18, 2026
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 18, 2026
Copy link
Member Author

overlookmotel commented Jan 18, 2026

Merge activity

…int compat mode (#18195)

#18124 altered parsing behavior to default to `script` / `module` source type depending on whether the file contains ESM syntax (e.g. `import` declarations).

This broke a several hundred Oxlint JS plugins conformance tests, because ESLint's behavior is to treat files as `module` source type unless directed otherwise.

Fix these conformance tests by reverting the "parse based on content" behavior in `RuleTester`, when `eslintCompat` option is enabled.
@graphite-app graphite-app bot force-pushed the om/01-18-fix_linter_plugins_rule_tester_default_to_module_source_type_in_eslint_compat_mode branch from ca43660 to 8a2dabc Compare January 18, 2026 23:02
@graphite-app graphite-app bot merged commit 8a2dabc into main Jan 18, 2026
19 checks passed
@graphite-app graphite-app bot deleted the om/01-18-fix_linter_plugins_rule_tester_default_to_module_source_type_in_eslint_compat_mode branch January 18, 2026 23:08
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants