Real-Time Code Formatting Feedback in IDEs
Implement tools that provide immediate formatting feedback within integrated development environments.
0 likes
239 views
Rule Content
---
description: Enforce real-time code formatting feedback within the IDE to maintain consistent code style.
globs: ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx', '**/*.py', '**/*.java', '**/*.c', '**/*.cpp', '**/*.cs', '**/*.php', '**/*.rb']
tags: [code-formatting, real-time-feedback, IDE-integration]
priority: 3
version: 1.0.0
---
# Real-Time Code Formatting Feedback in IDEs
## Context
- Applicable to all source code files within the project.
- Requires integration with the IDE's real-time feedback mechanisms.
## Requirements
- Implement tools or plugins that provide immediate feedback on code formatting issues as code is written.
- Ensure the feedback covers:
- Indentation consistency (e.g., 2 spaces for JavaScript, 4 spaces for Python).
- Proper use of line breaks and spacing around operators.
- Adherence to language-specific naming conventions (e.g., camelCase for JavaScript variables, snake_case for Python functions).
- Consistent use of braces and brackets as per language standards.
- Configure the IDE to automatically apply formatting rules upon saving files.
## Examples
<example>
**Good:**
function calculateTotal(price, quantity) {
const total = price * quantity;
return total;
}
*Consistent indentation and spacing, following JavaScript conventions.*
</example>
<example type="invalid">
**Bad:**
function calculateTotal(price,quantity){
const total=price*quantity;return total;}
*Inconsistent spacing and indentation, making the code harder to read.*
</example>