Skip to content

Commit 163ed09

Browse files
authored
Merge pull request #818 from sheikhlimon/docs/update-lint-guide
docs: update linting guide for TypeScript + React
2 parents a2a01eb + 1e077b9 commit 163ed09

File tree

1 file changed

+57
-135
lines changed

1 file changed

+57
-135
lines changed

community/understand-lint-checks.md

Lines changed: 57 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ title: Understand Checks before PR
44
sidebar_label: Understand Checks before PR
55
sidebar_position: 3
66
---
7-
# 🧠 Python Backend Development Guide
7+
8+
# 🧠 TypeScript + React Development Guide
89

910
Welcome to recode hive! To maintain a high standard of code quality, we follow a strict development and pull request process.
1011
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
1314

1415
## 📦 Prerequisites
1516

16-
- Python **3.8 or higher**
17-
- `pip` (Python package installer)
18-
- Git
17+
- Node.js **18+**
18+
- npm
1919

2020
---
2121

@@ -25,24 +25,19 @@ Before submitting your PR, please **follow the instructions below and attach a s
2525

2626
We use the following tools to enforce code quality:
2727

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
3532

3633
### ⚙️ Config Files
3734

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 |
4641

4742
---
4843

@@ -51,122 +46,49 @@ We use the following tools to enforce code quality:
5146
### 🔄 Install Dev Dependencies
5247

5348
```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
5666

67+
# Build the project
68+
npm run build
69+
```
5770

58-
📋 Makefile Commands
59-
Use these commands for a smooth workflow:
71+
## 🧹 Code Quality Checks
6072

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

Comments
 (0)