Skip to content

Add prettier cli tool for formatting code #34

@mohamedhyouns

Description

@mohamedhyouns

Release notes

Add the Prettier CLI tool to ensure consistent code formatting across the project. This helps maintain code quality and reduces the need for manual formatting.

Problem to solve

As a developer, I want consistent code formatting so I can avoid style inconsistencies and improve code readability.

Intended users

  • Developers maintaining or contributing to the project.

Metrics

  • Number of formatting issues caught during pre-commit hooks.
  • Time saved by automating code formatting.
  • Reduction in manual code reviews related to formatting.

User experience goal

The user should be able to run formatting checks and fixes easily with Prettier, and have formatting automatically validated before commits.

Proposal

  1. Add Prettier CLI to the project for code formatting.
  2. Add formatting scripts in package.json:
    • format:check: Check for formatting issues.
    • format:fix: Automatically format the code.
  3. Integrate Prettier with Husky pre-commit hooks to enforce formatting.

Further details

Prettier Configuration:

  • .prettierrc: Contains Prettier configuration settings.
  • .prettierignore: Specifies files to exclude from formatting.

Pre-commit Hook:

  • Automatically runs npm run format:check to catch formatting issues before committing.

Desired outcomes

  • Consistent code style enforced across the codebase.
  • Reduced manual effort in code reviews related to formatting.

Acceptance criteria

  • Formatting issues are detected and corrected via Prettier.
  • Pre-commit hooks enforce formatting checks automatically.

Links / references

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions