Dark mode
Linting & Formatting
Introduction
Linting and formatting are essential tools for maintaining code quality and consistency in React projects.
เครื่องมือ linting และ formatting เป็นสิ่งจำเป็นสำหรับการรักษาคุณภาพและความสม่ำเสมอของโค้ดในโปรเจค React
Recommended Tools
- ESLint: For identifying problematic patterns
- Prettier: For code formatting
- Husky + lint-staged: For pre-commit hooks
เครื่องมือที่แนะนำ:
- ESLint: ใช้ตรวจหาปัญหาในโค้ด
- Prettier: ใช้จัดรูปแบบโค้ดอัตโนมัติ
- Husky + lint-staged: ใช้รันคำสั่งก่อน commit
Configuration
ตัวอย่างการตั้งค่า
ดูตัวอย่างการตั้งค่าเพิ่มเติมได้ที่:
json
// Example .eslintrc.json
{
"extends": ["eslint:recommended", "plugin:react/recommended"]
}
json
// Example .prettierrc
{
"semi": true,
"singleQuote": true
}