Skip to content

fix(fmt): align singleBodyPosition schema values#34304

Merged
bartlomieju merged 2 commits into
denoland:mainfrom
msnandhis:fix-fmt-single-body-schema
Jun 8, 2026
Merged

fix(fmt): align singleBodyPosition schema values#34304
bartlomieju merged 2 commits into
denoland:mainfrom
msnandhis:fix-fmt-single-body-schema

Conversation

@msnandhis

Copy link
Copy Markdown
Contributor

Fixes #34289

Summary

  • remove the unsupported sameLineUnlessHanging value from the fmt.singleBodyPosition JSON schema enum
  • change the schema default to sameLine, which is accepted by the config parser

Tests

  • jq empty cli/schemas/config-file.v1.json
  • deno fmt --check cli/schemas/config-file.v1.json
  • jq -e '.properties.fmt.properties.singleBodyPosition.default == "sameLine" and ((.properties.fmt.properties.singleBodyPosition.enum | index("sameLineUnlessHanging")) == null)' cli/schemas/config-file.v1.json\n- cargo test -p deno_config deno_json::tests::test_parse_config\n\n## AI assistance\nThis PR was prepared with assistance from OpenAI Codex.

@deno-cla-assistant

deno-cla-assistant Bot commented May 22, 2026

Copy link
Copy Markdown

Deno Individual Contributor License Agreement

All contributors have signed the CLA. Thank you!

Re-run CLA check


This is an automated message from CLA Assistant

@fibibot fibibot 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 schema fix matches the formatter config surface: singleBodyPosition is accepted in repo tests with maintain, sameLine, and nextLine, and sameLineUnlessHanging now only remains under bracePosition. No code issue found; holding approval until the CLA is signed and CI runs.

@lunadogbot lunadogbot 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.

No code issue found. singleBodyPosition now matches SingleBodyPosition::{Maintain, SameLine, NextLine}, and sameLineUnlessHanging remains available only under bracePosition where the Rust config enum supports it. Holding approval until the CLA check is green.

@CLAassistant

CLAassistant commented May 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@fibibot fibibot 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 schema still matches the Rust config enum: singleBodyPosition now accepts only maintain, sameLine, and nextLine, while sameLineUnlessHanging remains under bracePosition. CLA is green now; holding approval until build/test CI runs on this head.

@lunadogbot lunadogbot 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.

CLA is green now. The schema still matches SingleBodyPosition::{Maintain, SameLine, NextLine} and leaves sameLineUnlessHanging only under bracePosition; holding approval until build/test CI runs on this head.

@fibibot fibibot 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.

CI is green now, promoting prior review to APPROVE.

@fibibot

fibibot commented May 29, 2026

Copy link
Copy Markdown
Contributor

@bartlomieju this is ready to merge

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch on the schema bug. The enum fix is correct — I verified sameLineUnlessHanging is genuinely invalid here: deno_config's SingleBodyPosition enum has only maintain/sameLine/nextLine (and it's deny_unknown_fields), and the underlying dprint type SameOrNextLinePosition has the same three. sameLineUnlessHanging belongs to bracePosition, not this field.

One thing to fix before this lands (inline): the new default value isn't right either. See the comment on the default line.

For reference, the schema default is advisory (editor hints/autocomplete), so this isn't a functional formatting bug — but since the PR is specifically about aligning the schema with what the parser accepts, getting the default accurate matters. Everything else (title, linked issue, CLA, AI disclosure, scope) looks good.

Comment thread cli/schemas/config-file.v1.json Outdated
@bartlomieju
bartlomieju merged commit bf1196e into denoland:main Jun 8, 2026
136 checks passed
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.

[fmt] unsupported fmt.singleBodyPosition variant 'sameLineUnlessHanging' in config schema

5 participants