Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
add codes to suppressions in www
Browse files Browse the repository at this point in the history
Summary:
This updates `www` suppressions to use error codes.

This diff was generated by running

```
~/fbsource/fbcode/flow/tool update-suppressions ~/www --bin ~/fbsource/fbcode/flow/facebook/flowd
hg status -n --rev master | xargs -P 20 -n 1000 prettier --write --require-pragma
hg status -n --rev master | xargs grep -P -l '@(partially-)?generated' | xargs hg revert -r master
hg status -n --rev master | xargs grep -P -l 'lightSyntaxTransform' | xargs hg revert -r master
flow --json | jq -r '.errors[] | .message[] | .loc.source' | sort -u | xargs hg revert -r master
arc rebuild
hg st -n | xargs -n 500 hg commit -m "[Flow][Codemod] add codes to suppressions in www"
```

on top of D22399626

bypass-lint
allow_many_files
drop-conflicts

Reviewed By: pieterv

Differential Revision: D22462377

fbshipit-source-id: 5c1d51e5b000a734c770d7a3e6b70fdf209cf154
  • Loading branch information
dsainati1 authored and facebook-github-bot committed Jul 10, 2020
1 parent fb728fd commit 8457ebb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/component/base/__tests__/DraftEditor.react-test.js
Expand Up @@ -17,7 +17,7 @@ const DraftEditor = require('DraftEditor.react');
const EditorState = require('EditorState');
const React = require('React');

// $FlowFixMe
// $FlowFixMe[cannot-resolve-module]
const ReactShallowRenderer = require('react-test-renderer/shallow');

let shallow;
Expand Down
32 changes: 17 additions & 15 deletions src/component/contents/__tests__/DraftEditorTextNode-test.js
Expand Up @@ -34,21 +34,21 @@ const renderIntoContainer = element => {
};

const initializeAsIE = () => {
/* $FlowFixMe(>=0.99.0 site=www) This comment suppresses an error found when
* Flow v0.47 was deployed. To see the error delete this comment and run
* Flow. */
/* $FlowFixMe[prop-missing] (>=0.99.0 site=www) This comment suppresses an
* error found when Flow v0.47 was deployed. To see the error delete this
* comment and run Flow. */
UserAgent.isBrowser.mockImplementation(() => true);
};

const initializeAsNonIE = () => {
/* $FlowFixMe(>=0.99.0 site=www) This comment suppresses an error found when
* Flow v0.47 was deployed. To see the error delete this comment and run
* Flow. */
/* $FlowFixMe[prop-missing] (>=0.99.0 site=www) This comment suppresses an
* error found when Flow v0.47 was deployed. To see the error delete this
* comment and run Flow. */
UserAgent.isBrowser.mockImplementation(() => false);
};

