Skip to content

Commit

Permalink
Added double newline delimiters to the following functions/files:
Browse files Browse the repository at this point in the history
* 'getDeclarationErrorAddendum' function of ReactDOMComponent.js
* 'getSourceInfoErrorAddendum' function of ReactElementValidator.js
* 'getDeclarationErrorAddendum' function of instantiateReactComponent.js and ReactElementValidator.js
* 'traverseAllChildrenImpl' function of traverseAllChildren.js
* 'attachRef' function of ReactRef.js
* 'mountIndeterminateComponent' function of ReactFiberBeginWork.js
* 'createFiberFromElementType' function of ReactFiber.js
* 'getDeclarationErrorAddendum' function of ReactDOMSelect.js
* 'unmountComponentAtNode' function of ReactMount.js
* 'getDeclarationErrorAddendum' function of ReactControlledValuePropTypes.js
* 'checkRenderMessage' function of CSSPropertyOperations.js
* 'getDeclarationErrorAddendum' function of ReactDomFiberSelect.js
* 'getCurrentComponentErrorInfo' function in 'ReactElementValidator'
* 'getDeclarationErrorAddendum' function in ReactDOMFiberComponent.js

Fixes #8719
  • Loading branch information
richiethomas committed Jan 11, 2017
1 parent 2da35fc commit e065bbb
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/addons/__tests__/ReactFragment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('ReactFragment', () => {
'Objects are not valid as a React child (found: object with keys ' +
'{a, b, c}). If you meant to render a collection of children, use an ' +
'array instead or wrap the object using createFragment(object) from ' +
'the React add-ons. Check the render method of `Foo`.'
'the React add-ons.\n\nCheck the render method of `Foo`.'
);
});

