Commit Graph

2615 Commits

Author SHA1 Message Date
overlookmotel 6c5b8be886 refactor(linter): create AllocatorPool in Runtime::new (#13106)
Move creation of `AllocatorPool` into just one place. Previously it was created in various places and passed in to `LintService::new` which passed it to `Runtime::new`. Just create it in `Runtime::new` instead.

This does have one substantive effect. Language server was creating `AllocatorPool` with `AllocatorPool::default` (0 slots for `Allocator`s) whereas now it's created with `rayon::current_num_threads()` slots.

This doesn't make much difference at present, because the pool creates allocators on demand. But it's going to become important when running JS plugins multi-threaded. At that point it'll be essential that the `AllocatorPool` is created with an accurate thread count, and undefined behavior may result if it isn't.
2025-08-15 15:05:49 +00:00
Sysix cc2a85b0db refactor(linter): remove CliRunResult from TsGoLintState (#13119)
Goal is there are no references for `oxlint` functions.
Now move `TsGoLintState` to `oxc_linter` so the server can use it too 🥳
2025-08-15 14:21:16 +02:00
Sysix 23e5642bb2 refactor(linter): move TsGoLintInput creation into own function (#13118)
Move the creation into an own function.
This would be later helpful when implementing it for the language server.
2025-08-15 12:11:26 +00:00
copilot-swe-agent 3bfb23518d perf(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish (#13098)
This PR resolves the TODO comment at line 126 in `apps/oxlint/src/tsgolint.rs` by implementing streaming diagnostics for tsgolint instead of waiting for the entire process to complete.

## Problem

Previously, the tsgolint integration would:
1. Spawn the tsgolint process
2. Wait for the entire process to complete using `child.wait_with_output()`
3. Parse all output at once
4. Send all diagnostics to the diagnostic service

This approach meant users had to wait for tsgolint to process all files before seeing any feedback, which could be slow for large codebases.

## Solution

The implementation now streams diagnostics as they are emitted:

1. **Streaming stdout reader**: Reads from the tsgolint process stdout in 4KB chunks as data becomes available
2. **Incremental message parsing**: Uses the existing binary protocol parser to process complete messages as they arrive in the buffer
3. **Immediate diagnostic sending**: Sends diagnostics to the diagnostic service via the `error_sender` channel as soon as they are parsed
4. **Proper buffering**: Keeps incomplete messages in the buffer for the next iteration to handle message boundaries correctly

## Key Changes

- Replaced `child.wait_with_output()` with streaming stdout reading in a separate thread
- Added incremental buffer processing that identifies complete messages using the binary protocol format
- Maintained backward compatibility - all existing tests pass
- Removed unused `parse_tsgolint_output()` function since parsing now happens incrementally
- Added proper error handling for both process exit status and stdout processing

## Benefits

- **Faster feedback**: Users see diagnostics as soon as tsgolint emits them, rather than waiting for completion
- **Better user experience**: Especially beneficial for large codebases where tsgolint processing takes significant time
- **Same reliability**: All existing functionality and error handling is preserved
- **No breaking changes**: The API and behavior remain the same from the user's perspective

The streaming implementation provides a more responsive experience while maintaining full compatibility with existing tsgolint integration.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey.
2025-08-15 09:07:43 +00:00
Sysix 43b1c5a954 fix(linter): do not count type-aware rules, when not enabled (#13062)
closes #13037
2025-08-14 15:57:25 +00:00
camc314 a0ccada6e6 fix(tsgolint): handle non-zero exit status from tsgolint process (#13087) 2025-08-14 11:08:39 +00:00
overlookmotel 4f2cc96e5f style(linter): add line break (#13061) 2025-08-13 18:12:43 +01:00
Copilot 61112a3c6a feat(linter): Add 36 new TypeScript ESLint rules with comprehensive test fixtures (#12893) 2025-08-13 12:19:44 +08:00
oxc-bot 18cfd18998 release(oxlint): v1.11.2 (#13013) 2025-08-12 12:47:19 +08:00
Copilot c461a862f3 fix(oxlint): Fix type-aware linting crash when Vue files are present (#13007) 2025-08-12 10:55:47 +08:00
Alexander S. fb8cbbf986 test(oxlint): enable tsgolint test with config parameter for windows (#13001) 2025-08-12 09:14:56 +08:00
Sysix 69303deb3d refactor(oxlint): pass DiagnosticService as a parameter for TsGoLintState.lint() (#13004)
Started to refactor for the language server, but noticed it needs more to be done: https://github.com/oxc-project/tsgolint/issues/71
Still opened the PR to align with the service:

https://github.com/oxc-project/oxc/blob/ca91a261556d88cde7ece4314d905a78aca1cc76/crates/oxc_linter/src/service/mod.rs#L91-L102
2025-08-11 19:06:52 +00:00
camc314 d59f3bbf40 test(oxlint): match x.ys when replacing var (#12990)
tsgolint is slow, this pr updates the regex to match `1.2s` so the snapshots match

https://github.com/oxc-project/oxc/actions/runs/16877756284/job/47806157516
2025-08-11 14:31:25 +00:00
camc314 29365455a8 fix(linter/tsgolint): report an error if tsgolint executable failed to spawn (#12984) 2025-08-11 08:58:13 +00:00
camchenry d7cca12a3a test(linter): add test for extended configs and overrides for tsgolint (#12924)
- addresses https://github.com/oxc-project/oxc/pull/12886#discussion_r2263237734
2025-08-09 14:51:47 +00:00
Sysix a13b3ee17c fix(oxlint): run tsgolint.CMD under windows (#12932) 2025-08-09 14:30:18 +00:00
oxc-bot 9c5a377d74 release(oxlint): v1.11.1 (#12928) 2025-08-09 17:50:26 +08:00
camchenry 7fc907fc43 fix(linter): resolve configured rules for every file linted by tsgolint (#12886)
The previous implementation of config resolution was simply incorrect. It did not resolve rule severities and overrides and nested configs properly. Now, although inefficient, we resolve the config file for every path that we will lint with `tsgolint` to correctly account for any possible nested configs, overrides, and so on.
2025-08-08 23:55:15 +00:00
Sysix 9d946aa487 test(oxlint): skip --type--aware test for big-endian (#12911)
I do not understand. But we should be safe that it works on every platform:
https://github.com/oxc-project/oxc/actions/runs/16832090346/job/47682086913
2025-08-08 14:04:48 +00:00
Sysix 695fbddf83 test(oxlint): fix --type-aware test on big-endian and skip for windows (#12910)
https://github.com/oxc-project/oxc/actions/runs/16831534930/job/47680206750
https://github.com/oxc-project/oxc/actions/runs/16831534945/job/47680206813
https://github.com/oxc-project/oxc/actions/runs/16831534945/job/47680206827
2025-08-08 13:43:33 +00:00
Sysix 38118abbcf test(oxlint): fix --type-aware snapshot + add non tsgolint rule (#12909) 2025-08-08 13:17:37 +00:00
renovate 1ed8c1a471 chore(deps): update dependency rust to v1.89.0 (#12873)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust) | minor | `1.88.0` -> `1.89.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.89.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1890-2025-08-07)

[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.88.0...1.89.0)

\==========================

<a id="1.89.0-Language"></a>

## Language

- [Stabilize explicitly inferred const arguments (`feature(generic_arg_infer)`)](https://redirect.github.com/rust-lang/rust/pull/141610)
- [Add a warn-by-default `mismatched_lifetime_syntaxes` lint.](https://redirect.github.com/rust-lang/rust/pull/138677)
  This lint detects when the same lifetime is referred to by different syntax categories between function arguments and return values, which can be confusing to read, especially in unsafe code.
  This lint supersedes the warn-by-default `elided_named_lifetimes` lint.
- [Expand `unpredictable_function_pointer_comparisons` to also lint on function pointer comparisons in external macros](https://redirect.github.com/rust-lang/rust/pull/134536)
- [Make the `dangerous_implicit_autorefs` lint deny-by-default](https://redirect.github.com/rust-lang/rust/pull/141661)
- [Stabilize the avx512 target features](https://redirect.github.com/rust-lang/rust/pull/138940)
- [Stabilize `kl` and `widekl` target features for x86](https://redirect.github.com/rust-lang/rust/pull/140766)
- [Stabilize `sha512`, `sm3` and `sm4` target features for x86](https://redirect.github.com/rust-lang/rust/pull/140767)
- [Stabilize LoongArch target features `f`, `d`, `frecipe`, `lasx`, `lbt`, `lsx`, and `lvz`](https://redirect.github.com/rust-lang/rust/pull/135015)
- [Remove `i128` and `u128` from `improper_ctypes_definitions`](https://redirect.github.com/rust-lang/rust/pull/137306)
- [Stabilize `repr128` (`#[repr(u128)]`, `#[repr(i128)]`)](https://redirect.github.com/rust-lang/rust/pull/138285)
- [Allow `#![doc(test(attr(..)))]` everywhere](https://redirect.github.com/rust-lang/rust/pull/140560)
- [Extend temporary lifetime extension to also go through tuple struct and tuple variant constructors](https://redirect.github.com/rust-lang/rust/pull/140593)
- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/)

<a id="1.89.0-Compiler"></a>

## Compiler

- [Default to non-leaf frame pointers on aarch64-linux](https://redirect.github.com/rust-lang/rust/pull/140832)
- [Enable non-leaf frame pointers for Arm64EC Windows](https://redirect.github.com/rust-lang/rust/pull/140862)
- [Set Apple frame pointers by architecture](https://redirect.github.com/rust-lang/rust/pull/141797)

<a id="1.89.0-Platform-Support"></a>

## Platform Support

- [Add new Tier-3 targets `loongarch32-unknown-none` and `loongarch32-unknown-none-softfloat`](https://redirect.github.com/rust-lang/rust/pull/142053)
- [`x86_64-apple-darwin` is in the process of being demoted to Tier 2 with host tools](https://redirect.github.com/rust-lang/rfcs/pull/3841)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

<a id="1.89.0-Libraries"></a>

## Libraries

- [Specify the base path for `file!`](https://redirect.github.com/rust-lang/rust/pull/134442)
- [Allow storing `format_args!()` in a variable](https://redirect.github.com/rust-lang/rust/pull/140748)
- [Add `#[must_use]` to `[T; N]::map`](https://redirect.github.com/rust-lang/rust/pull/140957)
- [Implement `DerefMut` for `Lazy{Cell,Lock}`](https://redirect.github.com/rust-lang/rust/pull/129334)
- [Implement `Default` for `array::IntoIter`](https://redirect.github.com/rust-lang/rust/pull/141574)
- [Implement `Clone` for `slice::ChunkBy`](https://redirect.github.com/rust-lang/rust/pull/138016)
- [Implement `io::Seek` for `io::Take`](https://redirect.github.com/rust-lang/rust/pull/138023)

<a id="1.89.0-Stabilized-APIs"></a>

## Stabilized APIs

- [`NonZero<char>`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html)
- Many intrinsics for x86, not enumerated here
  - [AVX512 intrinsics](https://redirect.github.com/rust-lang/rust/issues/111137)
  - [`SHA512`, `SM3` and `SM4` intrinsics](https://redirect.github.com/rust-lang/rust/issues/126624)
- [`File::lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock)
- [`File::lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock_shared)
- [`File::try_lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock)
- [`File::try_lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock_shared)
- [`File::unlock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.unlock)
- [`NonNull::from_ref`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_ref)
- [`NonNull::from_mut`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_mut)
- [`NonNull::without_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.without_provenance)
- [`NonNull::with_exposed_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.with_exposed_provenance)
- [`NonNull::expose_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.expose_provenance)
- [`OsString::leak`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.leak)
- [`PathBuf::leak`](https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.leak)
- [`Result::flatten`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.flatten)
- [`std::os::linux::net::TcpStreamExt::quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.quickack)
- [`std::os::linux::net::TcpStreamExt::set_quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.set_quickack)

These previously stable APIs are now stable in const contexts:

- [`<[T; N]>::as_mut_slice`](https://doc.rust-lang.org/stable/std/primitive.array.html#method.as_mut_slice)
- [`<[u8]>::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.slice.html#impl-%5Bu8%5D/method.eq_ignore_ascii_case)
- [`str::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.str.html#impl-str/method.eq_ignore_ascii_case)

<a id="1.89.0-Cargo"></a>

## Cargo

- [`cargo fix` and `cargo clippy --fix` now default to the same Cargo target selection as other build commands.](https://redirect.github.com/rust-lang/cargo/pull/15192/) Previously it would apply to all targets (like binaries, examples, tests, etc.). The `--edition` flag still applies to all targets.
- [Stabilize doctest-xcompile.](https://redirect.github.com/rust-lang/cargo/pull/15462/) Doctests are now tested when cross-compiling. Just like other tests, it will use the [`runner` setting](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) to run the tests. If you need to disable tests for a target, you can use the [ignore doctest attribute](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#ignoring-targets) to specify the targets to ignore.

<a id="1.89.0-Rustdoc"></a>

## Rustdoc

- [On mobile, make the sidebar full width and linewrap](https://redirect.github.com/rust-lang/rust/pull/139831). This makes long section and item names much easier to deal with on mobile.

<a id="1.89.0-Compatibility-Notes"></a>

## Compatibility Notes

- [Make `missing_fragment_specifier` an unconditional error](https://redirect.github.com/rust-lang/rust/pull/128425)
- [Enabling the `neon` target feature on `aarch64-unknown-none-softfloat` causes a warning](https://redirect.github.com/rust-lang/rust/pull/135160) because mixing code with and without that target feature is not properly supported by LLVM
- [Sized Hierarchy: Part I](https://redirect.github.com/rust-lang/rust/pull/137944)
  - Introduces a small breaking change affecting `?Sized` bounds on impls on recursive types which contain associated type projections. It is not expected to affect any existing published crates. Can be fixed by refactoring the involved types or opting into the `sized_hierarchy` unstable feature. See the [FCP report](https://redirect.github.com/rust-lang/rust/pull/137944#issuecomment-2912207485) for a code example.
- The warn-by-default `elided_named_lifetimes` lint is [superseded by the warn-by-default `mismatched_lifetime_syntaxes` lint.](https://redirect.github.com/rust-lang/rust/pull/138677)
- [Error on recursive opaque types earlier in the type checker](https://redirect.github.com/rust-lang/rust/pull/139419)
- [Type inference side effects from requiring element types of array repeat expressions are `Copy` are now only available at the end of type checking](https://redirect.github.com/rust-lang/rust/pull/139635)
- [The deprecated accidentally-stable `std::intrinsics::{copy,copy_nonoverlapping,write_bytes}` are now proper intrinsics](https://redirect.github.com/rust-lang/rust/pull/139916). There are no debug assertions guarding against UB, and they cannot be coerced to function pointers.
- [Remove long-deprecated `std::intrinsics::drop_in_place`](https://redirect.github.com/rust-lang/rust/pull/140151)
- [Make well-formedness predicates no longer coinductive](https://redirect.github.com/rust-lang/rust/pull/140208)
- [Remove hack when checking impl method compatibility](https://redirect.github.com/rust-lang/rust/pull/140557)
- [Remove unnecessary type inference due to built-in trait object impls](https://redirect.github.com/rust-lang/rust/pull/141352)
- [Lint against "stdcall", "fastcall", and "cdecl" on non-x86-32 targets](https://redirect.github.com/rust-lang/rust/pull/141435)
- [Future incompatibility warnings relating to the never type (`!`) are now reported in dependencies](https://redirect.github.com/rust-lang/rust/pull/141937)
- [Ensure `std::ptr::copy_*` intrinsics also perform the static self-init checks](https://redirect.github.com/rust-lang/rust/pull/142575)
- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/)

<a id="1.89.0-Internal-Changes"></a>

## Internal Changes

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Correctly un-remap compiler sources paths with the `rustc-dev` component](https://redirect.github.com/rust-lang/rust/pull/142377)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2025-08-08 09:53:16 +00:00
overlookmotel c072e0120d refactor(all): add missing lifetimes in function return types (#12895)
Where a type being returned by a function has lifetimes, specify them with `'_` instead of omitting them entirely. `Cow<str>` -> `Cow<'_, str>`.

This is split out from Rust upgrade PR #12873, so can see the diff in that PR more clearly.

Note: This is very slightly different from what was in #12873. Clippy auto-fix introduced a couple of unnecessary and weird-looking anonymous lifetimes in function params, which this PR skips.
2025-08-08 08:40:13 +00:00
oxc-bot d9268fa3f6 release(oxlint): v1.11.0 (#12880) 2025-08-07 23:03:23 +08:00
camchenry ac463478d9 feat(oxlint): add tsgolint integration (#12485)
- towards #12292
2025-08-07 13:46:24 +00:00
oxc-bot 5f74a0b160 release(oxlint): v1.10.0 (#12846)
## [1.10.0] - 2025-08-06

### 🚀 Features

- 44ac5a1 linter: Add eslint/no-unassigned-vars rule (#11365) (yefan)
- ce6eeee linter: Add `eslint/prefer-destructuring` rule (#12721)
(yefan)
- 9b35600 linter/jsx-a11y: Add support for mapped attributes in label
association checks (#12805) (camc314)
- 5475075 vscode/language_server: Add `tsConfigPath` option (#12484)
(Sysix)
- a754f7a linter: Support `countVoidThis` option in `max-params` rule
(#12604) (yefan)

### 🐛 Bug Fixes

- 2c1dab6 linter/no-unassigned-vars: False positive with variables in
for loop (#12833) (camc314)
- 5a24574 linter/func-style: Fix more false positives (#12828) (camc314)
- 33a7320 linter/no-throw-literal: Fix unconditional recursion in
`could_be_error` (#12819) (camc314)
- a3aec6a linter/explicit-module-boundary-types: Debug assertion fail
with top level return (#12820) (camc314)
- 6efe457 linter/no-empty-function: Respect allow options for functions
and arrow functions (#12814) (camc314)
- 1c21c46 linter/new-cap: Fix panic with computed member expr (#12804)
(camc314)
- 45206dd linter: Apply fix span offset after fixing the section source
text (#12758) (Sysix)
- 1e97e35 linter/unicorn/prefer-structured-clone: Update Default
implementation for `PreferStructuredCloneConfig` (#12791) (camc314)
- d382159 linter/unicorn/prefer-object-from-entries: Update Default
implementation for `PreferObjectFromEntriesConfig` (#12790) (camc314)
- b07d29c linter/typescript/no-this-alias: Update Default implementation
for `NoThisAliasConfig` (#12789) (camc314)
- 0db34ab linter/react/jsx-filename-case: Update Default implementation
for `JsxFilenameExtensionConfig` (#12788) (camc314)
- ff84eff linter/jest/prefer-lowercase-title: Update Default
implementation for `PreferLowercaseTitleConfig` (#12787) (camc314)
- 5175c6d linter/jest/no-large-snapshots: Update Default implementation
for `NoLargeSnapshotsConfig` (#12786) (camc314)
- 0eaebcd linter/jest/no-deprecated-functions: Update Default
implementation for `JestConfig` (#12785) (camc314)
- 4265db7 linter/import/no-anonymous-default-export: Update Default
implementation for `NoAnonymousDefaultExport` config (#12784) (camc314)
- 6a360e3 linter/import/extensions: Update Default implementation for
ExtensionsConfig (#12783) (camc314)
- 42c8f29 linter: Default options for `eslint/no-else-return` (#12762)
(Sysix)
- 4eac511 linter: Default options for `eslint/no-unneeded-ternary`
(#12761) (Sysix)
- 9c01dbf linter: Default options for `eslint/new-cap` (#12760) (Sysix)
- b25406f linter/explicit-function-return-types: Update default values
in ExplicitFunctionReturnTypeConfig (#12718) (camc314)
- ce5876d parser: Validate inner expression of type assertions in
assignment targets (#12614) (camc314)
- 5383331 linter/explicit-mod-boundary-types: False positive with jsx
elements (#12678) (camc314)
- d0e99b5 linter/explicit-mod-boundary-types: False positive with call
expressions (#12677) (camc314)
- 525137e linter: Add missing options to no-inner-declarations (#12661)
(camc314)
- fc4a327 linter: No-unused-vars false positive with class property
initializers (#12660) (camc314)
- 6af8631 linter/no-unused-vars: False positive with chain expression
(#12609) (camc314)
- 744ef52 linter: Correct `array-type` handling of `default:
'array-simple'` (#12607) (yefan)

### 🚜 Refactor

- 3f37ed1 linter: Replace `lazy_static` with `std::sync::LazyLock`
(#12822) (Copilot)
- 69fd08d semantic: Improve unused label tracking and add debug
assertions (#12812) (camc314)
- 030e397 linter: Simplify parsing CLI args (#12802) (overlookmotel)
- c0e224a linter: Store `ExternalRuleId` in `OxlintOverrides` not raw
names (#12502) (camc314)
- 61587e4 linter: Correct comment (#12792) (overlookmotel)
- 5adcb98 linter: Use `u32` to keep track of last fixed source text
position (#12696) (Sysix)
- 77acc11 linter, transformer: Use `Scoping::symbol_is_unused` (#12666)
(overlookmotel)
- ecf1cff language_server: Simplify offset adjustment by using
`Message.move_offset` (#12647) (Sysix)
- 7695393 linter: Simplify offset adjustment by using
`Message.move_offset` (#12595) (Sysix)
- b36dc92 linter: Refactor large arrays to reduce binary size (#12603)
(Boshen)
- 3b9f1f0 linter: Update iter_outer_expressions to take AstNodes
reference (#12583) (camc314)

### 📚 Documentation

- e760fd4 linter: Complete linter rules documentation with missing "Why
is this bad?" sections (#12757) (Copilot)
- 514322c rust: Add minimal documentation to example files in crates
directory (#12731) (Copilot)
- 1d910d5 linter: Fix typescript/consistent-type-imports rule options to
match TypeScript ESLint (#12707) (Copilot)
- 45e2fe8 rust: Fix typos and grammar mistakes in Rust documentation
comments (#12715) (Copilot)
- 7660a88 linter: Improve linter rule documentation with "Why is this
bad?" sections and enhanced examples (#12711) (Copilot)
- de1de35 rust: Add comprehensive README.md documentation for all Rust
crates (#12706) (Copilot)

### ⚡ Performance

- 09ae2a9 linter: Eliminate unnecessary Iterator::collect() allocations
(#12776) (Copilot)
- 693673b linter: Reduce iterations when collecting directories for
nested configs (#12329) (overlookmotel)

### 🎨 Styling

- cacbd1e linter/no-empty-function: Order match arms consistently
(#12815) (camc314)
- c15da81 codegen, formatter, linter, minifier, transformer: Re-order
imports (#12725) (Copilot)

### 🧪 Testing

- 3957fcc linter/no-undef: Add test case for `TSImportType` (#12800)
(camc314)
- d8ccff7 oxlint: Add `Tester::test_fix` mehod (#12754) (Sysix)
- c6bfb8a linter: Add rule configuration consistency test (#12744)
(camc314)
- 2ceb835 linter: Fix offset for partical source texts (#12594) (Sysix)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
2025-08-06 11:10:28 +01:00
camc314 c2d346455a chore(linter/no-unassigned-vars): move to category to correctness (#12832) 2025-08-05 13:17:15 +00:00
camc314 9b356004e5 feat(linter/jsx-a11y): add support for mapped attributes in label association checks (#12805)
fixes #12507
2025-08-04 18:55:39 +00:00
overlookmotel 030e397381 refactor(linter): simplify parsing CLI args (#12802)
Pure refactor. Just simplify this code a little and move comment about what it does.
2025-08-04 13:21:19 +00:00
camc314 c0e224a19a refactor(linter): store ExternalRuleId in OxlintOverrides not raw names (#12502)
fixes #12653
2025-08-04 09:11:28 +00:00
Sysix 45206ddcda fix(linter): apply fix span offset after fixing the section source text (#12758)
closes #12726

for now, the section source text / file source text is a logic of the runtime.
I am currently moving some logic into the `ContextHost` (for vue).
After that, we can clean it up and use the file source text with already right offset.
2025-08-03 23:02:55 +00:00
Sysix d8ccff73c6 test(oxlint): add Tester::test_fix mehod (#12754) 2025-08-03 23:02:55 +00:00
Copilot c15da81a7b style(codegen, formatter, linter, minifier, transformer): re-order imports (#12725)
This PR addresses the import ordering violations identified in #12723 by
fixing import ordering across key files in the codebase to follow the
updated Oxc convention.

## Import Ordering Convention

The correct order is:
1. `std` imports
2. External crates
3. Oxc crates (starting with `oxc_`)
4. Local crate (`crate`)
5. `super`
6. `mod`

With line breaks between each category.

## Key Principle: Source Priority

Imports should be imported from the closest available source:
- Prefer to `use` from a local `mod` over `super` or `crate`
- Prefer to `use` from `super` over `crate`

This ensures we don't lose information about module structure and
maintain the most direct import paths.

## Changes Made

Fixed import ordering violations in 11 files based on comprehensive code
review feedback, ensuring all rules from #12723 are properly applied:

### Core Applications
- `apps/oxlint/src/lib.rs` - Fixed pub use positioning and
mod-before-use rule compliance
- `apps/oxlint/src/tester.rs` - Added required line break after imports

### Core Crates  
- `crates/oxc_language_server/src/main.rs` - Moved mod statements before
related use statements
- `crates/oxc_transformer/src/options/es_features.rs` - Added required
line break after imports
- Additional fixes in codegen, formatter, linter, and minifier crates

## Repository-Wide Analysis

Comprehensive analysis revealed 890+ additional files with import
ordering violations. However, automated fixing proved challenging due
to:
- Complex multi-line `use` statements with braces
- Relative imports within crate modules requiring careful handling
- Risk of breaking builds with overly aggressive automation

## Verification

- All changes maintain proper `rustfmt` compatibility
- Comprehensive build verification confirms all packages compile
successfully
- Source priority preserved - local module imports maintained over crate
imports where appropriate
- All tests pass with the updated import ordering

This represents the first phase of addressing #12723, with remaining
violations requiring careful manual review or enhanced tooling.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
2025-08-01 20:53:18 +01:00
overlookmotel 693673b4f0 perf(linter): reduce iterations when collecting directories for nested configs (#12329)
Small perf optimization.

Presumably all paths will usually have the same prefix e.g.:

* `/Users/bozo/projects/best-project-ever`
* `/Users/bozo/projects/best-project-ever/src/components`
* `/Users/bozo/projects/best-project-ever/src/server`

When finding directories to search for nested configs, stop walking up to parent directories when find a directory that's already in the `HashSet`. We know that dir's parent, grandparent, etc will already be in the set too, so no need to check them again.
2025-07-30 10:05:53 +00:00
oxc-bot 9220b0a43e release(oxlint): v1.9.0 (#12582)
## [1.9.0] - 2025-07-29

### 💥 BREAKING CHANGES

- 5a7e72a semantic: [**BREAKING**] `AstNodes::program` return `&Program`
not `Option<&Program>` (#12515) (overlookmotel)

### 🚀 Features

- 3489ce0 linter: Add `typescript-eslint/explicit-module-boundary-types`
(#12402) (Don Isaac)

### 🐛 Bug Fixes

- 0fd3e87 linter: Default options for `eslint/yoda` (#12540) (Sysix)
- 724776f linter: Default options for `unicorn/switch-case-braces`
(#12539) (Sysix)
- fda45ea linter/promise/prefer-await-to-callbacks: False positive for
`addEventListener` (#12537) (Copilot)
- 1a710e3 linter/array-type: Fix more false negatives (#12501) (camc314)
- 2b5bf98 linter: Consistent-function-scoping false positive with
hoisted var declarations (#12523) (camc314)
- cc19c8b vscode: Fix statusbar icon order (#12544) (Christian Fehmer)
- 209d006 linter: Parse vue lang attribute without quotes (#12517)
(Sysix)
- 85a34ce linter/array-type: False negative with arrays in generic args
(#12500) (camc314)
- 98c1fbb linter/require-await: Improve async keyword detection in
get_delete_span function (#12494) (camc314)
- 7c75dba linter/require-await: Improve span calculation for object
properties (#12490) (camc314)
- 2b261cf linter/exhaustive-deps: False positive in exhaustive deps
(#12471) (camc314)

### 🚜 Refactor

- a696227 linter: Remove AstKind for SimpleAssignmentTarget (#12401)
(Tyler Earls)
- 7af38e1 napi/oxlint: Simplify `ExternalLinterLintFileCb` type (#12572)
(overlookmotel)
- 543fd53 napi/oxlint: Rename `run` to `lintFile` (#12567)
(overlookmotel)
- 0179c86 napi/oxlint: Reverse args of `ExternalLinter::new` (#12566)
(overlookmotel)
- 491c401 linter: Remove `#[must_use]` from `LintService::with_*`
methods (#12560) (overlookmotel)
- d44b0ac linter: Remove `Runner` trait (#12559) (overlookmotel)
- bea652f linter: Add `vue` and `regex` to `BuiltinLintPlugins` (#12542)
(Sysix)
- aa9dd21 linter/no-eval: Get source type from `Semantic` (#12514)
(overlookmotel)
- 5c33fc7 diagnostics: Implement `Eq` and `Ord` for `InfoPosition`
(#12505) (overlookmotel)
- 8c8c8bc napi/oxlint: Diagnostics communicate which rule via rule
index, not rule ID (#12482) (overlookmotel)
- e2d9b4d fixer: Add Debug trait to PossibleFixes and Message structs
(#12493) (camc314)
- f0b1f0d napi/oxlint, napi/parser: Remove source length from
`RawTransferMetadata` (#12483) (overlookmotel)
- 7e4959a napi/oxlint: Rename `rules` to `ruleNames` (#12477)
(overlookmotel)
- 7a0da04 diagnostics: Remove Option wrapper from MPSC channel and
sender field (#12467) (camc314)

### 🧪 Testing

- 56468c7 linter/no-unused-private-class-members: Add more test cases
(#12569) (camc314)
- 191a164 linter/no-unused-private-class-members: Add more test cases
(#12563) (camc314)
- d31adcf linter: Improve sorting diagnostics (#12504) (overlookmotel)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
2025-07-29 09:54:02 +01:00
overlookmotel 543fd53607 refactor(napi/oxlint): rename run to lintFile (#12567)
Pure refactor - just renaming. The function on JS side is called `lintFile`. Rename `run` to `lintFile` in Rust code, to match.
2025-07-28 11:23:07 +00:00
overlookmotel 491c401bd4 refactor(linter): remove #[must_use] from LintService::with_* methods (#12560)
Pure refactor. Remove `#[must_use]` from `LintService::with_paths` and `LintService::with_file_system`. I assume these are left over from a past time when these methods took and returned `self`.

Also, make these same methods on `Runtime` return `&mut Self` not `&Self`. We don't use the return value of these methods, but presumably they're meant to support chaining.
2025-07-28 09:17:04 +00:00
overlookmotel d44b0ac57f refactor(linter): remove Runner trait (#12559)
Refactor. As far as I can see, this trait does not add any value, since it's only implemented by `LintRunner`. So remove it.
2025-07-28 09:07:44 +00:00
Sysix bea652f083 refactor(linter): add vue and regex to BuiltinLintPlugins (#12542) 2025-07-27 12:15:58 +00:00
overlookmotel 5c33fc7065 refactor(diagnostics): implement Eq and Ord for InfoPosition (#12505)
Implement these traits to shorten code elsewhere.
2025-07-24 17:39:47 +00:00
overlookmotel d31adcf570 test(linter): improve sorting diagnostics (#12504)
Improve (I think) ordering of diagnostic in test snapshots.

1. Sort by filename first, then position. I think this was probably the original intention.
2. Include start column and end line+column in sort, for more deterministic order.
3. Use `sort_by_cached_key`. `Info::new` creates up to 3 `String` allocations, so preferable to cache the result of the closure, to avoid making those allocations repeatedly. `sort_by_key` will likely call the closure many times for each element.

If I've understood right, this reporter is only used in tests, so this PR makes no difference to users.
2025-07-24 17:39:47 +00:00
camc314 7a0da04b12 refactor(diagnostics): remove Option wrapper from MPSC channel and sender field (#12467) 2025-07-23 10:18:40 +00:00
oxc-bot 0b17927c46 release(oxlint): v1.8.0 (#12452)
## [1.8.0] - 2025-07-22

### 🚀 Features

- 6d2b549 napi/oxlint: Pass AST in buffer to JS (#12350) (overlookmotel)
- 14f0159 linter/exhaustive-deps: Add auto-fixer (#12354) (Don Isaac)

### 🐛 Bug Fixes

- 99e105f linter: Correct autofix in `unicorn/prefer-number-properties`
for Infinity (#12445) (yefan)
- 0b539e3 linter: `unicorn/catch-error-name` wasn't using the ignore
property (#12446) (Parbez)
- 05fba9b linter: Don't panic on `TSNonNullExpression` in
`unicorn/prefer-array-find` (#12400) (Sysix)
- 46e33d5 linter: Improve error handling in config file lookup (#12391)
(camc314)
- 4621872 linter: Parse second script block for `svelte` files (#12390)
(Sysix)
- fbe7eb4 linter/filename-case: Fix default config when no config is
provided (#12389) (camc314)
- fea9df4 linter: Report errors with the correct severity for custom
plugins (#12362) (camc314)
- 652c038 linter: Mark correctly enabled default rules for `--rules`
(#12163) (Sysix)
- eadc359 linter: Correct source text for vue files having script
attributes containig ">" char inside (#12375) (Sysix)
- 54d143a linter/exhaustive-deps: More descriptive messages for
always-rerender violations (#12336) (Don Isaac)
- dac4db9 linter/exhaustive-deps: Better diagnostics for missing
dependencies (#12337) (Don Isaac)
- 119d23a linter/prefer-array-flat-map: Error for `.flat(1.0)` (#12360)
(overlookmotel)

### 🚜 Refactor

- 2d9291c linter/prefer-number-properties: Simplify fixer logic (#12451)
(camc314)
- c5dff1e linter, napi/parser: Add `source_len` field to
`RawTransferMetadata` (#12383) (overlookmotel)
- 5e3b415 linter: Duplicate `RawTransferMetadata` in `oxc_linter` crate
(#12382) (overlookmotel)
- 773fd88 linter: Pass `&Allocator` into `Linter::run_external_rules`
(#12374) (overlookmotel)
- b10ed11 linter: Make unwrap unconditional (#12371) (overlookmotel)
- a0631d4 linter: Move running external rules into feature-gated
function (#12370) (overlookmotel)
- 4fc4e7c linter: Make feature gates for `oxlint2` feature consistent
(#12369) (overlookmotel)
- 50b1786 linter: Clarify usage of `Allocator` and `AllocatorGuard`
(#12332) (overlookmotel)
- 26d3a39 linter: Remove `ModuleContentOwner` abstraction (#12331)
(overlookmotel)

### 📚 Documentation

- 3c21d94 linter: Correct comment on `RawTransferMetadata2` type
(#12428) (overlookmotel)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
2025-07-22 12:18:24 +01:00
camc314 46e33d5202 fix(linter): improve error handling in config file lookup (#12391) 2025-07-18 14:31:07 +00:00
oxc-bot b144048cc1 release(oxlint): v1.7.0 (#12326)
## [1.7.0] - 2025-07-16

### 🚀 Features

- 5e428a4 linter/eslint-plugin-next: No-html-link-for-pages rule
addition (#12194) (Gabriel Díaz Aguilera)
- 9b14fbc ast: Add `ThisExpression` to `TSTypeName` (#12156) (Boshen)
- c551b8f linter: Report diagnostics from custom plugins (#12219)
(camc314)
- d387729 linter: JS custom rules config (#12160) (camc314)
- 152e59d napi/oxlint: Read source text into start of allocator (#12122)
(overlookmotel)
- bde1ef1 linter: Load custom JS plugins (#11980) (camc314)
- d4ebd14 linter: Add `oxlint2`/`disable_oxlint2` feature flags (#12130)
(camc314)
- a4dae73 linter: Introduce `LintPlugins` to store builtin + custom
plugins (#12117) (camc314)

### 🐛 Bug Fixes

- 3f9a1f0 linter/no-unused-private-class-members: Fix false positive
with nullish coalescing assignments (#12317) (camc314)
- 47fad0e linter/no-empty-file: False positive with empty file with
triple slash directive (#12293) (camc314)
- 633ba30 linter: False positive with unknown plugins when unmatched
eslint rule (#12285) (camc314)
- 9720774 linter: Report implicit config parse errors (#12260) (Simon
Buchan)
- 1920c6b language_server: Respect the root `.oxlintrc.json` file for
`ignorePatterns` (#12171) (Sysix)
- 98708eb linter: Fix inconsistent behavior in `no-duplicate-imports`
rule (#12192) (yefan)
- 853d2bc linter, language_server: Correctly identify usage of `import`
plugin (#12157) (overlookmotel)

### 🚜 Refactor

- ee761de ast: Remove `AstKind` for `AssignmentTarget` (#12252) (Tyler
Earls)
- c68b607 ast: Rename `TemplateLiteral::quasi` to
`TemplateLiteral::single_quasi` (#12266) (Dunqing)
- 32c32af ast: Check whether there is a single `quasi` in
`TemplateLiteral::quasi` (#12265) (Dunqing)
- 8f6a1da linter/js-plugins: Use `u32` for IDs (#12243) (overlookmotel)
- 36cd364 linter/js-plugins: Clean up code (#12242) (overlookmotel)
- 8c02ebd linter/js-plugins: Rename `specifiers` to `paths` (#12241)
(overlookmotel)
- 3adaf98 linter: Simplify getting nodes count (#12239) (overlookmotel)
- 6e54645 language_server: Store `LintService` instead of `Linter`
(#12016) (Sysix)
- 113cf8c linter: Move `LintServiceOptions.paths` to
`LintService.with_paths` (#12015) (Sysix)
- acfac68 oxlint: Adjust ignore patterns by counting bytes instead of
chars (#12209) (Sysix)
- 729b82b linter: Rename `plugin_name` to `plugin_specifier` (#12148)
(overlookmotel)
- 532b816 linter: Use `to_string` instead of `into` (#12147)
(overlookmotel)
- 89f2a69 linter: TODO comment (#12146) (overlookmotel)
- f90d3e1 linter: Feature gate `load_external_plugin` by both `oxlint2`
and `disable_oxlint2` features (#12141) (overlookmotel)
- 12e4ec7 linter: Make `tokio` dependency optional (#12140)
(overlookmotel)
- 1d2eaca oxlint2: Introduce `force_test_reporter` feature for
consistent graphical outputs (#12133) (camc314)
- 8814c53 ast: Remove `AstKind` for `PropertyKey` (#12108) (camchenry)
- 228cff5 semantic,linter: Assert that Program is always the first node
(#12123) (Ulrich Stark)
- e8e2a25 ast: Remove `AstKind` for `AssignmentTargetPattern` (#12105)
(camchenry)
- f7c675d linter: Rename `LintPlugins` to `BuiltinLintPlugins` (#12116)
(camc314)
- a9e5ec0 linter: Access plugins through config instead of storing
directly (#12115) (camc314)
- 9736a7f linter: Simplify `unicorn/require-post-message-target-origin`
(#12110) (shulaoda)

### 📚 Documentation

- 2e3db46 linter: Add missing backtick preventing website from building
(#12113) (camc314)

### ⚡ Performance

- d0f8b88 linter/js-plugins: Do not copy `Vec` (#12248) (overlookmotel)
- 4284d19 linter/js-plugins: Use hashmap `Entry` API + remove temp `Vec`
(#12247) (overlookmotel)
- c7889c3 semantic,linter: Simplify implementation and uses of ancestors
iterators (#12164) (Ulrich Stark)
- f99959c linter: Move work out of loop (#12145) (overlookmotel)
- 514d40c linter: Do not create `Resolver` unless required (#12142)
(overlookmotel)
- 7103527 linter/no-constructor-return: Optimize loop (#12138)
(overlookmotel)

### 🧪 Testing

- d1194e8 oxlint: Ignore test on windows (#12262) (camc314)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
2025-07-17 00:01:25 +01:00
Gabriel Díaz Aguilera 5e428a4579 feat(linter/eslint-plugin-next): no-html-link-for-pages rule addition (#12194)
Hello, i've succesfully added the rule next/no-html-link-for-pages rule
addition to the oxc linter. It has now full nextjs linter support.

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-15 14:31:11 +01:00
camc314 d1194e8bcf test(oxlint): ignore test on windows (#12262) 2025-07-14 13:03:01 +00:00
Simon Buchan 97207749e9 fix(linter): Report implicit config parse errors (#12260)
Fixes #12258 

Not super sure about the config path normalization, but it Works On My
Machine™️! Only other example of `<cwd>` in linter snapshots is the
`tsconfig` error, which explicitly formats the error at that location.

Might be nicer to regex the snapshot for any paths to handle Windows,
the current cwd detection in there seems a bit hacky anyway.

---------

Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2025-07-14 09:57:20 +01:00
camc314 c551b8fa5c feat(linter): report diagnostics from custom plugins (#12219) 2025-07-12 17:55:03 +00:00
camc314 d387729193 feat(linter): JS custom rules config (#12160) 2025-07-12 17:36:04 +00:00