diff --git a/community/understand-lint-checks.md b/community/understand-lint-checks.md index b9821457..cfff4e28 100644 --- a/community/understand-lint-checks.md +++ b/community/understand-lint-checks.md @@ -4,7 +4,8 @@ title: Understand Checks before PR sidebar_label: Understand Checks before PR sidebar_position: 3 --- -# ๐Ÿง  Python Backend Development Guide + +# ๐Ÿง  TypeScript + React Development Guide Welcome to recode hive! To maintain a high standard of code quality, we follow a strict development and pull request process. Before submitting your PR, please **follow the instructions below and attach a screenshot of the checks passed**. @@ -13,9 +14,8 @@ Before submitting your PR, please **follow the instructions below and attach a s ## ๐Ÿ“ฆ Prerequisites -- Python **3.8 or higher** -- `pip` (Python package installer) -- Git +- Node.js **18+** +- npm --- @@ -25,24 +25,19 @@ Before submitting your PR, please **follow the instructions below and attach a s We use the following tools to enforce code quality: -- `flake8`: Enforces PEP8 compliance -- `black`: Code formatting with 88-char line width -- `isort`: Automatically sorts imports -- `mypy`: Static type checking with strict rules -- `bandit`: Security vulnerability scanning -- `safety`: Checks for insecure packages -- `pre-commit`: Git hook to ensure checks are run before commit +- `eslint`: Linting for TypeScript & React +- `prettier`: Code formatting +- `typescript (tsc)`: Type checking +- `eslint-config-prettier` and `eslint-plugin-prettier`: Integrate Prettier with ESLint ### โš™๏ธ Config Files -| File | Purpose | -|---------------------------|---------------------------------------------------------------------| -| `.flake8` | Linting rules with complexity settings | -| `pyproject.toml` | Central config for `black`, `isort`, `mypy`, and `coverage` | -| `.pre-commit-config.yaml` | Pre-commit setup for linting, typing, formatting, and security | -| `requirements-dev.txt` | Dev dependencies with fixed versions | -| `.github/workflows/lint.yml` | CI/CD workflow for automated PR checks | -| `Makefile` | Common commands for easy use | +| File | Purpose | +| --------------- | ----------------------------------- | +| `.eslintrc.cjs` | ESLint rules for TypeScript + React | +| `.prettierrc` | Prettier formatting rules | +| `tsconfig.json` | TypeScript configuration | +| `package.json` | Dev dependencies and npm scripts | --- @@ -51,122 +46,49 @@ We use the following tools to enforce code quality: ### ๐Ÿ”„ Install Dev Dependencies ```bash -pip install -r requirements-dev.txt -pre-commit install +npm install +``` + +## ๐Ÿ“‹ Example Commands + +```bash +# Run lint checks +npm run lint + +# Automatically fix linting issues +npm run lint:fix + +# Type checking +npm run typecheck + +# Format code +npm run format +# Build the project +npm run build +``` -๐Ÿ“‹ Makefile Commands -Use these commands for a smooth workflow: +## ๐Ÿงน Code Quality Checks -make install # Set up the development environment -make format # Auto-format code (black + isort) -make lint # Run flake8, mypy, bandit, etc. -make test # Run tests with coverage report -make all # Run everything above in sequence - - -๐Ÿงน Code Quality Checks -๐Ÿ–ค Code Formatting - -black . -isort . - -๐Ÿงญ Code Quality Standards -| Standard | Tool(s) | -| -------------------- | ------------------ | -| PEP 8 Compliance | `flake8` | -| Formatting (88-char) | `black` | -| Sorted Imports | `isort` | -| Static Typing | `mypy` | -| Security Checks | `bandit`, `safety` | -| Git Hook Automation | `pre-commit` | -| Test Coverage | `pytest --cov` | - - -๐Ÿ“ Project Structure -๐Ÿ“ backend/ -โ”œโ”€โ”€ __init__.py # Package initialization -โ”œโ”€โ”€ user_service.py # Service logic with type hints -โ”œโ”€โ”€ test_user_service.py # Pytest-based test suite -๐Ÿ“ docs/python/ -โ””โ”€โ”€ code-quality-setup.md # Developer setup guide - - -๐Ÿš€ GitHub Actions Integration -Our CI/CD pipeline automatically runs on every pull request and includes: - -Python versions: 3.8, 3.9, 3.10, 3.11 - -Code formatting validation (black) - -Linting and static typing checks (flake8, mypy) - -Security scanning (bandit, safety) - -Test execution and coverage report - -๐Ÿ“ธ Pull Request Submission Checklist -Before opening a pull request: - -โœ… Run make all to ensure all checks pass - -โœ… Run python validate_config.py - -๐Ÿ“ธ Take a screenshot showing the terminal output - -๐Ÿ“Ž Attach the screenshot as a comment in your PR - -๐Ÿงช Config Validation Script -Run this before submitting a PR: - -bash -Copy -Edit -python validate_config.py -You should see: - -pgsql -Copy -Edit -โœ“ All checks passed! Python linting infrastructure is ready. - - - -๐Ÿงน Code Quality Checks -๐Ÿ–ค Code Formatting -bash -Copy -Edit -black . -isort . -๐Ÿงช Linting & Typing -bash -Copy -Edit -flake8 . -mypy . -๐Ÿ” Security Scans -bash -Copy -Edit -bandit -r . -safety check -๐Ÿ” Run Pre-commit on All Files -bash -Copy -Edit -pre-commit run --all-files -๐Ÿงช Testing -Run Unit Tests -bash -Copy -Edit -pytest -Run Tests with Coverage Report -bash -Copy -Edit -pytest --cov=. --cov-report=html -## License - -This project is licensed under the [MIT License](/License). +Standard Tool(s) +Linting eslint +Formatting prettier +Type Checking tsc + +| Standard | Tools(s) | +| --------------- | -------- | +| `Linting` | eslint | +| `Formatting` | prettier | +| `Type Checking` | tsc | + +## ๐Ÿ“ธ Pull Request Submission Checklist + +### Before opening a pull request: + +### โœ… Run all checks: + +```bash +npm run lint:fix +npm run format +npm run build +```