From 5db06ac511f7d416e885fe1bfd609f2ea7d165e2 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Fri, 24 Apr 2015 21:16:12 +0100 Subject: [PATCH] Add some common objc nits to the style guide @nicklockwood @a2 @vjeux Want to add something else? (or remove something) --- CONTRIBUTING.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32b4d2f93290b1..6bb19e007ba308 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,14 +52,27 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe ### Code -* Use semicolons; +#### General + * Add trailing commas, * 2 spaces for indentation (no tabs) -* Prefer `'` over `"` -* `'use strict';` -* 80 character line length * "Attractive" + +#### JavaScript + +* Use semicolons; +* `'use strict';` +* Prefer `'` over `"` * Do not use the optional parameters of `setTimeout` and `setInterval` +* 80 character line length + +#### Objective-C + +* Space after `@property` declarations +* Brackets on *every* `if`, on the *same* line +* `- method`, `@interface`, and `@implementation` brackets on the following line +* *Try* to keep it around 80 characters line length (sometimes it's just not possible...) +* `*` operator goes with the variable name (e.g. `NSObject *variableName;`) ### Documentation