@samitouri / QOS-React / commits / cae2a6f9d3

Got rid of linting errors on windows machines and a number of linting warnings. (#8846)

Zac Braddy committed Jan 28, 2017 at 23:36 UTC cae2a6f9d3a548838fcf64e5098d226545527f47
11 files changed +95 -27
grunt/config/browserify.js
+2
@@ -96,8 +96,10 @@ function simpleBannerify(src) {
96 // Does it work? Yes.
97 // Should it go away ASAP? Yes.
98 function wrapperify(src) {
99 + /* eslint-disable max-len*/
100 var toReplace =
101 `function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.${this.data.standalone} = f()}}`;
102 + /* eslint-enable max-len */
103 if (src.indexOf(toReplace) === -1) {
104 throw new Error('wrapperify failed to find code to replace');
105 }
scripts/release-manager/cli.js
+5 -1
@@ -98,7 +98,11 @@ const app = {
98 PATH_TO_REPO = config.reactPath;
99 return config;
100 } catch (e) {
101 - console.error('Attempt to load config file failed. Please run `init` command for initial setup or make sure ~/.react-release-manager.json is valid JSON. Using a default config which may not work properly.');
101 + console.error(
102 + 'Attempt to load config file failed. Please run `init` command for initial setup or make sure ' +
103 + '~/.react-release-manager.json is valid JSON. Using a default config which may not work ' +
104 + 'properly.'
105 + );
106 return DEFAULT_CONFIG;
107 }
108 },
scripts/release-manager/commands/docs-prs.js
+2 -1
@@ -16,7 +16,8 @@ const DOCS_LABEL = 'Documentation: needs merge to stable';
16 // track progress. on fail, pause and force user to handle manually, continue? prompt
17 // git push
18 // update labels on each PR
19 -// ALT: dump link to https://github.com/facebook/react/issues?q=label%3A%22Documentation%3A+needs+merge+to+stable%22+is%3Aclosed
19 +// ALT: dump link to
20 +// https://github.com/facebook/react/issues?q=label%3A%22Documentation%3A+needs+merge+to+stable%22+is%3Aclosed
21 // and say manual step to remove label
22
23
scripts/release-manager/commands/stable-prs.js
+8 -2
@@ -131,7 +131,10 @@ module.exports = function(vorpal, app) {
131 .then((richPRs) => {
132 return richPRs.filter((pr) => {
133 if (!pr.merged_at) {
134 - this.log(`${chalk.yellow.bold('WARNING')} ${pr.html_url} was not merged, should have the milestone unset.`);
134 + this.log(
135 + `${chalk.yellow.bold('WARNING')} ${pr.html_url} was not merged,` +
136 + ` should have the milestone unset.`
137 + );
138 return false;
139 }
140 return true;
@@ -168,7 +171,10 @@ module.exports = function(vorpal, app) {
171 resolve(results);
172 })
173 .catch((err) => {
171 - this.log(`${chalk.red.bold('ERROR')} Something went wrong and your repo is probably in a bad state. Sorry.`);
174 + this.log(
175 + `${chalk.red.bold('ERROR')} Something went wrong and your repo is` +
176 + ` probably in a bad state. Sorry.`
177 + );
178 resolve({
179 successful: [],
180 skipped: [],
src/renderers/dom/fiber/ReactDOMFiber.js
+12 -2
@@ -329,7 +329,12 @@ function warnAboutUnstableUse() {
329 warned = true;
330 }
331
332 -function renderSubtreeIntoContainer(parentComponent : ?ReactComponent<any, any, any>, children : ReactNodeList, containerNode : DOMContainerElement | Document, callback: ?Function) {
332 +function renderSubtreeIntoContainer(
333 + parentComponent : ?ReactComponent<any, any, any>,
334 + children : ReactNodeList,
335 + containerNode : DOMContainerElement | Document,
336 + callback: ?Function
337 +) {
338 validateContainer(containerNode);
339
340 let container : DOMContainerElement =
@@ -370,7 +375,12 @@ var ReactDOM = {
375 return renderSubtreeIntoContainer(null, element, container, callback);
376 },
377
373 - unstable_renderSubtreeIntoContainer(parentComponent : ReactComponent<any, any, any>, element : ReactElement<any>, containerNode : DOMContainerElement | Document, callback: ?Function) {
378 + unstable_renderSubtreeIntoContainer(
379 + parentComponent : ReactComponent<any, any, any>,
380 + element : ReactElement<any>,
381 + containerNode : DOMContainerElement | Document,
382 + callback: ?Function
383 + ) {
384 invariant(
385 parentComponent != null && ReactInstanceMap.has(parentComponent),
386 'parentComponent must be a valid React Component'
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+1 -1
@@ -369,7 +369,7 @@ function updateDOMProperties(
369 isCustomComponentTag : boolean,
370 ) : void {
371 // TODO: Handle wasCustomComponentTag
372 - for (var i = 0; i < updatePayload.length; i+=2) {
372 + for (var i = 0; i < updatePayload.length; i += 2) {
373 var propKey = updatePayload[i];
374 var propValue = updatePayload[i + 1];
375 if (propKey === STYLE) {
src/renderers/shared/fiber/ReactFiber.js
+5 -1
@@ -331,7 +331,11 @@ exports.createFiberFromText = function(content : string, priorityLevel : Priorit
331 return fiber;
332 };
333
334 -function createFiberFromElementType(type : mixed, key : null | string, debugOwner : null | Fiber | ReactInstance) : Fiber {
334 +function createFiberFromElementType(
335 + type : mixed,
336 + key : null | string,
337 + debugOwner : null | Fiber | ReactInstance
338 +) : Fiber {
339 let fiber;
340 if (typeof type === 'function') {
341 fiber = shouldConstruct(type) ?
src/renderers/shared/fiber/ReactFiberCompleteWork.js
+9 -1
@@ -211,7 +211,15 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
211 // Even better would be if children weren't special cased at all tho.
212 const instance : I = workInProgress.stateNode;
213 const currentHostContext = getHostContext();
214 - const updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
214 + const updatePayload = prepareUpdate(
215 + instance,
216 + type,
217 + oldProps,
218 + newProps,
219 + rootContainerInstance,
220 + currentHostContext
221 + );
222 +
223 // TODO: Type this specific to this type of component.
224 workInProgress.updateQueue = (updatePayload : any);
225 // If the update payload indicates that there is a change or if there
src/renderers/shared/fiber/ReactFiberReconciler.js
+43 -11
@@ -49,18 +49,43 @@ export type HostConfig<T, P, I, TI, PI, C, CX, PL> = {
49 getChildHostContext(parentHostContext : CX, type : T) : CX,
50 getPublicInstance(instance : I | TI) : PI,
51
52 - createInstance(type : T, props : P, rootContainerInstance : C, hostContext : CX, internalInstanceHandle : OpaqueNode) : I,
52 + createInstance(
53 + type : T,
54 + props : P,
55 + rootContainerInstance : C,
56 + hostContext : CX,
57 + internalInstanceHandle : OpaqueNode
58 + ) : I,
59 appendInitialChild(parentInstance : I, child : I | TI) : void,
60 finalizeInitialChildren(parentInstance : I, type : T, props : P, rootContainerInstance : C) : boolean,
61
56 - prepareUpdate(instance : I, type : T, oldProps : P, newProps : P, rootContainerInstance : C, hostContext : CX) : null | PL,
57 - commitUpdate(instance : I, updatePayload : PL, type : T, oldProps : P, newProps : P, internalInstanceHandle : OpaqueNode) : void,
62 + prepareUpdate(
63 + instance : I,
64 + type : T,
65 + oldProps : P,
66 + newProps : P,
67 + rootContainerInstance : C,
68 + hostContext : CX
69 + ) : null | PL,
70 + commitUpdate(
71 + instance : I,
72 + updatePayload : PL,
73 + type : T,
74 + oldProps : P,
75 + newProps : P,
76 + internalInstanceHandle : OpaqueNode
77 + ) : void,
78 commitMount(instance : I, type : T, newProps : P, internalInstanceHandle : OpaqueNode) : void,
79
80 shouldSetTextContent(props : P) : boolean,
81 resetTextContent(instance : I) : void,
82
63 - createTextInstance(text : string, rootContainerInstance : C, hostContext : CX, internalInstanceHandle : OpaqueNode) : TI,
83 + createTextInstance(
84 + text : string,
85 + rootContainerInstance : C,
86 + hostContext : CX,
87 + internalInstanceHandle : OpaqueNode
88 + ) : TI,
89 commitTextUpdate(textInstance : TI, oldText : string, newText : string) : void,
90
91 appendChild(parentInstance : I | C, child : I | TI) : void,
@@ -78,15 +103,16 @@ export type HostConfig<T, P, I, TI, PI, C, CX, PL> = {
103
104 export type Reconciler<C, I, TI> = {
105 createContainer(containerInfo : C) : OpaqueNode,
81 - updateContainer(element : ReactNodeList, container : OpaqueNode, parentComponent : ?ReactComponent<any, any, any>) : void,
106 + updateContainer(
107 + element : ReactNodeList,
108 + container : OpaqueNode,
109 + parentComponent : ?ReactComponent<any, any, any>
110 + ) : void,
111 performWithPriority(priorityLevel : PriorityLevel, fn : Function) : void,
83 - /* eslint-disable no-undef */
84 - // FIXME: ESLint complains about type parameter
112 batchedUpdates<A>(fn : () => A) : A,
113 unbatchedUpdates<A>(fn : () => A) : A,
114 syncUpdates<A>(fn : () => A) : A,
115 deferredUpdates<A>(fn : () => A) : A,
89 - /* eslint-enable no-undef */
116
117 // Used to extract the return value from the initial render. Legacy API.
118 getPublicRootInstance(container : OpaqueNode) : (ReactComponent<any, any, any> | TI | I | null),
@@ -102,8 +128,9 @@ getContextForSubtree._injectFiber(function(fiber : Fiber) {
128 parentContext;
129 });
130
105 -module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P, I, TI, PI, C, CX, PL>) : Reconciler<C, I, TI> {
106 -
131 +module.exports = function<T, P, I, TI, PI, C, CX, PL>(
132 + config : HostConfig<T, P, I, TI, PI, C, CX, PL>
133 +) : Reconciler<C, I, TI> {
134 var {
135 scheduleUpdate,
136 getPriorityContext,
@@ -133,7 +160,12 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
160 return current;
161 },
162
136 - updateContainer(element : ReactNodeList, container : OpaqueNode, parentComponent : ?ReactComponent<any, any, any>, callback: ?Function) : void {
163 + updateContainer(
164 + element : ReactNodeList,
165 + container : OpaqueNode,
166 + parentComponent : ?ReactComponent<any, any, any>,
167 + callback: ?Function
168 + ) : void {
169 // TODO: If this is a nested container, this won't be the root.
170 const root : FiberRoot = (container.stateNode : any);
171 const current = root.current;
src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js
+4 -3
@@ -301,12 +301,13 @@ describe('ReactCompositeComponent-state', () => {
301 });
302 // We expect the same thing to happen if we bail out in the middle.
303 expect(ops).toEqual(
304 - ReactDOMFeatureFlags.useFiber ?
305 - [
304 + ReactDOMFeatureFlags.useFiber
305 + ? [
306 // Fiber works as expected
307 'child did update',
308 'parent did update',
309 - ] : [
309 + ]
310 + : [
311 // Stack treats these as two separate updates and therefore the order
312 // is inverse.
313 'parent did update',
src/renderers/shared/shared/__tests__/ReactMultiChild-test.js
+4 -4
@@ -368,16 +368,16 @@ describe('ReactMultiChild', () => {
368 'twoA componentDidMount',
369
370 ...(
371 - ReactDOMFeatureFlags.useFiber ?
372 - [
371 + ReactDOMFeatureFlags.useFiber
372 + ? [
373 'oneB componentWillMount',
374 'oneB render',
375 'twoB componentWillMount',
376 'twoB render',
377 'oneA componentWillUnmount',
378 'twoA componentWillUnmount',
379 - ] :
380 - [
379 + ]
380 + : [
381 'oneB componentWillMount',
382 'oneB render',
383 'oneA componentWillUnmount',