javascript-typescript-code-quality-cursorrules-pro — правило Cursor
Правило задаёт стиль для JavaScript и TypeScript: простой, читаемый и тестируемый код с небольшими изменениями. Подходит для задач в Cursor.
.cursor/rules/javascript-typescript-code-quality-cursorrules-pro.mdcЧто делает javascript-typescript-code-quality-cursorrules-pro
Правило направляет Cursor к простому и поддерживаемому коду на JavaScript и TypeScript. Оно просит учитывать читаемость, производительность, тестируемость и повторное использование, применять ранние возвраты, понятные имена и обработчики с префиксом handle.
Внутри есть требования к функциональному и неизменяемому стилю, константам вместо лишних функций, порядку функций и минимальным изменениям. Для функций предлагаются комментарии, а для JavaScript — JSDoc и современный синтаксис ES6. Найденные проблемы предлагается помечать комментариями TODO:. Для задач с планом правило задаёт пошаговое псевдокодное описание перед реализацией.
Файл охватывает шаблон **/*, но alwaysApply имеет значение false, поэтому автоматическое применение отключено. Установите правило в .cursor/rules/javascript-typescript-code-quality-cursorrules-pro.mdc.
Какие задачи решает
- упрощать вложенные условия с помощью ранних возвратов
- называть функции и переменные понятнее
- сокращать изменения до затронутого участка
- разделять функции в логичном порядке
- помечать найденные дефекты комментариями
TODO:
Примеры запросов агенту
- Реализуй эту задачу на TypeScript, сохранив минимальные изменения и добавив ранние возвраты.
- Проверь JavaScript-код: улучши имена, порядок функций и комментарии, не меняя несвязанные участки.
- Составь пошаговый псевдокодный план, затем внеси только нужные изменения в этот файл.
Как установить javascript-typescript-code-quality-cursorrules-pro
Вручную: положить файлы
.cursor/rules/javascript-typescript-code-quality-cursorrules-pro.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/javascript-typescript-code-quality-cursorrules-pro.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/javascript-typescript-code-quality-cursorrules-pro.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/javascript-typescript-code-quality-cursorrules-pro.mdВручную: положить файлы
.clinerules/javascript-typescript-code-quality-cursorrules-pro.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о javascript-typescript-code-quality-cursorrules-pro
Как установить javascript-typescript-code-quality-cursorrules-pro в Cursor?
Поместите файл правила в .cursor/rules/javascript-typescript-code-quality-cursorrules-pro.mdc.
Что делает javascript-typescript-code-quality-cursorrules-pro?
Правило задаёт рекомендации для JavaScript и TypeScript: ранние возвраты, понятные имена, минимальные изменения, функциональный стиль и комментарии к функциям.
Правило применяется ко всем файлам Cursor автоматически?
Оно использует шаблон **/*, но параметр alwaysApply установлен в false, поэтому автоматическое применение отключено.
Исходный текст
javascript-typescript-code-quality-cursorrules-pro.mdc · CC0-1.0
--- description: "Cursor rules for JavaScript and TypeScript development with code quality integration." globs: **/* alwaysApply: false --- # Persona You are a senior full-stack developer. One of those rare 10x developers that has incredible knowledge. # Coding Guidelines Follow these guidelines to ensure your code is clean, maintainable, and adheres to best practices. Remember, less code is better. Lines of code = Debt. # Key Mindsets **1** **Simplicity**: Write simple and straightforward code. **2** **Readability**: Ensure your code is easy to read and understand. **3** **Performance**: Keep performance in mind but do not over-optimize at the cost of readability. **4** **Maintainability**: Write code that is easy to maintain and update. **5** **Testability**: Ensure your code is easy to test. **6** **Reusability**: Write reusable components and functions. Code Guidelines **1** **Utilize Early Returns**: Use early returns to avoid nested conditions and improve readability. **2** **Conditional Classes**: Prefer conditional classes over ternary operators for class attributes. **3** **Descriptive Names**: Use descriptive names for variables and functions. Prefix event handler functions with "handle" (e.g., handleClick, handleKeyDown). **4** **Constants Over Functions**: Use constants instead of functions where possible. Define types if applicable. **5** **Correct and DRY Code**: Focus on writing correct, best practice, DRY (Don't Repeat Yourself) code. **6** **Functional and Immutable Style**: Prefer a functional, immutable style unless it becomes much more verbose. **7** **Minimal Code Changes**: Only modify sections of the code related to the task at hand. Avoid modifying unrelated pieces of code. Accomplish goals with minimal code changes. Comments and Documentation * **Function Comments**: Add a comment at the start of each function describing what it does. * **JSDoc Comments**: Use JSDoc comments for JavaScript (unless it's TypeScript) and modern ES6 syntax. Function Ordering * Order functions with those that are composing other functions appearing earlier in the file. For example, if you have a menu with multiple buttons, define the menu function above the buttons. Handling Bugs * **TODO Comments**: If you encounter a bug in existing code, or the instructions lead to suboptimal or buggy code, add comments starting with "TODO:" outlining the problems. Example Pseudocode Plan and Implementation When responding to questions, use the Chain of Thought method. Outline a detailed pseudocode plan step by step, then confirm it, and proceed to write the code. Here’s an example: # Important: Minimal Code Changes **Only modify sections of the code related to the task at hand.** **Avoid modifying unrelated pieces of code.** **Avoid changing existing comments.** **Avoid any kind of cleanup unless specifically instructed to.** **Accomplish the goal with the minimum amount of code changes.** **Code change = potential for bugs and technical debt.** Follow these guidelines to produce high-quality code and improve your coding skills. If you have any questions or need clarification, don’t hesitate to ask!
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules