Skip to content

feat(linter/plugins): support commonjs source type in RuleTester#18198

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

feat(linter/plugins): support commonjs source type in RuleTester#18198
graphite-app[bot] merged 1 commit intomainfrom
om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 18, 2026

commonjs source type was previously supported in RuleTester only with eslintCompat option enabled (and it was then treated as script).

#18089 added support in Oxc parser for commonjs. Accept it in RuleTester (either with or without ESLint compatibility mode) and parse properly as CommonJS.

Copy link
Member Author

overlookmotel commented Jan 18, 2026


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.

@overlookmotel overlookmotel force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch from 3b38774 to ef08b7c Compare January 18, 2026 22:46
@overlookmotel overlookmotel force-pushed the om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_ branch from 83866f8 to e95a4fe Compare January 18, 2026 22:46
@overlookmotel overlookmotel marked this pull request as ready for review January 18, 2026 22:49
Copilot AI review requested due to automatic review settings January 18, 2026 22:49
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 adds native support for the commonjs source type in RuleTester, removing the previous requirement for ESLint compatibility mode. The Oxc parser now properly parses CommonJS code with this source type, treating it distinctly from script mode.

Changes:

  • Simplified source type handling logic to treat commonjs as a first-class source type
  • Updated tests to validate CommonJS-specific behavior (top-level return statements)
  • Improved ESLint conformance test pass rate by 4 tests for the strict rule

Reviewed changes

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

File Description
apps/oxlint/src-js/package/rule_tester.ts Removed the requirement for eslintCompat mode when using commonjs source type and eliminated the commonjsscript conversion logic
apps/oxlint/test/rule_tester.test.ts Simplified tests by removing nested eslintCompat test groups and added return 123; test case to validate CommonJS-specific behavior
apps/oxlint/conformance/src/rule_tester.ts Updated comment to reflect that eslintCompat no longer enables commonjs source type
apps/oxlint/conformance/snapshot.md Updated conformance test results showing 4 additional passing tests for the strict rule

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

@overlookmotel overlookmotel force-pushed the om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_ branch from e95a4fe to 84b352d Compare January 18, 2026 23:01
@overlookmotel overlookmotel self-assigned this Jan 18, 2026
@graphite-app graphite-app bot force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch 2 times, most recently from 80fc51f to 9a5146e Compare January 18, 2026 23:17
@graphite-app graphite-app bot force-pushed the om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_ branch from 84b352d to 8773a73 Compare January 18, 2026 23:17
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 19, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 19, 2026

Merge activity

…18198)

`commonjs` source type was previously supported in `RuleTester` only with `eslintCompat` option enabled (and it was then treated as `script`).

#18089 added support in Oxc parser for `commonjs`. Accept it in `RuleTester` (either with or without ESLint compatibility mode) and parse properly as CommonJS.
@graphite-app graphite-app bot force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch from 9a5146e to 6e8fa80 Compare January 19, 2026 04:39
@graphite-app graphite-app bot force-pushed the om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_ branch from 8773a73 to 7c86fc3 Compare January 19, 2026 04:39
Base automatically changed from om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ to main January 19, 2026 04:45
@graphite-app graphite-app bot merged commit 7c86fc3 into main Jan 19, 2026
20 checks passed
@graphite-app graphite-app bot deleted the om/01-18-feat_linter_plugins_support_commonjs_source_type_in_ruletester_ branch January 19, 2026 04:45
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 19, 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-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments