feat(linter): implement oxlint.config.ts support#17563
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. |
72ac379 to
ac6ec7e
Compare
ac6ec7e to
c84173e
Compare
6a0665a to
c617664
Compare
1929ac6 to
ae28df8
Compare
c617664 to
e5bf768
Compare
ae28df8 to
b6a065e
Compare
e5bf768 to
4cbf73f
Compare
4cbf73f to
4f9fb40
Compare
oxlint.config.ts supportoxlint.config.ts support
4f9fb40 to
9349081
Compare
9349081 to
9c0b3ff
Compare
5e202e7 to
060fd65
Compare
060fd65 to
7fddcca
Compare
37f46a1 to
122aff7
Compare
7fddcca to
e6d3347
Compare
e6d3347 to
3813d10
Compare
122aff7 to
25a2416
Compare
3813d10 to
0279fcc
Compare
580364e to
14bda94
Compare
Merge activity
|
There was a problem hiding this comment.
Pull request overview
This pull request implements support for TypeScript configuration files (oxlint.config.ts) in oxlint, enabling users to define linting configurations using TypeScript/JavaScript instead of JSON. This addresses issue #17527 and provides a more flexible configuration system for complex rule configurations, particularly in large monorepos where different teams maintain separate linting configs.
Changes:
- Added TypeScript config file support (
oxlint.config.ts) with conflict detection to prevent both JSON and TS configs in the same directory - Implemented parallel JS/TS config loading through Node.js with proper error handling for missing runtime, invalid exports, and execution errors
- Extended config discovery to detect both
.oxlintrc.jsonandoxlint.config.tsfiles, with validation and override support
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/oxlint/src/run.rs | Wires up JS config loader callback to CLI runner through NAPI interface |
| apps/oxlint/src/lint.rs | Adds config loader callback support to CliRunner with conditional compilation |
| apps/oxlint/src/lib.rs | Exports new js_config module and defines TS config filename constant |
| apps/oxlint/src/js_config.rs | Implements Rust-side JS config loader with JSON response parsing and error handling |
| apps/oxlint/src/config_loader.rs | Extends config discovery and loading to support TS files with conflict detection |
| apps/oxlint/src/lsp/server_linter.rs | Updates error handling to support configs without paths |
| apps/oxlint/src-js/js_config.ts | Implements Node.js-side config loading using dynamic imports with validation |
| apps/oxlint/test/fixtures/js_config_* | Comprehensive test fixtures covering basic usage, errors, conflicts, and overrides |
Comments suppressed due to low confidence (1)
apps/oxlint/src/run.rs:14
- The same
cfgattribute is applied twice in succession (lines 13 and 14). This is likely a mistake. One should be#[cfg(not(all(target_pointer_width = "64", target_endian = "little")))]and the other should be#[cfg(all(target_pointer_width = "64", target_endian = "little"))]. Currently, line 13 has the negation but line 14 doesn't negate it, so the import is only effective on 64-bit little-endian platforms. However, having both attributes on the same item means the second one overrides the first, making line 13 ineffective.
use crate::{
init::{init_miette, init_tracing},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/oxlint/test/fixtures/js_config_nested_conflict/files/nested/test.js
Show resolved
Hide resolved
Refs: #17527 note: this does not include language server support

Refs: #17527
note: this does not include language server support