Latest
Abc Style Guide
Names
- Use PascalCase for type names.
- Use PascalCase for enum values.
- Use PascalCase for global constants.
- Use camelCase for function names.
- Use camelCase for property names and local variables.
// Bad
export type myType = string;
// Good
export type MyType = string;
// Bad
enum Color {
RED,
BLACK,
}
// Good
enum Color {
Red,
Black,
}
// Bad
export function notFoundHandler(_?: Context): never {
throw new Error();
}
// Good
export function NotFoundHandler(_?: Context): never {
throw new Error();
}
// Bad
export function NotFoundHandler(flag: boolean): void | never {
if (flag) {
throw new Error();
}
}
// Good
export function notFoundHandler(flag: boolean): void | never {
if (flag) {
throw new Error();
}
}
// Bad
const GLOBAL_CONFIG = {};
// Good
const GlobalConfig = {};
null
& undefined
- Always use
undefined
.