@@ -4,7 +4,8 @@ title: Understand Checks before PR
4
4
sidebar_label : Understand Checks before PR
5
5
sidebar_position : 3
6
6
---
7
- # 🧠 Python Backend Development Guide
7
+
8
+ # 🧠 TypeScript + React Development Guide
8
9
9
10
Welcome to recode hive! To maintain a high standard of code quality, we follow a strict development and pull request process.
10
11
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
13
14
14
15
## 📦 Prerequisites
15
16
16
- - Python ** 3.8 or higher**
17
- - ` pip ` (Python package installer)
18
- - Git
17
+ - Node.js ** 18+**
18
+ - npm
19
19
20
20
---
21
21
@@ -25,24 +25,19 @@ Before submitting your PR, please **follow the instructions below and attach a s
25
25
26
26
We use the following tools to enforce code quality:
27
27
28
- - ` flake8 ` : Enforces PEP8 compliance
29
- - ` black ` : Code formatting with 88-char line width
30
- - ` isort ` : Automatically sorts imports
31
- - ` mypy ` : Static type checking with strict rules
32
- - ` bandit ` : Security vulnerability scanning
33
- - ` safety ` : Checks for insecure packages
34
- - ` pre-commit ` : Git hook to ensure checks are run before commit
28
+ - ` eslint ` : Linting for TypeScript & React
29
+ - ` prettier ` : Code formatting
30
+ - ` typescript (tsc) ` : Type checking
31
+ - ` eslint-config-prettier ` and ` eslint-plugin-prettier ` : Integrate Prettier with ESLint
35
32
36
33
### ⚙️ Config Files
37
34
38
- | File | Purpose |
39
- | ---------------------------| ---------------------------------------------------------------------|
40
- | ` .flake8 ` | Linting rules with complexity settings |
41
- | ` pyproject.toml ` | Central config for ` black ` , ` isort ` , ` mypy ` , and ` coverage ` |
42
- | ` .pre-commit-config.yaml ` | Pre-commit setup for linting, typing, formatting, and security |
43
- | ` requirements-dev.txt ` | Dev dependencies with fixed versions |
44
- | ` .github/workflows/lint.yml ` | CI/CD workflow for automated PR checks |
45
- | ` Makefile ` | Common commands for easy use |
35
+ | File | Purpose |
36
+ | --------------- | ----------------------------------- |
37
+ | ` .eslintrc.cjs ` | ESLint rules for TypeScript + React |
38
+ | ` .prettierrc ` | Prettier formatting rules |
39
+ | ` tsconfig.json ` | TypeScript configuration |
40
+ | ` package.json ` | Dev dependencies and npm scripts |
46
41
47
42
---
48
43
@@ -51,122 +46,49 @@ We use the following tools to enforce code quality:
51
46
### 🔄 Install Dev Dependencies
52
47
53
48
``` bash
54
- pip install -r requirements-dev.txt
55
- pre-commit install
49
+ npm install
50
+ ```
51
+
52
+ ## 📋 Example Commands
53
+
54
+ ``` bash
55
+ # Run lint checks
56
+ npm run lint
57
+
58
+ # Automatically fix linting issues
59
+ npm run lint:fix
60
+
61
+ # Type checking
62
+ npm run typecheck
63
+
64
+ # Format code
65
+ npm run format
56
66
67
+ # Build the project
68
+ npm run build
69
+ ```
57
70
58
- 📋 Makefile Commands
59
- Use these commands for a smooth workflow:
71
+ ## 🧹 Code Quality Checks
60
72
61
- make install # Set up the development environment
62
- make format # Auto-format code (black + isort)
63
- make lint # Run flake8, mypy, bandit, etc.
64
- make test # Run tests with coverage report
65
- make all # Run everything above in sequence
66
-
67
-
68
- 🧹 Code Quality Checks
69
- 🖤 Code Formatting
70
-
71
- black .
72
- isort .
73
-
74
- 🧭 Code Quality Standards
75
- | Standard | Tool(s) |
76
- | -------------------- | ------------------ |
77
- | PEP 8 Compliance | ` flake8` |
78
- | Formatting (88-char) | ` black` |
79
- | Sorted Imports | ` isort` |
80
- | Static Typing | ` mypy` |
81
- | Security Checks | ` bandit` , ` safety` |
82
- | Git Hook Automation | ` pre-commit` |
83
- | Test Coverage | ` pytest --cov` |
84
-
85
-
86
- 📁 Project Structure
87
- 📁 backend/
88
- ├── __init__.py # Package initialization
89
- ├── user_service.py # Service logic with type hints
90
- ├── test_user_service.py # Pytest-based test suite
91
- 📁 docs/python/
92
- └── code-quality-setup.md # Developer setup guide
93
-
94
-
95
- 🚀 GitHub Actions Integration
96
- Our CI/CD pipeline automatically runs on every pull request and includes:
97
-
98
- Python versions: 3.8, 3.9, 3.10, 3.11
99
-
100
- Code formatting validation (black)
101
-
102
- Linting and static typing checks (flake8, mypy)
103
-
104
- Security scanning (bandit, safety)
105
-
106
- Test execution and coverage report
107
-
108
- 📸 Pull Request Submission Checklist
109
- Before opening a pull request:
110
-
111
- ✅ Run make all to ensure all checks pass
112
-
113
- ✅ Run python validate_config.py
114
-
115
- 📸 Take a screenshot showing the terminal output
116
-
117
- 📎 Attach the screenshot as a comment in your PR
118
-
119
- 🧪 Config Validation Script
120
- Run this before submitting a PR:
121
-
122
- bash
123
- Copy
124
- Edit
125
- python validate_config.py
126
- You should see:
127
-
128
- pgsql
129
- Copy
130
- Edit
131
- ✓ All checks passed! Python linting infrastructure is ready.
132
-
133
-
134
-
135
- 🧹 Code Quality Checks
136
- 🖤 Code Formatting
137
- bash
138
- Copy
139
- Edit
140
- black .
141
- isort .
142
- 🧪 Linting & Typing
143
- bash
144
- Copy
145
- Edit
146
- flake8 .
147
- mypy .
148
- 🔐 Security Scans
149
- bash
150
- Copy
151
- Edit
152
- bandit -r .
153
- safety check
154
- 🔁 Run Pre-commit on All Files
155
- bash
156
- Copy
157
- Edit
158
- pre-commit run --all-files
159
- 🧪 Testing
160
- Run Unit Tests
161
- bash
162
- Copy
163
- Edit
164
- pytest
165
- Run Tests with Coverage Report
166
- bash
167
- Copy
168
- Edit
169
- pytest --cov=. --cov-report=html
170
- # # License
171
-
172
- This project is licensed under the [MIT License](/License).
73
+ Standard Tool(s)
74
+ Linting eslint
75
+ Formatting prettier
76
+ Type Checking tsc
77
+
78
+ | Standard | Tools(s) |
79
+ | --------------- | -------- |
80
+ | ` Linting ` | eslint |
81
+ | ` Formatting ` | prettier |
82
+ | ` Type Checking ` | tsc |
83
+
84
+ ## 📸 Pull Request Submission Checklist
85
+
86
+ ### Before opening a pull request:
87
+
88
+ ### ✅ Run all checks:
89
+
90
+ ``` bash
91
+ npm run lint:fix
92
+ npm run format
93
+ npm run build
94
+ ```
0 commit comments