Skip to content

Commit bed0ede

Browse files
committed
Merge pull request #1 from facebook/master
Merge
2 parents b9049ee + d3e4414 commit bed0ede

File tree

1,697 files changed

+118077
-22250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,697 files changed

+118077
-22250
lines changed

.buckconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2
7+
8+

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2

.eslintrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"no-debugger": 1, // disallow use of debugger
5656
"no-dupe-keys": 1, // disallow duplicate keys when creating object literals
5757
"no-empty": 0, // disallow empty statements
58-
"no-empty-class": 1, // disallow the use of empty character classes in regular expressions
5958
"no-ex-assign": 1, // disallow assigning to the exception in a catch block
6059
"no-extra-boolean-cast": 1, // disallow double-negation boolean casts in a boolean context
6160
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
@@ -126,9 +125,7 @@
126125
// Strict Mode
127126
// These rules relate to using strict mode.
128127

129-
"global-strict": [2, "always"], // require or disallow the "use strict" pragma in the global scope (off by default in the node environment)
130-
"no-extra-strict": 1, // disallow unnecessary use of "use strict"; when already in strict mode
131-
"strict": 0, // require that all functions are run in strict mode
128+
"strict": [2, "global"], // require or disallow the "use strict" pragma in the global scope (off by default in the node environment)
132129

133130
// Variables
134131
// These rules have to do with variable declarations.
@@ -174,11 +171,9 @@
174171
"no-lonely-if": 0, // disallow if as the only statement in an else block (off by default)
175172
"no-new-object": 1, // disallow use of the Object constructor
176173
"no-spaced-func": 1, // disallow space between function identifier and application
177-
"no-space-before-semi": 1, // disallow space before semicolon
178174
"no-ternary": 0, // disallow the use of ternary operators (off by default)
179175
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
180176
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
181-
"no-wrap-func": 1, // disallow wrapping of non-IIFE statements in parens
182177
"no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation
183178
"quotes": [1, "single", "avoid-escape"], // specify whether double or single quotes should be used
184179
"quote-props": 0, // require quotes around object literal property names (off by default)

.flowconfig

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,26 @@
77
# Some modules have their own node_modules with overlap
88
.*/node_modules/node-haste/.*
99

10-
# Ignore react-tools where there are overlaps, but don't ignore anything that
11-
# react-native relies on
12-
.*/node_modules/react-tools/src/React.js
13-
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
14-
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
15-
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
10+
# Ugh
11+
.*/node_modules/babel.*
12+
.*/node_modules/babylon.*
13+
.*/node_modules/invariant.*
14+
15+
# Ignore react and fbjs where there are overlaps, but don't ignore
16+
# anything that react-native relies on
17+
.*/node_modules/fbjs/lib/Map.js
18+
.*/node_modules/fbjs/lib/Promise.js
19+
.*/node_modules/fbjs/lib/fetch.js
20+
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
21+
.*/node_modules/fbjs/lib/isEmpty.js
22+
.*/node_modules/fbjs/lib/crc32.js
23+
.*/node_modules/fbjs/lib/ErrorUtils.js
24+
25+
# Flow has a built-in definition for the 'react' module which we prefer to use
26+
# over the currently-untyped source
27+
.*/node_modules/react/react.js
28+
.*/node_modules/react/lib/React.js
29+
.*/node_modules/react/lib/ReactDOM.js
1630

1731
# Ignore commoner tests
1832
.*/node_modules/commoner/test/.*
@@ -43,9 +57,9 @@ suppress_type=$FlowIssue
4357
suppress_type=$FlowFixMe
4458
suppress_type=$FixMe
4559

46-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
47-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
60+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
61+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
4862
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
4963

5064
[version]
51-
0.14.0
65+
0.20.1

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Force LF line endings for Bash scripts. On Windows the rest of the source
2+
# files will typically have CR+LF endings (Git default on Windows), but Bash
3+
# scripts need to have LF endings to work (under Cygwin), thus override to force
4+
# that.
5+
gradlew text eol=lf
6+
*.sh text eol=lf

