From 028a085257d7b22bb063e46650e9030b8021450f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Osman=20Ta=C5=9Fkaya?= Date: Sun, 7 Jan 2018 20:10:30 +0300 Subject: [PATCH] Header Fixment --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 423742e..ac8960b 100644 --- a/README.md +++ b/README.md @@ -44,19 +44,23 @@ The details in this guide have been very heavily inspired by several existing st * [Miscellaneous](#miscellaneous) + ## Code layout + ### Tabs or Spaces? Use **spaces only**, with **2 spaces** per indentation level. Never mix tabs and spaces. + ### Maximum Line Length Limit all lines to a maximum of 79 characters. + ### Blank Lines Separate top-level function and class definitions with a single blank line. @@ -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). + ### Trailing Whitespace Do not include trailing whitespace on any lines. + ### Optional Commas Avoid the use of commas before newlines when properties or elements of an Object or Array are listed on separate lines. @@ -98,11 +104,13 @@ bar: ``` + ### Encoding UTF-8 is the preferred source file encoding. + ## Module Imports If using a module system (CommonJS Modules, AMD, etc.), `require` statements should be placed on separate lines. @@ -118,6 +126,7 @@ These statements should be grouped in the following order: 3. Local imports _(imports specific to this application or library)_ + ## Whitespace in Expressions and Statements Avoid extraneous whitespace in the following situations: @@ -168,6 +177,7 @@ Additional recommendations: ``` + ## 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.) @@ -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. + ### Block Comments Block comments apply to the block of code that follows them. @@ -199,6 +210,7 @@ Paragraphs inside of block comments are separated by a line containing a single ``` + ### 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). @@ -222,6 +234,7 @@ However, inline comments can be useful in certain scenarios: ``` + ## Naming Conventions Use `camelCase` (with a leading lowercase character) to name all variables, methods, and object properties. @@ -243,6 +256,7 @@ _privateMethod: -> ``` + ## Functions _(These guidelines also apply to the methods of a class.)_ @@ -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.** + ## Strings Use string interpolation instead of string concatenation: @@ -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. + ## Conditionals Favor `unless` over `if` for negative conditions. @@ -360,6 +376,7 @@ Multi-line if/else clauses should use indentation: ``` + ## Looping and Comprehensions Take advantage of comprehensions whenever possible: @@ -388,6 +405,7 @@ alert("#{key} = #{value}") for key, value of object ``` + ## Extending Native Objects Do not modify native objects. @@ -395,11 +413,13 @@ Do not modify native objects. For example, do not modify `Array.prototype` to introduce `Array#forEach`. + ## Exceptions Do not suppress exceptions. + ## Annotations Use annotations when necessary to describe a specific action that must be taken against the indicated block of code. @@ -433,6 +453,7 @@ Annotation types: If a custom annotation is required, the annotation should be documented in the project's README. + ## Miscellaneous `and` is preferred over `&&`.