Skip to content

Cursor Rule for JavaScript Language

mdc
---
globs: *.js,*.mjs
alwaysApply: false
---

This rule provides the development specifications of the JavaScript language

## Code Style and Structure

- always use **ES modules** and deprecate **CommonJS**
- always use `const` to declare ordinary variables that will not be copied
- always use `let` to define ordinary variables that will be copied
- try to use **arrow functions** instead of **Function declarations**
- never use `var` to declare variables
- avoid defining and using global variables

## Name Conventions

- normal variable and function names always use **camelCase** (e.g. cacheKey)
- constant names use **UPPER_SNAKE_CASE** (e.g. GLOBAL_CONFIG)