a dotfile but it's really big
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

1### JavaScript Best Practices 2 3#### Code Style 4- Use `const` by default, `let` when needed, never `var` 5- Use arrow functions for callbacks 6- Use template literals over string concatenation 7- Use destructuring for object/array access 8 9#### Error Handling 10```javascript 11// GOOD: Proper async error handling 12async function fetchUser(id) { 13 try { 14 const response = await fetch(`/api/users/${id}`); 15 if (!response.ok) { 16 throw new Error(`HTTP ${response.status}`); 17 } 18 return await response.json(); 19 } catch (error) { 20 console.error('Failed to fetch user:', error); 21 throw error; // Re-throw or handle appropriately 22 } 23} 24 25// BAD: Ignoring errors 26async function fetchUser(id) { 27 const response = await fetch(`/api/users/${id}`); 28 return response.json(); // No error handling 29} 30``` 31 32#### Security 33- Never use `eval()` or `innerHTML` with user input 34- Validate all input on both client and server 35- Use `textContent` instead of `innerHTML` when possible 36- Sanitize URLs before navigation or fetch