← All Project Ideas

Code Formatter with Rules

advanced

A code formatter with configurable style rules, language-aware formatting, and diff preview. Supports indentation, line length, spacing rules, and import sorting with safe formatting that preserves...

Target user

Development teams who need consistent code formatting

Problem

Teams waste time on code style debates and manual formatting without a configurable formatter that enforces consistent style while preserving code semantics.

Requirements

  • Format code with configurable style rules
  • Support multiple programming languages
  • Preview changes as diff before applying
  • Sort and organize imports automatically
  • Preserve code semantics during formatting

Core technologies

TypeScript, AST, Prettier

Completion criteria

Teams can format code with custom rules, preview diffs, sort imports, and ensure semantic preservation.

Optional extensions

  • Add editor integration
  • Implement format-on-save
  • Add custom rule plugins
  • Support incremental formatting

Project phases

Phase 1: Phase 1: Formatting Engine

Tasks: Set up TypeScript project, Integrate AST-based formatter, Implement indentation and spacing rules, Add line length wrapping

Phase 2: Phase 2: Configuration and Imports

Tasks: Build configuration file parser, Implement import sorting, Add diff preview output, Create rule priority system

Phase 3: Phase 3: CLI and Integration

Tasks: Build CLI interface, Add file and directory processing, Implement format check mode, Create editor integration docs