Skip to content

Oxfmt - #438

Closed
sjvans wants to merge 9 commits into
developfrom
oxfmt
Closed

Oxfmt#438
sjvans wants to merge 9 commits into
developfrom
oxfmt

Conversation

@sjvans

@sjvans sjvans commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Integrate oxfmt Formatter for Code Style Consistency

Chore

🔧 Adds oxfmt (OXC-based formatter) as the project's code formatter, along with configuration and related tooling setup. Minor code style reformatting has been applied across existing files.

Changes

  • .oxfmtrc.jsonc: New formatter configuration file defining code style rules (single quotes, no semicolons, 120 print width, no trailing commas, etc.).
  • package.json: Added fmt and fmt:check scripts using oxfmt, added lint-staged integration to auto-format on commit, and added oxfmt and lint-staged as dev dependencies. Also reordered fields (homepage, license, author, peerDependencies) to match formatter output, and moved main field to its canonical position.
  • jest.config.js: Reformatted a multi-property object literal to span multiple lines per the new style rules.
  • lib/exporter/ConsoleMetricExporter.js: Reformatted a long LOG.info(...) call to wrap across multiple lines within the 120-character print width.
  • .gitignore: Added .claude/ to ignored paths.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.26.5

  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt
  • Correlation ID: 9c9108ba-9281-4f2d-86e1-bfbfcbeeda47
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is exploratory ("playing around with oxfmt") but has a concrete formatting regression in jest.config.js where the newly reformatted object literal has its key at column 0, suggesting the formatter output was applied incorrectly or the tool has a bug at that indentation level. The missing newline at EOF in the formatter's own config file is also worth addressing.

PR Bot Information

Version: 1.26.5

  • Event Trigger: pull_request.opened
  • Correlation ID: 9c9108ba-9281-4f2d-86e1-bfbfcbeeda47
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet

Comment thread jest.config.js
Comment on lines +11 to +13
process.env.cds_requires_telemetry_tracing = JSON.stringify({
_hana_prom: process.env.HANA_PROM === 'true'
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting: The object key _hana_prom is not indented - it's at column 0 instead of being indented inside the object literal, which is inconsistent and hard to read.

Suggested change
process.env.cds_requires_telemetry_tracing = JSON.stringify({
_hana_prom: process.env.HANA_PROM === 'true'
})
process.env.cds_requires_telemetry_tracing = JSON.stringify({
_hana_prom: process.env.HANA_PROM === 'true',
})

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Comment thread package.json Outdated
"oxfmt": "^0.56.0"
},
"peerDependencies": {
"@sap/cds": "^8 || ^9"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: peerDependencies was moved to after devDependencies, which is unconventional, but more critically it was temporarily removed and re-added — verify the final file still contains @sap/cds as a peer dependency (it does at lines 57-59), but this reordering should be intentional.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Comment thread .oxfmtrc.jsonc Outdated
"ignorePatterns": [
"*.md"
]
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best Practice: File is missing a trailing newline (\ No newline at end of file) - most linters and editors expect a newline at end of file, and it's inconsistent with the formatter's own intent.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

@sjvans

sjvans commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #473, which adopts prettier properly (config matching house style, format/format:check scripts, CI check, repo-wide reformat as a reviewable commit). This spike explored oxfmt but never landed.

@sjvans

sjvans commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Correction: superseded by #476 (adopts oxfmt properly — config from this spike, format/format:check scripts, CI check, no git hook, repo-wide reformat as a reviewable commit).

sjvans added a commit that referenced this pull request Aug 10, 2026
Supersedes the #438 oxfmt spike — adopts **oxfmt** (`0.63.0`, pinned)
properly.

## Config (`.oxfmtrc.jsonc`)
Based on the #438 spike, verified against the `lib/*.js` house style:
`singleQuote`, `semi: false`, `printWidth: 120`, `tabWidth: 2`,
`trailingComma: none`, `arrowParens: avoid`. `ignorePatterns` excludes
`*.md`, `node_modules`, `package-lock.json`, `CHANGELOG.md`, and
`jest.config.js` (see coordination).

## Scripts
- `format` → `npx oxfmt` (write is oxfmt's default)
- `format:check` → `npx oxfmt --check`

No git hook / husky / lint-staged — CI `format:check` + scripts only
(the intrusive hook from the #438 spike is intentionally not carried
over).

## Commits (reviewable split)
1. `chore: add oxfmt formatter tooling` — config + scripts + devDep +
lockfile + CI step
2. `chore: apply oxfmt formatting` — repo-wide reformat (11 files,
line-wrapping only; verified non-semantic via `git diff -w`)

## eslint coexistence
`@sap/cds/eslint.config.mjs` is `recommended` +
`no-unused-vars`/`no-console` only (no stylistic rules) → no conflict.
`npm run lint` stays green.

## CI
One line added to the `lint` job in `ci.yml`: `npm run format:check`.

## Verified
`npm run format:check` ✅ (56 files) · `npm run lint` (--max-warnings=0)
✅ · `npm run test` → 53 pass / 14 skip, exit 0 · lockfile resolved from
public npm (0 internal-registry URLs).

## Coordination
Parallel PR #474 (jest→vitest) deletes `jest.config.js` — this PR
excludes it from formatting (0-line diff confirmed) so no collision.
`package.json` change here is additive (scripts + devDep); lockfile will
conflict with #474 — whichever merges second rebases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant