Skip to content

Commit e1fb6ff

Browse files
trevorlasnfacebook-github-bot
authored andcommitted
Modernize docs: remove 'use strict' from docs -- es6 has 'use strict' by default
Summary: Removed <b>'use strict'</b> from docs since ES6 Modules already use <b>'use strict'</b> by default. https://stackoverflow.com/questions/31685262/not-recommended-to-use-use-strict-in-es6 > 10.2.1 Strict Mode Code > An ECMAScript Script syntactic unit may be processed using either unrestricted or strict mode syntax and semantics. Code is interpreted as strict mode code in the following situations: > Global code is strict mode code if it begins with a Directive Prologue that contains a Use Strict Directive (see 14.1.1). Module code is always strict mode code. All parts of a ClassDeclaration or a ClassExpression are strict mode code. Eval code is strict mode code if it begins with a Directive Prologue that contains a Use Strict Directive or if the call to eval is a direct eval (see 12.3.4.1) that is contained in strict mode code. Function code is strict mode code if the associated FunctionDeclaration, FunctionExpression, GeneratorDeclaration, GeneratorExpression, MethodDefinition, or ArrowFunction is contained in strict mode code or if the code that produces the value of the function’s [[ECMAScriptCode]] internal slot begins with a Directive Prologue that contains a Use Strict Directive. Function code that is supplied as the arguments to the built-in Function and Generator constructors is strict mode code if the last argument is a String that when processed is a FunctionBody that begins with a Directive Prologue that contains a Use Strict Directive. Spec: http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code Closes #16163 Differential Revision: D5968746 Pulled By: hramos fbshipit-source-id: 308f49184b1565311d5fd71786639eaee13be60a
1 parent 992ade1 commit e1fb6ff

7 files changed

Lines changed: 4 additions & 7 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ However, there are still some styles that the linter cannot pick up.
180180
#### JavaScript
181181

182182
* Use semicolons;
183-
* `'use strict';`
183+
* ES6 standards
184184
* Prefer `'` over `"`
185185
* Do not use the optional parameters of `setTimeout` and `setInterval`
186186
* 80 character line length

docs/CommunicationAndroid.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class MainActivity extends ReactActivity {
4646
```
4747

4848
```
49-
'use strict';
5049
5150
import React from 'react';
5251
import {

docs/CommunicationIOS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
3939
```
4040

4141
```
42-
'use strict';
4342
4443
import React from 'react';
4544
import {

docs/Contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ However, there are still some styles that the linter cannot pick up.
187187
#### JavaScript
188188

189189
* Use semicolons;
190-
* `'use strict';`
190+
* ES6 standards
191191
* Prefer `'` over `"`
192192
* Do not use the optional parameters of `setTimeout` and `setInterval`
193193
* 80 character line length

docs/CustomWebViewIOS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ To use your custom web view, you'll need to create a class for it. Your class mu
151151
To get your native component, you must use `requireNativeComponent`: the same as for regular custom components. However, you must pass in an extra third argument, `WebView.extraNativeComponentConfig`. This third argument contains prop types that are only required for native code.
152152

153153
```js
154+
154155
import React, { Component, PropTypes } from 'react';
155156
import { WebView, requireNativeComponent, NativeModules } from 'react-native';
156157
const { CustomWebViewManager } = NativeModules;
@@ -176,6 +177,7 @@ const RCTCustomWebView = requireNativeComponent(
176177
CustomWebView,
177178
WebView.extraNativeComponentConfig
178179
);
180+
179181
```
180182

181183
If you want to add custom props to your native component, you can use `nativeConfig.props` on the web view. For iOS, you should also set the `nativeConfig.viewManager` prop with your custom WebView ViewManager as in the example above.

docs/IntegrationWithExistingApps.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ First, create an empty `index.js` file in the root of your React Native project.
305305
In your `index.js`, create your component. In our sample here, we will add simple `<Text>` component within a styled `<View>`
306306

307307
```javascript
308-
'use strict';
309308

310309
import React from 'react';
311310
import {
@@ -600,7 +599,6 @@ First, create an empty `index.js` file in the root of your React Native project.
600599
In your `index.js`, create your component. In our sample here, we will add simple `<Text>` component within a styled `<View>`:
601600

602601
```javascript
603-
'use strict';
604602

605603
import React from 'react';
606604
import {

docs/NativeModulesAndroid.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ protected List<ReactPackage> getPackages() {
144144
To make it simpler to access your new functionality from JavaScript, it is common to wrap the native module in a JavaScript module. This is not necessary but saves the consumers of your library the need to pull it off of `NativeModules` each time. This JavaScript file also becomes a good location for you to add any JavaScript side functionality.
145145

146146
```js
147-
'use strict';
148147
/**
149148
* This exposes the native ToastExample module as a JS module. This has a
150149
* function 'show' which takes the following parameters:

0 commit comments

Comments
 (0)