Coding

Clases (Style 03-01)

  • Use upper camel case when naming classes.

export class ExceptionService{
    constructor () { }
}

Constants (Style 03-02)

  • Declare variables with const if their values should not change during the application lifetime.

  • Consider spelling const variables in lower camel case.

  • tolerate existing const variables that are spelled in UPPER_SNAKE_CASE. Because some third party modules use it.

export const mockHeroes = ['Sam', 'Jill']; // Prefer
export const heroesURL = 'api/heroes'; // Prefer
export const VILLAINS_URL  = 'api/villains'; // Tolerate

Interfaces (Style 03-03)

  • Name an interface using upper camel case.

  • Naming an interface without an I prefix.

  • Consider using a class instead of an interface. Read about it.arrow-up-right

Properties and Methods (Style 03-04)

  • Use lower camel case to name properties and methods.

  • Do not use prefixing private properties and methods with an underscore.

Import line spacing(Style 03-06)

  • Leave one empty line between third party imports and applications imports.

  • List the import lines alphabetized by the module.

  • List destructed imported symbols alphabetically.

Was this helpful?