Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function declaration in if statement #6963

Merged
merged 1 commit into from
Jun 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'indent': [ERROR, 2, {SwitchCase: 1}],
'jsx-quotes': [ERROR, 'prefer-double'],
'no-bitwise': OFF,
'no-inner-declarations': [ERROR, 'functions'],
'no-multi-spaces': ERROR,
'no-restricted-syntax': [ERROR, 'WithStatement'],
'no-shadow': ERROR,
Expand Down
4 changes: 2 additions & 2 deletions scripts/bench/extract-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function print(outerComponent) {
var values = keys.map((childKey) => renderedChildren[childKey]);

if (keys.length) {
function dump(children) {
var dump = function(children) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to write var dump = function dump(children) { to keep function names in stack trace

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code have here is fine for what I use it for.

if (typeof children === 'boolean' || children == null) {
return '' + children;
}
Expand All @@ -130,7 +130,7 @@ function print(outerComponent) {
debugger;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is only used interactively and that's an error case.

throw new Error('hmm');
}
}
};

markup += '\n';
var children = element.props.children;
Expand Down
8 changes: 4 additions & 4 deletions src/isomorphic/classic/element/ReactElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ ReactElement.createElement = function(type, config, children) {
type;

// Create dummy `key` and `ref` property to `props` to warn users against its use
function warnAboutAccessingKey() {
var warnAboutAccessingKey = function() {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
warning(
Expand All @@ -223,10 +223,10 @@ ReactElement.createElement = function(type, config, children) {
);
}
return undefined;
}
};
warnAboutAccessingKey.isReactWarning = true;

function warnAboutAccessingRef() {
var warnAboutAccessingRef = function() {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
warning(
Expand All @@ -239,7 +239,7 @@ ReactElement.createElement = function(type, config, children) {
);
}
return undefined;
}
};
warnAboutAccessingRef.isReactWarning = true;

if (typeof props.$$typeof === 'undefined' ||
Expand Down