General guidelines on how to code for this probject
Those will be run automatically by the CI and if any error is found will fail the build.
tslint
for typescript styling. With vscode install the tslint extension to have live warning.stylelint
for scss. With vscode install the stylelint extension to have live warning.
Use 2 group for import(TSLint will then make sure they are sorted alpha in each group):
- For npm import
- For local import
e.g.
import { Component } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { autobind } from "@batch-flask/core";
import { Observable } from "rxjs";
import { NotificationService } from "@batch-flask/ui/notifications";
import { SidebarRef } from "@batch-flask/ui/sidebar";
// Code goes here
Try to use absolute import whenever possible(From the root of the project - start with `"app/...") Only use a relative import for
// Good
import {Some} from "app/components/folder/file"
import {Some} from "./file"
import {Some} from "./folder/file"
// Ok
import {Some} from "../folder/file"
// Bad
import {Some} from "../../folder/file"
import {Some} from "../../../folder/file"
Use templateUrl: "abc.html"
instead of template: require("abc.html")
.
Try to only use template: "<inline-template></inline-template>"
for simple templates.