Commit Graph

1376 Commits

Author SHA1 Message Date
Paul O’Shannessy 47ee780caf [lint] fix consistent-returns 2015-01-13 15:26:33 -08:00
Paul O’Shannessy 2126600c37 [lint] disable a couple rules since rest args aren't processed right 2015-01-13 15:26:33 -08:00
Paul O’Shannessy 847357e42e [lint] Fix reasonable lines to 80
I don't agree with 80 on principal but it's what we have for now.

This fixes the reasonable cases. Most of the long lines are in docblocks
with long type information or containing links.
2015-01-13 15:26:33 -08:00
Paul O’Shannessy e27da99731 [lint] Fix majority of issues eslint found 2015-01-13 15:26:33 -08:00
Paul O’Shannessy df2ddc5dfa [lint] convert to single quotes 2015-01-13 15:26:33 -08:00
Paul O’Shannessy df64a67b7f codemod "use strict" to 'use strict' for better linting 2015-01-13 15:26:32 -08:00
Jim fa40eefa00 Merge pull request #2818 from jsfb/unmasked-context-in-performContextUpdate
Context warning should fire on update, not just initial mount.
Renamed a couple instances of context
2015-01-13 15:05:45 -08:00
Paul O’Shannessy aeffbef21f Merge pull request #2662 from zpao/eslint
Use eslint
2015-01-13 14:03:16 -08:00
Paul O’Shannessy 3f8d4eaa63 Use eslint
These rules are very close to what we have internally. We may still miss
a couple things (jsdoc params being a big one) but it's good enough.
This is also more restrictive than what we enforce internally, but it's
for the best.
2015-01-13 14:01:34 -08:00
Sebastian Markbage 2330962d25 Warn when defined methods are used in plain JS classes
In ReactClass we use early validation to warn you if a accidentally defined
propTypes in the wrong place or if you mispelled componentShouldUpdate.

For plain JS classes there is no early validation process. Therefore, we
wait to do this validation until the component is mounted before we issue
the warning.

This should bring us to warning-parity with ReactClass.
2015-01-13 11:29:28 -08:00
Sebastian Markbage ff032dc857 Introducing ReactComponentBase base class
This is the base class that will be used by ES6 classes.

I'm only moving setState and forceUpdate to this base class and the other
functions are disabled for modern classes as we're intending to deprecate
them. The base classes only have getters that warn if accessed. It's as if
they didn't exist.

ReactClass now extends ReactComponentBase but also adds the deprecated
methods. They are not yet fully deprecated on the ReactClass API.

I added some extra tests to composite component which we weren't testing
to avoid regressions.

