Skip to content

CodeStyle

Ilya Azin edited this page Nov 26, 2020 · 2 revisions

Please, don't ignore theese recommendations

Commits

  • Use semantic commits

    commits:

    • feature(scope): details
    • fix(scope): details
    • refactor(scope): details
    • and etc..
  • Use gitflow

    branches:

    • feature/{name} => dev
    • bugfix/{name} => dev
    • and etc..

Code

  • Don't be blinded by DRY principle

    TODO: add comments

  • Add comments - only if it's required
  • Describe props/types
type TreeItem = {
    /** Unique identifier */
    id: TreeNodeId;
    /** Name */
    name: string;
    /** Amount of related items */
    count: number;
    /** Parent identifier */
    parentId?: TreeNodeId;
}
  • Use tsdoc-like style
/**
 * Tooltip
 * @remark If you should not specify `title` props - tooltip'll be invisible
 */
const Tooltip = (props: Props) => {

Styles

  • Use css vars
    • specially - with work with colors
    • not only on app level, also at component's level
.app {
    --clr-base: #4d97fd;
    --clr-base-hover: #4d97fd1f;
    ...
}
Clone this wiki locally