Commit Graph

17 Commits

Author SHA1 Message Date
leaysgur 0f4af5d7df test(formatter_tests): assert fingerprint survives formatting (#26322)
Historically, only JS formatter has had the `detect_code_removal` feature, which uses CI to check for missing nodes or comments.

While this would be useful in other languages (especially CSS), but setting up the mechanism is difficult. For now, just start with something simple that just guarantees the number of comments.

That said, even with a mechanism in place, it can't detect anything unless the cases are fully covered by fixtures, so this only tells us that the current state is problem-free.
2026-09-04 07:14:53 +00:00
leaysgur 3b054de895 fix(formatter_graphql): align comment printing after open { (#26271)
Aligned the handling of line comments immediately following an opening `{`.

(For GraphQL only,) previously kept their own line, now matches other languages by inserting a line break and treating them as leading comments for the next element.

This brings it in line with Prettier's style. The only drawback is that the behavior of `-line` style comments. However, since most of these can be replaced with `-next-line` style comments, we are going to standardize on this consistent behavior for now.

prettier/prettier#1267 (won't fix)
2026-09-03 08:17:35 +00:00
leaysgur 69b9a0ed81 test(formatter_graphql, formatter_yaml): consolidate fixtures and fix crlf coverage gap (#26123)
GQL: Consolidate redundant fixtures
YAML: Just add notes
2026-08-27 05:33:59 +00:00
leaysgur 181953b92d docs(oxfmt,formatter_core,formatter,formatter_yaml,formatter_css,formatter_graphql): extract DIVERGENCES.md out from AGENTS.md (#26121)
- Extract "known divergences" section from `AGENTS.md` to explicit `DIVERGENCES.md` with code example
- Update all anchors
- Add missing pinned fixtures
2026-08-27 05:33:58 +00:00
leaysgur b297fb1cb8 refactor(formatter,formatter_tests): fix up (#25478)
Cleaning up after the series of migrations.

- Docs clean up
- More strict `jsdoc` option handling in fixture tests
2026-08-12 00:48:33 +00:00
leaysgur e4437275de refactor(formatter_css,formatter_json,formatter_graphql,formatter_tests): move out prettier CSS,JSON,GraphQL conformance from tasks/ (#25472)
Migration from tasks/prettier_conformance to each crate test using oxc_formatter_tests, for CSS, JSON, and GraphQL.
2026-08-12 00:48:32 +00:00
leaysgur 6e1b4ddceb refactor(formatter_core,formatter_tests): extract oxc_formatter_tests crate from oxc_formatter_core (#25465)
- Extract `test_harness` feature as crate `oxc_formatter_tests`
- This crate will also provide infra for `tasks/prettier_conformance` later
2026-08-12 00:40:59 +00:00
leaysgur 96a9744198 refactor(formatter_core): export apply_core_options for tests (#25139)
The same as #25138, for fixture tests.
2026-07-31 08:11:23 +00:00
leaysgur dbf85def42 refactor(formatter_graphql): rework comment printing (#24970)
Also fixes #24927

- rework comment printing to follow the rules and align with other formatters
- bump `oxc-graphql-parser`
  - to track comments inside a node's span more accurately
2026-07-27 05:31:01 +00:00
leaysgur 5f76998fe7 fix(formatter_graphql): keep same line comments pending across intervening tokens (#24579)
Ensure consistent behavior across all formatters.

Line comments at the EOL are not included in the calculation of `print-width`.
2026-07-16 01:37:30 +00:00
leaysgur 0ccd8a14b7 feat(formatter_graphql): update oxc-graphql-parser 0.0.5 (#24106)
Part of #23923

Supports more syntax like:

- Fragment arguments
- Extends directives
2026-07-03 10:11:20 +00:00
leaysgur e1ece97823 fix(formatter_graphql): break implements list by print-width (#23997)
Part of #23923

Now `implements` long list are broken on print-width.

```gql
type LongNoDirective implements Node &
  RequirableByPullRequest &
  UniformResourceLocatable &
  ExtraLongInterface {
  id: ID!
}
```
2026-07-03 07:22:01 +00:00
leaysgur 2dc451ca8b chore(formatter_graphql): use oxc-graphql-parser (#23919) 2026-06-29 04:15:34 +00:00
leaysgur cc8db2b11c refactor(formatter_graphql): fix up code and comments (#23488)
Finally fixed up Fable's work.
2026-06-29 03:15:27 +00:00
leaysgur 3f355e5c22 fix(formatter_graphql): improve major prettier diffs (#23419)
Fixed some minor formatting diffs by checking real world repo.
2026-06-29 03:15:26 +00:00
leaysgur 259e0cdf60 feat(oxfmt,formatter_graphql)!: support draft syntax with removing prettier fallback (#23326)
- Fork `apollo-rs` to be compatible with Prettier(`latest` for now)
  - https://github.com/leaysgur/apollo-rs
- By doing this, Prettier fallback is no longer needed
- And now all prettier_conformance are passed, no parse error skip

> [!WARNING]
> TODO: Move fork under `oxc-project` org and replace refs
2026-06-29 03:15:25 +00:00
leaysgur 4e66212c28 feat(formatter_graphql): implement oxc_formatter_graphql (#23317)
- Implement `oxc_formatter_graphql` crate
- Use `apollo-parser` crate from `apollo-rs`
  - https://github.com/apollographql/apollo-rs
  - Which follows Oct2021 spec
- Prettier uses `graphql-js` and implements more and more syntax
  - v16 for `latest = 3.8.4` and v17 for `main = 3.9.x`

NOTE: So at the point of this PR, diffs can be seen as skipped in prettier_conformance.
Will be addressed in later PR by forking `apollo-parser`.
2026-06-29 02:38:28 +00:00