Ensure consistent application of coding style conventions throughout the codebase, including naming patterns, type usage, code organization, and formatting standards.
Ensure consistent application of coding style conventions throughout the codebase, including naming patterns, type usage, code organization, and formatting standards.
Key areas to maintain consistency:
Naming Conventions:
STACKOVERFLOW
not StackOverflow
)readonly
modifier consistently to input signals and computed valuesType Usage:
unknown
over any
for better type safetyCode Organization:
async/await
syntax consistently instead of Promise.resolve()
Example of consistent readonly usage:
// Consistent - all inputs marked as readonly
readonly docContent = input<DocContent | undefined>();
readonly urlFragment = toSignal(this.route.fragment);
readonly hasClosed = linkedSignal(() => { ... });
// Inconsistent - missing readonly modifiers
docContent = input<DocContent | undefined>();
urlFragment = toSignal(this.route.fragment);
Example of consistent constant extraction:
// Good - constants extracted and consistently named
const MAX_DISPLAY_LENGTH = 200;
const COPY_FEEDBACK_TIMEOUT = 2000;
const STACKOVERFLOW = 'https://stackoverflow.com/questions/tagged/angular';
// Avoid - magic numbers and inconsistent naming
setTimeout(() => { ... }, 2000);
export const StackOverflow = 'https://stackoverflow.com/questions/tagged/angular';
Consistency in style reduces cognitive load, improves maintainability, and makes the codebase more professional. Establish team conventions and apply them uniformly across all files.
Enter the URL of a public GitHub repository