Fix function declaration in if statement (#6963)
Firefox doesn't like these and throws.
Ben Alpert committed
Jun 4, 2016 at 13:37 UTC
3c3c30a19a25fd542861e97f197d22b8f4c586de
3 files changed
+7
-6
.eslintrc.js
+1
@@ -30,6 +30,7 @@ module.exports = {
30
'indent': [ERROR, 2, {SwitchCase: 1}],
31
'jsx-quotes': [ERROR, 'prefer-double'],
32
'no-bitwise': OFF,
33
+ 'no-inner-declarations': [ERROR, 'functions'],
34
'no-multi-spaces': ERROR,
35
'no-restricted-syntax': [ERROR, 'WithStatement'],
36
'no-shadow': ERROR,
scripts/bench/extract-component.js
+2
-2
@@ -112,7 +112,7 @@ function print(outerComponent) {
112
var values = keys.map((childKey) => renderedChildren[childKey]);
113
114
if (keys.length) {
115
- function dump(children) {
115
+ var dump = function(children) {
116
if (typeof children === 'boolean' || children == null) {
117
return '' + children;
118
}
@@ -130,7 +130,7 @@ function print(outerComponent) {
130
debugger;
131
throw new Error('hmm');
132
}
133
- }
133
+ };
134
135
markup += '\n';
136
var children = element.props.children;
src/isomorphic/classic/element/ReactElement.js
+4
-4
@@ -210,7 +210,7 @@ ReactElement.createElement = function(type, config, children) {
210
type;
211
212
// Create dummy `key` and `ref` property to `props` to warn users against its use
213
- function warnAboutAccessingKey() {
213
+ var warnAboutAccessingKey = function() {
214
if (!specialPropKeyWarningShown) {
215
specialPropKeyWarningShown = true;
216
warning(
@@ -223,10 +223,10 @@ ReactElement.createElement = function(type, config, children) {
223
);
224
}
225
return undefined;
226
- }
226
+ };
227
warnAboutAccessingKey.isReactWarning = true;
228
229
- function warnAboutAccessingRef() {
229
+ var warnAboutAccessingRef = function() {
230
if (!specialPropRefWarningShown) {
231
specialPropRefWarningShown = true;
232
warning(
@@ -239,7 +239,7 @@ ReactElement.createElement = function(type, config, children) {
239
);
240
}
241
return undefined;
242
- }
242
+ };
243
warnAboutAccessingRef.isReactWarning = true;
244
245
if (typeof props.$$typeof === 'undefined' ||