Skip to content

Commit

Permalink
Merged master (with events -> legacy-events package rename)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 14, 2019
2 parents 441d014 + b1a03df commit 44e4109
Show file tree
Hide file tree
Showing 119 changed files with 2,316 additions and 1,473 deletions.
13 changes: 0 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ jobs:
- *run_yarn
- run: yarn test-prod --maxWorkers=2

test_coverage:
docker: *docker
environment: *environment

steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: ./scripts/circleci/test_coverage.sh

build:
docker: *docker
environment: *environment
Expand Down Expand Up @@ -257,6 +247,3 @@ workflows:
- test_fuzz:
requires:
- setup
- test_coverage:
requires:
- setup
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ module.exports = {
rules: {
// https://github.com/jest-community/eslint-plugin-jest
'jest/no-focused-tests': ERROR,
'jest/valid-expect': ERROR,
'jest/valid-expect-in-promise': ERROR,
},
},
{
Expand All @@ -140,6 +142,8 @@ module.exports = {
],

globals: {
SharedArrayBuffer: true,

spyOnDev: true,
spyOnDevAndProd: true,
spyOnProd: true,
Expand Down
11 changes: 10 additions & 1 deletion fixtures/ssr/src/components/Chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ export default class Chrome extends Component {
<Theme.Provider value={this.state.theme}>
{this.props.children}
<div>
<ThemeToggleButton onChange={theme => this.setState({theme})} />
<ThemeToggleButton
onChange={theme => {
React.unstable_withSuspenseConfig(
() => {
this.setState({theme});
},
{timeoutMs: 6000}
);
}}
/>
</div>
</Theme.Provider>
<script
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"eslint": "^6.1.0",
"eslint-config-fbjs": "^1.1.1",
"eslint-plugin-flowtype": "^2.25.0",
"eslint-plugin-jest": "^21.6.1",
"eslint-plugin-jest": "^22.15.0",
"eslint-plugin-no-for-of-loops": "^1.0.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-react": "^6.7.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ const tests = {
// Valid because the ref is captured.
code: `
function useMyThing(myRef) {
const myRef = useRef();
useEffect(() => {
const handleMove = () => {};
const node = myRef.current;
Expand Down Expand Up @@ -1024,6 +1023,28 @@ const tests = {
}
`,
},
// Ignore arguments keyword for arrow functions.
{
code: `
function Example() {
useEffect(() => {
arguments
}, [])
}
`,
},
{
code: `
function Example() {
useEffect(() => {
const bar = () => {
arguments;
};
bar();
}, [])
}
`,
},
],
invalid: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ eslintTester.run('react-hooks', ReactHooksESLintRule, {
useHook2 = () => { useState(); };
({useHook: () => { useState(); }});
({useHook() { useState(); }});
const {useHook = () => { useState(); }} = {};
const {useHook3 = () => { useState(); }} = {};
({useHook = () => { useState(); }} = {});
`,
`
Expand Down
13 changes: 7 additions & 6 deletions packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,14 @@ export default {
});
}

// Ignore references to the function itself as it's not defined yet.
const def = reference.resolved.defs[0];
if (
def != null &&
def.node != null &&
def.node.init === node.parent
) {

if (def == null) {
continue;
}

// Ignore references to the function itself as it's not defined yet.
if (def.node != null && def.node.init === node.parent) {
continue;
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('EventPluginRegistry', () => {
// The public API surface of this is covered by other tests so
// if `EventPluginRegistry` is ever deleted, these tests should be
// safe to remove too.
EventPluginRegistry = require('events/EventPluginRegistry');
EventPluginRegistry = require('legacy-events/EventPluginRegistry');

createPlugin = function(properties) {
return Object.assign({extractEvents: function() {}}, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ describe('ResponderEventPlugin', () => {
jest.resetModules();

const ReactDOMUnstableNativeDependencies = require('react-dom/unstable-native-dependencies');
EventBatching = require('events/EventBatching');
EventPluginUtils = require('events/EventPluginUtils');
EventBatching = require('legacy-events/EventBatching');
EventPluginUtils = require('legacy-events/EventPluginUtils');
ResponderEventPlugin =
ReactDOMUnstableNativeDependencies.ResponderEventPlugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let accumulate;

describe('accumulate', () => {
beforeEach(() => {
accumulate = require('events/accumulate').default;
accumulate = require('legacy-events/accumulate').default;
});

it('throws if the second item is null', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let accumulateInto;

describe('accumulateInto', () => {
beforeEach(() => {
accumulateInto = require('events/accumulateInto').default;
accumulateInto = require('legacy-events/accumulateInto').default;
});

it('throws if the second item is null', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"private": true,
"name": "events",
"name": "legacy-events",
"version": "0.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe('ReactBrowserEventEmitter', () => {
LISTENER.mockClear();

// TODO: can we express this test with only public API?
EventPluginHub = require('events/EventPluginHub');
EventPluginRegistry = require('events/EventPluginRegistry');
EventPluginHub = require('legacy-events/EventPluginHub');
EventPluginRegistry = require('legacy-events/EventPluginRegistry');
React = require('react');
ReactDOM = require('react-dom');
ReactDOMComponentTree = require('../client/ReactDOMComponentTree');
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ describe('ReactDOMComponent', () => {
if (typeof value !== 'undefined') {
re += quoteRegexp(value) + '[\\\'"]';
}
expect(new RegExp(re).test(actual)).toBe(true);
expect(actual).toMatch(new RegExp(re));
}

function genMarkup(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ describe('ReactDOMServerIntegration', () => {
});
});

describe('component hierarchies', async function() {
describe('component hierarchies', function() {
itRenders('single child hierarchies of components', async render => {
const Component = props => <div>{props.children}</div>;
let e = await render(
Expand Down
Loading

0 comments on commit 44e4109

Please sign in to comment.