domains / / microsoft/typescript
Preserve naming consistency
Maintain consistent naming patterns and casing across all related code entities to ensure clarity and prevent errors. This includes: 1. Use consistent casing for technical identifiers across all occurrences (in code, documentation, and translations)
Maintain consistent naming patterns and casing across all related code entities to ensure clarity and prevent errors. This includes:
- Use consistent casing for technical identifiers across all occurrences (in code, documentation, and translations)
- When entities are conceptually related (like types and namespaces sharing the same name), ensure naming consistency is maintained across all instances
- When renaming an identifier, ensure all related occurrences are updated consistently
Example:
// CORRECT: Consistent casing of 'checkJs' option
// In code:
compiler.options.checkJs = true;
// In documentation:
// "Use the 'checkJs' option to get errors from JavaScript files."
// CORRECT: Consistent naming across related entities
type Foo = number;
namespace Foo {
export type U = string;
}
export = Foo;
// When renaming 'Foo', ensure it's renamed in all three places
Inconsistent naming leads to confusion, makes code harder to maintain, and can cause runtime errors when references don’t match.