.gitignore

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
!**/*.xcworkspacedata
55
!**/*.xcsettings
66
!**/*.xcscheme
7-
build/
87
*.pbxuser
98
!default.pbxuser
109
*.mode1v3
@@ -22,10 +21,21 @@ DerivedData
2221
*.xcuserstate
2322
project.xcworkspace
2423

25-
# OS X
26-
.DS_Store
24+
# Gradle
25+
/build/
26+
/Examples/**/android/app/build/
27+
/ReactAndroid/build/
28+
29+
# Android
30+
.idea
31+
.gradle
32+
local.properties
33+
*.iml
2734

2835
# Node
2936
node_modules
3037
*.log
3138
.nvm
39+
40+
# OS X
41+
.DS_Store

.travis.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
language: objective-c
22

3-
osx_image: xcode6.4
3+
osx_image: xcode7.2
44

55
cache:
66
directories:
77
- node_modules
88
- .nvm
99

10-
before_install:
11-
# Update brew twice because the first run can fail: https://github.com/Homebrew/homebrew/issues/42553
12-
- brew update; brew update
1310
install:
14-
- brew reinstall xctool nvm
11+
- brew reinstall nvm
1512
- mkdir -p .nvm
1613
- export NVM_DIR="$PWD/.nvm"
1714
- source $(brew --prefix nvm)/nvm.sh
18-
- nvm install iojs-v3
19-
- rm -Rf `node -p "require('os').tmpDir()"`/jest_preprocess_cache
20-
- npm install -g flow-bin@`node -p "require('fs').readFileSync('.flowconfig', 'utf8').split('[version]')[1].trim()"`
15+
- nvm install 5
16+
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
2117
- npm config set spin=false
18+
- npm install -g flow-bin@`node -p "require('fs').readFileSync('.flowconfig', 'utf8').split('[version]')[1].trim()"`
2219
- npm install
2320

2421
script:
@@ -31,7 +28,19 @@ script:
3128
elif [ "$TEST_TYPE" = js ]
3229
then
3330
34-
flow check && npm test
31+
npm install [email protected]
32+
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; flow --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" node bots/code-analysis-bot.js
33+
flow check && npm test -- '\/Libraries\/'
34+
35+
elif [ "$TEST_TYPE" = packager ]
36+
then
37+
38+
npm test -- '\/packager\/'
39+
40+
elif [ "$TEST_TYPE" = cli ]
41+
then
42+
43+
npm test -- '\/(local|private|react-native)-cli\/'
3544
3645
elif [ "$TEST_TYPE" = build_website ]
3746
then
@@ -60,11 +69,19 @@ env:
6069
matrix:
6170
- TEST_TYPE=objc
6271
- TEST_TYPE=js
72+
- TEST_TYPE=packager
73+
- TEST_TYPE=cli
6374
- TEST_TYPE=build_website
6475
- TEST_TYPE=e2e
6576
global:
77+
# $GITHUB_TOKEN
6678
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="
79+
# $APPETIZE_TOKEN
80+
- secure: "egsvVSpszTzrNd6bN62DsVAzMiSZI/OHgdizfPryqvqWBf655ztE6XFQSEFNpuIAzSKDDF25ioT8iPfVsbC1iK6HDWHfmqYxML0L+OoU0gi+hV2oKUBFZDZ1fwSnFoWuBdNdMDpLlUxvJp6N1WyfNOB2dxuZUt8eTt48Hi3+Hpc="
81+
# $S3_TOKEN
82+
- secure: "lY8JZPA0A7zT7L5KF9BBg34XYWIeR/RJiEvE7l7oVr88KnEPtyd//79eHhhVKnUnav7zsk5QJwkcX0MxKTp/dp4G0Am+zOX+sfA8kQrJ+2/+FzFW7AEsW/kHByfaIEIly9DQvUFt4I4oMm8nQZysJLahDgNWglyI3RTuJp//hcY="
6783

6884
branches:
6985
only:
7086
- master
87+
- /^.*-stable$/

