Skip to content
Closed
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
7 changes: 4 additions & 3 deletions scripts/jest/test-framework-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ env.beforeEach(() => {
compare(actual) {
return {
pass: callCount === 0,
message: 'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.',
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.',
};
},
};
Expand Down
4 changes: 3 additions & 1 deletion scripts/release-manager/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module.exports = function(vorpal, app) {
{
name: 'githubToken',
type: 'input',
message: `${chalk.bold('GitHub token?')} ${chalk.grey('(needs "repo" privs)')} `,
message: `${chalk.bold('GitHub token?')} ${chalk.grey(
'(needs "repo" privs)'
)} `,
},
{
name: 'reactPath',
Expand Down
4 changes: 3 additions & 1 deletion scripts/release-manager/commands/npm-check-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module.exports = function(vorpal, app) {

if (packagesNeedingAccess.length) {
this.log(
`${chalk.red('FAILED')} You don't have access to all of the packages ` +
`${chalk.red(
'FAILED'
)} You don't have access to all of the packages ` +
`you need. We just opened a URL to file a new issue requesting access.`
);
opn(
Expand Down
8 changes: 6 additions & 2 deletions scripts/release-manager/commands/npm-grant-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ module.exports = function(vorpal, app) {

if (packagesNeedingAccess.length) {
this.log(
`${chalk.yellow('PENDING')} Granting access to ${packagesNeedingAccess}`
`${chalk.yellow(
'PENDING'
)} Granting access to ${packagesNeedingAccess}`
);
npmUtils.grantAccess(app, answers.username, packagesNeedingAccess);
this.log(
`${chalk.green('OK')} Access has been granted to ${answers.username}.`
`${chalk.green(
'OK'
)} Access has been granted to ${answers.username}.`
);
resolve();
} else {
Expand Down
3 changes: 2 additions & 1 deletion scripts/release-manager/commands/npm-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = function(vorpal, app) {
this.prompt([
{
type: 'confirm',
message: 'Did you run `grunt build` or `grunt release` and bump the version number?',
message:
'Did you run `grunt build` or `grunt release` and bump the version number?',
default: false,
name: 'checklist',
},
Expand Down
21 changes: 15 additions & 6 deletions scripts/release-manager/commands/stable-prs.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ module.exports = function(vorpal, app) {
{
name: 'destMilestone',
type: 'list',
message: 'Which milestone should we assign PRs to upon completion?',
message:
'Which milestone should we assign PRs to upon completion?',
choices: milestoneChoices,
},
{
name: 'labels',
type: 'checkbox',
message: 'Which PRs should we select (use spacebar to check all that apply)',
message:
'Which PRs should we select (use spacebar to check all that apply)',
choices: labelChoices,
},
]).then(answers => {
Expand Down Expand Up @@ -136,7 +138,9 @@ module.exports = function(vorpal, app) {
.filter(pr => {
if (!pr.merged_at) {
this.log(
`${chalk.yellow.bold('WARNING')} ${pr.html_url} was not merged,` +
`${chalk.yellow.bold(
'WARNING'
)} ${pr.html_url} was not merged,` +
` should have the milestone unset.`
);
return false;
Expand Down Expand Up @@ -180,7 +184,9 @@ module.exports = function(vorpal, app) {
})
.catch(err => {
this.log(
`${chalk.red.bold('ERROR')} Something went wrong and your repo is` +
`${chalk.red.bold(
'ERROR'
)} Something went wrong and your repo is` +
` probably in a bad state. Sorry.`
);
resolve({
Expand Down Expand Up @@ -243,13 +249,16 @@ function cherryPickPRs(app, prs) {
return this.prompt({
name: 'handle',
type: 'list',
message: `${chalk.red`Failed!`} ${chalk.yellow('This must be resolved manually!')}`,
message: `${chalk.red`Failed!`} ${chalk.yellow(
'This must be resolved manually!'
)}`,
choices: [
{value: 'ok', name: 'Continue, mark successful'},
{value: 'skip', name: 'Continue, mark skipped'},
{
value: 'abort',
name: 'Abort process. Will require manual resetting of git state.',
name:
'Abort process. Will require manual resetting of git state.',
},
],
}).then(answers => {
Expand Down
4 changes: 3 additions & 1 deletion scripts/release-manager/commands/utils/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function generateAccessNeededIssue(username, packages) {
body: `In order to publish React to npm I need access to the following repositories:
${packages.map(pkg => `- [${pkg}](https://npm.im/${pkg})`).join('\n')}`,
};
return `https://github.com/facebook/react/issues/new?${querystring.stringify(data)}`;
return `https://github.com/facebook/react/issues/new?${querystring.stringify(
data
)}`;
}

function grantAccess(app, username, packages) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/release-manager/commands/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ module.exports = function(vorpal, app) {
{
name: 'tag',
type: 'confirm',
message: 'Tag the version commit (not necessary for non-stable releases)?',
message:
'Tag the version commit (not necessary for non-stable releases)?',
default: true,
when: res => res.commit,
},
Expand Down
4 changes: 3 additions & 1 deletion scripts/rollup/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ function replaceFbjsModuleAliases(bundleType) {
}
}

const devOnlyModuleStub = `'${resolve('./scripts/rollup/shims/rollup/DevOnlyStubShim.js')}'`;
const devOnlyModuleStub = `'${resolve(
'./scripts/rollup/shims/rollup/DevOnlyStubShim.js'
)}'`;

function replaceDevOnlyStubbedModules(bundleType) {
switch (bundleType) {
Expand Down
4 changes: 3 additions & 1 deletion src/isomorphic/classic/element/ReactElementValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ function validateExplicitKey(element, parentType) {
element._owner !== ReactCurrentOwner.current
) {
// Give the component that originally created this child.
childOwner = ` It was passed a child from ${getComponentName(element._owner)}.`;
childOwner = ` It was passed a child from ${getComponentName(
element._owner,
)}.`;
}

warning(
Expand Down
6 changes: 4 additions & 2 deletions src/renderers/__tests__/ReactCompositeComponentState-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ describe('ReactCompositeComponent-state', () => {
this.setState({step: 2}, () => {
// Tests that earlier setState callbacks are not dropped
ops.push(
`callback -- step: ${this.state.step}, extra: ${!!this.state.extra}`,
`callback -- step: ${this.state.step}, extra: ${!!this.state
.extra}`,
);
});
// Treat like replaceState
Expand Down Expand Up @@ -458,7 +459,8 @@ describe('ReactCompositeComponent-state', () => {
this.setState({step: 2}, () => {
// Tests that earlier setState callbacks are not dropped
ops.push(
`callback -- step: ${this.state.step}, extra: ${!!this.state.extra}`,
`callback -- step: ${this.state.step}, extra: ${!!this.state
.extra}`,
);
});
// Treat like replaceState
Expand Down
5 changes: 2 additions & 3 deletions src/renderers/__tests__/ReactErrorBoundaries-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2001,11 +2001,10 @@ describe('ReactErrorBoundaries', () => {
ReactDOM.render(
<ErrorBoundary>
<BrokenComponentDidMountErrorBoundary
renderError={error => (
renderError={error =>
<div>
We should never catch our own error: {error.message}.
</div>
)}
</div>}
/>
</ErrorBoundary>,
container,
Expand Down
5 changes: 2 additions & 3 deletions src/renderers/__tests__/ReactIdentity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ describe('ReactIdentity', () => {

it('should allow key property to express identity', () => {
var node;
var Component = props => (
var Component = props =>
<div ref={c => (node = c)}>
<div key={props.swap ? 'banana' : 'apple'} />
<div key={props.swap ? 'apple' : 'banana'} />
</div>
);
</div>;

var container = document.createElement('div');
ReactDOM.render(<Component />, container);
Expand Down
3 changes: 2 additions & 1 deletion src/renderers/dom/ReactDOMStackEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
ComponentTree: {
getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
getClosestInstanceFromNode:
ReactDOMComponentTree.getClosestInstanceFromNode,
getNodeFromInstance: function(inst) {
// inst is an internal instance (but could be a composite)
if (inst._renderedComponent) {
Expand Down
17 changes: 11 additions & 6 deletions src/renderers/dom/fiber/ReactDOMFiberEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ let selectionInformation: ?mixed = null;
* @internal
*/
function isValidContainer(node) {
return !!(node &&
return !!(
node &&
(node.nodeType === ELEMENT_NODE ||
node.nodeType === DOCUMENT_NODE ||
node.nodeType === DOCUMENT_FRAGMENT_NODE));
node.nodeType === DOCUMENT_FRAGMENT_NODE)
);
}

function getReactRootElementInContainer(container: any) {
Expand All @@ -116,9 +118,11 @@ function getReactRootElementInContainer(container: any) {

function shouldReuseContent(container) {
const rootElement = getReactRootElementInContainer(container);
return !!(rootElement &&
return !!(
rootElement &&
rootElement.nodeType === ELEMENT_NODE &&
rootElement.getAttribute(ID_ATTRIBUTE_NAME));
rootElement.getAttribute(ID_ATTRIBUTE_NAME)
);
}

function shouldAutoFocusHostComponent(type: string, props: Props): boolean {
Expand Down Expand Up @@ -468,8 +472,9 @@ function renderSubtreeIntoContainer(
if (__DEV__) {
const isRootRenderedBySomeReact = !!container._reactRootContainer;
const rootEl = getReactRootElementInContainer(container);
const hasNonRootReactChild = !!(rootEl &&
ReactDOMComponentTree.getInstanceFromNode(rootEl));
const hasNonRootReactChild = !!(
rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl)
);

warning(
!hasNonRootReactChild || isRootRenderedBySomeReact,
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ var DOMProperty = {
ROOT_ATTRIBUTE_NAME: 'data-reactroot',

ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR +
'\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
ATTRIBUTE_NAME_CHAR:
ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',

/**
* Map from property "standard name" to an object with info about how to set
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,8 @@ describe('ReactDOMComponent', () => {
var previousLine = (matches || [])[1];

expectDev(console.error.calls.argsFor(1)[0]).toContain('onClick');
matches = console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/) || {
};
matches =
console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/) || {};
var currentLine = (matches || [])[1];

//verify line number has a proper relative difference,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2137,22 +2137,22 @@ describe('ReactDOMServerIntegration', () => {
it('should error reconnecting a div with children separated by whitespace on the client', () =>
expectMarkupMismatch(
<div id="parent"><div id="child1" /><div id="child2" /></div>,
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
// eslint-disable-next-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
));

it('should error reconnecting a div with children separated by different whitespace on the server', () =>
expectMarkupMismatch(
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
// eslint-disable-next-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
<div id="parent"><div id="child1" /><div id="child2" /></div>,
));

it('should error reconnecting a div with children separated by different whitespace', () =>
expectMarkupMismatch(
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
// prettier-ignore
<div id="parent"><div id="child1" /> <div id="child2" /></div>, // eslint-disable-line no-multi-spaces
// eslint-disable-next-line no-multi-spaces
<div id="parent"><div id="child1" /> <div id="child2" /></div>,
));

it('can distinguish an empty component from a dom node', () =>
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/eventPlugins/SelectEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ var SelectEventPlugin = {
var doc = nativeEventTarget.window === nativeEventTarget
? nativeEventTarget.document
: nativeEventTarget.nodeType === DOCUMENT_NODE
? nativeEventTarget
: nativeEventTarget.ownerDocument;
? nativeEventTarget
: nativeEventTarget.ownerDocument;
if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ if (__DEV__) {
var standardName = DOMProperty.isCustomAttribute(lowerCasedName)
? lowerCasedName
: DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName)
? DOMProperty.getPossibleStandardName[lowerCasedName]
: null;
? DOMProperty.getPossibleStandardName[lowerCasedName]
: null;

var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(
lowerCasedName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ var WheelEventInterface = {
? event.deltaY
: // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event
? -event.wheelDeltaY
: // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
? -event.wheelDeltaY
: // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var ReactDOMIDOperations = require('ReactDOMIDOperations');
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
processChildrenUpdates:
ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,

replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup,
};
Expand Down
12 changes: 8 additions & 4 deletions src/renderers/dom/stack/client/ReactMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ function hasNonRootReactChild(container) {
*/
function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl &&
return !!(
rootEl &&
isReactNode(rootEl) &&
!ReactDOMComponentTree.getInstanceFromNode(rootEl));
!ReactDOMComponentTree.getInstanceFromNode(rootEl)
);
}

/**
Expand All @@ -218,10 +220,12 @@ function nodeIsRenderedByOtherInstance(container) {
* @internal
*/
function isValidContainer(node) {
return !!(node &&
return !!(
node &&
(node.nodeType === ELEMENT_NODE ||
node.nodeType === DOCUMENT_NODE ||
node.nodeType === DOCUMENT_FRAGMENT_NODE));
node.nodeType === DOCUMENT_FRAGMENT_NODE)
);
}

/**
Expand Down
Loading