test(linter/plugins): handle globalReturn and impliedStrict options in conformance tests#18307
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Merge activity
|
…ns in conformance tests (#18307) Closes #16862. In conformance tests, support `globalReturn` and `impliedStrict` options. This fixes ~40 failing tests. This PR does not add these options to actually linter, because Oxlint doesn't provide a way to set these options through config. Ideally, we *would* support these options in `RuleTester` in `eslintCompat` mode, but that would add extra code to the main linter implementation. We can do that when we move `RuleTester` into its own package.
There was a problem hiding this comment.
Pull request overview
This PR adds support for the globalReturn and impliedStrict parser options in conformance tests to fix approximately 40 failing tests. These options affect how the scope analyzer interprets the code (allowing top-level return statements and treating code as strict mode), but are only enabled in the conformance test build and not in the main linter.
Changes:
- Added
analyzeOptionsOverrideobject in scope.ts to allow runtime overriding ofglobalReturnandimpliedStrictoptions during conformance tests - Modified
setEcmaVersionContexttosetEcmaVersionAndFeaturesto extract and apply these parser options from test case configuration - Updated type definitions in tester.ts to allow these properties in test case configurations
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/scope.ts | Adds override mechanism for globalReturn and impliedStrict options guarded by CONFORMANCE flag |
| apps/oxlint/src-js/package/rule_tester.ts | Extracts parser options from test cases and applies them to scope analyzer, renames function to reflect expanded functionality |
| apps/oxlint/conformance/tester.ts | Updates type definitions to allow globalReturn and impliedStrict in test case configurations |
| apps/oxlint/conformance/snapshot.md | Shows test pass rate improvements: 2 more rules fully passing, 42 more tests passing overall |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
43627ec to
44be0eb
Compare
355e6c9 to
4e24692
Compare

Closes #16862.
In conformance tests, support
globalReturnandimpliedStrictoptions. This fixes ~40 failing tests.This PR does not add these options to actually linter, because Oxlint doesn't provide a way to set these options through config.
Ideally, we would support these options in
RuleTesterineslintCompatmode, but that would add extra code to the main linter implementation. We can do that when we moveRuleTesterinto its own package.