CONTRIBUTING.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,28 @@ The core team will be monitoring for pull requests. When we get one, we'll run s
1919
1. Fork the repo and create your branch from `master`.
2020
2. If you've added code that should be tested, add tests!
2121
3. If you've changed APIs, update the documentation.
22-
4. Ensure tests pass on Travis.
23-
5. Make sure your code lints (`node linter.js <files touched>`).
24-
6. Squash your commits (`git rebase -i`).
25-
7. If you haven't already, complete the CLA.
22+
4. Add the copyright notice to the top of any new files you've added.
23+
5. Ensure tests pass on Travis and Circle CI.
24+
6. Make sure your code lints (`node linter.js <files touched>`).
25+
7. Squash your commits (`git rebase -i`).
26+
8. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
27+
28+
#### Copyright Notice for files
29+
30+
Copy and paste this to the top of your new file(s):
31+
32+
```JS
33+
/**
34+
* Copyright (c) 2015-present, Facebook, Inc.
35+
* All rights reserved.
36+
*
37+
* This source code is licensed under the BSD-style license found in the
38+
* LICENSE file in the root directory of this source tree. An additional grant
39+
* of patent rights can be found in the PATENTS file in the same directory.
40+
*/
41+
```
42+
43+
If you've added a new module, add a `@providesModule <moduleName>` at the end of the comment. This will allow the haste package manager to find it.
2644

2745
### Contributor License Agreement (CLA)
2846

@@ -46,8 +64,8 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
4664

4765
## How to Get in Touch
4866

49-
* IRC - [#reactnative on freenode](http://webchat.freenode.net/?channels=reactnative)
5067
* [Facebook group](https://www.facebook.com/groups/react.native.community/)
68+
* Reactiflux — [#react-native](http://join.reactiflux.com/)
5169

5270
## Style Guide
5371

@@ -67,6 +85,14 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
6785
* Do not use the optional parameters of `setTimeout` and `setInterval`
6886
* 80 character line length
6987

88+
#### JSX
89+
90+
* Prefer `'` over `"` for string literal props
91+
* When wrapping opening tags over multiple lines, place one prop per line
92+
* `{}` of props should hug their values (no spaces)
93+
* Place the closing `>` of opening tags on the same line as the last prop
94+
* Place the closing `/>` of self-closing tags on their own line and left-align them with the opening `<`
95+
7096
#### Objective-C
7197

7298
* Space after `@property` declarations
@@ -75,6 +101,12 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
75101
* *Try* to keep it around 80 characters line length (sometimes it's just not possible...)
76102
* `*` operator goes with the variable name (e.g. `NSObject *variableName;`)
77103

104+
#### Java
105+
106+
* If a method call spans multiple lines closing bracket is on the same line as the last argument.
107+
* If a method header doesn't fit on one line each argument goes on a separate line.
108+
* 100 character line length
109+
78110
### Documentation
79111

80112
* Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation.

Examples/2048/2048/AppDelegate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3636
* on the same Wi-Fi network.
3737
*/
3838

39-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios"];
39+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios&dev=true"];
4040

4141
/**
4242
* OPTION 2
@@ -56,7 +56,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
5656
launchOptions:launchOptions];
5757

5858
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
59-
UIViewController *rootViewController = [[UIViewController alloc] init];
59+
UIViewController *rootViewController = [UIViewController new];
6060
rootViewController.view = rootView;
6161
self.window.rootViewController = rootViewController;
6262
[self.window makeKeyAndVisible];

Examples/2048/Game2048.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ var styles = StyleSheet.create({
237237
marginBottom: 20,
238238
},
239239
tryAgain: {
240-
backgroundColor: '#887766',
240+
backgroundColor: '#887761',
241241
padding: 20,
242242
borderRadius: 5,
243243
},
@@ -279,7 +279,7 @@ var styles = StyleSheet.create({
279279
backgroundColor: '#eeeecc',
280280
},
281281
tile8: {
282-
backgroundColor: '#ffbb88',
282+
backgroundColor: '#ffbb87',
283283
},
284284
tile16: {
285285
backgroundColor: '#ff9966',

0 commit comments

Comments
 (0)