Naming conventions

Naming conventions are hugely important to maintainability and readability. This guide recommends naming conventions for the file name and the symbol name.

General naming guidelines

Do use consistent names for all symbols.

Do follow a pattern that describes the symbol's feature then its type. The recommended pattern is feature.type.ts

Separate file names with dots and dashes

Do use dashes to separate words in the descriptive name.

Do use dots to separate the descriptive name from the type.

Do use consistent type names for all components following a pattern that describes the component's feature then its type. A recommended pattern is feature.type.ts.

Do use conventional type names including

  • .actions

  • .component

  • .constant

  • .directive

  • .effects

  • .facade

  • .guard

  • .interface

  • .module

  • .pipe

  • .reducer

  • .resolver

  • .routes

  • .selectors

  • .service

Invent additional type names if you must but take care not to create too many.

Symbols and file names

Do use consistent names for all assets named after what they represent.

Do use upper camel case for class names.

Do match the name of the symbol to the name of the file.

Do append the symbol name with the conventional suffix (such as Component, Directive, Module, Pipe, or Service) for a thing of that type.

Do give the filename the conventional suffix (such as .component.ts, .directive.ts, .module.ts, .pipe.ts, or .service.ts) for a file of that type.

Analytics naming guidelines

Do use lowercase for names and properties

Do use underscores to separate words

Do start with a letter.

Do use only letters, numbers, and underscores.

Do follow Google's naming rules

Reference: Google's event naming rules

Avoid spaces

Avoid reserved event names

Avoid reserved prefixes

Last updated