--- name: "JavaScript Standards" description: "Cross-project JavaScript and MJS standards for clarity, maintainability, and performance-aware code." applyTo: "**/*.js,**/*.mjs" --- - Prefer `const` over `let`, and avoid `var`. - Use async/await for asynchronous flows. - Keep modules focused and avoid monolithic files. - Remove dead code and unused imports during related edits. - Use early returns to reduce branching complexity. - Keep behavior explicit; avoid implicit coercion and hidden side effects. - Favor composition and reusable utilities over duplicated logic. - Avoid deep nesting, callback-heavy control flow, and blocking sync work in user-facing paths. - Validate with the project's JavaScript lint, test, and build commands.