const expectPopulatedSpan = (stub, testString) => {
// $FlowExpectedError node could be null
// $FlowExpectedError[incompatible-type] node could be null
const node: Element = ReactDOM.findDOMNode(stub);
expect(node.tagName).toBe('SPAN');
expect(node.childNodes.length).toBe(1);
Expand All @@ -60,7 +60,8 @@ test('must initialize correctly with an empty string, non-IE', function() {
const stub = renderIntoContainer(
<DraftEditorTextNode>{''}</DraftEditorTextNode>,
);
// $FlowExpectedError we know node is an Element
// $FlowExpectedError[incompatible-use] we know node is an Element
// $FlowExpectedError[prop-missing] we know node is an Element
expect(ReactDOM.findDOMNode(stub).tagName).toBe('BR');
});

Expand Down Expand Up @@ -149,13 +150,13 @@ test('must skip updates if text already matches DOM, non-IE', function() {

renderIntoContainer(<DraftEditorTextNode>{TEST_A}</DraftEditorTextNode>);

// $FlowExpectedError property render is missing in HTMLDivElement
// $FlowExpectedError[prop-missing] property render is missing in HTMLDivElement
expect(stub.render.mock.calls.length).toBe(0);

// Sanity check that updating is performed when appropriate.
renderIntoContainer(<DraftEditorTextNode>{TEST_B}</DraftEditorTextNode>);

// $FlowExpectedError property render is missing in HTMLDivElement
// $FlowExpectedError[prop-missing] property render is missing in HTMLDivElement
expect(stub.render.mock.calls.length).toBe(1);
});

Expand All @@ -169,13 +170,13 @@ test('must skip updates if text already matches DOM, IE', function() {

renderIntoContainer(<DraftEditorTextNode>{TEST_A}</DraftEditorTextNode>);

// $FlowExpectedError property render is missing in HTMLDivElement
// $FlowExpectedError[prop-missing] property render is missing in HTMLDivElement
expect(stub.render.mock.calls.length).toBe(0);

// Sanity check that updating is performed when appropriate.
renderIntoContainer(<DraftEditorTextNode>{TEST_B}</DraftEditorTextNode>);

// $FlowExpectedError property render is missing in HTMLDivElement
// $FlowExpectedError[prop-missing] property render is missing in HTMLDivElement
expect(stub.render.mock.calls.length).toBe(1);
});

Expand All @@ -187,7 +188,8 @@ test('must update from non-empty to empty, non-IE', function() {

renderIntoContainer(<DraftEditorTextNode>{''}</DraftEditorTextNode>);

// $FlowExpectedError we know node is an Element
// $FlowExpectedError[incompatible-use] we know node is an Element
// $FlowExpectedError[prop-missing] we know node is an Element
expect(ReactDOM.findDOMNode(stub).tagName).toBe('BR');
});

Expand Down Expand Up @@ -217,11 +219,11 @@ test('must force unchanged text back into the DOM', function() {
<DraftEditorTextNode>{TEST_A}</DraftEditorTextNode>,
);

// $FlowExpectedError we know node is not null
// $FlowExpectedError[incompatible-use] we know node is not null
ReactDOM.findDOMNode(stub).textContent = TEST_B;

renderIntoContainer(<DraftEditorTextNode>{TEST_A}</DraftEditorTextNode>);

// $FlowExpectedError we know node is not null
// $FlowExpectedError[incompatible-use] we know node is not null
expect(ReactDOM.findDOMNode(stub).textContent).toBe(TEST_A);
});
Expand Up @@ -103,11 +103,12 @@ beforeEach(() => {
test('isInCompositionMode is properly updated on composition events', () => {
// `inCompositionMode` is updated inside editOnCompositionStart,
// which is why we can't just call compositionHandler.onCompositionStart.
// $FlowExpectedError
// $FlowExpectedError[incompatible-call]
editOnCompositionStart(editor, {});
expect(editor.setMode).toHaveBeenLastCalledWith('composite');
expect(editor._latestEditorState.isInCompositionMode()).toBe(true);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionEnd(editor);
jest.runAllTimers();
expect(editor._latestEditorState.isInCompositionMode()).toBe(false);
Expand All @@ -121,9 +122,11 @@ test('Can handle a single mutation', () => {
require('DOMObserver').prototype.stopAndFlushMutations.mockReturnValue(
mutations,
);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionStart(editor);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionEnd(editor);
jest.runAllTimers();

Expand All @@ -144,9 +147,11 @@ test('Can handle mutations in multiple blocks', () => {
require('DOMObserver').prototype.stopAndFlushMutations.mockReturnValue(
mutations,
);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionStart(editor);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionEnd(editor);
jest.runAllTimers();

Expand All @@ -172,9 +177,11 @@ test('Can handle mutations in the same block in multiple leaf nodes', () => {
require('DOMObserver').prototype.stopAndFlushMutations.mockReturnValue(
mutations,
);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionStart(editor);
// $FlowExpectedError
// $FlowExpectedError[incompatible-use]
// $FlowExpectedError[incompatible-call]
compositionHandler.onCompositionEnd(editor);
jest.runAllTimers();

Expand Down
4 changes: 2 additions & 2 deletions src/component/handlers/edit/__tests__/editOnBlur-test.js
Expand Up @@ -67,7 +67,7 @@ test('editor removes selection on blur (default behaviour)', () => {
editor: editorNode,
};

// $FlowExpectedError
// $FlowExpectedError[incompatible-call]
onBlur(editor, getBlurEvent(editorNode));

expect(globalSelection.removeAllRanges).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -97,7 +97,7 @@ test('editor preserves selection on blur', () => {
editor: editorNode,
};

// $FlowExpectedError
// $FlowExpectedError[incompatible-call]
onBlur(editor, getBlurEvent(editorNode));

expect(globalSelection.removeAllRanges).toHaveBeenCalledTimes(0);
Expand Down
6 changes: 3 additions & 3 deletions src/component/handlers/edit/__tests__/editOnInput-test.js
Expand Up @@ -62,7 +62,7 @@ test('restoreEditorDOM and keyCommandPlainBackspace are NOT called when the `inp
currentTarget: editorNode,
};

// $FlowExpectedError
// $FlowExpectedError[incompatible-call]
onInput(editor, inputEvent);

expect(require('keyCommandPlainBackspace')).toHaveBeenCalledTimes(0);
Expand Down Expand Up @@ -94,10 +94,10 @@ test('restoreEditorDOM and keyCommandPlainBackspace are called when backspace is
currentTarget: editorNode,
};

// $FlowExpectedError
// $FlowExpectedError[incompatible-call]
onInput(editor, inputEvent);

// $FlowExpectedError
// $FlowExpectedError[prop-missing]
const newEditorState = require('keyCommandPlainBackspace').mock.results[0]
.value;
expect(require('keyCommandPlainBackspace')).toHaveBeenCalledWith(
Expand Down
Expand Up @@ -76,9 +76,9 @@ beforeEach(() => {
});

const convertFromHTML = (html_string, config) => {
/* $FlowFixMe(>=0.122.0 site=www) This comment suppresses an error found when
* Flow v0.122.0 was deployed. To see the error, delete this comment and run
* Flow. */
/* $FlowFixMe[cannot-spread-inexact] (>=0.122.0 site=www) This comment
* suppresses an error found when Flow v0.122.0 was deployed. To see the
* error, delete this comment and run Flow. */
const options = {
...DEFAULT_CONFIG,
...config,
Expand Down

0 comments on commit 8457ebb

Please sign in to comment.