Expand Down
6 changes: 3 additions & 3 deletions src/isomorphic/classic/element/ReactElementValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = getComponentName(ReactCurrentOwner.current);
if (name) {
return ' Check the render method of `' + name + '`.';
return '\n\nCheck the render method of `' + name + '`.';
}
}
return '';
Expand All @@ -48,7 +48,7 @@ function getSourceInfoErrorAddendum(elementProps) {
var source = elementProps.__source;
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
var lineNumber = source.lineNumber;
return ' Check your code at ' + fileName + ':' + lineNumber + '.';
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
}
return '';
}
Expand All @@ -67,7 +67,7 @@ function getCurrentComponentErrorInfo(parentType) {
var parentName = typeof parentType === 'string' ?
parentType : parentType.displayName || parentType.name;
if (parentName) {
info = ` Check the top-level render call using <${parentName}>.`;
info = `\n\nCheck the top-level render call using <${parentName}>.`;
}
}
return info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ describe('ReactElementValidator', () => {

expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Each child in an array or iterator should have a unique "key" prop. ' +
'Check the render method of `InnerClass`. ' +
'Each child in an array or iterator should have a unique "key" prop.' +
'\n\nCheck the render method of `InnerClass`. ' +
'It was passed a child from ComponentWrapper. '
);
});
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('ReactElementValidator', () => {
expectDev(console.error.calls.count()).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Each child in an array or iterator should have a unique ' +
'"key" prop. Check the top-level render call using <div>. See ' +
'"key" prop.\n\nCheck the top-level render call using <div>. See ' +
'https://fb.me/react-warning-keys for more information.\n' +
' in div (at **)'
);
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('ReactElementValidator', () => {
expectDev(console.error.calls.count()).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Each child in an array or iterator should have a unique ' +
'"key" prop. Check the render method of `Component`. See ' +
'"key" prop.\n\nCheck the render method of `Component`. See ' +
'https://fb.me/react-warning-keys for more information.\n' +
' in div (at **)\n' +
' in Component (at **)\n' +
Expand Down Expand Up @@ -342,14 +342,14 @@ describe('ReactElementValidator', () => {
ReactTestUtils.renderIntoDocument(React.createElement(ParentComp));
}).toThrowError(
'Element type is invalid: expected a string (for built-in components) ' +
'or a class/function (for composite components) but got: null. Check ' +
'or a class/function (for composite components) but got: null.\n\nCheck ' +
'the render method of `ParentComp`.'
);
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: null. Check the render method of `ParentComp`.' +
'components) but got: null.\n\nCheck the render method of `ParentComp`.' +
'\n in ParentComp'
);
});
Expand Down Expand Up @@ -551,7 +551,7 @@ describe('ReactElementValidator', () => {
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: undefined. You likely forgot to export your ' +
'component from the file it\'s defined in. Check your code at **.'
'component from the file it\'s defined in.\n\nCheck your code at **.'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ describe('ReactJSXElementValidator', () => {

expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Each child in an array or iterator should have a unique "key" prop. ' +
'Check the render method of `InnerComponent`. ' +
'Each child in an array or iterator should have a unique "key" prop.' +
'\n\nCheck the render method of `InnerComponent`. ' +
'It was passed a child from ComponentWrapper. '
);
});
Expand Down Expand Up @@ -260,26 +260,26 @@ describe('ReactJSXElementValidator', () => {
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: undefined. You likely forgot to export your ' +
'component from the file it\'s defined in. ' +
'Check your code at **.'
'component from the file it\'s defined in.' +
'\n\nCheck your code at **.'
);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: null. ' +
'Check your code at **.'
'components) but got: null.' +
'\n\nCheck your code at **.'
);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(2)[0])).toBe(
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: boolean. ' +
'Check your code at **.'
'components) but got: boolean.' +
'\n\nCheck your code at **.'
);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(3)[0])).toBe(
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: number. ' +
'Check your code at **.'
'components) but got: number.' +
'\n\nCheck your code at **.'
);
void <Div />;
expectDev(console.error.calls.count()).toBe(4);
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/dom/fiber/ReactDOMFiberComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function getDeclarationErrorAddendum() {
var ownerName = getCurrentFiberOwnerName();
if (ownerName) {
// TODO: also report the stack.
return ' This DOM node was rendered by `' + ownerName + '`.';
return '\n\nThis DOM node was rendered by `' + ownerName + '`.';
}
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/dom/fiber/wrappers/ReactDOMFiberSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var didWarnValueDefaultValue = false;
function getDeclarationErrorAddendum() {
var ownerName = getCurrentFiberOwnerName();
if (ownerName) {
return ' Check the render method of `' + ownerName + '`.';
return '\n\nCheck the render method of `' + ownerName + '`.';
}
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/dom/shared/CSSPropertyOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ if (__DEV__) {
// TODO: also report the stack.
}
if (ownerName) {
return ' Check the render method of `' + ownerName + '`.';
return '\n\nCheck the render method of `' + ownerName + '`.';
}
return '';
};
Expand Down
28 changes: 14 additions & 14 deletions src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ describe('CSSPropertyOperations', () => {
ReactDOM.render(<Comp />, root);
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: Unsupported style property background-color. Did you mean backgroundColor? ' +
'Check the render method of `Comp`.'
'Warning: Unsupported style property background-color. Did you mean backgroundColor?' +
'\n\nCheck the render method of `Comp`.'
);
});

Expand All @@ -146,12 +146,12 @@ describe('CSSPropertyOperations', () => {

expectDev(console.error.calls.count()).toBe(2);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: Unsupported style property -ms-transform. Did you mean msTransform? ' +
'Check the render method of `Comp`.'
'Warning: Unsupported style property -ms-transform. Did you mean msTransform?' +
'\n\nCheck the render method of `Comp`.'
);
expectDev(console.error.calls.argsFor(1)[0]).toEqual(
'Warning: Unsupported style property -webkit-transform. Did you mean WebkitTransform? ' +
'Check the render method of `Comp`.'
'Warning: Unsupported style property -webkit-transform. Did you mean WebkitTransform?' +
'\n\nCheck the render method of `Comp`.'
);
});

