Skip to content

Conversation

@onairmarc
Copy link
Member

This pull request introduces a comprehensive, user-configurable system for code formatting and sorting in the project. It adds support for a TypeScript-based configuration file (core.config.ts), enables deep customization of Prettier, package.json, tsconfig.json, and code sorting behaviors, and refactors the CLI and config loading logic to support these features. The changes establish a robust foundation for flexible formatting and sorting workflows.

Key changes:

Configuration System

  • Introduced a new configuration system with a sample config file (core.config.example.ts) allowing users to customize formatting and sorting behaviors (Prettier, package.json, tsconfig.json, class members, React components, and file declarations) via a TypeScript config file.
  • Added comprehensive configuration type definitions and a default configuration in src/config/types.ts, supporting deep merging of user and default configs.

Configuration Loading and Utilities

  • Implemented logic to load and transpile the user’s core.config.ts (TypeScript) file at runtime, falling back to defaults if not present or invalid, in src/config/loader.ts.
  • Provided a single config entry point in src/config/index.ts to expose types, config loading, and utility functions.

CLI Refactor

  • Rewrote the CLI (src/cli.ts) to support the new configuration system, including command-line argument parsing, dry-run support, and stepwise invocation of formatting and sorting based on the config. It also adds logic to detect existing Prettier configs and skip formatting if configured to do so.

Build and Format Scripts

  • Updated package.json scripts to separate building and formatting steps, and added a combined script for both.

Type Exports

  • Exported the SortClassMembersConfig type from src/sortClassMembers for external use.

@onairmarc onairmarc merged commit 637067f into main Jan 3, 2026
4 checks passed
@onairmarc onairmarc deleted the config branch January 3, 2026 00:46
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.

2 participants