GithubHelp home page GithubHelp logo

coding-guidelines's Introduction

Coding Guidelines

Best practices and guidelines for writing HTML, CSS , JavaScript and other languages.

Every line of code should appear to be written by a single person, no matter the number of contributors. Twitter

Table of Contents

Source Code Formatting

The following settings are required for source code created within the project(s). The recommendation is to set the configuration of IDE settings accordingly.

Type Setting
Line Width 120 characters
Indention 4 spaces
Encoding UTF-8
Line Endings UNIX
  • Tabs are not to be used at all, use soft tabs with 4 spaces
  • Code is documentation. Comments are useful, but should be removed by the delivering system (e.g. minify/uglify)
  • Prevent inline styles where possible. The only reasonable way is when changing styling by JavaScript
  • Deprecated markup/functionality should never be used
  • Add new line at end of files
  • Trim trailing white space

JavaScript

The general coding standards are derived from Mozillas coding standards for JavaScript with more specific ruling provided by Douglas Crockford. Also the Coding Guidelines from AirBnb are pretty awesome.

Notation

  • Lines should not contain trailing spaces, even after binary operators, commas or semicolons
  • Separate binary operators with spaces
  • Spaces after commas and semicolons, but not before.
  • Spaces after keywords, e.g. if (x > 0)
  • Spaces around braces used for in-line functions or objects, except before commas or semicolons etc. pp.
  • Constants should be in UPPER_CASE
  • Don't use reserved keywords as identifiers, see ES6

For a more in-depth definition please see the JavaScript guidelines.

JSDoc

Every method needs to get a JSDoc comment. The comment should describe the meaning and the responsibility of the class or the method. It is important that responses to null values or similar values that may be out of range are described. Also parameters must be documented and explained.

coding-guidelines's People

Contributors

sharafc avatar

Watchers

 avatar

coding-guidelines's Issues

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.