-
-
Notifications
You must be signed in to change notification settings - Fork 729
feat(linter/plugins): implement context.languageOptions
#15486
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
feat(linter/plugins): implement context.languageOptions
#15486
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
|
There was a problem hiding this 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 implements support for languageOptions in the oxlint plugin context API, bringing it closer to ESLint compatibility. This allows plugin rules to access information about how a file was parsed, including source type, ECMAScript version, parser options, and globals.
Key changes:
- Added
languageOptionsproperty to the plugin context withsourceType,ecmaVersion,parserOptions, andglobalsproperties - Created
PARSER_OPTIONSandLANGUAGE_OPTIONSsingleton objects to efficiently provide language configuration - Exported
LanguageOptionstype from the main index for plugin consumers
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/context.ts | Implements languageOptions and parserOptions objects with getters for source type, ECMAScript version, parser, and globals |
| apps/oxlint/src-js/index.ts | Exports the new LanguageOptions type for plugin authors |
| apps/oxlint/test/fixtures/languageOptions/plugin.ts | Test plugin that reports all language options to verify functionality |
| apps/oxlint/test/fixtures/languageOptions/.oxlintrc.json | Configuration file for the language options test fixture |
| apps/oxlint/test/fixtures/languageOptions/files/index.{js,mjs,cjs} | Test files with different module types (script vs module) |
| apps/oxlint/test/fixtures/languageOptions/output.snap.md | Expected output showing correct language options for each file type |
| apps/oxlint/test/e2e.test.ts | Adds test case for language options fixture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Implement
Context#languageOptions.