Code Quality Tools
This page documents the tools and practices used to maintain a consistent and high-quality codebase for the project. It covers the package manager, bundler, linting, code formatting, and developer best practices.
Linting
Section titled “Linting”Linting is enforced across both the frontend and backend to maintain code consistency and catch common issues early.
- Tool Used: ESLint
- Configuration: Separate ESLint config files are used for the frontend and backend to accommodate context-specific rules and frameworks.
- Enforcement:
- Runs locally with
npm run lint - Auto-fix with
npm run lint:fix
- Runs locally with
Running the Linter
Section titled “Running the Linter”To run the linter on the frontend, use:
npm run lintCode Formatting
Section titled “Code Formatting”Prettier is used to maintain consistent code style across the project.
- Tool: Prettier
- Purpose: Automatically format code according to style rules.
- Common Usage: involves checking formatting and applying formatting to your codebase.
- Enforcement:
npm run formatformats all the filesnpm run check-formatensure formatting compliance
# Check formattingnpx prettier --check .# Automatically format all files
npx prettier --write .Package Manager
Section titled “Package Manager”- Tool: npm
- Purpose: Manage dependencies, scripts, and project packages.
- Common Usage: installing dependencies, running scripts, adding/removing packages, and managing versions
# Install project dependenciesnpm install# Run defined scripts (e.g., lint, test, start)npm run <script>Bundler
Section titled “Bundler”A bundler compiles, optimizes, and packages frontend code (JavaScript, CSS, assets) for the browser.
- Tool: Vite
- Purpose: Fast, modern frontend bundler for React and other frameworks.
npm run dev # Start development servernpm run build # Build production filesnpm run preview # Preview production buildTip: Always build your project before deploying to ensure all assets are bundled and optimized.
Developer Guidelines
Section titled “Developer Guidelines”- Run linting (npm run lint) and formatting (npx prettier —write .) before committing code -Resolve all linting errors before merging to main branches. -Follow ESLint and Prettier rules to ensure consistent and readable code. -Use npm scripts and bundler commands for development and production builds.