Expand All @@ -175,11 +175,11 @@ describe('CSSPropertyOperations', () => {
expectDev(console.error.calls.count()).toBe(2);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: Unsupported vendor-prefixed style property oTransform. ' +
'Did you mean OTransform? Check the render method of `Comp`.'
'Did you mean OTransform?\n\nCheck the render method of `Comp`.'
);
expectDev(console.error.calls.argsFor(1)[0]).toEqual(
'Warning: Unsupported vendor-prefixed style property webkitTransform. ' +
'Did you mean WebkitTransform? Check the render method of `Comp`.'
'Did you mean WebkitTransform?\n\nCheck the render method of `Comp`.'
);
});

Expand All @@ -202,12 +202,12 @@ describe('CSSPropertyOperations', () => {
ReactDOM.render(<Comp />, root);
expectDev(console.error.calls.count()).toBe(2);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: Style property values shouldn\'t contain a semicolon. ' +
'Check the render method of `Comp`. Try "backgroundColor: blue" instead.',
'Warning: Style property values shouldn\'t contain a semicolon.' +
'\n\nCheck the render method of `Comp`. Try "backgroundColor: blue" instead.',
);
expectDev(console.error.calls.argsFor(1)[0]).toEqual(
'Warning: Style property values shouldn\'t contain a semicolon. ' +
'Check the render method of `Comp`. Try "color: red" instead.',
'Warning: Style property values shouldn\'t contain a semicolon.' +
'\n\nCheck the render method of `Comp`. Try "color: red" instead.',
);
});

Expand All @@ -226,8 +226,8 @@ describe('CSSPropertyOperations', () => {

expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: `NaN` is an invalid value for the `fontSize` css style property. ' +
'Check the render method of `Comp`.'
'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
'\n\nCheck the render method of `Comp`.'
);
});
});
6 changes: 3 additions & 3 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ describe('ReactDOMComponent', () => {
container
);
}).toThrowError(
'This DOM node was rendered by `Owner`.'
'\n\nThis DOM node was rendered by `Owner`.'
);
});

Expand Down Expand Up @@ -1048,7 +1048,7 @@ describe('ReactDOMComponent', () => {
ReactDOM.render(<X />, container);
}).toThrowError(
'input is a void element tag and must neither have `children` ' +
'nor use `dangerouslySetInnerHTML`. This DOM node was rendered by `X`.'
'nor use `dangerouslySetInnerHTML`.\n\nThis DOM node was rendered by `X`.'
);
});

