TypeScript JSDoc .cursorrules prompt file
About .cursorrules prompt file
What you can build
TypeScript Linting Tool: A web-based tool that analyzes TypeScript files and applies these rules to ensure that code adheres to best practices regarding type safety, naming conventions, file structure, and more. It can provide messages and suggest replacements to improve code quality.
EdgeDB Integration Helper: An app that aids developers in converting raw EdgeQL strings into type-safe edgeql-js queries. It could include a feature for generating specific EdgeDB types to replace generic types like 'any'.
Hono Framework Development Environment: An IDE plugin specifically optimized for working with the Hono framework, automatically ensuring proper request handler typings and context usage, and guiding users to uphold framework-specific best practices.
TypeScript Refactoring Service: A service that scans TypeScript projects to enforce atomic file structures by limiting exports per file and suggesting meaningful file names based on content, helping maintain organized and clear project structures.
JSDoc Comment Generator: An extension for code editors that automatically inserts JSDoc comments into functions, prompting developers to describe the function, its parameters, and return values, improving documentation consistency.
Import Optimization Plugin: A plugin for TypeScript environments that automates the process of removing unused imports and sorting them alphabetically to maintain a clean and readable codebase.
Error Handling Best Practices Tool: A service that analyzes async functions within a TypeScript codebase, ensuring the use of consistent try-catch blocks for error handling, and prompting modifications to adhere to this approach.
Code Structure Auditing Website: A website that allows developers to upload TypeScript files and receive feedback on function and class lengths, suggesting refactoring opportunities when limits exceed the recommended number of lines.
Parameter Interface Generator: A tool that automatically suggests and generates TypeScript interfaces for function parameters, promoting type safety by encouraging developers to define parameter types explicitly.
Async Function Validator: An app focused on reviewing async functions in TypeScript code to ensure consistent error handling and adherence to structural guidelines, providing recommendations for improvement.
Benefits
- Comprehensive rules covering TypeScript best practices, including naming conventions, explicit typing, and consistent error handling across development.
- Framework-specific guidance for EdgeDB-js and Hono, promoting tools for type safety and maintainability.
- File structure and documentation standards for enhanced project organization and readability, including atomic file exports and JSDoc enforcement.
Synopsis
TypeScript developers designing scalable applications would benefit by using this prompt to establish consistent coding standards, improve code readability, and ensure maintainability.
Overview of .cursorrules prompt
The .cursorrules file provides a set of automated coding rules and conventions tailored for TypeScript development. It outlines rules for coding style, such as preferring explicit types, using camelCase for variables, and PascalCase for class names. Specific guidelines are included for using the EdgeDB-js query builder, Hono framework request handlers, and ensuring atomic file structure. It also enforces documentation using JSDoc comments, optimizes import statements by removing unused ones and sorting them alphabetically, and offers best practices like interface usage for function parameters. Additionally, the file sets limits on function and class length for maintainability and promotes consistent error handling in asynchronous functions. The purpose is to enhance code readability, maintainability, and type safety across TypeScript projects.