Coding standards are a set of guidelines and best practices that are used to create consistent, high-quality code. It is best to adopt these basic coding standards before creating Pull requests.

  1. Please use spaces for indentation (2 spaces) and not tabs.
  2. Utilize the available tools in VSCode for automatic indentation.
  1. Create types for:
    i. New variables
    ii. New function return types
    iii. New arguments to functions
// i. New variables
let myString: string;
let myNumber: number;
// ii. New function return types
function exampleFunction(): boolean {
return true;
// iii. New arguments to functions
function processInput(input: string): void {
// Code to process the input
  1. Start type definitions for complex object structures (Type or Interface).
// Type definition for a user object
type User = {
id: number;
name: string;
age: number;
  1. Avoid using "any" as a type.
  1. Ensure accurate naming:
    i. Use indicative names for Booleans, like isXXXX or hasXXXX or XXXXInd.
  2. Use camelCase for all variables and class functions (statics should be all CAPITALIZED).
  3. Prefer const over let; completely avoid using var.
  1. Review the necessity of @state, as it's used almost by default
  2. Avoid direct DOM manipulation.
  3. Lifecycle functions should always start by calling the super version (except for render()).
  1. Comment functions and new blocks of code.
  2. Add comments for tricky problem-solving to aid understanding.
  3. If modifying the behavior of a function, update the comment or add a new one.
  4. Remove code instead of just commenting it out.
  1. Avoid very long functions; break them down.
  2. Eliminate duplication; create functions for common tasks.
  3. Avoid deeply nested if() statements:
    i. This can be done by keeping functions short
    ii. Also can sometimes be achieved by early returning from function based on negative condition
  4. Minimize nesting of ternary operators (x ? y : x) if possible.