Expand Down Expand Up @@ -1143,7 +1143,7 @@ describe('ReactDOMComponent', () => {
}).toThrowError(
'The `style` prop expects a mapping from style properties to values, ' +
'not a string. For example, style={{marginRight: spacing + \'em\'}} ' +
'when using JSX. This DOM node was rendered by `Animal`.'
'when using JSX.\n\nThis DOM node was rendered by `Animal`.'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var propTypes = {
var loggedTypeFailures = {};
function getDeclarationErrorAddendum(ownerName) {
if (ownerName) {
return ' Check the render method of `' + ownerName + '`.';
return '\n\nCheck the render method of `' + ownerName + '`.';
}
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/dom/stack/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function getDeclarationErrorAddendum(internalInstance) {
if (owner) {
var name = owner.getName();
if (name) {
return ' This DOM node was rendered by `' + name + '`.';
return '\n\nThis DOM node was rendered by `' + name + '`.';
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/stack/client/ReactMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ var ReactMount = {
'_renderNewRootComponent(): Render methods should be a pure function ' +
'of props and state; triggering nested component updates from ' +
'render is not allowed. If necessary, trigger nested updates in ' +
'componentDidUpdate. Check the render method of %s.',
'componentDidUpdate.\n\nCheck the render method of %s.',
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
'ReactCompositeComponent'
);
Expand Down Expand Up @@ -572,7 +572,7 @@ var ReactMount = {
'unmountComponentAtNode(): Render methods should be a pure function ' +
'of props and state; triggering nested component updates from render ' +
'is not allowed. If necessary, trigger nested updates in ' +
'componentDidUpdate. Check the render method of %s.',
'componentDidUpdate.\n\nCheck the render method of %s.',
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
'ReactCompositeComponent'
);
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/dom/stack/client/wrappers/ReactDOMSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
return '\n\nCheck the render method of `' + name + '`.';
}
}
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shared/fiber/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function createFiberFromElementType(type : mixed, key : null | string, debugOwne
}
const ownerName = debugOwner ? getComponentName(debugOwner) : null;
if (ownerName) {
info += ' Check the render method of `' + ownerName + '`.';
info += '\n\nCheck the render method of `' + ownerName + '`.';
}
}
invariant(
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shared/fiber/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ module.exports = function<T, P, I, TI, PI, C, CX>(
let info = '';
const ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();
if (ownerName) {
info += ' Check the render method of `' + ownerName + '`.';
info += '\n\nCheck the render method of `' + ownerName + '`.';
}

let warningKey = ownerName || workInProgress._debugID || '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ describe('ReactIncrementalErrorHandling', () => {
'Element type is invalid: expected a string (for built-in components) or ' +
'a class/function (for composite components) but got: undefined. ' +
'You likely forgot to export your component from the file it\'s ' +
'defined in. Check the render method of `BrokenRender`.'
'defined in.\n\nCheck the render method of `BrokenRender`.'
)]);
expect(console.error.calls.count()).toBe(1);
});
Expand Down Expand Up @@ -796,7 +796,7 @@ describe('ReactIncrementalErrorHandling', () => {
'Element type is invalid: expected a string (for built-in components) or ' +
'a class/function (for composite components) but got: undefined. ' +
'You likely forgot to export your component from the file it\'s ' +
'defined in. Check the render method of `BrokenRender`.'
'defined in.\n\nCheck the render method of `BrokenRender`.'
)]);
expect(console.error.calls.count()).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ describe('ReactIncrementalSideEffects', () => {

expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Stateless function components cannot be given refs. ' +
'Attempts to access this ref will fail. Check the render method ' +
'Attempts to access this ref will fail.\n\nCheck the render method ' +
'of `Foo`.\n' +
' in FunctionalComponent (at **)\n' +
' in div (at **)\n' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ describe('ReactComponent', () => {
'Element type is invalid: expected a string (for built-in components) ' +
'or a class/function (for composite components) but got: undefined. ' +
'You likely forgot to export your component from the file it\'s ' +
'defined in. Check the render method of `Bar`.'
'defined in.\n\nCheck the render method of `Bar`.'
);

// One warning for each element creation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ describe('ReactCompositeComponent', () => {
'Warning: _renderNewRootComponent(): Render methods should ' +
'be a pure function of props and state; triggering nested component ' +
'updates from render is not allowed. If necessary, trigger nested ' +
'updates in componentDidUpdate. Check the render method of Outer.'
'updates in componentDidUpdate.\n\nCheck the render method of Outer.'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ describe('ReactMultiChild', () => {
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: Using Maps as children is not yet fully supported. It is an ' +
'experimental feature that might be removed. Convert it to a sequence ' +
'/ iterable of keyed ReactElements instead. Check the render method of `Parent`.'
'/ iterable of keyed ReactElements instead.\n\nCheck the render method of `Parent`.'
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('ReactStatelessComponent', () => {
expectDev(console.error.calls.count()).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Stateless function components cannot be given refs. ' +
'Attempts to access this ref will fail. Check the render method ' +
'Attempts to access this ref will fail.\n\nCheck the render method ' +
'of `ParentUsingStringRef`.\n' +
' in StatelessComponent (at **)\n' +
' in div (at **)\n' +
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('ReactStatelessComponent', () => {
expectDev(console.error.calls.count()).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Stateless function components cannot be given refs. ' +
'Attempts to access this ref will fail. Check the render method ' +
'Attempts to access this ref will fail.\n\nCheck the render method ' +
'of `ParentUsingFunctionRef`.\n' +
' in StatelessComponent (at **)\n' +
' in div (at **)\n' +
Expand Down
Loading

0 comments on commit e065bbb

Please sign in to comment.