Try to re-enable Prettier

This commit is contained in:
Dan Abramov
2017-06-15 00:30:50 +01:00
parent 83d0dc4989
commit 5b89c1bb2d
29 changed files with 123 additions and 97 deletions
+4 -3
View File
@@ -46,9 +46,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.'
};
}
};
+4 -3
View File
@@ -44,9 +44,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.'
};
}
};
+4 -3
View File
@@ -47,9 +47,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.'
};
}
};
+4 -3
View File
@@ -45,9 +45,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.'
};
}
};
+4 -3
View File
@@ -45,9 +45,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.'
};
}
};
+4 -3
View File
@@ -41,9 +41,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.'
};
}
};
+4 -3
View File
@@ -41,9 +41,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.'
};
}
};
+1 -2
View File
@@ -23,8 +23,7 @@ fi
# These seem out of order but extract-errors must be run after jest.
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp lint')
# Temporary: I can't figure out why it fails on CI but works locally
# COMMANDS_TO_RUN+=('node ./scripts/prettier/index')
COMMANDS_TO_RUN+=('node ./scripts/prettier/index')
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp flow')
COMMANDS_TO_RUN+=('./node_modules/.bin/grunt build')
COMMANDS_TO_RUN+=('./scripts/circleci/test_extract_errors.sh')
@@ -40,7 +40,7 @@ function typeCheckFailRequiredValues(declaration) {
'`testComponent`, but its value is `null`.';
var unspecifiedMsg =
'The prop `testProp` is marked as required in ' +
'`testComponent`, but its value is \`undefined\`.';
'`testComponent`, but its value is `undefined`.';
var props1 = {testProp: null};
var error1 = declaration(
props1,
+2 -1
View File
@@ -47,7 +47,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) {
@@ -84,10 +84,10 @@ var reactTopListenersCounter = 0;
var topEventMapping = {
topAbort: 'abort',
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
topAnimationIteration: getVendorPrefixedEventName('animationiteration') ||
'animationiteration',
topAnimationStart: getVendorPrefixedEventName('animationstart') ||
'animationstart',
topAnimationIteration:
getVendorPrefixedEventName('animationiteration') || 'animationiteration',
topAnimationStart:
getVendorPrefixedEventName('animationstart') || 'animationstart',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
@@ -144,8 +144,8 @@ var topEventMapping = {
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topTransitionEnd: getVendorPrefixedEventName('transitionend') ||
'transitionend',
topTransitionEnd:
getVendorPrefixedEventName('transitionend') || 'transitionend',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel',
@@ -209,8 +209,10 @@ var ReactBrowserEventEmitter = Object.assign({}, ReactEventEmitterMixin, {
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function() {
return !!(ReactBrowserEventEmitter.ReactEventListener &&
ReactBrowserEventEmitter.ReactEventListener.isEnabled());
return !!(
ReactBrowserEventEmitter.ReactEventListener &&
ReactBrowserEventEmitter.ReactEventListener.isEnabled()
);
},
/**
+15 -11
View File
@@ -216,9 +216,11 @@ function hasNonRootReactChild(container) {
*/
function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl &&
return !!(
rootEl &&
isReactNode(rootEl) &&
!ReactDOMComponentTree.getInstanceFromNode(rootEl));
!ReactDOMComponentTree.getInstanceFromNode(rootEl)
);
}
/**
@@ -229,10 +231,12 @@ function nodeIsRenderedByOtherInstance(container) {
* @internal
*/
function isValidContainer(node) {
return !!(node &&
return !!(
node &&
(node.nodeType === ELEMENT_NODE_TYPE ||
node.nodeType === DOC_NODE_TYPE ||
node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)
);
}
/**
@@ -445,13 +449,13 @@ var ReactMount = {
? " Instead of passing a string like 'div', pass " +
"React.createElement('div') or <div />."
: typeof nextElement === 'function'
? ' Instead of passing a class like Foo, pass ' +
'React.createElement(Foo) or <Foo />.'
: // Check if it quacks like an element
nextElement != null && nextElement.props !== undefined
? ' This may be caused by unintentionally loading two independent ' +
'copies of React.'
: '',
? ' Instead of passing a class like Foo, pass ' +
'React.createElement(Foo) or <Foo />.'
: // Check if it quacks like an element
nextElement != null && nextElement.props !== undefined
? ' This may be caused by unintentionally loading two independent ' +
'copies of React.'
: '',
);
warning(
@@ -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,
+2 -2
View File
@@ -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
@@ -20,7 +20,8 @@ var ReactDOMIDOperations = require('ReactDOMIDOperations');
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
processChildrenUpdates:
ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup,
};
@@ -59,8 +59,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,
+2 -1
View File
@@ -41,7 +41,8 @@ var ReactNative = {
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
/* eslint-enable camelcase */
unmountComponentAtNodeAndRemoveContainer: ReactNativeMount.unmountComponentAtNodeAndRemoveContainer,
unmountComponentAtNodeAndRemoveContainer:
ReactNativeMount.unmountComponentAtNodeAndRemoveContainer,
};
// Inject the runtime into a devtools global hook regardless of browser.
@@ -15,9 +15,11 @@ var ReactNativeDOMIDOperations = require('ReactNativeDOMIDOperations');
var ReactNativeReconcileTransaction = require('ReactNativeReconcileTransaction');
var ReactNativeComponentEnvironment = {
processChildrenUpdates: ReactNativeDOMIDOperations.dangerouslyProcessChildrenUpdates,
processChildrenUpdates:
ReactNativeDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkup: ReactNativeDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
replaceNodeWithMarkup:
ReactNativeDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* @param {DOMElement} Element to clear.
+8 -6
View File
@@ -118,9 +118,10 @@ function getTreeSnapshot(registeredIDs) {
updateCount: ReactComponentTreeHook.getUpdateCount(id),
childIDs: ReactComponentTreeHook.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID ||
(parentID && ReactComponentTreeHook.getOwnerID(parentID)) ||
0,
ownerID:
ownerID ||
(parentID && ReactComponentTreeHook.getOwnerID(parentID)) ||
0,
parentID,
};
return tree;
@@ -205,9 +206,10 @@ function endLifeCycleTimer(debugID, timerType) {
currentFlushMeasurements.push({
timerType,
instanceID: debugID,
duration: performanceNow() -
currentTimerStartTime -
currentTimerNestedFlushDuration,
duration:
performanceNow() -
currentTimerStartTime -
currentTimerNestedFlushDuration,
});
}
currentTimerStartTime = 0;
@@ -50,9 +50,9 @@ describe('ReactCoroutine', () => {
function HandleYields(props, yields) {
ops.push('HandleYields');
return yields.map(y => (
<y.continuation isSame={props.foo === y.props.bar} />
));
return yields.map(y =>
<y.continuation isSame={props.foo === y.props.bar} />,
);
}
// An alternative API could mark Parent as something that needs
@@ -159,8 +159,9 @@ describe('ReactHostOperationHistoryHook', () => {
{
instanceID: inst._debugID,
type: 'mount',
payload: '<div style="color:red;background-color:yellow;" ' +
'data-reactroot="" data-reactid="1"></div>',
payload:
'<div style="color:red;background-color:yellow;" ' +
'data-reactroot="" data-reactid="1"></div>',
},
]);
}
@@ -279,8 +280,9 @@ describe('ReactHostOperationHistoryHook', () => {
{
instanceID: inst._debugID,
type: 'mount',
payload: '<div class="rad" tabindex="42" data-reactroot="" ' +
'data-reactid="1"></div>',
payload:
'<div class="rad" tabindex="42" data-reactroot="" ' +
'data-reactid="1"></div>',
},
]);
}
@@ -382,8 +384,9 @@ describe('ReactHostOperationHistoryHook', () => {
{
instanceID: inst._debugID,
type: 'mount',
payload: '<div data-x="rad" data-y="42" data-reactroot="" ' +
'data-reactid="1"></div>',
payload:
'<div data-x="rad" data-y="42" data-reactroot="" ' +
'data-reactid="1"></div>',
},
]);
}
@@ -460,8 +463,9 @@ describe('ReactHostOperationHistoryHook', () => {
{
instanceID: inst._debugID,
type: 'mount',
payload: '<my-component className="rad" tabIndex="42" ' +
'data-reactroot="" data-reactid="1"></my-component>',
payload:
'<my-component className="rad" tabIndex="42" ' +
'data-reactroot="" data-reactid="1"></my-component>',
},
]);
}
@@ -322,10 +322,10 @@ function setResponderAndExtractTransfer(
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: topLevelType === 'topSelectionChange'
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: topLevelType === 'topSelectionChange'
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
// TODO: stop one short of the current responder.
var bubbleShouldSetFrom = !responderInst
@@ -519,8 +519,8 @@ var ResponderEventPlugin = {
var incrementalTouch = isResponderTouchStart
? eventTypes.responderStart
: isResponderTouchMove
? eventTypes.responderMove
: isResponderTouchEnd ? eventTypes.responderEnd : null;
? eventTypes.responderMove
: isResponderTouchEnd ? eventTypes.responderEnd : null;
if (incrementalTouch) {
var gesture = ResponderSyntheticEvent.getPooled(
@@ -43,10 +43,10 @@ var TouchHistoryMath = {
total += ofCurrent && isXAxis
? oneTouchData.currentPageX
: ofCurrent && !isXAxis
? oneTouchData.currentPageY
: !ofCurrent && isXAxis
? oneTouchData.previousPageX
: oneTouchData.previousPageY;
? oneTouchData.currentPageY
: !ofCurrent && isXAxis
? oneTouchData.previousPageX
: oneTouchData.previousPageY;
count = 1;
}
} else {
@@ -69,12 +69,12 @@ var _touchConfig = function(
var activeTouchObjects = topType === 'topTouchStart'
? allTouchObjects
: topType === 'topTouchMove'
? allTouchObjects
: topType === 'topTouchEnd'
? antiSubsequence(allTouchObjects, changedIndices)
: topType === 'topTouchCancel'
? antiSubsequence(allTouchObjects, changedIndices)
: null;
? allTouchObjects
: topType === 'topTouchEnd'
? antiSubsequence(allTouchObjects, changedIndices)
: topType === 'topTouchCancel'
? antiSubsequence(allTouchObjects, changedIndices)
: null;
return {
nativeEvent: touchEvent(
@@ -22,9 +22,11 @@ import type {ReactInstance} from 'ReactInstanceType';
* @final
*/
function isValidOwner(object: any): boolean {
return !!(object &&
return !!(
object &&
typeof object.attachRef === 'function' &&
typeof object.detachRef === 'function');
typeof object.detachRef === 'function'
);
}
/**
@@ -31,12 +31,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);
+1 -1
View File
@@ -134,7 +134,7 @@ var TransactionImpl = {
E,
F,
G,
T: (a: A, b: B, c: C, d: D, e: E, f: F) => G
T: (a: A, b: B, c: C, d: D, e: E, f: F) => G,
>(method: T, scope: any, a: A, b: B, c: C, d: D, e: E, f: F): G {
/* eslint-enable space-before-function-paren */
invariant(
@@ -64,7 +64,8 @@ Object.assign(ShallowComponentWrapper.prototype, ReactCompositeComponent, {
return new NoopInternalComponent(element);
},
_replaceNodeWithMarkup: function() {},
_renderValidatedComponent: ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext,
_renderValidatedComponent:
ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext,
});
function _batchedRender(renderer, element, context) {
+3 -2
View File
@@ -156,8 +156,9 @@ var ReactTestUtils = {
var internalInstance = ReactInstanceMap.get(inst);
var constructor = internalInstance._currentElement.type;
return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
constructor === type);
return !!(
ReactTestUtils.isCompositeComponentElement(inst) && constructor === type
);
},
getRenderedChildOfCompositeComponent: function(inst) {