Commit Graph

126 Commits

Author SHA1 Message Date
Daniel Rodgers-Pryor 6bd6ef208b ReactCSSTransitionGroup timeouts
As discussed in issue 1326
(https://github.com/facebook/react/issues/1326) transitionend events are
unreliable; they may not fire because the element is no longer painted,
the browser tab is no longer focused or for a range of other reasons.
This is particularly harmful during leave transitions since the leaving
element will be permanently stuck in the DOM (and possibly visible).

The ReactCSSTransitionGroup now requires timeouts to be passed in
explicitly for each type of animation. Omitting the timeout duration
for a transition now triggers a PropTypes warning with a link to the
updated documentation.
2015-08-20 11:38:27 +10:00
Ben Alpert 9adcff442a Apply codemod for React -> ReactDOM split
Ran the codemod automatically then ran

```
codemod.py -m -d src '(var React\b[^\n]*;)\n\n(var ReactDOM)' '\1\n\2'
```

to clean up spacing of requires.
2015-08-10 15:24:30 -07:00
Sebastian Markbage 754ee176d0 Add property key names + type of value to fragment warning
This provides useful context in the logs to help us filter out things like
{__html:...}.
2015-08-07 20:01:03 -07:00
Sebastian Markbage cd1ab32d2f Set the owner during traverseAllChildren
This is basically just adding some context to the warning in ReactFragment
so that we can more easily find the callers.
2015-08-05 21:04:52 -07:00
Paul O’Shannessy e8d79c3548 Fix a couple lint issues as a followup for #3761 2015-07-28 17:49:53 -07:00
Paul O’Shannessy edf4d24c49 Merge pull request #3761 from alexpien/CustomClassesForReactCSSTransitionGroup
Custom class names in ReactCSSTransitionGroup
2015-07-28 16:59:51 -07:00
Toru Kobayashi 17a4dc83e0 Add runtime deprecation warning for cloneWithProps 2015-07-09 19:12:26 +09:00
Ben Alpert 07107ca936 Merge pull request #4184 from zpao/move-from-addons
Move renderSubtreeIntoContainer into ReactDOMClient
2015-07-02 22:53:47 +02:00
Kamron Batman 72b432df03 Fixed header comment spacing.
Fixed header comment spacing in the header for ReactComponentWithPureRenderMixin.
2015-07-02 09:36:52 -07:00
Paul O’Shannessy bbadc15ac1 Move renderSubtreeIntoContainer into ReactDOMClient 2015-06-20 18:08:33 -07:00
Johannes Lumpe b16f9d42b1 Guard against a null node
This could fix #2619
2015-06-19 11:21:22 +03:00
alexpien f1e524b0b1 Add support for appear and appear-active classes 2015-06-15 12:05:18 -07:00
Paul O’Shannessy a74138bdee Fix docblock of ReactFragment 2015-06-08 13:49:29 -07:00
Benjamin Woodruff f41abdf70f Enable more eslint-plugin-react rules
This should contain all the rules we probably want to use, except
react/wrap-multilines, which requires a larger codemod, and would
clutter this commit.
2015-06-04 09:43:16 -07:00
Paul O’Shannessy 6b79977c31 Merge pull request #3416 from koba04/remove-jshint
Remove the codes relating to jshint
2015-06-03 19:45:51 -07:00
Toru Kobayashi ce46068def Remove the codes relating to jshint 2015-06-04 09:32:37 +09:00
Benjamin Woodruff 17e7046754 Add custom eslint rule for warning and invariant
See #2869

Checks that the *second* argument of warning and invariant are a literal
string, or a concatination of literal strings, and that the number of
arguments is correct based on the number of %s substrings.

This commit also fixes a few places where the existing code had broken
error messages!

The rule itself is pretty straightforward, although adding the tests
ended up being a bit painful, as eslint-tester depends on mocha, and
therefore needs to be run in a separate grunt task.
2015-06-03 17:19:32 -07:00
Benjamin Woodruff c089eece50 Switch to using comma-dangle: always-multiline
This is a machine-generated codemod, but it's pretty safe since it was
generated by hooking into eslint's own report.

A few files had to be touched up by hand because there were existing
formatting issues with nested arrays/objects:

src/shared/utils/__tests__/OrderedMap-test.js
src/shared/utils/__tests__/Transaction-test.js
src/shared/utils/__tests__/traverseAllChildren-test.js
src/isomorphic/children/__tests__/ReactChildren-test.js
2015-06-02 16:57:26 -07:00
Benjamin Woodruff 21ca3f732f Enable linting for __tests__
Closes #3971.

> After #3968, the next thing we should do is start linting our tests.
> Historically we've ignored them due to lack of parser compatibility.
> But that shouldn't be a problem anymore. We may want to integrate
> https://www.npmjs.com/package/eslint-plugin-react to more aggressively
> lint our JSX in tests.

I understand this diff touches a lot of stuff, so I tried to keep it to
a near-minimal set of changes to make eslint happy.
2015-06-01 16:01:03 -07:00
Benjamin Woodruff 58fb322e21 Use babel-eslint and update eslint
-   Removes esprima-fb dependency
-   Tightens up eslintrc with some minor rules we were pretty-much
    following anyways.
-   Adds pretty colors to the `grunt lint` output
-   Breaks block-scoped-var :(
2015-05-28 09:42:55 -07:00
Ben Alpert 39402fe75d Revert "Add key warning to nested collections"
This heuristic isn't great because it relies on inspecting deep children which aren't guaranteed to be React elements. In particular, this was causing stack overflows in a component we had that used a *DOM node* as children, like `<DOMContainer>{node}</DOMContainer>`.

This reverts commits:
0a3aa8493a
64c9d9d762
0c58f4f6b1
8cf226e442
086636747f
2015-05-18 23:11:07 -07:00
Paul O’Shannessy 490d8835fc Merge pull request #3737 from Morhaus/nested-proptypes-warnings
Better warnings for nested propTypes
2015-05-16 12:09:29 -07:00
Sebastian Markbage 0b063f8a09 Reorganize Src Files for Isomorphic React Package
The new folder structure is organized around major packages that are expected to ship separately in some form.

`/isomorphic`

I moved classic/modern and children utils into a directory called "isomorphic" with the main export being ReactIsomorphic. This will eventually become the "react" package.

This includes all the dependencies that you might need to create a component without dependencies on the renderer/reconciler.

The rest moves into decoupled renderers.

`/renderers/dom/client` - This is the main renderer for DOM.

`/renderers/dom/server` - This is the server-side renderer for HTML strings.

`/addons` and `/test` - Same as before for now.

You're not supposed to take on a dependency inside another package.

Shared code is organized into a "shared" directory which is intended to support all the packages in that subdirectory. Meaning that once we swap to CommonJS modules, the only time you should use `..` is to target `../shared/` or `../../shared`.

E.g. `/shared/` is common utils that are used by everything.

`/renderers/shared/` is code that is shared by all renderers, such as the main reconciliation algorithm.

Shared code will likely be copied into each package rather than referenced. This allow us to have separate state and allow inlining and deadcode elimination.
2015-05-15 18:35:22 -07:00
Morhaus 12a43d4eee Better warnings for nested propTypes
`arrayOf`, `shape` and `objectOf` warnings now display the full path of
the invalid key.
2015-05-14 11:33:07 +02:00
alexpien 039110f8bf Allow ReactCSSTransitionGroup to also take in object containing classNames instead of relying on manipulation of the transitionName property 2015-04-27 18:56:00 -07:00
Ben Alpert 086636747f Add key warning to nested collections
Also when reusing elements in multiple contexts -- before we were mutating each element to indicate its validity; now we mutate the array containing it (which we create, in the case of rest-arg children).

Fixes #2496. Fixes #3348.
2015-04-27 14:41:25 -07:00
Jim 41348ba911 Merge pull request #3640 from jsfb/render-subtree-pass-context
Provide top level method for rendering subtree (passes context)
2015-04-22 14:29:06 -07:00
Jim c93b4245cb Provide top level method for rendering subtree (passes context) 2015-04-22 14:25:29 -07:00
Ben Alpert 302f0a1f5a Remove ReactRAFBatchingStrategy
We don't use or support this, so let's just delete it. (#3570)
2015-04-20 12:09:15 -07:00
Ben Alpert 08e4420019 Use setState transaction for TransitionGroup instead of extra property 2015-04-01 14:34:01 -07:00
Ben Alpert 205273d2ee Merge pull request #2549 from ashtuchkin/fix-transitiongroup-multiremove
Fix ReactTransitionGroup behavior when removing several children at once
2015-04-01 14:33:42 -07:00
Jeff Chan af7e43269f Fix immutability helper to check hasOwnProperty safely
This makes `update({}, {'hasOwnProperty': {$set: 'yolo'}})` work.
2015-04-01 12:25:12 -07:00
Ben Alpert 1aa4e3c234 Merge pull request #3440 from spicyj/console-error
Use console.error to show stack trace in console
2015-03-24 13:30:01 -07:00
Ben Alpert 26664315a6 Merge pull request #3438 from spicyj/lint
Lint fixes
2015-03-17 14:14:57 -07:00
cpojer fb23276178 Add warning for getDOMNode calls. 2015-03-17 14:08:04 -07:00
Ben Alpert e791fccf58 Use console.error to show stack trace in console
Better version of #3277.

Test Plan: jest, grunt test
2015-03-17 13:39:04 -07:00
Ben Alpert c34fa7f3d2 Lint fixes 2015-03-17 13:30:15 -07:00
Paul O’Shannessy bb0fc28fac Fix PureRender test to use providesModule 2015-03-16 13:56:43 -07:00
Sebastian Markbåge ca8d7cba1b Merge pull request #3355 from cpojer/shallowCompare
Add shallowCompare module and use it in PureRenderMixin + tests
2015-03-12 17:45:22 -07:00
cpojer ae7da3aadd foo.getDOMNode => React.findDOMNode(foo) 2015-03-10 17:17:21 -07:00
cpojer a1631bea71 Add shallowCompare module and use it in PureRenderMixin + tests 2015-03-09 18:49:37 -07:00
Ben Alpert 7ebf7c46f5 ReactFragment counts as a node without warning
Fixes #3286.
2015-03-01 11:50:07 -08:00
Sebastian Markbage 5a2c80382c More warnings to ReactFragment.create
Apparently I could've used these too because if you accept an arbitrary
node, then these could end up being objects, but those objects might
also be arrays or elements.
2015-02-19 15:11:49 -08:00
Henry Zhu 07cfd66028 lint: remove spaces from object braces 2015-02-19 00:10:31 -05:00
Henry Zhu e2a57920da lint whitespace , trailing comma 2015-02-13 23:13:47 -05:00
Sebastian Markbåge 032fb6ce11 Merge pull request #3107 from sebmarkbage/fragments
Warn if a non-object value is used in ReactFragment.create
2015-02-11 11:58:46 -08:00
Jim 4e5543965d Flip console.warn to use warning module so users can intercept all warnings by shimming the warning module.
The two remaining console.warns are:

/Users/jsproch/react/src/test/mock-modules.js:
   19      return mocks.generateFromMetadata(mocks.getMetadata(exports));
   20    } catch (err) {
   21:     console.warn(err);
   22      return exports;
   23    }

/Users/jsproch/react/src/vendor/core/warning.js:
   39        var argIndex = 0;
   40        var message = 'Warning: ' + format.replace(/%s/g, () => args[argIndex++]);
   41:       console.warn(message);
   42        try {
   43          // --- Welcome to debugging React ---
2015-02-10 15:23:24 -08:00
Sebastian Markbage 093ab00085 Warn if a non-object value is used in ReactFragment.create
I made this mistake while upgrading a few callers.

I'm leaving this as warning so that it is always safe to wrap any existing
child in React.addons.createFragment without breaking prod.

This makes upgrading easier.
2015-02-10 09:44:14 -08:00
Sebastian Markbage 56f51156ba Make keyed object fragments an opaque type
This triggers a warning if you try to pass a keyed object as a child.

You now have to wrap it in React.addons.createFragment(object) which
creates a proxy (in dev) which warns if it is accessed. The purpose of
this is to make these into opaque objects so that nobody relies on its
data structure.

After that we can turn it into a different data structure such as a
ReactFragment node or an iterable of flattened ReactElements.
2015-02-09 14:24:56 -08:00
Rick Beerendonk 3e0750a4ad Update copyright headers for 2015 2015-01-31 20:18:25 +01:00