Skip to content

Instantly share code, notes, and snippets.

@cadriel
Last active May 3, 2016 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cadriel/915dffbf0aaae8b13dbaedad9862b4ce to your computer and use it in GitHub Desktop.
Save cadriel/915dffbf0aaae8b13dbaedad9862b4ce to your computer and use it in GitHub Desktop.

Developer Naming Conventions

Directives and Components

Directives and Components should be prefixed with edc. Attribute Directives should use camel case while Components should use kebab case. Class names should not be prefixed.

@Directive({
  selector: '[edcTitle]'
})
class Title {}

@Component({
  selector: `edc-button`
})
class Button {}

@Inputs and Attributes

Inputs and Attributes should have no common prefix, except in cases where the name would conflict with internal html attributes. Examples might include title or id. A list of attributes that should be prefixed can be found here.

@Component({
  selector: 'edc-button'
})
class Button {
  @Input() edcTitle string;
  @Input() edcId number;
  @Input() type string;
}

Files and Folders

No prefixes should be used. Sub folders should not be required under its respective component folder.

├── [componentname]/
    ├── [componentname].component.ts
    ├── [componentname].model.ts
    ├── [componentname].service.ts
    ├── [componentname].component.spec.ts
    ├── [componentname].e2e.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment