Giter VIP home page Giter VIP logo

frontend-guidelines's Introduction

Frontend Dev Guidelines, tools

Code style - Prettier

Non-default options:

// .prettierrc
{
  "printWidth": 120,
  "singleQuote": true,
  "arrowParens": "always"
}

Note: the Require Prama option might be useful while transitioning

CI

Configure a pre-commit hook

Extra

Check out the Editor Integrations

TypeScript

Using tslint-config-airbnb, tslint-config-prettier

// tslint.json
{
  "defaultSeverity": "error",
  "extends": [
      "tslint:recommended",
      "tslint-config-airbnb",
      "tslint-config-prettier"
  ],
  "jsRules": {},
  "rules": {
    ...
    "ter-arrow-parens": [true, "always"],
    ...
  },
  "rulesDirectory": []
}

Styling & Templates

BEM

We use BEM CSS class naming. In short:

Block: Standalone entity that is meaningful on its own.

Eg. header, container, menu, checkbox, input

Element: A part of a block that has no standalone meaning and is semantically tied to its block.

Eg. menu__item, list__item, checkbox__caption, header__title

Modifier: A flag on a block or element. Use them to change appearance or behavior.

Eg. menu__item--disabled, list__item--highlighted, checkbox--checked, button--primary

Templates

Use angular-bem for BEM classes.

<div class="header">
  <h1 class="header__title">
    Hello, and welcome to <span class="header__title--accented">Bitrise</span>
  </h1>
</div>

SCSS

Linting with stylelint

We use an extended version of stylelint-config-recommended with a list of property orders. See .stylelintrc for the list of rules.

Plugins: stylelint-order

Mixin naming convention:

TODO

package.json scripts

{
  ...
  "scripts": {
    ...
    "lint:style": "stylelint \"./**/*.scss\""
  }
}

frontend-guidelines's People

Contributors

simonmarton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.