javascript
Installation
SKILL.md
JavaScript
Overview
This skill provides a general overview of JavaScript best practices and guidelines.
- Follow the general-code-quality skill for early returns, naming, and comments.
- Prefer CSS transitions/animations over JavaScript (see the css skill).
- 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.