Skip to content

Fix file formatting with Prettier#9

Merged
chris-c-thomas merged 1 commit intomainfrom
fix/formatting
Mar 3, 2026
Merged

Fix file formatting with Prettier#9
chris-c-thomas merged 1 commit intomainfrom
fix/formatting

Conversation

@chris-c-thomas
Copy link
Copy Markdown
Owner

@chris-c-thomas chris-c-thomas commented Mar 3, 2026

This pull request primarily refactors code formatting across several files, improving readability and consistency by splitting long lines and formatting complex expressions. No functional changes or new features are introduced; all modifications are focused on code style and maintainability.

Code formatting and readability improvements:

  • Reformatted long function signatures, object initializations, and conditional expressions to use multi-line formatting for better readability in packages/core/src/ast/builder.ts, packages/core/src/ast/builder.test.ts, and packages/core/src/ast/types.ts. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]
  • Updated test files and CLI commands to use consistent formatting for options, arguments, and object literals in packages/cli/src/commands/convert.ts, packages/cli/src/commands/download.ts, packages/cli/src/ui.ts, and related test files. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Consolidated and simplified export statements for improved clarity in packages/core/src/index.ts. [1] [2]

Summary by CodeRabbit

  • Refactor

    • Consolidated and reformatted code across multiple packages for improved readability and consistency.
    • Streamlined multi-line declarations and expressions into more concise formats throughout the codebase.
    • Enhanced internal tracking with explicit metadata fields for improved stability.
  • Bug Fixes

    • Fixed chapter metadata handling to ensure identifier information is properly propagated during conversion.

@chris-c-thomas chris-c-thomas requested a review from Copilot March 3, 2026 20:50
@chris-c-thomas chris-c-thomas self-assigned this Mar 3, 2026
@chris-c-thomas chris-c-thomas added the enhancement Enhancements made to exisiting features or codebase label Mar 3, 2026
@chris-c-thomas chris-c-thomas merged commit 2f1affc into main Mar 3, 2026
2 of 4 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between a9ed346 and 25e1db3.

📒 Files selected for processing (16)
  • packages/cli/src/commands/convert.ts
  • packages/cli/src/commands/download.ts
  • packages/cli/src/ui.ts
  • packages/core/src/ast/builder.test.ts
  • packages/core/src/ast/builder.ts
  • packages/core/src/ast/types.test.ts
  • packages/core/src/ast/types.ts
  • packages/core/src/index.ts
  • packages/core/src/markdown/frontmatter.test.ts
  • packages/core/src/markdown/links.test.ts
  • packages/core/src/markdown/renderer.test.ts
  • packages/core/src/markdown/renderer.ts
  • packages/usc/src/converter.test.ts
  • packages/usc/src/converter.ts
  • packages/usc/src/downloader.ts
  • packages/usc/src/index.ts

📝 Walkthrough

Walkthrough

A comprehensive formatting and code style refactoring across cli, core, and usc packages standardizing multi-line constructs and whitespace for consistency. Includes one functional enhancement: explicit chapter identifier tracking in converter's dry-run metadata collection path.

Changes

Cohort / File(s) Summary
CLI Command Formatting
packages/cli/src/commands/convert.ts, packages/cli/src/commands/download.ts, packages/cli/src/ui.ts
Formatting adjustments to function signatures, option declarations, and error handling—collapsing multi-line expressions to single-line or vice versa. No behavioral changes.
Core AST Builder & Types
packages/core/src/ast/builder.ts, packages/core/src/ast/builder.test.ts, packages/core/src/ast/types.ts, packages/core/src/ast/types.test.ts
Introduced explicit elementName and textBuffer fields in StackFrame for metadata tracking. Expanded object literals and type unions to multi-line formats for readability. Test data and assertions reformatted. Functional behavior unchanged.
Core Markdown Components
packages/core/src/markdown/frontmatter.test.ts, packages/core/src/markdown/links.test.ts, packages/core/src/markdown/renderer.ts, packages/core/src/markdown/renderer.test.ts
Quote style normalization and test data restructuring. Function signature and set literal formatting adjustments. Control flow and rendering logic unaffected.
Core Exports
packages/core/src/index.ts
Export statement reformatted from multi-line to single-line; exported identifiers unchanged.
USC Converter
packages/usc/src/converter.ts, packages/usc/src/converter.test.ts
Formatting and line-break adjustments across helper functions. Functional enhancement: dry-run path now explicitly propagates chapter identifier in chapterAncestor object. Array operation refactored to single-line expression in tests.
USC Downloader & Exports
packages/usc/src/downloader.ts, packages/usc/src/index.ts
Function signature and export statement reformatting from single-line to multi-line for clarity. No runtime or type changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies Prettier-driven formatting updates across the monorepo to improve readability and consistency, without changing behavior in the core AST/markdown pipeline, USC conversion/downloading logic, or CLI commands.

Changes:

  • Reformats long type unions, function signatures, and complex conditionals/chains for readability in @law2md/core and @law2md/usc.
  • Normalizes formatting in CLI command definitions and UI helper functions.
  • Simplifies a few multi-line exports/object literals into more compact forms where they fit within the configured print width.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/usc/src/index.ts Reformats type re-exports into a multi-line export block.
packages/usc/src/downloader.ts Splits a long helper function signature across multiple lines.
packages/usc/src/converter.ts Reflows ternaries, object types, chained string ops, and predicates for readability.
packages/usc/src/converter.test.ts Compacts a filter+map chain into a single line.
packages/core/src/markdown/renderer.ts Splits renderSection signature; compacts a small Set initialization.
packages/core/src/markdown/renderer.test.ts Reflows test AST literals (including quote minimization in a string).
packages/core/src/markdown/links.test.ts Compacts register and expect(...).toBe(...) calls to single lines.
packages/core/src/markdown/frontmatter.test.ts Normalizes string quoting consistent with Prettier configuration.
packages/core/src/index.ts Compacts AST constant exports; removes trailing blank line.
packages/core/src/ast/types.ts Reformats a long string-literal union type across multiple lines.
packages/core/src/ast/types.test.ts Reflows inline object literals into multi-line objects.
packages/core/src/ast/builder.ts Reflows unions/conditionals/object literals to match Prettier formatting.
packages/core/src/ast/builder.test.ts Splits helper signature and reflows complex expressions/calls.
packages/cli/src/ui.ts Compacts a function signature onto one line within print width.
packages/cli/src/commands/download.ts Compacts simple ternaries into single-line expressions.
packages/cli/src/commands/convert.ts Splits a helper signature; compacts a .option(...) and console.error(...) call.

@chris-c-thomas chris-c-thomas deleted the fix/formatting branch March 3, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancements made to exisiting features or codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants