Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Fixment #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,23 @@ The details in this guide have been very heavily inspired by several existing st
* [Miscellaneous](#miscellaneous)

<a name="code_layout"/>

## Code layout

<a name="tabs_or_spaces"/>

### Tabs or Spaces?

Use **spaces only**, with **2 spaces** per indentation level. Never mix tabs and spaces.

<a name="maximum_line_length"/>

### Maximum Line Length

Limit all lines to a maximum of 79 characters.

<a name="blank_lines"/>

### Blank Lines

Separate top-level function and class definitions with a single blank line.
Expand All @@ -66,11 +70,13 @@ Separate method definitions inside of a class with a single blank line.
Use a single blank line within the bodies of methods or functions in cases where this improves readability (e.g., for the purpose of delineating logical sections).

<a name="trailing_whitespace"/>

### Trailing Whitespace

Do not include trailing whitespace on any lines.

<a name="optional_commas"/>

### Optional Commas

Avoid the use of commas before newlines when properties or elements of an Object or Array are listed on separate lines.
Expand Down Expand Up @@ -98,11 +104,13 @@ bar:
```

<a name="encoding"/>

### Encoding

UTF-8 is the preferred source file encoding.

<a name="module_imports"/>

## Module Imports

If using a module system (CommonJS Modules, AMD, etc.), `require` statements should be placed on separate lines.
Expand All @@ -118,6 +126,7 @@ These statements should be grouped in the following order:
3. Local imports _(imports specific to this application or library)_

<a name="whitespace"/>

## Whitespace in Expressions and Statements

Avoid extraneous whitespace in the following situations:
Expand Down Expand Up @@ -168,6 +177,7 @@ Additional recommendations:
```

<a name="comments"/>

## Comments

If modifying code that is described by an existing comment, update the comment such that it accurately reflects the new code. (Ideally, improve the code to obviate the need for the comment, and delete the comment entirely.)
Expand All @@ -177,6 +187,7 @@ The first word of the comment should be capitalized, unless the first word is an
If a comment is short, the period at the end can be omitted.

<a name="block_comments"/>

### Block Comments

Block comments apply to the block of code that follows them.
Expand All @@ -199,6 +210,7 @@ Paragraphs inside of block comments are separated by a line containing a single
```

<a name="inline_comments"/>

### Inline Comments

Inline comments are placed on the line immediately above the statement that they are describing. If the inline comment is sufficiently short, it can be placed on the same line as the statement (separated by a single space from the end of the statement).
Expand All @@ -222,6 +234,7 @@ However, inline comments can be useful in certain scenarios:
```

<a name="naming_conventions"/>

## Naming Conventions

Use `camelCase` (with a leading lowercase character) to name all variables, methods, and object properties.
Expand All @@ -243,6 +256,7 @@ _privateMethod: ->
```

<a name="functions"/>

## Functions

_(These guidelines also apply to the methods of a class.)_
Expand Down Expand Up @@ -313,6 +327,7 @@ In cases where method calls are being chained, some adopters of this style prefe
The function grouping style is not recommended. However, **if the function grouping style is adopted for a particular project, be consistent with its usage.**

<a name="strings"/>

## Strings

Use string interpolation instead of string concatenation:
Expand All @@ -325,6 +340,7 @@ Use string interpolation instead of string concatenation:
Prefer single quoted strings (`''`) instead of double quoted (`""`) strings, unless features like string interpolation are being used for the given string.

<a name="conditionals"/>

## Conditionals

Favor `unless` over `if` for negative conditions.
Expand Down Expand Up @@ -360,6 +376,7 @@ Multi-line if/else clauses should use indentation:
```

<a name="looping_and_comprehensions"/>

## Looping and Comprehensions

Take advantage of comprehensions whenever possible:
Expand Down Expand Up @@ -388,18 +405,21 @@ alert("#{key} = #{value}") for key, value of object
```

<a name="extending_native_objects"/>

## Extending Native Objects

Do not modify native objects.

For example, do not modify `Array.prototype` to introduce `Array#forEach`.

<a name="exceptions"/>

## Exceptions

Do not suppress exceptions.

<a name="annotations"/>

## Annotations

Use annotations when necessary to describe a specific action that must be taken against the indicated block of code.
Expand Down Expand Up @@ -433,6 +453,7 @@ Annotation types:
If a custom annotation is required, the annotation should be documented in the project's README.

<a name="miscellaneous"/>

## Miscellaneous

`and` is preferred over `&&`.
Expand Down