I also added some test for ES6 classes. These are not testing the new
state initialization process. That's coming in a follow up.
2015-01-13 10:54:19 -08:00
Jim e4842b4ae2 Context warning should fire on update, not just initial mount.
Renamed a couple instances of context to make it clear if it was masked/unmasked
2015-01-12 16:40:08 -08:00
Paul O’Shannessy 5394acdb4b Merge pull request #2799 from stkb/master
Wrap setInnerHTML in Windows 8 apps (Fixes #441)
2015-01-07 16:47:32 -08:00
Paul O’Shannessy 4772967e29 Remove period from findDOMNode test filename 2015-01-07 15:16:31 -08:00
Paul O’Shannessy 6204aeec7d Merge pull request #2822 from zpao/rm-immutable
Remove LegacyImmutableObject
2015-01-07 13:27:21 -08:00
Jim 9514861d93 Merge pull request #2814 from jsfb/testutils-consolemock
Added jasmine matcher that expects calls to console.warn.
2015-01-07 13:10:53 -08:00
Paul O’Shannessy 7863175cd9 Remove LegacyImmutableObject
We don't use it and it's not part of the build so nobody else is using
it. You should probably use immutable instead anyway.
2015-01-07 11:37:52 -08:00
Jim bd4aff062d Added jasmine matcher that expects calls to console.warn. 2015-01-06 14:05:37 -08:00
Jim e5b3f9aefa Merge pull request #2520 from jsfb/warn-for-dangerouslySetInnerHtml
Added checks for incorrect usage of innerHTML. Fixes #1370
2015-01-05 13:39:16 -08:00
Jim 158e0dd35a Merge pull request #2614 from jsfb/monitor-should-update-owner-is-useful
Find cases where shouldUpdateReactComponent is det
2015-01-05 13:32:43 -08:00
Jim f507ba3c2b Minor updates to findDOMNode, as per additional post-commit CR feedback. 2015-01-05 13:26:35 -08:00
Steve Baker 9c55b961d3 code formatting fixes 2015-01-05 18:21:53 +01:00
Steve Baker 3287ea52fe Wrap setInnerHTML in Windows 8 apps 2015-01-02 20:28:58 +01:00
Sebastian Markbåge 82a30268a3 Merge pull request #2767 from sebmarkbage/moderntypevalidation
Add late class validation warnings for statics
2014-12-29 12:45:49 -05:00
Sebastian Markbage 82d15c8fd5 Add late class validation warnings for statics
ES6 classes won't have an early validation step. Therefore I added some
extra validation later on in the process. These would've normally have
been caught by createClass in classic React.
2014-12-29 12:43:40 -05:00
Sebastian Markbåge 9cd290a8c8 Merge pull request #2783 from dylanharrington/master
Fix typo in warning for invalid reused markup
2014-12-29 12:14:22 -05:00
Sebastian Markbåge bd5a91a55c Merge pull request #2768 from sebmarkbage/duplicatetests
Removed some duplicate tests
2014-12-29 09:10:26 -08:00
Dylan Harrington 159ba54b8c Fix typo in warning message for invalid reused markup 2014-12-29 01:55:16 -08:00
Sebastian Markbåge 11f83c1fa0 Merge pull request #2769 from sebmarkbage/breakonwarning
Throw a caught error in the default warning module
2014-12-25 14:47:34 -08:00
Paul O’Shannessy 20c43d4ec8 Fixup jsdoc for findDOMNode 2014-12-23 15:56:05 -08:00
Paul O’Shannessy b2bf83ec85 Temporarily fix EmptyComponents
This a workaround for the problem described in #2770. It should be
temporary because this is really just working around the real problem.
2014-12-23 15:33:53 -08:00
Sebastian Markbage f1bab136d0 Throw a caught error in the default warning module
This throws an error that is immediately caught. This allows you to use the
debugger's "break on caught exception" feature to break on warnings.

This should help with tracking down these warnings using the stack.

However, it could also add more noise to other debugging pattern.
2014-12-23 14:21:04 -08:00
Sebastian Markbage 8864692237 Removed some duplicate tests
These tests are duplicates of the same test in the same file. Copy/paste
fail.
2014-12-23 13:59:11 -08:00
Paul O’Shannessy 3fec78638d v0.13.0-alpha.1
Bumping version numbers so we can push to npm.
2014-12-23 12:04:23 -08:00
Jim e0725341cf Merge pull request #2646 from jsfb/getDOMNode-becomes-findDOMNode
Added findDOMNode, as we move toward deprecating getDOMNode
2014-12-22 13:05:49 -08:00
Sebastian Markbage cea2c38733 Separate createElement and JSX tests
This essentially copies all classic element creation tests to the modern
JSX tests. The classic tests doesn't use JSX and modern tests do.

The idea is that the JSX tests can start dropping dynamic checks once
we have Flow support for those features. JSX won't be necessary for
dropping dynamic checks. Plain object will also work. Flow will also not
be necessary for JSX. However, the tests should test for the suggested
combination (JSX + Flow).

This also moves some misplaced tests to ReactDOM and Validator.

Note that the modern tests uses ES6 classes. I will add separate tests for
those. However, these are not guaranteed to have .displayName so all our
error messages should check .name if available instead. This should be
better abstracted but I just adhoc fix this for now.
2014-12-18 16:13:29 -08:00
Jim a463191bb2 Find cases where shouldUpdateReactComponent is determined by the owner. 2014-12-18 14:24:09 -08:00
Jim b46a6ce4bb Added findDOMNode, as we move toward deprecating getDOMNode 2014-12-18 13:55:44 -08:00
Sebastian Markbage e31f23fc2a Add placeholders for static prop type tests
This is where tests of static prop types should go when we have the
infrastructure set up to handle it.
2014-12-18 13:52:56 -08:00
Sebastian Markbage 019028bec4 Renamed classic/propTypes to classic/types
I want to create a parallel folder for static type checking in the
"modern" folder so lets use the generic "types" name.
2014-12-18 13:40:32 -08:00
Sebastian Markbåge 7354a699ff Revert "Monitoring code use of cloneWithProps" 2014-12-18 12:13:09 -08:00
Paul O’Shannessy 50a0d69961 Protect better against createElement(null/undefined)
This adds a warning to React.createElement in __DEV__ about using null
or undefined. This is technically valid since element creation can be
considered safe and usable in multiple rendering environments. But
rendering in a DOM environment with an element with null/undefined type
is not safe.
2014-12-17 10:38:02 -08:00
Paul O’Shannessy 63d8e0c144 Fix lint 2014-12-14 15:22:24 -08:00
Paul O’Shannessy 0b0fa760cc Merge pull request #2647 from zpao/text-component-expect
Add toBeTextComponentWithValue to reactComponentExpect
2014-12-14 14:33:37 -08:00
Paul O’Shannessy c46dadea55 Remove deprecated methods since 0.12 shipped 2014-12-14 14:19:44 -08:00
Paul O’Shannessy c9fb5b258e Add toBeTextComponentWithValue to reactComponentExpect
This was previously possible by looking at renderedChildren and props
but this feels better.
2014-12-14 14:12:29 -08:00
Sebastian Markbage 801e953334 Move ReactClass, ReactElement and ReactPropTypes into "traditional"
This moves ReactClass, ReactElement and ReactPropTypes into a legacy folder
but since it's not quite legacy yet, I call it "classic".

These are "classic" because they are decoupled and can be replaced by
ES6 classes, JSX and Flow respectively.

This also extracts unit tests from ReactCompositeComponent, which was
terribly overloaded, into the new corresponding test suites.

There is one weird case for ReactContextValidator. This actually happens in
core, and technically belongs to ReactCompositeComponent. I'm not sure
we will be able to statically validate contexts so this might be a case
for dynamic checks even in the future. Leaving the unit tests in classic
until we can figure out what to do with them.
2014-12-12 17:54:35 -08:00
Paul O’Shannessy 80ed4d870a Merge pull request #2690 from salier/before-input
Combine BeforeInput and Composition event plugins
2014-12-11 17:08:26 -08:00
Jim 74f5b21758 Fixed ReactTestUtils scry for TextComponents. Fixes issue #2654. 2014-12-11 13:12:35 -08:00
Isaac Salier-Hellendag 9ad0e1d846 Update BeforeInputEventPlugin.js 2014-12-10 11:36:39 -05:00