javascript
Installation
SKILL.md
JavaScript
Overview
This skill provides a general overview of JavaScript best practices and guidelines.
- Use early returns whenever possible to make the code more readable.
- Use descriptive variable and function/const names. Only use abbreviations when they are well-known and universally understood.
- Prefer CSS transitions/animations over JavaScript for smoother, GPU-accelerated effects
- Check the code for linting errors and fix them, using
eslintandeslint-config-kswedbergif available.
Function Syntax
- Use function expressions instead of function declarations.
- Use named function expressions when you need to use the function name in the function body (e.g. for recursion).
- Use arrow functions for concise anonymous functions.
- Avoid arrow functions ONLY when you need to access a
thiskeyword scoped within the function. - When returning an object literal, NEVER use the shorthand format. Instead, use curly braces and return the object explicitly.