Commit Graph

9 Commits

Author SHA1 Message Date
leaysgur 5ff57f83c0 fix(formatter/sort-imports): handle custom side effect groups (#26217)
Fixes #26165

- `side_effect` is predefined selector, it cannot be used as custom group name
- respect custom group which uses `side_effect` as side-effect-import correctly
- fix metadata detection bug
2026-09-01 03:56:36 +00:00
Boshen baf022d74d refactor(ast)!: remove old AstBuilder methods (#24563)
Closes the migration tracked in #23043.

The new builder API (methods on the AST types themselves) has been in place for a while, all Oxc crates are migrated, and every crate which uses `AstBuilder` already enables `disable_old_builder` in its tests. The module docs said "after a few weeks, we will remove `AstBuilder`'s own methods entirely" — this does that.

## What's removed

- `crates/oxc_ast/src/generated/ast_builder.rs` and `builder/methods.rs` — `AstBuilder`'s own node and primitive constructors.
- `AstBuilderGenerator`, which produced the former.
- The `disable_old_builder` Cargo feature, plus the dev-dependency hacks it required across 33 manifests. Eight crates depended on `oxc_ast` *purely* to turn the feature on; those deps and their `cargo-shear` ignore entries are gone too.

## One thing worth reviewing

`AstBuilderGenerator` owned the `#[builder(default)]` / `#[builder(skip)]` attr registration that `BuilderMethodsGenerator` only *reads* — its doc comment said as much. Deleting it naively would have silently dropped `skip`/`default` handling for the 12 AST types using those attrs, so `attrs()` and `parse_attr()` move to `BuilderMethodsGenerator`.

The evidence this was faithful: after regenerating, `builder_methods.rs` and every other generated file are **byte-identical**. The only generated change in the diff is the deletion.

## Breaking changes

- `AstBuilder`'s own methods are gone. Use the AST type methods: `Statement::new_expression_statement(span, expr, &builder)` instead of `builder.statement_expression(span, expr)`.
- `AstBuilder` is no longer `Copy`/`Clone`, and its `allocator` field is private — use the `allocator` method from `GetAllocator`.
- `AstBuilder` and `NONE` are no longer re-exported from the crate root; import them from `oxc_ast::builder`. (The `disable_old_builder` feature already gated these off, so nothing in-tree used the root path.)
- The `disable_old_builder` feature no longer exists — remove it from any manifest that sets it.

A migration note covering all of the above is in `crates/oxc_ast/src/builder/mod.rs`.

---

Implemented with AI assistance (Claude Code); design, review, and verification driven by the author per the repo AI-usage policy.
2026-07-21 15:22:46 +00:00
overlookmotel 85a6853e0b fix(tasks): enable disable_old_builder Cargo feature for oxc_ast crate for all tasks (#23885)
Part of #23043.

We don't enable `oxc_ast`'s `disable_old_builder` Cargo feature in any of our published crates, or crates that are depended on by published crates.

Tasks are private to the repo, so enable this feature on them, to ensure no usage of legacy `AstBuilder` methods sneak in during the transition period before we delete these methods.
2026-06-28 12:13:17 +00:00
leaysgur 1aea211424 refactor(oxfmt): Move Oxfmtrc to apps/oxfmt (#17824)
Before this PR, `Oxfmtrc` was defined in `oxc_formatter` to avoid the circular reference `oxc_language_server` > `oxfmt` > `oxc_language_server`....

But now, `oxc_language_server` does not depend on `Oxfmtrc` since LSP implementation has moved to `apps/oxfmt`.

Therefore, by this PR, `Oxfmtrc` is moved to its proper location, in `apps/oxfmt`.

- Moved `Oxfmtrc` from `oxc_formatter` to `apps/oxfmt`
- Re-exposed from `apps/oxfmt`
- Now only `tasks/website_formatter` depends on it
- Also aligned JSON schema generation with `oxlint` by `just formatter-schema-json`

NOTE: In `oxc_formatter`, there are 2 places (`ir_transform` and `fixtures` tests) where we manually convert options from JSON. I'd like to fix this too in the future.
2026-01-09 15:11:36 +00:00
leaysgur a3f3c580e1 feat(oxfmt): Support TOML(v1.0 only) files (#17113)
Fixes #16907, closes #17048

- Basically, the same approach with `prettier-plugin-toml`
  - https://github.com/ikatyang-collab/linguist-languages/blob/main/data/TOML.js
  - https://github.com/un-ts/prettier/blob/master/packages/toml/src/index.ts#L27-L31

I will add tests in next PR.
Also, I will add improvement to reduce cloning options.
2025-12-19 13:43:19 +00:00
leaysgur d7199882db fix(oxfmt): Make Rust CLI as just formatting CLI (#16768)
When adding new features primarily using JS via napi, to reduce future maintenance burdens such as missed implementations.
2025-12-12 05:44:06 +00:00
Boshen b86d3e3f6b feat(website): add schema-markdown command to website_formatter (#16345)
- Extract Renderer and schema rendering logic from website_linter to website_common
- Add schema-json and schema-markdown commands to website_formatter

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-03 05:18:22 +00:00
Yuji Sugiura 9317ebcf2f fix(tasks/website): Upload formatter cli.snap (#16141)
This fixes `main` CI failure.

And, make `cargo t` to generate snapshots.
2025-11-26 14:04:50 +08:00
Boshen 116e0d174b feat(website): auto generate oxfmt docs (#15985)
Corresponding PR: https://github.com/oxc-project/oxc-project.github.io/pull/643

The next PR will get the json schema auto generated as well.
2025-11-26 03:46:06 +00:00